UNPKG

588 kBJavaScriptView Raw
1(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
2(function (process,global){
3'use strict';
4
5/* eslint no-unused-vars: off */
6/* eslint-env commonjs */
7
8/**
9 * Shim process.stdout.
10 */
11
12process.stdout = require('browser-stdout')({label: false});
13
14var Mocha = require('./lib/mocha');
15
16/**
17 * Create a Mocha instance.
18 *
19 * @return {undefined}
20 */
21
22var mocha = new Mocha({reporter: 'html'});
23
24/**
25 * Save timer references to avoid Sinon interfering (see GH-237).
26 */
27
28var Date = global.Date;
29var setTimeout = global.setTimeout;
30var setInterval = global.setInterval;
31var clearTimeout = global.clearTimeout;
32var clearInterval = global.clearInterval;
33
34var uncaughtExceptionHandlers = [];
35
36var originalOnerrorHandler = global.onerror;
37
38/**
39 * Remove uncaughtException listener.
40 * Revert to original onerror handler if previously defined.
41 */
42
43process.removeListener = function(e, fn) {
44 if (e === 'uncaughtException') {
45 if (originalOnerrorHandler) {
46 global.onerror = originalOnerrorHandler;
47 } else {
48 global.onerror = function() {};
49 }
50 var i = uncaughtExceptionHandlers.indexOf(fn);
51 if (i !== -1) {
52 uncaughtExceptionHandlers.splice(i, 1);
53 }
54 }
55};
56
57/**
58 * Implements uncaughtException listener.
59 */
60
61process.on = function(e, fn) {
62 if (e === 'uncaughtException') {
63 global.onerror = function(err, url, line) {
64 fn(new Error(err + ' (' + url + ':' + line + ')'));
65 return !mocha.allowUncaught;
66 };
67 uncaughtExceptionHandlers.push(fn);
68 }
69};
70
71// The BDD UI is registered by default, but no UI will be functional in the
72// browser without an explicit call to the overridden `mocha.ui` (see below).
73// Ensure that this default UI does not expose its methods to the global scope.
74mocha.suite.removeAllListeners('pre-require');
75
76var immediateQueue = [];
77var immediateTimeout;
78
79function timeslice() {
80 var immediateStart = new Date().getTime();
81 while (immediateQueue.length && new Date().getTime() - immediateStart < 100) {
82 immediateQueue.shift()();
83 }
84 if (immediateQueue.length) {
85 immediateTimeout = setTimeout(timeslice, 0);
86 } else {
87 immediateTimeout = null;
88 }
89}
90
91/**
92 * High-performance override of Runner.immediately.
93 */
94
95Mocha.Runner.immediately = function(callback) {
96 immediateQueue.push(callback);
97 if (!immediateTimeout) {
98 immediateTimeout = setTimeout(timeslice, 0);
99 }
100};
101
102/**
103 * Function to allow assertion libraries to throw errors directly into mocha.
104 * This is useful when running tests in a browser because window.onerror will
105 * only receive the 'message' attribute of the Error.
106 */
107mocha.throwError = function(err) {
108 uncaughtExceptionHandlers.forEach(function(fn) {
109 fn(err);
110 });
111 throw err;
112};
113
114/**
115 * Override ui to ensure that the ui functions are initialized.
116 * Normally this would happen in Mocha.prototype.loadFiles.
117 */
118
119mocha.ui = function(ui) {
120 Mocha.prototype.ui.call(this, ui);
121 this.suite.emit('pre-require', global, null, this);
122 return this;
123};
124
125/**
126 * Setup mocha with the given setting options.
127 */
128
129mocha.setup = function(opts) {
130 if (typeof opts === 'string') {
131 opts = {ui: opts};
132 }
133 for (var opt in opts) {
134 if (opts.hasOwnProperty(opt)) {
135 this[opt](opts[opt]);
136 }
137 }
138 return this;
139};
140
141/**
142 * Run mocha, returning the Runner.
143 */
144
145mocha.run = function(fn) {
146 var options = mocha.options;
147 mocha.globals('location');
148
149 var query = Mocha.utils.parseQuery(global.location.search || '');
150 if (query.grep) {
151 mocha.grep(query.grep);
152 }
153 if (query.fgrep) {
154 mocha.fgrep(query.fgrep);
155 }
156 if (query.invert) {
157 mocha.invert();
158 }
159
160 return Mocha.prototype.run.call(mocha, function(err) {
161 // The DOM Document is not available in Web Workers.
162 var document = global.document;
163 if (
164 document &&
165 document.getElementById('mocha') &&
166 options.noHighlighting !== true
167 ) {
168 Mocha.utils.highlightTags('code');
169 }
170 if (fn) {
171 fn(err);
172 }
173 });
174};
175
176/**
177 * Expose the process shim.
178 * https://github.com/mochajs/mocha/pull/916
179 */
180
181Mocha.process = process;
182
183/**
184 * Expose mocha.
185 */
186
187global.Mocha = Mocha;
188global.mocha = mocha;
189
190// this allows test/acceptance/required-tokens.js to pass; thus,
191// you can now do `const describe = require('mocha').describe` in a
192// browser context (assuming browserification). should fix #880
193module.exports = global;
194
195}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
196},{"./lib/mocha":14,"_process":69,"browser-stdout":41}],2:[function(require,module,exports){
197(function (process,global){
198'use strict';
199
200/**
201 * Web Notifications module.
202 * @module Growl
203 */
204
205/**
206 * Save timer references to avoid Sinon interfering (see GH-237).
207 */
208var Date = global.Date;
209var setTimeout = global.setTimeout;
210var EVENT_RUN_END = require('../runner').constants.EVENT_RUN_END;
211
212/**
213 * Checks if browser notification support exists.
214 *
215 * @public
216 * @see {@link https://caniuse.com/#feat=notifications|Browser support (notifications)}
217 * @see {@link https://caniuse.com/#feat=promises|Browser support (promises)}
218 * @see {@link Mocha#growl}
219 * @see {@link Mocha#isGrowlCapable}
220 * @return {boolean} whether browser notification support exists
221 */
222exports.isCapable = function() {
223 var hasNotificationSupport = 'Notification' in window;
224 var hasPromiseSupport = typeof Promise === 'function';
225 return process.browser && hasNotificationSupport && hasPromiseSupport;
226};
227
228/**
229 * Implements browser notifications as a pseudo-reporter.
230 *
231 * @public
232 * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/notification|Notification API}
233 * @see {@link https://developers.google.com/web/fundamentals/push-notifications/display-a-notification|Displaying a Notification}
234 * @see {@link Growl#isPermitted}
235 * @see {@link Mocha#_growl}
236 * @param {Runner} runner - Runner instance.
237 */
238exports.notify = function(runner) {
239 var promise = isPermitted();
240
241 /**
242 * Attempt notification.
243 */
244 var sendNotification = function() {
245 // If user hasn't responded yet... "No notification for you!" (Seinfeld)
246 Promise.race([promise, Promise.resolve(undefined)])
247 .then(canNotify)
248 .then(function() {
249 display(runner);
250 })
251 .catch(notPermitted);
252 };
253
254 runner.once(EVENT_RUN_END, sendNotification);
255};
256
257/**
258 * Checks if browser notification is permitted by user.
259 *
260 * @private
261 * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Notification/permission|Notification.permission}
262 * @see {@link Mocha#growl}
263 * @see {@link Mocha#isGrowlPermitted}
264 * @returns {Promise<boolean>} promise determining if browser notification
265 * permissible when fulfilled.
266 */
267function isPermitted() {
268 var permitted = {
269 granted: function allow() {
270 return Promise.resolve(true);
271 },
272 denied: function deny() {
273 return Promise.resolve(false);
274 },
275 default: function ask() {
276 return Notification.requestPermission().then(function(permission) {
277 return permission === 'granted';
278 });
279 }
280 };
281
282 return permitted[Notification.permission]();
283}
284
285/**
286 * @summary
287 * Determines if notification should proceed.
288 *
289 * @description
290 * Notification shall <strong>not</strong> proceed unless `value` is true.
291 *
292 * `value` will equal one of:
293 * <ul>
294 * <li><code>true</code> (from `isPermitted`)</li>
295 * <li><code>false</code> (from `isPermitted`)</li>
296 * <li><code>undefined</code> (from `Promise.race`)</li>
297 * </ul>
298 *
299 * @private
300 * @param {boolean|undefined} value - Determines if notification permissible.
301 * @returns {Promise<undefined>} Notification can proceed
302 */
303function canNotify(value) {
304 if (!value) {
305 var why = value === false ? 'blocked' : 'unacknowledged';
306 var reason = 'not permitted by user (' + why + ')';
307 return Promise.reject(new Error(reason));
308 }
309 return Promise.resolve();
310}
311
312/**
313 * Displays the notification.
314 *
315 * @private
316 * @param {Runner} runner - Runner instance.
317 */
318function display(runner) {
319 var stats = runner.stats;
320 var symbol = {
321 cross: '\u274C',
322 tick: '\u2705'
323 };
324 var logo = require('../../package').notifyLogo;
325 var _message;
326 var message;
327 var title;
328
329 if (stats.failures) {
330 _message = stats.failures + ' of ' + stats.tests + ' tests failed';
331 message = symbol.cross + ' ' + _message;
332 title = 'Failed';
333 } else {
334 _message = stats.passes + ' tests passed in ' + stats.duration + 'ms';
335 message = symbol.tick + ' ' + _message;
336 title = 'Passed';
337 }
338
339 // Send notification
340 var options = {
341 badge: logo,
342 body: message,
343 dir: 'ltr',
344 icon: logo,
345 lang: 'en-US',
346 name: 'mocha',
347 requireInteraction: false,
348 timestamp: Date.now()
349 };
350 var notification = new Notification(title, options);
351
352 // Autoclose after brief delay (makes various browsers act same)
353 var FORCE_DURATION = 4000;
354 setTimeout(notification.close.bind(notification), FORCE_DURATION);
355}
356
357/**
358 * As notifications are tangential to our purpose, just log the error.
359 *
360 * @private
361 * @param {Error} err - Why notification didn't happen.
362 */
363function notPermitted(err) {
364 console.error('notification error:', err.message);
365}
366
367}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
368},{"../../package":90,"../runner":34,"_process":69}],3:[function(require,module,exports){
369'use strict';
370
371/**
372 * Expose `Progress`.
373 */
374
375module.exports = Progress;
376
377/**
378 * Initialize a new `Progress` indicator.
379 */
380function Progress() {
381 this.percent = 0;
382 this.size(0);
383 this.fontSize(11);
384 this.font('helvetica, arial, sans-serif');
385}
386
387/**
388 * Set progress size to `size`.
389 *
390 * @public
391 * @param {number} size
392 * @return {Progress} Progress instance.
393 */
394Progress.prototype.size = function(size) {
395 this._size = size;
396 return this;
397};
398
399/**
400 * Set text to `text`.
401 *
402 * @public
403 * @param {string} text
404 * @return {Progress} Progress instance.
405 */
406Progress.prototype.text = function(text) {
407 this._text = text;
408 return this;
409};
410
411/**
412 * Set font size to `size`.
413 *
414 * @public
415 * @param {number} size
416 * @return {Progress} Progress instance.
417 */
418Progress.prototype.fontSize = function(size) {
419 this._fontSize = size;
420 return this;
421};
422
423/**
424 * Set font to `family`.
425 *
426 * @param {string} family
427 * @return {Progress} Progress instance.
428 */
429Progress.prototype.font = function(family) {
430 this._font = family;
431 return this;
432};
433
434/**
435 * Update percentage to `n`.
436 *
437 * @param {number} n
438 * @return {Progress} Progress instance.
439 */
440Progress.prototype.update = function(n) {
441 this.percent = n;
442 return this;
443};
444
445/**
446 * Draw on `ctx`.
447 *
448 * @param {CanvasRenderingContext2d} ctx
449 * @return {Progress} Progress instance.
450 */
451Progress.prototype.draw = function(ctx) {
452 try {
453 var percent = Math.min(this.percent, 100);
454 var size = this._size;
455 var half = size / 2;
456 var x = half;
457 var y = half;
458 var rad = half - 1;
459 var fontSize = this._fontSize;
460
461 ctx.font = fontSize + 'px ' + this._font;
462
463 var angle = Math.PI * 2 * (percent / 100);
464 ctx.clearRect(0, 0, size, size);
465
466 // outer circle
467 ctx.strokeStyle = '#9f9f9f';
468 ctx.beginPath();
469 ctx.arc(x, y, rad, 0, angle, false);
470 ctx.stroke();
471
472 // inner circle
473 ctx.strokeStyle = '#eee';
474 ctx.beginPath();
475 ctx.arc(x, y, rad - 1, 0, angle, true);
476 ctx.stroke();
477
478 // text
479 var text = this._text || (percent | 0) + '%';
480 var w = ctx.measureText(text).width;
481
482 ctx.fillText(text, x - w / 2 + 1, y + fontSize / 2 - 1);
483 } catch (ignore) {
484 // don't fail if we can't render progress
485 }
486 return this;
487};
488
489},{}],4:[function(require,module,exports){
490(function (global){
491'use strict';
492
493exports.isatty = function isatty() {
494 return true;
495};
496
497exports.getWindowSize = function getWindowSize() {
498 if ('innerHeight' in global) {
499 return [global.innerHeight, global.innerWidth];
500 }
501 // In a Web Worker, the DOM Window is not available.
502 return [640, 480];
503};
504
505}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
506},{}],5:[function(require,module,exports){
507'use strict';
508/**
509 * @module Context
510 */
511/**
512 * Expose `Context`.
513 */
514
515module.exports = Context;
516
517/**
518 * Initialize a new `Context`.
519 *
520 * @private
521 */
522function Context() {}
523
524/**
525 * Set or get the context `Runnable` to `runnable`.
526 *
527 * @private
528 * @param {Runnable} runnable
529 * @return {Context} context
530 */
531Context.prototype.runnable = function(runnable) {
532 if (!arguments.length) {
533 return this._runnable;
534 }
535 this.test = this._runnable = runnable;
536 return this;
537};
538
539/**
540 * Set or get test timeout `ms`.
541 *
542 * @private
543 * @param {number} ms
544 * @return {Context} self
545 */
546Context.prototype.timeout = function(ms) {
547 if (!arguments.length) {
548 return this.runnable().timeout();
549 }
550 this.runnable().timeout(ms);
551 return this;
552};
553
554/**
555 * Set test timeout `enabled`.
556 *
557 * @private
558 * @param {boolean} enabled
559 * @return {Context} self
560 */
561Context.prototype.enableTimeouts = function(enabled) {
562 if (!arguments.length) {
563 return this.runnable().enableTimeouts();
564 }
565 this.runnable().enableTimeouts(enabled);
566 return this;
567};
568
569/**
570 * Set or get test slowness threshold `ms`.
571 *
572 * @private
573 * @param {number} ms
574 * @return {Context} self
575 */
576Context.prototype.slow = function(ms) {
577 if (!arguments.length) {
578 return this.runnable().slow();
579 }
580 this.runnable().slow(ms);
581 return this;
582};
583
584/**
585 * Mark a test as skipped.
586 *
587 * @private
588 * @throws Pending
589 */
590Context.prototype.skip = function() {
591 this.runnable().skip();
592};
593
594/**
595 * Set or get a number of allowed retries on failed tests
596 *
597 * @private
598 * @param {number} n
599 * @return {Context} self
600 */
601Context.prototype.retries = function(n) {
602 if (!arguments.length) {
603 return this.runnable().retries();
604 }
605 this.runnable().retries(n);
606 return this;
607};
608
609},{}],6:[function(require,module,exports){
610'use strict';
611/**
612 * @module Errors
613 */
614/**
615 * Factory functions to create throwable error objects
616 */
617
618/**
619 * Creates an error object to be thrown when no files to be tested could be found using specified pattern.
620 *
621 * @public
622 * @param {string} message - Error message to be displayed.
623 * @param {string} pattern - User-specified argument value.
624 * @returns {Error} instance detailing the error condition
625 */
626function createNoFilesMatchPatternError(message, pattern) {
627 var err = new Error(message);
628 err.code = 'ERR_MOCHA_NO_FILES_MATCH_PATTERN';
629 err.pattern = pattern;
630 return err;
631}
632
633/**
634 * Creates an error object to be thrown when the reporter specified in the options was not found.
635 *
636 * @public
637 * @param {string} message - Error message to be displayed.
638 * @param {string} reporter - User-specified reporter value.
639 * @returns {Error} instance detailing the error condition
640 */
641function createInvalidReporterError(message, reporter) {
642 var err = new TypeError(message);
643 err.code = 'ERR_MOCHA_INVALID_REPORTER';
644 err.reporter = reporter;
645 return err;
646}
647
648/**
649 * Creates an error object to be thrown when the interface specified in the options was not found.
650 *
651 * @public
652 * @param {string} message - Error message to be displayed.
653 * @param {string} ui - User-specified interface value.
654 * @returns {Error} instance detailing the error condition
655 */
656function createInvalidInterfaceError(message, ui) {
657 var err = new Error(message);
658 err.code = 'ERR_MOCHA_INVALID_INTERFACE';
659 err.interface = ui;
660 return err;
661}
662
663/**
664 * Creates an error object to be thrown when a behavior, option, or parameter is unsupported.
665 *
666 * @public
667 * @param {string} message - Error message to be displayed.
668 * @returns {Error} instance detailing the error condition
669 */
670function createUnsupportedError(message) {
671 var err = new Error(message);
672 err.code = 'ERR_MOCHA_UNSUPPORTED';
673 return err;
674}
675
676/**
677 * Creates an error object to be thrown when an argument is missing.
678 *
679 * @public
680 * @param {string} message - Error message to be displayed.
681 * @param {string} argument - Argument name.
682 * @param {string} expected - Expected argument datatype.
683 * @returns {Error} instance detailing the error condition
684 */
685function createMissingArgumentError(message, argument, expected) {
686 return createInvalidArgumentTypeError(message, argument, expected);
687}
688
689/**
690 * Creates an error object to be thrown when an argument did not use the supported type
691 *
692 * @public
693 * @param {string} message - Error message to be displayed.
694 * @param {string} argument - Argument name.
695 * @param {string} expected - Expected argument datatype.
696 * @returns {Error} instance detailing the error condition
697 */
698function createInvalidArgumentTypeError(message, argument, expected) {
699 var err = new TypeError(message);
700 err.code = 'ERR_MOCHA_INVALID_ARG_TYPE';
701 err.argument = argument;
702 err.expected = expected;
703 err.actual = typeof argument;
704 return err;
705}
706
707/**
708 * Creates an error object to be thrown when an argument did not use the supported value
709 *
710 * @public
711 * @param {string} message - Error message to be displayed.
712 * @param {string} argument - Argument name.
713 * @param {string} value - Argument value.
714 * @param {string} [reason] - Why value is invalid.
715 * @returns {Error} instance detailing the error condition
716 */
717function createInvalidArgumentValueError(message, argument, value, reason) {
718 var err = new TypeError(message);
719 err.code = 'ERR_MOCHA_INVALID_ARG_VALUE';
720 err.argument = argument;
721 err.value = value;
722 err.reason = typeof reason !== 'undefined' ? reason : 'is invalid';
723 return err;
724}
725
726/**
727 * Creates an error object to be thrown when an exception was caught, but the `Error` is falsy or undefined.
728 *
729 * @public
730 * @param {string} message - Error message to be displayed.
731 * @returns {Error} instance detailing the error condition
732 */
733function createInvalidExceptionError(message, value) {
734 var err = new Error(message);
735 err.code = 'ERR_MOCHA_INVALID_EXCEPTION';
736 err.valueType = typeof value;
737 err.value = value;
738 return err;
739}
740
741module.exports = {
742 createInvalidArgumentTypeError: createInvalidArgumentTypeError,
743 createInvalidArgumentValueError: createInvalidArgumentValueError,
744 createInvalidExceptionError: createInvalidExceptionError,
745 createInvalidInterfaceError: createInvalidInterfaceError,
746 createInvalidReporterError: createInvalidReporterError,
747 createMissingArgumentError: createMissingArgumentError,
748 createNoFilesMatchPatternError: createNoFilesMatchPatternError,
749 createUnsupportedError: createUnsupportedError
750};
751
752},{}],7:[function(require,module,exports){
753'use strict';
754
755var Runnable = require('./runnable');
756var inherits = require('./utils').inherits;
757
758/**
759 * Expose `Hook`.
760 */
761
762module.exports = Hook;
763
764/**
765 * Initialize a new `Hook` with the given `title` and callback `fn`
766 *
767 * @class
768 * @extends Runnable
769 * @param {String} title
770 * @param {Function} fn
771 */
772function Hook(title, fn) {
773 Runnable.call(this, title, fn);
774 this.type = 'hook';
775}
776
777/**
778 * Inherit from `Runnable.prototype`.
779 */
780inherits(Hook, Runnable);
781
782/**
783 * Get or set the test `err`.
784 *
785 * @memberof Hook
786 * @public
787 * @param {Error} err
788 * @return {Error}
789 */
790Hook.prototype.error = function(err) {
791 if (!arguments.length) {
792 err = this._error;
793 this._error = null;
794 return err;
795 }
796
797 this._error = err;
798};
799
800},{"./runnable":33,"./utils":38}],8:[function(require,module,exports){
801'use strict';
802
803var Test = require('../test');
804var EVENT_FILE_PRE_REQUIRE = require('../suite').constants
805 .EVENT_FILE_PRE_REQUIRE;
806
807/**
808 * BDD-style interface:
809 *
810 * describe('Array', function() {
811 * describe('#indexOf()', function() {
812 * it('should return -1 when not present', function() {
813 * // ...
814 * });
815 *
816 * it('should return the index when present', function() {
817 * // ...
818 * });
819 * });
820 * });
821 *
822 * @param {Suite} suite Root suite.
823 */
824module.exports = function bddInterface(suite) {
825 var suites = [suite];
826
827 suite.on(EVENT_FILE_PRE_REQUIRE, function(context, file, mocha) {
828 var common = require('./common')(suites, context, mocha);
829
830 context.before = common.before;
831 context.after = common.after;
832 context.beforeEach = common.beforeEach;
833 context.afterEach = common.afterEach;
834 context.run = mocha.options.delay && common.runWithSuite(suite);
835 /**
836 * Describe a "suite" with the given `title`
837 * and callback `fn` containing nested suites
838 * and/or tests.
839 */
840
841 context.describe = context.context = function(title, fn) {
842 return common.suite.create({
843 title: title,
844 file: file,
845 fn: fn
846 });
847 };
848
849 /**
850 * Pending describe.
851 */
852
853 context.xdescribe = context.xcontext = context.describe.skip = function(
854 title,
855 fn
856 ) {
857 return common.suite.skip({
858 title: title,
859 file: file,
860 fn: fn
861 });
862 };
863
864 /**
865 * Exclusive suite.
866 */
867
868 context.describe.only = function(title, fn) {
869 return common.suite.only({
870 title: title,
871 file: file,
872 fn: fn
873 });
874 };
875
876 /**
877 * Describe a specification or test-case
878 * with the given `title` and callback `fn`
879 * acting as a thunk.
880 */
881
882 context.it = context.specify = function(title, fn) {
883 var suite = suites[0];
884 if (suite.isPending()) {
885 fn = null;
886 }
887 var test = new Test(title, fn);
888 test.file = file;
889 suite.addTest(test);
890 return test;
891 };
892
893 /**
894 * Exclusive test-case.
895 */
896
897 context.it.only = function(title, fn) {
898 return common.test.only(mocha, context.it(title, fn));
899 };
900
901 /**
902 * Pending test case.
903 */
904
905 context.xit = context.xspecify = context.it.skip = function(title) {
906 return context.it(title);
907 };
908
909 /**
910 * Number of attempts to retry.
911 */
912 context.it.retries = function(n) {
913 context.retries(n);
914 };
915 });
916};
917
918module.exports.description = 'BDD or RSpec style [default]';
919
920},{"../suite":36,"../test":37,"./common":9}],9:[function(require,module,exports){
921'use strict';
922
923var Suite = require('../suite');
924var errors = require('../errors');
925var createMissingArgumentError = errors.createMissingArgumentError;
926
927/**
928 * Functions common to more than one interface.
929 *
930 * @param {Suite[]} suites
931 * @param {Context} context
932 * @param {Mocha} mocha
933 * @return {Object} An object containing common functions.
934 */
935module.exports = function(suites, context, mocha) {
936 /**
937 * Check if the suite should be tested.
938 *
939 * @private
940 * @param {Suite} suite - suite to check
941 * @returns {boolean}
942 */
943 function shouldBeTested(suite) {
944 return (
945 !mocha.options.grep ||
946 (mocha.options.grep &&
947 mocha.options.grep.test(suite.fullTitle()) &&
948 !mocha.options.invert)
949 );
950 }
951
952 return {
953 /**
954 * This is only present if flag --delay is passed into Mocha. It triggers
955 * root suite execution.
956 *
957 * @param {Suite} suite The root suite.
958 * @return {Function} A function which runs the root suite
959 */
960 runWithSuite: function runWithSuite(suite) {
961 return function run() {
962 suite.run();
963 };
964 },
965
966 /**
967 * Execute before running tests.
968 *
969 * @param {string} name
970 * @param {Function} fn
971 */
972 before: function(name, fn) {
973 suites[0].beforeAll(name, fn);
974 },
975
976 /**
977 * Execute after running tests.
978 *
979 * @param {string} name
980 * @param {Function} fn
981 */
982 after: function(name, fn) {
983 suites[0].afterAll(name, fn);
984 },
985
986 /**
987 * Execute before each test case.
988 *
989 * @param {string} name
990 * @param {Function} fn
991 */
992 beforeEach: function(name, fn) {
993 suites[0].beforeEach(name, fn);
994 },
995
996 /**
997 * Execute after each test case.
998 *
999 * @param {string} name
1000 * @param {Function} fn
1001 */
1002 afterEach: function(name, fn) {
1003 suites[0].afterEach(name, fn);
1004 },
1005
1006 suite: {
1007 /**
1008 * Create an exclusive Suite; convenience function
1009 * See docstring for create() below.
1010 *
1011 * @param {Object} opts
1012 * @returns {Suite}
1013 */
1014 only: function only(opts) {
1015 opts.isOnly = true;
1016 return this.create(opts);
1017 },
1018
1019 /**
1020 * Create a Suite, but skip it; convenience function
1021 * See docstring for create() below.
1022 *
1023 * @param {Object} opts
1024 * @returns {Suite}
1025 */
1026 skip: function skip(opts) {
1027 opts.pending = true;
1028 return this.create(opts);
1029 },
1030
1031 /**
1032 * Creates a suite.
1033 *
1034 * @param {Object} opts Options
1035 * @param {string} opts.title Title of Suite
1036 * @param {Function} [opts.fn] Suite Function (not always applicable)
1037 * @param {boolean} [opts.pending] Is Suite pending?
1038 * @param {string} [opts.file] Filepath where this Suite resides
1039 * @param {boolean} [opts.isOnly] Is Suite exclusive?
1040 * @returns {Suite}
1041 */
1042 create: function create(opts) {
1043 var suite = Suite.create(suites[0], opts.title);
1044 suite.pending = Boolean(opts.pending);
1045 suite.file = opts.file;
1046 suites.unshift(suite);
1047 if (opts.isOnly) {
1048 if (mocha.options.forbidOnly && shouldBeTested(suite)) {
1049 throw new Error('`.only` forbidden');
1050 }
1051
1052 suite.parent.appendOnlySuite(suite);
1053 }
1054 if (suite.pending) {
1055 if (mocha.options.forbidPending && shouldBeTested(suite)) {
1056 throw new Error('Pending test forbidden');
1057 }
1058 }
1059 if (typeof opts.fn === 'function') {
1060 opts.fn.call(suite);
1061 suites.shift();
1062 } else if (typeof opts.fn === 'undefined' && !suite.pending) {
1063 throw createMissingArgumentError(
1064 'Suite "' +
1065 suite.fullTitle() +
1066 '" was defined but no callback was supplied. ' +
1067 'Supply a callback or explicitly skip the suite.',
1068 'callback',
1069 'function'
1070 );
1071 } else if (!opts.fn && suite.pending) {
1072 suites.shift();
1073 }
1074
1075 return suite;
1076 }
1077 },
1078
1079 test: {
1080 /**
1081 * Exclusive test-case.
1082 *
1083 * @param {Object} mocha
1084 * @param {Function} test
1085 * @returns {*}
1086 */
1087 only: function(mocha, test) {
1088 test.parent.appendOnlyTest(test);
1089 return test;
1090 },
1091
1092 /**
1093 * Pending test case.
1094 *
1095 * @param {string} title
1096 */
1097 skip: function(title) {
1098 context.test(title);
1099 },
1100
1101 /**
1102 * Number of retry attempts
1103 *
1104 * @param {number} n
1105 */
1106 retries: function(n) {
1107 context.retries(n);
1108 }
1109 }
1110 };
1111};
1112
1113},{"../errors":6,"../suite":36}],10:[function(require,module,exports){
1114'use strict';
1115var Suite = require('../suite');
1116var Test = require('../test');
1117
1118/**
1119 * Exports-style (as Node.js module) interface:
1120 *
1121 * exports.Array = {
1122 * '#indexOf()': {
1123 * 'should return -1 when the value is not present': function() {
1124 *
1125 * },
1126 *
1127 * 'should return the correct index when the value is present': function() {
1128 *
1129 * }
1130 * }
1131 * };
1132 *
1133 * @param {Suite} suite Root suite.
1134 */
1135module.exports = function(suite) {
1136 var suites = [suite];
1137
1138 suite.on(Suite.constants.EVENT_FILE_REQUIRE, visit);
1139
1140 function visit(obj, file) {
1141 var suite;
1142 for (var key in obj) {
1143 if (typeof obj[key] === 'function') {
1144 var fn = obj[key];
1145 switch (key) {
1146 case 'before':
1147 suites[0].beforeAll(fn);
1148 break;
1149 case 'after':
1150 suites[0].afterAll(fn);
1151 break;
1152 case 'beforeEach':
1153 suites[0].beforeEach(fn);
1154 break;
1155 case 'afterEach':
1156 suites[0].afterEach(fn);
1157 break;
1158 default:
1159 var test = new Test(key, fn);
1160 test.file = file;
1161 suites[0].addTest(test);
1162 }
1163 } else {
1164 suite = Suite.create(suites[0], key);
1165 suites.unshift(suite);
1166 visit(obj[key], file);
1167 suites.shift();
1168 }
1169 }
1170 }
1171};
1172
1173module.exports.description = 'Node.js module ("exports") style';
1174
1175},{"../suite":36,"../test":37}],11:[function(require,module,exports){
1176'use strict';
1177
1178exports.bdd = require('./bdd');
1179exports.tdd = require('./tdd');
1180exports.qunit = require('./qunit');
1181exports.exports = require('./exports');
1182
1183},{"./bdd":8,"./exports":10,"./qunit":12,"./tdd":13}],12:[function(require,module,exports){
1184'use strict';
1185
1186var Test = require('../test');
1187var EVENT_FILE_PRE_REQUIRE = require('../suite').constants
1188 .EVENT_FILE_PRE_REQUIRE;
1189
1190/**
1191 * QUnit-style interface:
1192 *
1193 * suite('Array');
1194 *
1195 * test('#length', function() {
1196 * var arr = [1,2,3];
1197 * ok(arr.length == 3);
1198 * });
1199 *
1200 * test('#indexOf()', function() {
1201 * var arr = [1,2,3];
1202 * ok(arr.indexOf(1) == 0);
1203 * ok(arr.indexOf(2) == 1);
1204 * ok(arr.indexOf(3) == 2);
1205 * });
1206 *
1207 * suite('String');
1208 *
1209 * test('#length', function() {
1210 * ok('foo'.length == 3);
1211 * });
1212 *
1213 * @param {Suite} suite Root suite.
1214 */
1215module.exports = function qUnitInterface(suite) {
1216 var suites = [suite];
1217
1218 suite.on(EVENT_FILE_PRE_REQUIRE, function(context, file, mocha) {
1219 var common = require('./common')(suites, context, mocha);
1220
1221 context.before = common.before;
1222 context.after = common.after;
1223 context.beforeEach = common.beforeEach;
1224 context.afterEach = common.afterEach;
1225 context.run = mocha.options.delay && common.runWithSuite(suite);
1226 /**
1227 * Describe a "suite" with the given `title`.
1228 */
1229
1230 context.suite = function(title) {
1231 if (suites.length > 1) {
1232 suites.shift();
1233 }
1234 return common.suite.create({
1235 title: title,
1236 file: file,
1237 fn: false
1238 });
1239 };
1240
1241 /**
1242 * Exclusive Suite.
1243 */
1244
1245 context.suite.only = function(title) {
1246 if (suites.length > 1) {
1247 suites.shift();
1248 }
1249 return common.suite.only({
1250 title: title,
1251 file: file,
1252 fn: false
1253 });
1254 };
1255
1256 /**
1257 * Describe a specification or test-case
1258 * with the given `title` and callback `fn`
1259 * acting as a thunk.
1260 */
1261
1262 context.test = function(title, fn) {
1263 var test = new Test(title, fn);
1264 test.file = file;
1265 suites[0].addTest(test);
1266 return test;
1267 };
1268
1269 /**
1270 * Exclusive test-case.
1271 */
1272
1273 context.test.only = function(title, fn) {
1274 return common.test.only(mocha, context.test(title, fn));
1275 };
1276
1277 context.test.skip = common.test.skip;
1278 context.test.retries = common.test.retries;
1279 });
1280};
1281
1282module.exports.description = 'QUnit style';
1283
1284},{"../suite":36,"../test":37,"./common":9}],13:[function(require,module,exports){
1285'use strict';
1286
1287var Test = require('../test');
1288var EVENT_FILE_PRE_REQUIRE = require('../suite').constants
1289 .EVENT_FILE_PRE_REQUIRE;
1290
1291/**
1292 * TDD-style interface:
1293 *
1294 * suite('Array', function() {
1295 * suite('#indexOf()', function() {
1296 * suiteSetup(function() {
1297 *
1298 * });
1299 *
1300 * test('should return -1 when not present', function() {
1301 *
1302 * });
1303 *
1304 * test('should return the index when present', function() {
1305 *
1306 * });
1307 *
1308 * suiteTeardown(function() {
1309 *
1310 * });
1311 * });
1312 * });
1313 *
1314 * @param {Suite} suite Root suite.
1315 */
1316module.exports = function(suite) {
1317 var suites = [suite];
1318
1319 suite.on(EVENT_FILE_PRE_REQUIRE, function(context, file, mocha) {
1320 var common = require('./common')(suites, context, mocha);
1321
1322 context.setup = common.beforeEach;
1323 context.teardown = common.afterEach;
1324 context.suiteSetup = common.before;
1325 context.suiteTeardown = common.after;
1326 context.run = mocha.options.delay && common.runWithSuite(suite);
1327
1328 /**
1329 * Describe a "suite" with the given `title` and callback `fn` containing
1330 * nested suites and/or tests.
1331 */
1332 context.suite = function(title, fn) {
1333 return common.suite.create({
1334 title: title,
1335 file: file,
1336 fn: fn
1337 });
1338 };
1339
1340 /**
1341 * Pending suite.
1342 */
1343 context.suite.skip = function(title, fn) {
1344 return common.suite.skip({
1345 title: title,
1346 file: file,
1347 fn: fn
1348 });
1349 };
1350
1351 /**
1352 * Exclusive test-case.
1353 */
1354 context.suite.only = function(title, fn) {
1355 return common.suite.only({
1356 title: title,
1357 file: file,
1358 fn: fn
1359 });
1360 };
1361
1362 /**
1363 * Describe a specification or test-case with the given `title` and
1364 * callback `fn` acting as a thunk.
1365 */
1366 context.test = function(title, fn) {
1367 var suite = suites[0];
1368 if (suite.isPending()) {
1369 fn = null;
1370 }
1371 var test = new Test(title, fn);
1372 test.file = file;
1373 suite.addTest(test);
1374 return test;
1375 };
1376
1377 /**
1378 * Exclusive test-case.
1379 */
1380
1381 context.test.only = function(title, fn) {
1382 return common.test.only(mocha, context.test(title, fn));
1383 };
1384
1385 context.test.skip = common.test.skip;
1386 context.test.retries = common.test.retries;
1387 });
1388};
1389
1390module.exports.description =
1391 'traditional "suite"/"test" instead of BDD\'s "describe"/"it"';
1392
1393},{"../suite":36,"../test":37,"./common":9}],14:[function(require,module,exports){
1394(function (process,global){
1395'use strict';
1396
1397/*!
1398 * mocha
1399 * Copyright(c) 2011 TJ Holowaychuk <tj@vision-media.ca>
1400 * MIT Licensed
1401 */
1402
1403var escapeRe = require('escape-string-regexp');
1404var path = require('path');
1405var builtinReporters = require('./reporters');
1406var growl = require('./growl');
1407var utils = require('./utils');
1408var mocharc = require('./mocharc.json');
1409var errors = require('./errors');
1410var Suite = require('./suite');
1411var createStatsCollector = require('./stats-collector');
1412var createInvalidReporterError = errors.createInvalidReporterError;
1413var createInvalidInterfaceError = errors.createInvalidInterfaceError;
1414var EVENT_FILE_PRE_REQUIRE = Suite.constants.EVENT_FILE_PRE_REQUIRE;
1415var EVENT_FILE_POST_REQUIRE = Suite.constants.EVENT_FILE_POST_REQUIRE;
1416var EVENT_FILE_REQUIRE = Suite.constants.EVENT_FILE_REQUIRE;
1417var sQuote = utils.sQuote;
1418
1419exports = module.exports = Mocha;
1420
1421/**
1422 * To require local UIs and reporters when running in node.
1423 */
1424
1425if (!process.browser) {
1426 var cwd = process.cwd();
1427 module.paths.push(cwd, path.join(cwd, 'node_modules'));
1428}
1429
1430/**
1431 * Expose internals.
1432 */
1433
1434/**
1435 * @public
1436 * @class utils
1437 * @memberof Mocha
1438 */
1439exports.utils = utils;
1440exports.interfaces = require('./interfaces');
1441/**
1442 * @public
1443 * @memberof Mocha
1444 */
1445exports.reporters = builtinReporters;
1446exports.Runnable = require('./runnable');
1447exports.Context = require('./context');
1448/**
1449 *
1450 * @memberof Mocha
1451 */
1452exports.Runner = require('./runner');
1453exports.Suite = Suite;
1454exports.Hook = require('./hook');
1455exports.Test = require('./test');
1456
1457/**
1458 * Constructs a new Mocha instance with `options`.
1459 *
1460 * @public
1461 * @class Mocha
1462 * @param {Object} [options] - Settings object.
1463 * @param {boolean} [options.allowUncaught] - Propagate uncaught errors?
1464 * @param {boolean} [options.asyncOnly] - Force `done` callback or promise?
1465 * @param {boolean} [options.bail] - Bail after first test failure?
1466 * @param {boolean} [options.checkLeaks] - Check for global variable leaks?
1467 * @param {boolean} [options.color] - Color TTY output from reporter?
1468 * @param {boolean} [options.delay] - Delay root suite execution?
1469 * @param {boolean} [options.diff] - Show diff on failure?
1470 * @param {string} [options.fgrep] - Test filter given string.
1471 * @param {boolean} [options.forbidOnly] - Tests marked `only` fail the suite?
1472 * @param {boolean} [options.forbidPending] - Pending tests fail the suite?
1473 * @param {boolean} [options.fullTrace] - Full stacktrace upon failure?
1474 * @param {string[]} [options.global] - Variables expected in global scope.
1475 * @param {RegExp|string} [options.grep] - Test filter given regular expression.
1476 * @param {boolean} [options.growl] - Enable desktop notifications?
1477 * @param {boolean} [options.inlineDiffs] - Display inline diffs?
1478 * @param {boolean} [options.invert] - Invert test filter matches?
1479 * @param {boolean} [options.noHighlighting] - Disable syntax highlighting?
1480 * @param {string|constructor} [options.reporter] - Reporter name or constructor.
1481 * @param {Object} [options.reporterOption] - Reporter settings object.
1482 * @param {number} [options.retries] - Number of times to retry failed tests.
1483 * @param {number} [options.slow] - Slow threshold value.
1484 * @param {number|string} [options.timeout] - Timeout threshold value.
1485 * @param {string} [options.ui] - Interface name.
1486 */
1487function Mocha(options) {
1488 options = utils.assign({}, mocharc, options || {});
1489 this.files = [];
1490 this.options = options;
1491 // root suite
1492 this.suite = new exports.Suite('', new exports.Context(), true);
1493
1494 this.grep(options.grep)
1495 .fgrep(options.fgrep)
1496 .ui(options.ui)
1497 .reporter(options.reporter, options.reporterOption)
1498 .slow(options.slow)
1499 .global(options.global);
1500
1501 // this guard exists because Suite#timeout does not consider `undefined` to be valid input
1502 if (typeof options.timeout !== 'undefined') {
1503 this.timeout(options.timeout === false ? 0 : options.timeout);
1504 }
1505
1506 if ('retries' in options) {
1507 this.retries(options.retries);
1508 }
1509
1510 [
1511 'allowUncaught',
1512 'asyncOnly',
1513 'bail',
1514 'checkLeaks',
1515 'color',
1516 'delay',
1517 'diff',
1518 'forbidOnly',
1519 'forbidPending',
1520 'fullTrace',
1521 'growl',
1522 'inlineDiffs',
1523 'invert'
1524 ].forEach(function(opt) {
1525 if (options[opt]) {
1526 this[opt]();
1527 }
1528 }, this);
1529}
1530
1531/**
1532 * Enables or disables bailing on the first failure.
1533 *
1534 * @public
1535 * @see [CLI option](../#-bail-b)
1536 * @param {boolean} [bail=true] - Whether to bail on first error.
1537 * @returns {Mocha} this
1538 * @chainable
1539 */
1540Mocha.prototype.bail = function(bail) {
1541 this.suite.bail(bail !== false);
1542 return this;
1543};
1544
1545/**
1546 * @summary
1547 * Adds `file` to be loaded for execution.
1548 *
1549 * @description
1550 * Useful for generic setup code that must be included within test suite.
1551 *
1552 * @public
1553 * @see [CLI option](../#-file-filedirectoryglob)
1554 * @param {string} file - Pathname of file to be loaded.
1555 * @returns {Mocha} this
1556 * @chainable
1557 */
1558Mocha.prototype.addFile = function(file) {
1559 this.files.push(file);
1560 return this;
1561};
1562
1563/**
1564 * Sets reporter to `reporter`, defaults to "spec".
1565 *
1566 * @public
1567 * @see [CLI option](../#-reporter-name-r-name)
1568 * @see [Reporters](../#reporters)
1569 * @param {String|Function} reporter - Reporter name or constructor.
1570 * @param {Object} [reporterOptions] - Options used to configure the reporter.
1571 * @returns {Mocha} this
1572 * @chainable
1573 * @throws {Error} if requested reporter cannot be loaded
1574 * @example
1575 *
1576 * // Use XUnit reporter and direct its output to file
1577 * mocha.reporter('xunit', { output: '/path/to/testspec.xunit.xml' });
1578 */
1579Mocha.prototype.reporter = function(reporter, reporterOptions) {
1580 if (typeof reporter === 'function') {
1581 this._reporter = reporter;
1582 } else {
1583 reporter = reporter || 'spec';
1584 var _reporter;
1585 // Try to load a built-in reporter.
1586 if (builtinReporters[reporter]) {
1587 _reporter = builtinReporters[reporter];
1588 }
1589 // Try to load reporters from process.cwd() and node_modules
1590 if (!_reporter) {
1591 try {
1592 _reporter = require(reporter);
1593 } catch (err) {
1594 if (
1595 err.code !== 'MODULE_NOT_FOUND' ||
1596 err.message.indexOf('Cannot find module') !== -1
1597 ) {
1598 // Try to load reporters from a path (absolute or relative)
1599 try {
1600 _reporter = require(path.resolve(process.cwd(), reporter));
1601 } catch (_err) {
1602 _err.code !== 'MODULE_NOT_FOUND' ||
1603 _err.message.indexOf('Cannot find module') !== -1
1604 ? console.warn(sQuote(reporter) + ' reporter not found')
1605 : console.warn(
1606 sQuote(reporter) +
1607 ' reporter blew up with error:\n' +
1608 err.stack
1609 );
1610 }
1611 } else {
1612 console.warn(
1613 sQuote(reporter) + ' reporter blew up with error:\n' + err.stack
1614 );
1615 }
1616 }
1617 }
1618 if (!_reporter) {
1619 throw createInvalidReporterError(
1620 'invalid reporter ' + sQuote(reporter),
1621 reporter
1622 );
1623 }
1624 this._reporter = _reporter;
1625 }
1626 this.options.reporterOption = reporterOptions;
1627 // alias option name is used in public reporters xunit/tap/progress
1628 this.options.reporterOptions = reporterOptions;
1629 return this;
1630};
1631
1632/**
1633 * Sets test UI `name`, defaults to "bdd".
1634 *
1635 * @public
1636 * @see [CLI option](../#-ui-name-u-name)
1637 * @see [Interface DSLs](../#interfaces)
1638 * @param {string|Function} [ui=bdd] - Interface name or class.
1639 * @returns {Mocha} this
1640 * @chainable
1641 * @throws {Error} if requested interface cannot be loaded
1642 */
1643Mocha.prototype.ui = function(ui) {
1644 var bindInterface;
1645 if (typeof ui === 'function') {
1646 bindInterface = ui;
1647 } else {
1648 ui = ui || 'bdd';
1649 bindInterface = exports.interfaces[ui];
1650 if (!bindInterface) {
1651 try {
1652 bindInterface = require(ui);
1653 } catch (err) {
1654 throw createInvalidInterfaceError(
1655 'invalid interface ' + sQuote(ui),
1656 ui
1657 );
1658 }
1659 }
1660 }
1661 bindInterface(this.suite);
1662
1663 this.suite.on(EVENT_FILE_PRE_REQUIRE, function(context) {
1664 exports.afterEach = context.afterEach || context.teardown;
1665 exports.after = context.after || context.suiteTeardown;
1666 exports.beforeEach = context.beforeEach || context.setup;
1667 exports.before = context.before || context.suiteSetup;
1668 exports.describe = context.describe || context.suite;
1669 exports.it = context.it || context.test;
1670 exports.xit = context.xit || (context.test && context.test.skip);
1671 exports.setup = context.setup || context.beforeEach;
1672 exports.suiteSetup = context.suiteSetup || context.before;
1673 exports.suiteTeardown = context.suiteTeardown || context.after;
1674 exports.suite = context.suite || context.describe;
1675 exports.teardown = context.teardown || context.afterEach;
1676 exports.test = context.test || context.it;
1677 exports.run = context.run;
1678 });
1679
1680 return this;
1681};
1682
1683/**
1684 * Loads `files` prior to execution.
1685 *
1686 * @description
1687 * The implementation relies on Node's `require` to execute
1688 * the test interface functions and will be subject to its cache.
1689 *
1690 * @private
1691 * @see {@link Mocha#addFile}
1692 * @see {@link Mocha#run}
1693 * @see {@link Mocha#unloadFiles}
1694 * @param {Function} [fn] - Callback invoked upon completion.
1695 */
1696Mocha.prototype.loadFiles = function(fn) {
1697 var self = this;
1698 var suite = this.suite;
1699 this.files.forEach(function(file) {
1700 file = path.resolve(file);
1701 suite.emit(EVENT_FILE_PRE_REQUIRE, global, file, self);
1702 suite.emit(EVENT_FILE_REQUIRE, require(file), file, self);
1703 suite.emit(EVENT_FILE_POST_REQUIRE, global, file, self);
1704 });
1705 fn && fn();
1706};
1707
1708/**
1709 * Removes a previously loaded file from Node's `require` cache.
1710 *
1711 * @private
1712 * @static
1713 * @see {@link Mocha#unloadFiles}
1714 * @param {string} file - Pathname of file to be unloaded.
1715 */
1716Mocha.unloadFile = function(file) {
1717 delete require.cache[require.resolve(file)];
1718};
1719
1720/**
1721 * Unloads `files` from Node's `require` cache.
1722 *
1723 * @description
1724 * This allows files to be "freshly" reloaded, providing the ability
1725 * to reuse a Mocha instance programmatically.
1726 *
1727 * <strong>Intended for consumers &mdash; not used internally</strong>
1728 *
1729 * @public
1730 * @see {@link Mocha#run}
1731 * @returns {Mocha} this
1732 * @chainable
1733 */
1734Mocha.prototype.unloadFiles = function() {
1735 this.files.forEach(Mocha.unloadFile);
1736 return this;
1737};
1738
1739/**
1740 * Sets `grep` filter after escaping RegExp special characters.
1741 *
1742 * @public
1743 * @see {@link Mocha#grep}
1744 * @param {string} str - Value to be converted to a regexp.
1745 * @returns {Mocha} this
1746 * @chainable
1747 * @example
1748 *
1749 * // Select tests whose full title begins with `"foo"` followed by a period
1750 * mocha.fgrep('foo.');
1751 */
1752Mocha.prototype.fgrep = function(str) {
1753 if (!str) {
1754 return this;
1755 }
1756 return this.grep(new RegExp(escapeRe(str)));
1757};
1758
1759/**
1760 * @summary
1761 * Sets `grep` filter used to select specific tests for execution.
1762 *
1763 * @description
1764 * If `re` is a regexp-like string, it will be converted to regexp.
1765 * The regexp is tested against the full title of each test (i.e., the
1766 * name of the test preceded by titles of each its ancestral suites).
1767 * As such, using an <em>exact-match</em> fixed pattern against the
1768 * test name itself will not yield any matches.
1769 * <br>
1770 * <strong>Previous filter value will be overwritten on each call!</strong>
1771 *
1772 * @public
1773 * @see [CLI option](../#-grep-regexp-g-regexp)
1774 * @see {@link Mocha#fgrep}
1775 * @see {@link Mocha#invert}
1776 * @param {RegExp|String} re - Regular expression used to select tests.
1777 * @return {Mocha} this
1778 * @chainable
1779 * @example
1780 *
1781 * // Select tests whose full title contains `"match"`, ignoring case
1782 * mocha.grep(/match/i);
1783 * @example
1784 *
1785 * // Same as above but with regexp-like string argument
1786 * mocha.grep('/match/i');
1787 * @example
1788 *
1789 * // ## Anti-example
1790 * // Given embedded test `it('only-this-test')`...
1791 * mocha.grep('/^only-this-test$/'); // NO! Use `.only()` to do this!
1792 */
1793Mocha.prototype.grep = function(re) {
1794 if (utils.isString(re)) {
1795 // extract args if it's regex-like, i.e: [string, pattern, flag]
1796 var arg = re.match(/^\/(.*)\/(g|i|)$|.*/);
1797 this.options.grep = new RegExp(arg[1] || arg[0], arg[2]);
1798 } else {
1799 this.options.grep = re;
1800 }
1801 return this;
1802};
1803
1804/**
1805 * Inverts `grep` matches.
1806 *
1807 * @public
1808 * @see {@link Mocha#grep}
1809 * @return {Mocha} this
1810 * @chainable
1811 * @example
1812 *
1813 * // Select tests whose full title does *not* contain `"match"`, ignoring case
1814 * mocha.grep(/match/i).invert();
1815 */
1816Mocha.prototype.invert = function() {
1817 this.options.invert = true;
1818 return this;
1819};
1820
1821/**
1822 * Enables or disables ignoring global leaks.
1823 *
1824 * @deprecated since v7.0.0
1825 * @public
1826 * @see {@link Mocha#checkLeaks}
1827 * @param {boolean} [ignoreLeaks=false] - Whether to ignore global leaks.
1828 * @return {Mocha} this
1829 * @chainable
1830 */
1831Mocha.prototype.ignoreLeaks = function(ignoreLeaks) {
1832 utils.deprecate(
1833 '"ignoreLeaks()" is DEPRECATED, please use "checkLeaks()" instead.'
1834 );
1835 this.options.checkLeaks = !ignoreLeaks;
1836 return this;
1837};
1838
1839/**
1840 * Enables or disables checking for global variables leaked while running tests.
1841 *
1842 * @public
1843 * @see [CLI option](../#-check-leaks)
1844 * @param {boolean} [checkLeaks=true] - Whether to check for global variable leaks.
1845 * @return {Mocha} this
1846 * @chainable
1847 */
1848Mocha.prototype.checkLeaks = function(checkLeaks) {
1849 this.options.checkLeaks = checkLeaks !== false;
1850 return this;
1851};
1852
1853/**
1854 * Displays full stack trace upon test failure.
1855 *
1856 * @public
1857 * @see [CLI option](../#-full-trace)
1858 * @param {boolean} [fullTrace=true] - Whether to print full stacktrace upon failure.
1859 * @return {Mocha} this
1860 * @chainable
1861 */
1862Mocha.prototype.fullTrace = function(fullTrace) {
1863 this.options.fullTrace = fullTrace !== false;
1864 return this;
1865};
1866
1867/**
1868 * Enables desktop notification support if prerequisite software installed.
1869 *
1870 * @public
1871 * @see [CLI option](../#-growl-g)
1872 * @return {Mocha} this
1873 * @chainable
1874 */
1875Mocha.prototype.growl = function() {
1876 this.options.growl = this.isGrowlCapable();
1877 if (!this.options.growl) {
1878 var detail = process.browser
1879 ? 'notification support not available in this browser...'
1880 : 'notification support prerequisites not installed...';
1881 console.error(detail + ' cannot enable!');
1882 }
1883 return this;
1884};
1885
1886/**
1887 * @summary
1888 * Determines if Growl support seems likely.
1889 *
1890 * @description
1891 * <strong>Not available when run in browser.</strong>
1892 *
1893 * @private
1894 * @see {@link Growl#isCapable}
1895 * @see {@link Mocha#growl}
1896 * @return {boolean} whether Growl support can be expected
1897 */
1898Mocha.prototype.isGrowlCapable = growl.isCapable;
1899
1900/**
1901 * Implements desktop notifications using a pseudo-reporter.
1902 *
1903 * @private
1904 * @see {@link Mocha#growl}
1905 * @see {@link Growl#notify}
1906 * @param {Runner} runner - Runner instance.
1907 */
1908Mocha.prototype._growl = growl.notify;
1909
1910/**
1911 * Specifies whitelist of variable names to be expected in global scope.
1912 *
1913 * @public
1914 * @see [CLI option](../#-global-variable-name)
1915 * @see {@link Mocha#checkLeaks}
1916 * @param {String[]|String} global - Accepted global variable name(s).
1917 * @return {Mocha} this
1918 * @chainable
1919 * @example
1920 *
1921 * // Specify variables to be expected in global scope
1922 * mocha.global(['jQuery', 'MyLib']);
1923 */
1924Mocha.prototype.global = function(global) {
1925 this.options.global = (this.options.global || [])
1926 .concat(global)
1927 .filter(Boolean)
1928 .filter(function(elt, idx, arr) {
1929 return arr.indexOf(elt) === idx;
1930 });
1931 return this;
1932};
1933// for backwards compability, 'globals' is an alias of 'global'
1934Mocha.prototype.globals = Mocha.prototype.global;
1935
1936/**
1937 * Enables or disables TTY color output by screen-oriented reporters.
1938 *
1939 * @deprecated since v7.0.0
1940 * @public
1941 * @see {@link Mocha#color}
1942 * @param {boolean} colors - Whether to enable color output.
1943 * @return {Mocha} this
1944 * @chainable
1945 */
1946Mocha.prototype.useColors = function(colors) {
1947 utils.deprecate('"useColors()" is DEPRECATED, please use "color()" instead.');
1948 if (colors !== undefined) {
1949 this.options.color = colors;
1950 }
1951 return this;
1952};
1953
1954/**
1955 * Enables or disables TTY color output by screen-oriented reporters.
1956 *
1957 * @public
1958 * @see [CLI option](../#-color-c-colors)
1959 * @param {boolean} [color=true] - Whether to enable color output.
1960 * @return {Mocha} this
1961 * @chainable
1962 */
1963Mocha.prototype.color = function(color) {
1964 this.options.color = color !== false;
1965 return this;
1966};
1967
1968/**
1969 * Determines if reporter should use inline diffs (rather than +/-)
1970 * in test failure output.
1971 *
1972 * @deprecated since v7.0.0
1973 * @public
1974 * @see {@link Mocha#inlineDiffs}
1975 * @param {boolean} [inlineDiffs=false] - Whether to use inline diffs.
1976 * @return {Mocha} this
1977 * @chainable
1978 */
1979Mocha.prototype.useInlineDiffs = function(inlineDiffs) {
1980 utils.deprecate(
1981 '"useInlineDiffs()" is DEPRECATED, please use "inlineDiffs()" instead.'
1982 );
1983 this.options.inlineDiffs = inlineDiffs !== undefined && inlineDiffs;
1984 return this;
1985};
1986
1987/**
1988 * Enables or disables reporter to use inline diffs (rather than +/-)
1989 * in test failure output.
1990 *
1991 * @public
1992 * @see [CLI option](../#-inline-diffs)
1993 * @param {boolean} [inlineDiffs=true] - Whether to use inline diffs.
1994 * @return {Mocha} this
1995 * @chainable
1996 */
1997Mocha.prototype.inlineDiffs = function(inlineDiffs) {
1998 this.options.inlineDiffs = inlineDiffs !== false;
1999 return this;
2000};
2001
2002/**
2003 * Determines if reporter should include diffs in test failure output.
2004 *
2005 * @deprecated since v7.0.0
2006 * @public
2007 * @see {@link Mocha#diff}
2008 * @param {boolean} [hideDiff=false] - Whether to hide diffs.
2009 * @return {Mocha} this
2010 * @chainable
2011 */
2012Mocha.prototype.hideDiff = function(hideDiff) {
2013 utils.deprecate('"hideDiff()" is DEPRECATED, please use "diff()" instead.');
2014 this.options.diff = !(hideDiff === true);
2015 return this;
2016};
2017
2018/**
2019 * Enables or disables reporter to include diff in test failure output.
2020 *
2021 * @public
2022 * @see [CLI option](../#-diff)
2023 * @param {boolean} [diff=true] - Whether to show diff on failure.
2024 * @return {Mocha} this
2025 * @chainable
2026 */
2027Mocha.prototype.diff = function(diff) {
2028 this.options.diff = diff !== false;
2029 return this;
2030};
2031
2032/**
2033 * @summary
2034 * Sets timeout threshold value.
2035 *
2036 * @description
2037 * A string argument can use shorthand (such as "2s") and will be converted.
2038 * If the value is `0`, timeouts will be disabled.
2039 *
2040 * @public
2041 * @see [CLI option](../#-timeout-ms-t-ms)
2042 * @see [Timeouts](../#timeouts)
2043 * @see {@link Mocha#enableTimeouts}
2044 * @param {number|string} msecs - Timeout threshold value.
2045 * @return {Mocha} this
2046 * @chainable
2047 * @example
2048 *
2049 * // Sets timeout to one second
2050 * mocha.timeout(1000);
2051 * @example
2052 *
2053 * // Same as above but using string argument
2054 * mocha.timeout('1s');
2055 */
2056Mocha.prototype.timeout = function(msecs) {
2057 this.suite.timeout(msecs);
2058 return this;
2059};
2060
2061/**
2062 * Sets the number of times to retry failed tests.
2063 *
2064 * @public
2065 * @see [CLI option](../#-retries-n)
2066 * @see [Retry Tests](../#retry-tests)
2067 * @param {number} retry - Number of times to retry failed tests.
2068 * @return {Mocha} this
2069 * @chainable
2070 * @example
2071 *
2072 * // Allow any failed test to retry one more time
2073 * mocha.retries(1);
2074 */
2075Mocha.prototype.retries = function(n) {
2076 this.suite.retries(n);
2077 return this;
2078};
2079
2080/**
2081 * Sets slowness threshold value.
2082 *
2083 * @public
2084 * @see [CLI option](../#-slow-ms-s-ms)
2085 * @param {number} msecs - Slowness threshold value.
2086 * @return {Mocha} this
2087 * @chainable
2088 * @example
2089 *
2090 * // Sets "slow" threshold to half a second
2091 * mocha.slow(500);
2092 * @example
2093 *
2094 * // Same as above but using string argument
2095 * mocha.slow('0.5s');
2096 */
2097Mocha.prototype.slow = function(msecs) {
2098 this.suite.slow(msecs);
2099 return this;
2100};
2101
2102/**
2103 * Enables or disables timeouts.
2104 *
2105 * @public
2106 * @see [CLI option](../#-timeout-ms-t-ms)
2107 * @param {boolean} enableTimeouts - Whether to enable timeouts.
2108 * @return {Mocha} this
2109 * @chainable
2110 */
2111Mocha.prototype.enableTimeouts = function(enableTimeouts) {
2112 this.suite.enableTimeouts(
2113 arguments.length && enableTimeouts !== undefined ? enableTimeouts : true
2114 );
2115 return this;
2116};
2117
2118/**
2119 * Forces all tests to either accept a `done` callback or return a promise.
2120 *
2121 * @public
2122 * @see [CLI option](../#-async-only-a)
2123 * @param {boolean} [asyncOnly=true] - Wether to force `done` callback or promise.
2124 * @return {Mocha} this
2125 * @chainable
2126 */
2127Mocha.prototype.asyncOnly = function(asyncOnly) {
2128 this.options.asyncOnly = asyncOnly !== false;
2129 return this;
2130};
2131
2132/**
2133 * Disables syntax highlighting (in browser).
2134 *
2135 * @public
2136 * @return {Mocha} this
2137 * @chainable
2138 */
2139Mocha.prototype.noHighlighting = function() {
2140 this.options.noHighlighting = true;
2141 return this;
2142};
2143
2144/**
2145 * Enables or disables uncaught errors to propagate.
2146 *
2147 * @public
2148 * @see [CLI option](../#-allow-uncaught)
2149 * @param {boolean} [allowUncaught=true] - Whether to propagate uncaught errors.
2150 * @return {Mocha} this
2151 * @chainable
2152 */
2153Mocha.prototype.allowUncaught = function(allowUncaught) {
2154 this.options.allowUncaught = allowUncaught !== false;
2155 return this;
2156};
2157
2158/**
2159 * @summary
2160 * Delays root suite execution.
2161 *
2162 * @description
2163 * Used to perform asynch operations before any suites are run.
2164 *
2165 * @public
2166 * @see [delayed root suite](../#delayed-root-suite)
2167 * @returns {Mocha} this
2168 * @chainable
2169 */
2170Mocha.prototype.delay = function delay() {
2171 this.options.delay = true;
2172 return this;
2173};
2174
2175/**
2176 * Causes tests marked `only` to fail the suite.
2177 *
2178 * @public
2179 * @see [CLI option](../#-forbid-only)
2180 * @param {boolean} [forbidOnly=true] - Whether tests marked `only` fail the suite.
2181 * @returns {Mocha} this
2182 * @chainable
2183 */
2184Mocha.prototype.forbidOnly = function(forbidOnly) {
2185 this.options.forbidOnly = forbidOnly !== false;
2186 return this;
2187};
2188
2189/**
2190 * Causes pending tests and tests marked `skip` to fail the suite.
2191 *
2192 * @public
2193 * @see [CLI option](../#-forbid-pending)
2194 * @param {boolean} [forbidPending=true] - Whether pending tests fail the suite.
2195 * @returns {Mocha} this
2196 * @chainable
2197 */
2198Mocha.prototype.forbidPending = function(forbidPending) {
2199 this.options.forbidPending = forbidPending !== false;
2200 return this;
2201};
2202
2203/**
2204 * Mocha version as specified by "package.json".
2205 *
2206 * @name Mocha#version
2207 * @type string
2208 * @readonly
2209 */
2210Object.defineProperty(Mocha.prototype, 'version', {
2211 value: require('../package.json').version,
2212 configurable: false,
2213 enumerable: true,
2214 writable: false
2215});
2216
2217/**
2218 * Callback to be invoked when test execution is complete.
2219 *
2220 * @callback DoneCB
2221 * @param {number} failures - Number of failures that occurred.
2222 */
2223
2224/**
2225 * Runs root suite and invokes `fn()` when complete.
2226 *
2227 * @description
2228 * To run tests multiple times (or to run tests in files that are
2229 * already in the `require` cache), make sure to clear them from
2230 * the cache first!
2231 *
2232 * @public
2233 * @see {@link Mocha#unloadFiles}
2234 * @see {@link Runner#run}
2235 * @param {DoneCB} [fn] - Callback invoked when test execution completed.
2236 * @return {Runner} runner instance
2237 */
2238Mocha.prototype.run = function(fn) {
2239 if (this.files.length) {
2240 this.loadFiles();
2241 }
2242 var suite = this.suite;
2243 var options = this.options;
2244 options.files = this.files;
2245 var runner = new exports.Runner(suite, options.delay);
2246 createStatsCollector(runner);
2247 var reporter = new this._reporter(runner, options);
2248 runner.checkLeaks = options.checkLeaks === true;
2249 runner.fullStackTrace = options.fullTrace;
2250 runner.asyncOnly = options.asyncOnly;
2251 runner.allowUncaught = options.allowUncaught;
2252 runner.forbidOnly = options.forbidOnly;
2253 runner.forbidPending = options.forbidPending;
2254 if (options.grep) {
2255 runner.grep(options.grep, options.invert);
2256 }
2257 if (options.global) {
2258 runner.globals(options.global);
2259 }
2260 if (options.growl) {
2261 this._growl(runner);
2262 }
2263 if (options.color !== undefined) {
2264 exports.reporters.Base.useColors = options.color;
2265 }
2266 exports.reporters.Base.inlineDiffs = options.inlineDiffs;
2267 exports.reporters.Base.hideDiff = !options.diff;
2268
2269 function done(failures) {
2270 fn = fn || utils.noop;
2271 if (reporter.done) {
2272 reporter.done(failures, fn);
2273 } else {
2274 fn(failures);
2275 }
2276 }
2277
2278 return runner.run(done);
2279};
2280
2281}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
2282},{"../package.json":90,"./context":5,"./errors":6,"./growl":2,"./hook":7,"./interfaces":11,"./mocharc.json":15,"./reporters":21,"./runnable":33,"./runner":34,"./stats-collector":35,"./suite":36,"./test":37,"./utils":38,"_process":69,"escape-string-regexp":49,"path":42}],15:[function(require,module,exports){
2283module.exports={
2284 "diff": true,
2285 "extension": ["js"],
2286 "opts": "./test/mocha.opts",
2287 "package": "./package.json",
2288 "reporter": "spec",
2289 "slow": 75,
2290 "timeout": 2000,
2291 "ui": "bdd",
2292 "watch-ignore": ["node_modules", ".git"]
2293}
2294
2295},{}],16:[function(require,module,exports){
2296'use strict';
2297
2298module.exports = Pending;
2299
2300/**
2301 * Initialize a new `Pending` error with the given message.
2302 *
2303 * @param {string} message
2304 */
2305function Pending(message) {
2306 this.message = message;
2307}
2308
2309},{}],17:[function(require,module,exports){
2310(function (process){
2311'use strict';
2312/**
2313 * @module Base
2314 */
2315/**
2316 * Module dependencies.
2317 */
2318
2319var tty = require('tty');
2320var diff = require('diff');
2321var milliseconds = require('ms');
2322var utils = require('../utils');
2323var supportsColor = process.browser ? null : require('supports-color');
2324var constants = require('../runner').constants;
2325var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
2326var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
2327
2328/**
2329 * Expose `Base`.
2330 */
2331
2332exports = module.exports = Base;
2333
2334/**
2335 * Check if both stdio streams are associated with a tty.
2336 */
2337
2338var isatty = process.stdout.isTTY && process.stderr.isTTY;
2339
2340/**
2341 * Save log references to avoid tests interfering (see GH-3604).
2342 */
2343var consoleLog = console.log;
2344
2345/**
2346 * Enable coloring by default, except in the browser interface.
2347 */
2348
2349exports.useColors =
2350 !process.browser &&
2351 (supportsColor.stdout || process.env.MOCHA_COLORS !== undefined);
2352
2353/**
2354 * Inline diffs instead of +/-
2355 */
2356
2357exports.inlineDiffs = false;
2358
2359/**
2360 * Default color map.
2361 */
2362
2363exports.colors = {
2364 pass: 90,
2365 fail: 31,
2366 'bright pass': 92,
2367 'bright fail': 91,
2368 'bright yellow': 93,
2369 pending: 36,
2370 suite: 0,
2371 'error title': 0,
2372 'error message': 31,
2373 'error stack': 90,
2374 checkmark: 32,
2375 fast: 90,
2376 medium: 33,
2377 slow: 31,
2378 green: 32,
2379 light: 90,
2380 'diff gutter': 90,
2381 'diff added': 32,
2382 'diff removed': 31
2383};
2384
2385/**
2386 * Default symbol map.
2387 */
2388
2389exports.symbols = {
2390 ok: '✓',
2391 err: '✖',
2392 dot: '․',
2393 comma: ',',
2394 bang: '!'
2395};
2396
2397// With node.js on Windows: use symbols available in terminal default fonts
2398if (process.platform === 'win32') {
2399 exports.symbols.ok = '\u221A';
2400 exports.symbols.err = '\u00D7';
2401 exports.symbols.dot = '.';
2402}
2403
2404/**
2405 * Color `str` with the given `type`,
2406 * allowing colors to be disabled,
2407 * as well as user-defined color
2408 * schemes.
2409 *
2410 * @private
2411 * @param {string} type
2412 * @param {string} str
2413 * @return {string}
2414 */
2415var color = (exports.color = function(type, str) {
2416 if (!exports.useColors) {
2417 return String(str);
2418 }
2419 return '\u001b[' + exports.colors[type] + 'm' + str + '\u001b[0m';
2420});
2421
2422/**
2423 * Expose term window size, with some defaults for when stderr is not a tty.
2424 */
2425
2426exports.window = {
2427 width: 75
2428};
2429
2430if (isatty) {
2431 exports.window.width = process.stdout.getWindowSize
2432 ? process.stdout.getWindowSize(1)[0]
2433 : tty.getWindowSize()[1];
2434}
2435
2436/**
2437 * Expose some basic cursor interactions that are common among reporters.
2438 */
2439
2440exports.cursor = {
2441 hide: function() {
2442 isatty && process.stdout.write('\u001b[?25l');
2443 },
2444
2445 show: function() {
2446 isatty && process.stdout.write('\u001b[?25h');
2447 },
2448
2449 deleteLine: function() {
2450 isatty && process.stdout.write('\u001b[2K');
2451 },
2452
2453 beginningOfLine: function() {
2454 isatty && process.stdout.write('\u001b[0G');
2455 },
2456
2457 CR: function() {
2458 if (isatty) {
2459 exports.cursor.deleteLine();
2460 exports.cursor.beginningOfLine();
2461 } else {
2462 process.stdout.write('\r');
2463 }
2464 }
2465};
2466
2467var showDiff = (exports.showDiff = function(err) {
2468 return (
2469 err &&
2470 err.showDiff !== false &&
2471 sameType(err.actual, err.expected) &&
2472 err.expected !== undefined
2473 );
2474});
2475
2476function stringifyDiffObjs(err) {
2477 if (!utils.isString(err.actual) || !utils.isString(err.expected)) {
2478 err.actual = utils.stringify(err.actual);
2479 err.expected = utils.stringify(err.expected);
2480 }
2481}
2482
2483/**
2484 * Returns a diff between 2 strings with coloured ANSI output.
2485 *
2486 * @description
2487 * The diff will be either inline or unified dependent on the value
2488 * of `Base.inlineDiff`.
2489 *
2490 * @param {string} actual
2491 * @param {string} expected
2492 * @return {string} Diff
2493 */
2494var generateDiff = (exports.generateDiff = function(actual, expected) {
2495 try {
2496 return exports.inlineDiffs
2497 ? inlineDiff(actual, expected)
2498 : unifiedDiff(actual, expected);
2499 } catch (err) {
2500 var msg =
2501 '\n ' +
2502 color('diff added', '+ expected') +
2503 ' ' +
2504 color('diff removed', '- actual: failed to generate Mocha diff') +
2505 '\n';
2506 return msg;
2507 }
2508});
2509
2510/**
2511 * Outputs the given `failures` as a list.
2512 *
2513 * @public
2514 * @memberof Mocha.reporters.Base
2515 * @variation 1
2516 * @param {Object[]} failures - Each is Test instance with corresponding
2517 * Error property
2518 */
2519exports.list = function(failures) {
2520 var multipleErr, multipleTest;
2521 Base.consoleLog();
2522 failures.forEach(function(test, i) {
2523 // format
2524 var fmt =
2525 color('error title', ' %s) %s:\n') +
2526 color('error message', ' %s') +
2527 color('error stack', '\n%s\n');
2528
2529 // msg
2530 var msg;
2531 var err;
2532 if (test.err && test.err.multiple) {
2533 if (multipleTest !== test) {
2534 multipleTest = test;
2535 multipleErr = [test.err].concat(test.err.multiple);
2536 }
2537 err = multipleErr.shift();
2538 } else {
2539 err = test.err;
2540 }
2541 var message;
2542 if (err.message && typeof err.message.toString === 'function') {
2543 message = err.message + '';
2544 } else if (typeof err.inspect === 'function') {
2545 message = err.inspect() + '';
2546 } else {
2547 message = '';
2548 }
2549 var stack = err.stack || message;
2550 var index = message ? stack.indexOf(message) : -1;
2551
2552 if (index === -1) {
2553 msg = message;
2554 } else {
2555 index += message.length;
2556 msg = stack.slice(0, index);
2557 // remove msg from stack
2558 stack = stack.slice(index + 1);
2559 }
2560
2561 // uncaught
2562 if (err.uncaught) {
2563 msg = 'Uncaught ' + msg;
2564 }
2565 // explicitly show diff
2566 if (!exports.hideDiff && showDiff(err)) {
2567 stringifyDiffObjs(err);
2568 fmt =
2569 color('error title', ' %s) %s:\n%s') + color('error stack', '\n%s\n');
2570 var match = message.match(/^([^:]+): expected/);
2571 msg = '\n ' + color('error message', match ? match[1] : msg);
2572
2573 msg += generateDiff(err.actual, err.expected);
2574 }
2575
2576 // indent stack trace
2577 stack = stack.replace(/^/gm, ' ');
2578
2579 // indented test title
2580 var testTitle = '';
2581 test.titlePath().forEach(function(str, index) {
2582 if (index !== 0) {
2583 testTitle += '\n ';
2584 }
2585 for (var i = 0; i < index; i++) {
2586 testTitle += ' ';
2587 }
2588 testTitle += str;
2589 });
2590
2591 Base.consoleLog(fmt, i + 1, testTitle, msg, stack);
2592 });
2593};
2594
2595/**
2596 * Constructs a new `Base` reporter instance.
2597 *
2598 * @description
2599 * All other reporters generally inherit from this reporter.
2600 *
2601 * @public
2602 * @class
2603 * @memberof Mocha.reporters
2604 * @param {Runner} runner - Instance triggers reporter actions.
2605 * @param {Object} [options] - runner options
2606 */
2607function Base(runner, options) {
2608 var failures = (this.failures = []);
2609
2610 if (!runner) {
2611 throw new TypeError('Missing runner argument');
2612 }
2613 this.options = options || {};
2614 this.runner = runner;
2615 this.stats = runner.stats; // assigned so Reporters keep a closer reference
2616
2617 runner.on(EVENT_TEST_PASS, function(test) {
2618 if (test.duration > test.slow()) {
2619 test.speed = 'slow';
2620 } else if (test.duration > test.slow() / 2) {
2621 test.speed = 'medium';
2622 } else {
2623 test.speed = 'fast';
2624 }
2625 });
2626
2627 runner.on(EVENT_TEST_FAIL, function(test, err) {
2628 if (showDiff(err)) {
2629 stringifyDiffObjs(err);
2630 }
2631 // more than one error per test
2632 if (test.err && err instanceof Error) {
2633 test.err.multiple = (test.err.multiple || []).concat(err);
2634 } else {
2635 test.err = err;
2636 }
2637 failures.push(test);
2638 });
2639}
2640
2641/**
2642 * Outputs common epilogue used by many of the bundled reporters.
2643 *
2644 * @public
2645 * @memberof Mocha.reporters
2646 */
2647Base.prototype.epilogue = function() {
2648 var stats = this.stats;
2649 var fmt;
2650
2651 Base.consoleLog();
2652
2653 // passes
2654 fmt =
2655 color('bright pass', ' ') +
2656 color('green', ' %d passing') +
2657 color('light', ' (%s)');
2658
2659 Base.consoleLog(fmt, stats.passes || 0, milliseconds(stats.duration));
2660
2661 // pending
2662 if (stats.pending) {
2663 fmt = color('pending', ' ') + color('pending', ' %d pending');
2664
2665 Base.consoleLog(fmt, stats.pending);
2666 }
2667
2668 // failures
2669 if (stats.failures) {
2670 fmt = color('fail', ' %d failing');
2671
2672 Base.consoleLog(fmt, stats.failures);
2673
2674 Base.list(this.failures);
2675 Base.consoleLog();
2676 }
2677
2678 Base.consoleLog();
2679};
2680
2681/**
2682 * Pads the given `str` to `len`.
2683 *
2684 * @private
2685 * @param {string} str
2686 * @param {string} len
2687 * @return {string}
2688 */
2689function pad(str, len) {
2690 str = String(str);
2691 return Array(len - str.length + 1).join(' ') + str;
2692}
2693
2694/**
2695 * Returns inline diff between 2 strings with coloured ANSI output.
2696 *
2697 * @private
2698 * @param {String} actual
2699 * @param {String} expected
2700 * @return {string} Diff
2701 */
2702function inlineDiff(actual, expected) {
2703 var msg = errorDiff(actual, expected);
2704
2705 // linenos
2706 var lines = msg.split('\n');
2707 if (lines.length > 4) {
2708 var width = String(lines.length).length;
2709 msg = lines
2710 .map(function(str, i) {
2711 return pad(++i, width) + ' |' + ' ' + str;
2712 })
2713 .join('\n');
2714 }
2715
2716 // legend
2717 msg =
2718 '\n' +
2719 color('diff removed', 'actual') +
2720 ' ' +
2721 color('diff added', 'expected') +
2722 '\n\n' +
2723 msg +
2724 '\n';
2725
2726 // indent
2727 msg = msg.replace(/^/gm, ' ');
2728 return msg;
2729}
2730
2731/**
2732 * Returns unified diff between two strings with coloured ANSI output.
2733 *
2734 * @private
2735 * @param {String} actual
2736 * @param {String} expected
2737 * @return {string} The diff.
2738 */
2739function unifiedDiff(actual, expected) {
2740 var indent = ' ';
2741 function cleanUp(line) {
2742 if (line[0] === '+') {
2743 return indent + colorLines('diff added', line);
2744 }
2745 if (line[0] === '-') {
2746 return indent + colorLines('diff removed', line);
2747 }
2748 if (line.match(/@@/)) {
2749 return '--';
2750 }
2751 if (line.match(/\\ No newline/)) {
2752 return null;
2753 }
2754 return indent + line;
2755 }
2756 function notBlank(line) {
2757 return typeof line !== 'undefined' && line !== null;
2758 }
2759 var msg = diff.createPatch('string', actual, expected);
2760 var lines = msg.split('\n').splice(5);
2761 return (
2762 '\n ' +
2763 colorLines('diff added', '+ expected') +
2764 ' ' +
2765 colorLines('diff removed', '- actual') +
2766 '\n\n' +
2767 lines
2768 .map(cleanUp)
2769 .filter(notBlank)
2770 .join('\n')
2771 );
2772}
2773
2774/**
2775 * Returns character diff for `err`.
2776 *
2777 * @private
2778 * @param {String} actual
2779 * @param {String} expected
2780 * @return {string} the diff
2781 */
2782function errorDiff(actual, expected) {
2783 return diff
2784 .diffWordsWithSpace(actual, expected)
2785 .map(function(str) {
2786 if (str.added) {
2787 return colorLines('diff added', str.value);
2788 }
2789 if (str.removed) {
2790 return colorLines('diff removed', str.value);
2791 }
2792 return str.value;
2793 })
2794 .join('');
2795}
2796
2797/**
2798 * Colors lines for `str`, using the color `name`.
2799 *
2800 * @private
2801 * @param {string} name
2802 * @param {string} str
2803 * @return {string}
2804 */
2805function colorLines(name, str) {
2806 return str
2807 .split('\n')
2808 .map(function(str) {
2809 return color(name, str);
2810 })
2811 .join('\n');
2812}
2813
2814/**
2815 * Object#toString reference.
2816 */
2817var objToString = Object.prototype.toString;
2818
2819/**
2820 * Checks that a / b have the same type.
2821 *
2822 * @private
2823 * @param {Object} a
2824 * @param {Object} b
2825 * @return {boolean}
2826 */
2827function sameType(a, b) {
2828 return objToString.call(a) === objToString.call(b);
2829}
2830
2831Base.consoleLog = consoleLog;
2832
2833Base.abstract = true;
2834
2835}).call(this,require('_process'))
2836},{"../runner":34,"../utils":38,"_process":69,"diff":48,"ms":60,"supports-color":42,"tty":4}],18:[function(require,module,exports){
2837'use strict';
2838/**
2839 * @module Doc
2840 */
2841/**
2842 * Module dependencies.
2843 */
2844
2845var Base = require('./base');
2846var utils = require('../utils');
2847var constants = require('../runner').constants;
2848var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
2849var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
2850var EVENT_SUITE_BEGIN = constants.EVENT_SUITE_BEGIN;
2851var EVENT_SUITE_END = constants.EVENT_SUITE_END;
2852
2853/**
2854 * Expose `Doc`.
2855 */
2856
2857exports = module.exports = Doc;
2858
2859/**
2860 * Constructs a new `Doc` reporter instance.
2861 *
2862 * @public
2863 * @class
2864 * @memberof Mocha.reporters
2865 * @extends Mocha.reporters.Base
2866 * @param {Runner} runner - Instance triggers reporter actions.
2867 * @param {Object} [options] - runner options
2868 */
2869function Doc(runner, options) {
2870 Base.call(this, runner, options);
2871
2872 var indents = 2;
2873
2874 function indent() {
2875 return Array(indents).join(' ');
2876 }
2877
2878 runner.on(EVENT_SUITE_BEGIN, function(suite) {
2879 if (suite.root) {
2880 return;
2881 }
2882 ++indents;
2883 Base.consoleLog('%s<section class="suite">', indent());
2884 ++indents;
2885 Base.consoleLog('%s<h1>%s</h1>', indent(), utils.escape(suite.title));
2886 Base.consoleLog('%s<dl>', indent());
2887 });
2888
2889 runner.on(EVENT_SUITE_END, function(suite) {
2890 if (suite.root) {
2891 return;
2892 }
2893 Base.consoleLog('%s</dl>', indent());
2894 --indents;
2895 Base.consoleLog('%s</section>', indent());
2896 --indents;
2897 });
2898
2899 runner.on(EVENT_TEST_PASS, function(test) {
2900 Base.consoleLog('%s <dt>%s</dt>', indent(), utils.escape(test.title));
2901 var code = utils.escape(utils.clean(test.body));
2902 Base.consoleLog('%s <dd><pre><code>%s</code></pre></dd>', indent(), code);
2903 });
2904
2905 runner.on(EVENT_TEST_FAIL, function(test, err) {
2906 Base.consoleLog(
2907 '%s <dt class="error">%s</dt>',
2908 indent(),
2909 utils.escape(test.title)
2910 );
2911 var code = utils.escape(utils.clean(test.body));
2912 Base.consoleLog(
2913 '%s <dd class="error"><pre><code>%s</code></pre></dd>',
2914 indent(),
2915 code
2916 );
2917 Base.consoleLog(
2918 '%s <dd class="error">%s</dd>',
2919 indent(),
2920 utils.escape(err)
2921 );
2922 });
2923}
2924
2925Doc.description = 'HTML documentation';
2926
2927},{"../runner":34,"../utils":38,"./base":17}],19:[function(require,module,exports){
2928(function (process){
2929'use strict';
2930/**
2931 * @module Dot
2932 */
2933/**
2934 * Module dependencies.
2935 */
2936
2937var Base = require('./base');
2938var inherits = require('../utils').inherits;
2939var constants = require('../runner').constants;
2940var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
2941var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
2942var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
2943var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
2944var EVENT_RUN_END = constants.EVENT_RUN_END;
2945
2946/**
2947 * Expose `Dot`.
2948 */
2949
2950exports = module.exports = Dot;
2951
2952/**
2953 * Constructs a new `Dot` reporter instance.
2954 *
2955 * @public
2956 * @class
2957 * @memberof Mocha.reporters
2958 * @extends Mocha.reporters.Base
2959 * @param {Runner} runner - Instance triggers reporter actions.
2960 * @param {Object} [options] - runner options
2961 */
2962function Dot(runner, options) {
2963 Base.call(this, runner, options);
2964
2965 var self = this;
2966 var width = (Base.window.width * 0.75) | 0;
2967 var n = -1;
2968
2969 runner.on(EVENT_RUN_BEGIN, function() {
2970 process.stdout.write('\n');
2971 });
2972
2973 runner.on(EVENT_TEST_PENDING, function() {
2974 if (++n % width === 0) {
2975 process.stdout.write('\n ');
2976 }
2977 process.stdout.write(Base.color('pending', Base.symbols.comma));
2978 });
2979
2980 runner.on(EVENT_TEST_PASS, function(test) {
2981 if (++n % width === 0) {
2982 process.stdout.write('\n ');
2983 }
2984 if (test.speed === 'slow') {
2985 process.stdout.write(Base.color('bright yellow', Base.symbols.dot));
2986 } else {
2987 process.stdout.write(Base.color(test.speed, Base.symbols.dot));
2988 }
2989 });
2990
2991 runner.on(EVENT_TEST_FAIL, function() {
2992 if (++n % width === 0) {
2993 process.stdout.write('\n ');
2994 }
2995 process.stdout.write(Base.color('fail', Base.symbols.bang));
2996 });
2997
2998 runner.once(EVENT_RUN_END, function() {
2999 process.stdout.write('\n');
3000 self.epilogue();
3001 });
3002}
3003
3004/**
3005 * Inherit from `Base.prototype`.
3006 */
3007inherits(Dot, Base);
3008
3009Dot.description = 'dot matrix representation';
3010
3011}).call(this,require('_process'))
3012},{"../runner":34,"../utils":38,"./base":17,"_process":69}],20:[function(require,module,exports){
3013(function (global){
3014'use strict';
3015
3016/* eslint-env browser */
3017/**
3018 * @module HTML
3019 */
3020/**
3021 * Module dependencies.
3022 */
3023
3024var Base = require('./base');
3025var utils = require('../utils');
3026var Progress = require('../browser/progress');
3027var escapeRe = require('escape-string-regexp');
3028var constants = require('../runner').constants;
3029var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
3030var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
3031var EVENT_SUITE_BEGIN = constants.EVENT_SUITE_BEGIN;
3032var EVENT_SUITE_END = constants.EVENT_SUITE_END;
3033var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
3034var escape = utils.escape;
3035
3036/**
3037 * Save timer references to avoid Sinon interfering (see GH-237).
3038 */
3039
3040var Date = global.Date;
3041
3042/**
3043 * Expose `HTML`.
3044 */
3045
3046exports = module.exports = HTML;
3047
3048/**
3049 * Stats template.
3050 */
3051
3052var statsTemplate =
3053 '<ul id="mocha-stats">' +
3054 '<li class="progress"><canvas width="40" height="40"></canvas></li>' +
3055 '<li class="passes"><a href="javascript:void(0);">passes:</a> <em>0</em></li>' +
3056 '<li class="failures"><a href="javascript:void(0);">failures:</a> <em>0</em></li>' +
3057 '<li class="duration">duration: <em>0</em>s</li>' +
3058 '</ul>';
3059
3060var playIcon = '&#x2023;';
3061
3062/**
3063 * Constructs a new `HTML` reporter instance.
3064 *
3065 * @public
3066 * @class
3067 * @memberof Mocha.reporters
3068 * @extends Mocha.reporters.Base
3069 * @param {Runner} runner - Instance triggers reporter actions.
3070 * @param {Object} [options] - runner options
3071 */
3072function HTML(runner, options) {
3073 Base.call(this, runner, options);
3074
3075 var self = this;
3076 var stats = this.stats;
3077 var stat = fragment(statsTemplate);
3078 var items = stat.getElementsByTagName('li');
3079 var passes = items[1].getElementsByTagName('em')[0];
3080 var passesLink = items[1].getElementsByTagName('a')[0];
3081 var failures = items[2].getElementsByTagName('em')[0];
3082 var failuresLink = items[2].getElementsByTagName('a')[0];
3083 var duration = items[3].getElementsByTagName('em')[0];
3084 var canvas = stat.getElementsByTagName('canvas')[0];
3085 var report = fragment('<ul id="mocha-report"></ul>');
3086 var stack = [report];
3087 var progress;
3088 var ctx;
3089 var root = document.getElementById('mocha');
3090
3091 if (canvas.getContext) {
3092 var ratio = window.devicePixelRatio || 1;
3093 canvas.style.width = canvas.width;
3094 canvas.style.height = canvas.height;
3095 canvas.width *= ratio;
3096 canvas.height *= ratio;
3097 ctx = canvas.getContext('2d');
3098 ctx.scale(ratio, ratio);
3099 progress = new Progress();
3100 }
3101
3102 if (!root) {
3103 return error('#mocha div missing, add it to your document');
3104 }
3105
3106 // pass toggle
3107 on(passesLink, 'click', function(evt) {
3108 evt.preventDefault();
3109 unhide();
3110 var name = /pass/.test(report.className) ? '' : ' pass';
3111 report.className = report.className.replace(/fail|pass/g, '') + name;
3112 if (report.className.trim()) {
3113 hideSuitesWithout('test pass');
3114 }
3115 });
3116
3117 // failure toggle
3118 on(failuresLink, 'click', function(evt) {
3119 evt.preventDefault();
3120 unhide();
3121 var name = /fail/.test(report.className) ? '' : ' fail';
3122 report.className = report.className.replace(/fail|pass/g, '') + name;
3123 if (report.className.trim()) {
3124 hideSuitesWithout('test fail');
3125 }
3126 });
3127
3128 root.appendChild(stat);
3129 root.appendChild(report);
3130
3131 if (progress) {
3132 progress.size(40);
3133 }
3134
3135 runner.on(EVENT_SUITE_BEGIN, function(suite) {
3136 if (suite.root) {
3137 return;
3138 }
3139
3140 // suite
3141 var url = self.suiteURL(suite);
3142 var el = fragment(
3143 '<li class="suite"><h1><a href="%s">%s</a></h1></li>',
3144 url,
3145 escape(suite.title)
3146 );
3147
3148 // container
3149 stack[0].appendChild(el);
3150 stack.unshift(document.createElement('ul'));
3151 el.appendChild(stack[0]);
3152 });
3153
3154 runner.on(EVENT_SUITE_END, function(suite) {
3155 if (suite.root) {
3156 updateStats();
3157 return;
3158 }
3159 stack.shift();
3160 });
3161
3162 runner.on(EVENT_TEST_PASS, function(test) {
3163 var url = self.testURL(test);
3164 var markup =
3165 '<li class="test pass %e"><h2>%e<span class="duration">%ems</span> ' +
3166 '<a href="%s" class="replay">' +
3167 playIcon +
3168 '</a></h2></li>';
3169 var el = fragment(markup, test.speed, test.title, test.duration, url);
3170 self.addCodeToggle(el, test.body);
3171 appendToStack(el);
3172 updateStats();
3173 });
3174
3175 runner.on(EVENT_TEST_FAIL, function(test) {
3176 var el = fragment(
3177 '<li class="test fail"><h2>%e <a href="%e" class="replay">' +
3178 playIcon +
3179 '</a></h2></li>',
3180 test.title,
3181 self.testURL(test)
3182 );
3183 var stackString; // Note: Includes leading newline
3184 var message = test.err.toString();
3185
3186 // <=IE7 stringifies to [Object Error]. Since it can be overloaded, we
3187 // check for the result of the stringifying.
3188 if (message === '[object Error]') {
3189 message = test.err.message;
3190 }
3191
3192 if (test.err.stack) {
3193 var indexOfMessage = test.err.stack.indexOf(test.err.message);
3194 if (indexOfMessage === -1) {
3195 stackString = test.err.stack;
3196 } else {
3197 stackString = test.err.stack.substr(
3198 test.err.message.length + indexOfMessage
3199 );
3200 }
3201 } else if (test.err.sourceURL && test.err.line !== undefined) {
3202 // Safari doesn't give you a stack. Let's at least provide a source line.
3203 stackString = '\n(' + test.err.sourceURL + ':' + test.err.line + ')';
3204 }
3205
3206 stackString = stackString || '';
3207
3208 if (test.err.htmlMessage && stackString) {
3209 el.appendChild(
3210 fragment(
3211 '<div class="html-error">%s\n<pre class="error">%e</pre></div>',
3212 test.err.htmlMessage,
3213 stackString
3214 )
3215 );
3216 } else if (test.err.htmlMessage) {
3217 el.appendChild(
3218 fragment('<div class="html-error">%s</div>', test.err.htmlMessage)
3219 );
3220 } else {
3221 el.appendChild(
3222 fragment('<pre class="error">%e%e</pre>', message, stackString)
3223 );
3224 }
3225
3226 self.addCodeToggle(el, test.body);
3227 appendToStack(el);
3228 updateStats();
3229 });
3230
3231 runner.on(EVENT_TEST_PENDING, function(test) {
3232 var el = fragment(
3233 '<li class="test pass pending"><h2>%e</h2></li>',
3234 test.title
3235 );
3236 appendToStack(el);
3237 updateStats();
3238 });
3239
3240 function appendToStack(el) {
3241 // Don't call .appendChild if #mocha-report was already .shift()'ed off the stack.
3242 if (stack[0]) {
3243 stack[0].appendChild(el);
3244 }
3245 }
3246
3247 function updateStats() {
3248 // TODO: add to stats
3249 var percent = ((stats.tests / runner.total) * 100) | 0;
3250 if (progress) {
3251 progress.update(percent).draw(ctx);
3252 }
3253
3254 // update stats
3255 var ms = new Date() - stats.start;
3256 text(passes, stats.passes);
3257 text(failures, stats.failures);
3258 text(duration, (ms / 1000).toFixed(2));
3259 }
3260}
3261
3262/**
3263 * Makes a URL, preserving querystring ("search") parameters.
3264 *
3265 * @param {string} s
3266 * @return {string} A new URL.
3267 */
3268function makeUrl(s) {
3269 var search = window.location.search;
3270
3271 // Remove previous grep query parameter if present
3272 if (search) {
3273 search = search.replace(/[?&]grep=[^&\s]*/g, '').replace(/^&/, '?');
3274 }
3275
3276 return (
3277 window.location.pathname +
3278 (search ? search + '&' : '?') +
3279 'grep=' +
3280 encodeURIComponent(escapeRe(s))
3281 );
3282}
3283
3284/**
3285 * Provide suite URL.
3286 *
3287 * @param {Object} [suite]
3288 */
3289HTML.prototype.suiteURL = function(suite) {
3290 return makeUrl(suite.fullTitle());
3291};
3292
3293/**
3294 * Provide test URL.
3295 *
3296 * @param {Object} [test]
3297 */
3298HTML.prototype.testURL = function(test) {
3299 return makeUrl(test.fullTitle());
3300};
3301
3302/**
3303 * Adds code toggle functionality for the provided test's list element.
3304 *
3305 * @param {HTMLLIElement} el
3306 * @param {string} contents
3307 */
3308HTML.prototype.addCodeToggle = function(el, contents) {
3309 var h2 = el.getElementsByTagName('h2')[0];
3310
3311 on(h2, 'click', function() {
3312 pre.style.display = pre.style.display === 'none' ? 'block' : 'none';
3313 });
3314
3315 var pre = fragment('<pre><code>%e</code></pre>', utils.clean(contents));
3316 el.appendChild(pre);
3317 pre.style.display = 'none';
3318};
3319
3320/**
3321 * Display error `msg`.
3322 *
3323 * @param {string} msg
3324 */
3325function error(msg) {
3326 document.body.appendChild(fragment('<div id="mocha-error">%s</div>', msg));
3327}
3328
3329/**
3330 * Return a DOM fragment from `html`.
3331 *
3332 * @param {string} html
3333 */
3334function fragment(html) {
3335 var args = arguments;
3336 var div = document.createElement('div');
3337 var i = 1;
3338
3339 div.innerHTML = html.replace(/%([se])/g, function(_, type) {
3340 switch (type) {
3341 case 's':
3342 return String(args[i++]);
3343 case 'e':
3344 return escape(args[i++]);
3345 // no default
3346 }
3347 });
3348
3349 return div.firstChild;
3350}
3351
3352/**
3353 * Check for suites that do not have elements
3354 * with `classname`, and hide them.
3355 *
3356 * @param {text} classname
3357 */
3358function hideSuitesWithout(classname) {
3359 var suites = document.getElementsByClassName('suite');
3360 for (var i = 0; i < suites.length; i++) {
3361 var els = suites[i].getElementsByClassName(classname);
3362 if (!els.length) {
3363 suites[i].className += ' hidden';
3364 }
3365 }
3366}
3367
3368/**
3369 * Unhide .hidden suites.
3370 */
3371function unhide() {
3372 var els = document.getElementsByClassName('suite hidden');
3373 while (els.length > 0) {
3374 els[0].className = els[0].className.replace('suite hidden', 'suite');
3375 }
3376}
3377
3378/**
3379 * Set an element's text contents.
3380 *
3381 * @param {HTMLElement} el
3382 * @param {string} contents
3383 */
3384function text(el, contents) {
3385 if (el.textContent) {
3386 el.textContent = contents;
3387 } else {
3388 el.innerText = contents;
3389 }
3390}
3391
3392/**
3393 * Listen on `event` with callback `fn`.
3394 */
3395function on(el, event, fn) {
3396 if (el.addEventListener) {
3397 el.addEventListener(event, fn, false);
3398 } else {
3399 el.attachEvent('on' + event, fn);
3400 }
3401}
3402
3403HTML.browserOnly = true;
3404
3405}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
3406},{"../browser/progress":3,"../runner":34,"../utils":38,"./base":17,"escape-string-regexp":49}],21:[function(require,module,exports){
3407'use strict';
3408
3409// Alias exports to a their normalized format Mocha#reporter to prevent a need
3410// for dynamic (try/catch) requires, which Browserify doesn't handle.
3411exports.Base = exports.base = require('./base');
3412exports.Dot = exports.dot = require('./dot');
3413exports.Doc = exports.doc = require('./doc');
3414exports.TAP = exports.tap = require('./tap');
3415exports.JSON = exports.json = require('./json');
3416exports.HTML = exports.html = require('./html');
3417exports.List = exports.list = require('./list');
3418exports.Min = exports.min = require('./min');
3419exports.Spec = exports.spec = require('./spec');
3420exports.Nyan = exports.nyan = require('./nyan');
3421exports.XUnit = exports.xunit = require('./xunit');
3422exports.Markdown = exports.markdown = require('./markdown');
3423exports.Progress = exports.progress = require('./progress');
3424exports.Landing = exports.landing = require('./landing');
3425exports.JSONStream = exports['json-stream'] = require('./json-stream');
3426
3427},{"./base":17,"./doc":18,"./dot":19,"./html":20,"./json":23,"./json-stream":22,"./landing":24,"./list":25,"./markdown":26,"./min":27,"./nyan":28,"./progress":29,"./spec":30,"./tap":31,"./xunit":32}],22:[function(require,module,exports){
3428(function (process){
3429'use strict';
3430/**
3431 * @module JSONStream
3432 */
3433/**
3434 * Module dependencies.
3435 */
3436
3437var Base = require('./base');
3438var constants = require('../runner').constants;
3439var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
3440var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
3441var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
3442var EVENT_RUN_END = constants.EVENT_RUN_END;
3443
3444/**
3445 * Expose `JSONStream`.
3446 */
3447
3448exports = module.exports = JSONStream;
3449
3450/**
3451 * Constructs a new `JSONStream` reporter instance.
3452 *
3453 * @public
3454 * @class
3455 * @memberof Mocha.reporters
3456 * @extends Mocha.reporters.Base
3457 * @param {Runner} runner - Instance triggers reporter actions.
3458 * @param {Object} [options] - runner options
3459 */
3460function JSONStream(runner, options) {
3461 Base.call(this, runner, options);
3462
3463 var self = this;
3464 var total = runner.total;
3465
3466 runner.once(EVENT_RUN_BEGIN, function() {
3467 writeEvent(['start', {total: total}]);
3468 });
3469
3470 runner.on(EVENT_TEST_PASS, function(test) {
3471 writeEvent(['pass', clean(test)]);
3472 });
3473
3474 runner.on(EVENT_TEST_FAIL, function(test, err) {
3475 test = clean(test);
3476 test.err = err.message;
3477 test.stack = err.stack || null;
3478 writeEvent(['fail', test]);
3479 });
3480
3481 runner.once(EVENT_RUN_END, function() {
3482 writeEvent(['end', self.stats]);
3483 });
3484}
3485
3486/**
3487 * Mocha event to be written to the output stream.
3488 * @typedef {Array} JSONStream~MochaEvent
3489 */
3490
3491/**
3492 * Writes Mocha event to reporter output stream.
3493 *
3494 * @private
3495 * @param {JSONStream~MochaEvent} event - Mocha event to be output.
3496 */
3497function writeEvent(event) {
3498 process.stdout.write(JSON.stringify(event) + '\n');
3499}
3500
3501/**
3502 * Returns an object literal representation of `test`
3503 * free of cyclic properties, etc.
3504 *
3505 * @private
3506 * @param {Test} test - Instance used as data source.
3507 * @return {Object} object containing pared-down test instance data
3508 */
3509function clean(test) {
3510 return {
3511 title: test.title,
3512 fullTitle: test.fullTitle(),
3513 duration: test.duration,
3514 currentRetry: test.currentRetry()
3515 };
3516}
3517
3518JSONStream.description = 'newline delimited JSON events';
3519
3520}).call(this,require('_process'))
3521},{"../runner":34,"./base":17,"_process":69}],23:[function(require,module,exports){
3522(function (process){
3523'use strict';
3524/**
3525 * @module JSON
3526 */
3527/**
3528 * Module dependencies.
3529 */
3530
3531var Base = require('./base');
3532var constants = require('../runner').constants;
3533var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
3534var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
3535var EVENT_TEST_END = constants.EVENT_TEST_END;
3536var EVENT_RUN_END = constants.EVENT_RUN_END;
3537var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
3538
3539/**
3540 * Expose `JSON`.
3541 */
3542
3543exports = module.exports = JSONReporter;
3544
3545/**
3546 * Constructs a new `JSON` reporter instance.
3547 *
3548 * @public
3549 * @class JSON
3550 * @memberof Mocha.reporters
3551 * @extends Mocha.reporters.Base
3552 * @param {Runner} runner - Instance triggers reporter actions.
3553 * @param {Object} [options] - runner options
3554 */
3555function JSONReporter(runner, options) {
3556 Base.call(this, runner, options);
3557
3558 var self = this;
3559 var tests = [];
3560 var pending = [];
3561 var failures = [];
3562 var passes = [];
3563
3564 runner.on(EVENT_TEST_END, function(test) {
3565 tests.push(test);
3566 });
3567
3568 runner.on(EVENT_TEST_PASS, function(test) {
3569 passes.push(test);
3570 });
3571
3572 runner.on(EVENT_TEST_FAIL, function(test) {
3573 failures.push(test);
3574 });
3575
3576 runner.on(EVENT_TEST_PENDING, function(test) {
3577 pending.push(test);
3578 });
3579
3580 runner.once(EVENT_RUN_END, function() {
3581 var obj = {
3582 stats: self.stats,
3583 tests: tests.map(clean),
3584 pending: pending.map(clean),
3585 failures: failures.map(clean),
3586 passes: passes.map(clean)
3587 };
3588
3589 runner.testResults = obj;
3590
3591 process.stdout.write(JSON.stringify(obj, null, 2));
3592 });
3593}
3594
3595/**
3596 * Return a plain-object representation of `test`
3597 * free of cyclic properties etc.
3598 *
3599 * @private
3600 * @param {Object} test
3601 * @return {Object}
3602 */
3603function clean(test) {
3604 var err = test.err || {};
3605 if (err instanceof Error) {
3606 err = errorJSON(err);
3607 }
3608
3609 return {
3610 title: test.title,
3611 fullTitle: test.fullTitle(),
3612 duration: test.duration,
3613 currentRetry: test.currentRetry(),
3614 err: cleanCycles(err)
3615 };
3616}
3617
3618/**
3619 * Replaces any circular references inside `obj` with '[object Object]'
3620 *
3621 * @private
3622 * @param {Object} obj
3623 * @return {Object}
3624 */
3625function cleanCycles(obj) {
3626 var cache = [];
3627 return JSON.parse(
3628 JSON.stringify(obj, function(key, value) {
3629 if (typeof value === 'object' && value !== null) {
3630 if (cache.indexOf(value) !== -1) {
3631 // Instead of going in a circle, we'll print [object Object]
3632 return '' + value;
3633 }
3634 cache.push(value);
3635 }
3636
3637 return value;
3638 })
3639 );
3640}
3641
3642/**
3643 * Transform an Error object into a JSON object.
3644 *
3645 * @private
3646 * @param {Error} err
3647 * @return {Object}
3648 */
3649function errorJSON(err) {
3650 var res = {};
3651 Object.getOwnPropertyNames(err).forEach(function(key) {
3652 res[key] = err[key];
3653 }, err);
3654 return res;
3655}
3656
3657JSONReporter.description = 'single JSON object';
3658
3659}).call(this,require('_process'))
3660},{"../runner":34,"./base":17,"_process":69}],24:[function(require,module,exports){
3661(function (process){
3662'use strict';
3663/**
3664 * @module Landing
3665 */
3666/**
3667 * Module dependencies.
3668 */
3669
3670var Base = require('./base');
3671var inherits = require('../utils').inherits;
3672var constants = require('../runner').constants;
3673var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
3674var EVENT_RUN_END = constants.EVENT_RUN_END;
3675var EVENT_TEST_END = constants.EVENT_TEST_END;
3676var STATE_FAILED = require('../runnable').constants.STATE_FAILED;
3677
3678var cursor = Base.cursor;
3679var color = Base.color;
3680
3681/**
3682 * Expose `Landing`.
3683 */
3684
3685exports = module.exports = Landing;
3686
3687/**
3688 * Airplane color.
3689 */
3690
3691Base.colors.plane = 0;
3692
3693/**
3694 * Airplane crash color.
3695 */
3696
3697Base.colors['plane crash'] = 31;
3698
3699/**
3700 * Runway color.
3701 */
3702
3703Base.colors.runway = 90;
3704
3705/**
3706 * Constructs a new `Landing` reporter instance.
3707 *
3708 * @public
3709 * @class
3710 * @memberof Mocha.reporters
3711 * @extends Mocha.reporters.Base
3712 * @param {Runner} runner - Instance triggers reporter actions.
3713 * @param {Object} [options] - runner options
3714 */
3715function Landing(runner, options) {
3716 Base.call(this, runner, options);
3717
3718 var self = this;
3719 var width = (Base.window.width * 0.75) | 0;
3720 var total = runner.total;
3721 var stream = process.stdout;
3722 var plane = color('plane', '✈');
3723 var crashed = -1;
3724 var n = 0;
3725
3726 function runway() {
3727 var buf = Array(width).join('-');
3728 return ' ' + color('runway', buf);
3729 }
3730
3731 runner.on(EVENT_RUN_BEGIN, function() {
3732 stream.write('\n\n\n ');
3733 cursor.hide();
3734 });
3735
3736 runner.on(EVENT_TEST_END, function(test) {
3737 // check if the plane crashed
3738 var col = crashed === -1 ? ((width * ++n) / total) | 0 : crashed;
3739
3740 // show the crash
3741 if (test.state === STATE_FAILED) {
3742 plane = color('plane crash', '✈');
3743 crashed = col;
3744 }
3745
3746 // render landing strip
3747 stream.write('\u001b[' + (width + 1) + 'D\u001b[2A');
3748 stream.write(runway());
3749 stream.write('\n ');
3750 stream.write(color('runway', Array(col).join('⋅')));
3751 stream.write(plane);
3752 stream.write(color('runway', Array(width - col).join('⋅') + '\n'));
3753 stream.write(runway());
3754 stream.write('\u001b[0m');
3755 });
3756
3757 runner.once(EVENT_RUN_END, function() {
3758 cursor.show();
3759 process.stdout.write('\n');
3760 self.epilogue();
3761 });
3762}
3763
3764/**
3765 * Inherit from `Base.prototype`.
3766 */
3767inherits(Landing, Base);
3768
3769Landing.description = 'Unicode landing strip';
3770
3771}).call(this,require('_process'))
3772},{"../runnable":33,"../runner":34,"../utils":38,"./base":17,"_process":69}],25:[function(require,module,exports){
3773(function (process){
3774'use strict';
3775/**
3776 * @module List
3777 */
3778/**
3779 * Module dependencies.
3780 */
3781
3782var Base = require('./base');
3783var inherits = require('../utils').inherits;
3784var constants = require('../runner').constants;
3785var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
3786var EVENT_RUN_END = constants.EVENT_RUN_END;
3787var EVENT_TEST_BEGIN = constants.EVENT_TEST_BEGIN;
3788var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
3789var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
3790var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
3791var color = Base.color;
3792var cursor = Base.cursor;
3793
3794/**
3795 * Expose `List`.
3796 */
3797
3798exports = module.exports = List;
3799
3800/**
3801 * Constructs a new `List` reporter instance.
3802 *
3803 * @public
3804 * @class
3805 * @memberof Mocha.reporters
3806 * @extends Mocha.reporters.Base
3807 * @param {Runner} runner - Instance triggers reporter actions.
3808 * @param {Object} [options] - runner options
3809 */
3810function List(runner, options) {
3811 Base.call(this, runner, options);
3812
3813 var self = this;
3814 var n = 0;
3815
3816 runner.on(EVENT_RUN_BEGIN, function() {
3817 Base.consoleLog();
3818 });
3819
3820 runner.on(EVENT_TEST_BEGIN, function(test) {
3821 process.stdout.write(color('pass', ' ' + test.fullTitle() + ': '));
3822 });
3823
3824 runner.on(EVENT_TEST_PENDING, function(test) {
3825 var fmt = color('checkmark', ' -') + color('pending', ' %s');
3826 Base.consoleLog(fmt, test.fullTitle());
3827 });
3828
3829 runner.on(EVENT_TEST_PASS, function(test) {
3830 var fmt =
3831 color('checkmark', ' ' + Base.symbols.ok) +
3832 color('pass', ' %s: ') +
3833 color(test.speed, '%dms');
3834 cursor.CR();
3835 Base.consoleLog(fmt, test.fullTitle(), test.duration);
3836 });
3837
3838 runner.on(EVENT_TEST_FAIL, function(test) {
3839 cursor.CR();
3840 Base.consoleLog(color('fail', ' %d) %s'), ++n, test.fullTitle());
3841 });
3842
3843 runner.once(EVENT_RUN_END, self.epilogue.bind(self));
3844}
3845
3846/**
3847 * Inherit from `Base.prototype`.
3848 */
3849inherits(List, Base);
3850
3851List.description = 'like "spec" reporter but flat';
3852
3853}).call(this,require('_process'))
3854},{"../runner":34,"../utils":38,"./base":17,"_process":69}],26:[function(require,module,exports){
3855(function (process){
3856'use strict';
3857/**
3858 * @module Markdown
3859 */
3860/**
3861 * Module dependencies.
3862 */
3863
3864var Base = require('./base');
3865var utils = require('../utils');
3866var constants = require('../runner').constants;
3867var EVENT_RUN_END = constants.EVENT_RUN_END;
3868var EVENT_SUITE_BEGIN = constants.EVENT_SUITE_BEGIN;
3869var EVENT_SUITE_END = constants.EVENT_SUITE_END;
3870var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
3871
3872/**
3873 * Constants
3874 */
3875
3876var SUITE_PREFIX = '$';
3877
3878/**
3879 * Expose `Markdown`.
3880 */
3881
3882exports = module.exports = Markdown;
3883
3884/**
3885 * Constructs a new `Markdown` reporter instance.
3886 *
3887 * @public
3888 * @class
3889 * @memberof Mocha.reporters
3890 * @extends Mocha.reporters.Base
3891 * @param {Runner} runner - Instance triggers reporter actions.
3892 * @param {Object} [options] - runner options
3893 */
3894function Markdown(runner, options) {
3895 Base.call(this, runner, options);
3896
3897 var level = 0;
3898 var buf = '';
3899
3900 function title(str) {
3901 return Array(level).join('#') + ' ' + str;
3902 }
3903
3904 function mapTOC(suite, obj) {
3905 var ret = obj;
3906 var key = SUITE_PREFIX + suite.title;
3907
3908 obj = obj[key] = obj[key] || {suite: suite};
3909 suite.suites.forEach(function(suite) {
3910 mapTOC(suite, obj);
3911 });
3912
3913 return ret;
3914 }
3915
3916 function stringifyTOC(obj, level) {
3917 ++level;
3918 var buf = '';
3919 var link;
3920 for (var key in obj) {
3921 if (key === 'suite') {
3922 continue;
3923 }
3924 if (key !== SUITE_PREFIX) {
3925 link = ' - [' + key.substring(1) + ']';
3926 link += '(#' + utils.slug(obj[key].suite.fullTitle()) + ')\n';
3927 buf += Array(level).join(' ') + link;
3928 }
3929 buf += stringifyTOC(obj[key], level);
3930 }
3931 return buf;
3932 }
3933
3934 function generateTOC(suite) {
3935 var obj = mapTOC(suite, {});
3936 return stringifyTOC(obj, 0);
3937 }
3938
3939 generateTOC(runner.suite);
3940
3941 runner.on(EVENT_SUITE_BEGIN, function(suite) {
3942 ++level;
3943 var slug = utils.slug(suite.fullTitle());
3944 buf += '<a name="' + slug + '"></a>' + '\n';
3945 buf += title(suite.title) + '\n';
3946 });
3947
3948 runner.on(EVENT_SUITE_END, function() {
3949 --level;
3950 });
3951
3952 runner.on(EVENT_TEST_PASS, function(test) {
3953 var code = utils.clean(test.body);
3954 buf += test.title + '.\n';
3955 buf += '\n```js\n';
3956 buf += code + '\n';
3957 buf += '```\n\n';
3958 });
3959
3960 runner.once(EVENT_RUN_END, function() {
3961 process.stdout.write('# TOC\n');
3962 process.stdout.write(generateTOC(runner.suite));
3963 process.stdout.write(buf);
3964 });
3965}
3966
3967Markdown.description = 'GitHub Flavored Markdown';
3968
3969}).call(this,require('_process'))
3970},{"../runner":34,"../utils":38,"./base":17,"_process":69}],27:[function(require,module,exports){
3971(function (process){
3972'use strict';
3973/**
3974 * @module Min
3975 */
3976/**
3977 * Module dependencies.
3978 */
3979
3980var Base = require('./base');
3981var inherits = require('../utils').inherits;
3982var constants = require('../runner').constants;
3983var EVENT_RUN_END = constants.EVENT_RUN_END;
3984var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
3985
3986/**
3987 * Expose `Min`.
3988 */
3989
3990exports = module.exports = Min;
3991
3992/**
3993 * Constructs a new `Min` reporter instance.
3994 *
3995 * @description
3996 * This minimal test reporter is best used with '--watch'.
3997 *
3998 * @public
3999 * @class
4000 * @memberof Mocha.reporters
4001 * @extends Mocha.reporters.Base
4002 * @param {Runner} runner - Instance triggers reporter actions.
4003 * @param {Object} [options] - runner options
4004 */
4005function Min(runner, options) {
4006 Base.call(this, runner, options);
4007
4008 runner.on(EVENT_RUN_BEGIN, function() {
4009 // clear screen
4010 process.stdout.write('\u001b[2J');
4011 // set cursor position
4012 process.stdout.write('\u001b[1;3H');
4013 });
4014
4015 runner.once(EVENT_RUN_END, this.epilogue.bind(this));
4016}
4017
4018/**
4019 * Inherit from `Base.prototype`.
4020 */
4021inherits(Min, Base);
4022
4023Min.description = 'essentially just a summary';
4024
4025}).call(this,require('_process'))
4026},{"../runner":34,"../utils":38,"./base":17,"_process":69}],28:[function(require,module,exports){
4027(function (process){
4028'use strict';
4029/**
4030 * @module Nyan
4031 */
4032/**
4033 * Module dependencies.
4034 */
4035
4036var Base = require('./base');
4037var constants = require('../runner').constants;
4038var inherits = require('../utils').inherits;
4039var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
4040var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
4041var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
4042var EVENT_RUN_END = constants.EVENT_RUN_END;
4043var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
4044
4045/**
4046 * Expose `Dot`.
4047 */
4048
4049exports = module.exports = NyanCat;
4050
4051/**
4052 * Constructs a new `Nyan` reporter instance.
4053 *
4054 * @public
4055 * @class Nyan
4056 * @memberof Mocha.reporters
4057 * @extends Mocha.reporters.Base
4058 * @param {Runner} runner - Instance triggers reporter actions.
4059 * @param {Object} [options] - runner options
4060 */
4061function NyanCat(runner, options) {
4062 Base.call(this, runner, options);
4063
4064 var self = this;
4065 var width = (Base.window.width * 0.75) | 0;
4066 var nyanCatWidth = (this.nyanCatWidth = 11);
4067
4068 this.colorIndex = 0;
4069 this.numberOfLines = 4;
4070 this.rainbowColors = self.generateColors();
4071 this.scoreboardWidth = 5;
4072 this.tick = 0;
4073 this.trajectories = [[], [], [], []];
4074 this.trajectoryWidthMax = width - nyanCatWidth;
4075
4076 runner.on(EVENT_RUN_BEGIN, function() {
4077 Base.cursor.hide();
4078 self.draw();
4079 });
4080
4081 runner.on(EVENT_TEST_PENDING, function() {
4082 self.draw();
4083 });
4084
4085 runner.on(EVENT_TEST_PASS, function() {
4086 self.draw();
4087 });
4088
4089 runner.on(EVENT_TEST_FAIL, function() {
4090 self.draw();
4091 });
4092
4093 runner.once(EVENT_RUN_END, function() {
4094 Base.cursor.show();
4095 for (var i = 0; i < self.numberOfLines; i++) {
4096 write('\n');
4097 }
4098 self.epilogue();
4099 });
4100}
4101
4102/**
4103 * Inherit from `Base.prototype`.
4104 */
4105inherits(NyanCat, Base);
4106
4107/**
4108 * Draw the nyan cat
4109 *
4110 * @private
4111 */
4112
4113NyanCat.prototype.draw = function() {
4114 this.appendRainbow();
4115 this.drawScoreboard();
4116 this.drawRainbow();
4117 this.drawNyanCat();
4118 this.tick = !this.tick;
4119};
4120
4121/**
4122 * Draw the "scoreboard" showing the number
4123 * of passes, failures and pending tests.
4124 *
4125 * @private
4126 */
4127
4128NyanCat.prototype.drawScoreboard = function() {
4129 var stats = this.stats;
4130
4131 function draw(type, n) {
4132 write(' ');
4133 write(Base.color(type, n));
4134 write('\n');
4135 }
4136
4137 draw('green', stats.passes);
4138 draw('fail', stats.failures);
4139 draw('pending', stats.pending);
4140 write('\n');
4141
4142 this.cursorUp(this.numberOfLines);
4143};
4144
4145/**
4146 * Append the rainbow.
4147 *
4148 * @private
4149 */
4150
4151NyanCat.prototype.appendRainbow = function() {
4152 var segment = this.tick ? '_' : '-';
4153 var rainbowified = this.rainbowify(segment);
4154
4155 for (var index = 0; index < this.numberOfLines; index++) {
4156 var trajectory = this.trajectories[index];
4157 if (trajectory.length >= this.trajectoryWidthMax) {
4158 trajectory.shift();
4159 }
4160 trajectory.push(rainbowified);
4161 }
4162};
4163
4164/**
4165 * Draw the rainbow.
4166 *
4167 * @private
4168 */
4169
4170NyanCat.prototype.drawRainbow = function() {
4171 var self = this;
4172
4173 this.trajectories.forEach(function(line) {
4174 write('\u001b[' + self.scoreboardWidth + 'C');
4175 write(line.join(''));
4176 write('\n');
4177 });
4178
4179 this.cursorUp(this.numberOfLines);
4180};
4181
4182/**
4183 * Draw the nyan cat
4184 *
4185 * @private
4186 */
4187NyanCat.prototype.drawNyanCat = function() {
4188 var self = this;
4189 var startWidth = this.scoreboardWidth + this.trajectories[0].length;
4190 var dist = '\u001b[' + startWidth + 'C';
4191 var padding = '';
4192
4193 write(dist);
4194 write('_,------,');
4195 write('\n');
4196
4197 write(dist);
4198 padding = self.tick ? ' ' : ' ';
4199 write('_|' + padding + '/\\_/\\ ');
4200 write('\n');
4201
4202 write(dist);
4203 padding = self.tick ? '_' : '__';
4204 var tail = self.tick ? '~' : '^';
4205 write(tail + '|' + padding + this.face() + ' ');
4206 write('\n');
4207
4208 write(dist);
4209 padding = self.tick ? ' ' : ' ';
4210 write(padding + '"" "" ');
4211 write('\n');
4212
4213 this.cursorUp(this.numberOfLines);
4214};
4215
4216/**
4217 * Draw nyan cat face.
4218 *
4219 * @private
4220 * @return {string}
4221 */
4222
4223NyanCat.prototype.face = function() {
4224 var stats = this.stats;
4225 if (stats.failures) {
4226 return '( x .x)';
4227 } else if (stats.pending) {
4228 return '( o .o)';
4229 } else if (stats.passes) {
4230 return '( ^ .^)';
4231 }
4232 return '( - .-)';
4233};
4234
4235/**
4236 * Move cursor up `n`.
4237 *
4238 * @private
4239 * @param {number} n
4240 */
4241
4242NyanCat.prototype.cursorUp = function(n) {
4243 write('\u001b[' + n + 'A');
4244};
4245
4246/**
4247 * Move cursor down `n`.
4248 *
4249 * @private
4250 * @param {number} n
4251 */
4252
4253NyanCat.prototype.cursorDown = function(n) {
4254 write('\u001b[' + n + 'B');
4255};
4256
4257/**
4258 * Generate rainbow colors.
4259 *
4260 * @private
4261 * @return {Array}
4262 */
4263NyanCat.prototype.generateColors = function() {
4264 var colors = [];
4265
4266 for (var i = 0; i < 6 * 7; i++) {
4267 var pi3 = Math.floor(Math.PI / 3);
4268 var n = i * (1.0 / 6);
4269 var r = Math.floor(3 * Math.sin(n) + 3);
4270 var g = Math.floor(3 * Math.sin(n + 2 * pi3) + 3);
4271 var b = Math.floor(3 * Math.sin(n + 4 * pi3) + 3);
4272 colors.push(36 * r + 6 * g + b + 16);
4273 }
4274
4275 return colors;
4276};
4277
4278/**
4279 * Apply rainbow to the given `str`.
4280 *
4281 * @private
4282 * @param {string} str
4283 * @return {string}
4284 */
4285NyanCat.prototype.rainbowify = function(str) {
4286 if (!Base.useColors) {
4287 return str;
4288 }
4289 var color = this.rainbowColors[this.colorIndex % this.rainbowColors.length];
4290 this.colorIndex += 1;
4291 return '\u001b[38;5;' + color + 'm' + str + '\u001b[0m';
4292};
4293
4294/**
4295 * Stdout helper.
4296 *
4297 * @param {string} string A message to write to stdout.
4298 */
4299function write(string) {
4300 process.stdout.write(string);
4301}
4302
4303NyanCat.description = '"nyan cat"';
4304
4305}).call(this,require('_process'))
4306},{"../runner":34,"../utils":38,"./base":17,"_process":69}],29:[function(require,module,exports){
4307(function (process){
4308'use strict';
4309/**
4310 * @module Progress
4311 */
4312/**
4313 * Module dependencies.
4314 */
4315
4316var Base = require('./base');
4317var constants = require('../runner').constants;
4318var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
4319var EVENT_TEST_END = constants.EVENT_TEST_END;
4320var EVENT_RUN_END = constants.EVENT_RUN_END;
4321var inherits = require('../utils').inherits;
4322var color = Base.color;
4323var cursor = Base.cursor;
4324
4325/**
4326 * Expose `Progress`.
4327 */
4328
4329exports = module.exports = Progress;
4330
4331/**
4332 * General progress bar color.
4333 */
4334
4335Base.colors.progress = 90;
4336
4337/**
4338 * Constructs a new `Progress` reporter instance.
4339 *
4340 * @public
4341 * @class
4342 * @memberof Mocha.reporters
4343 * @extends Mocha.reporters.Base
4344 * @param {Runner} runner - Instance triggers reporter actions.
4345 * @param {Object} [options] - runner options
4346 */
4347function Progress(runner, options) {
4348 Base.call(this, runner, options);
4349
4350 var self = this;
4351 var width = (Base.window.width * 0.5) | 0;
4352 var total = runner.total;
4353 var complete = 0;
4354 var lastN = -1;
4355
4356 // default chars
4357 options = options || {};
4358 var reporterOptions = options.reporterOptions || {};
4359
4360 options.open = reporterOptions.open || '[';
4361 options.complete = reporterOptions.complete || '▬';
4362 options.incomplete = reporterOptions.incomplete || Base.symbols.dot;
4363 options.close = reporterOptions.close || ']';
4364 options.verbose = reporterOptions.verbose || false;
4365
4366 // tests started
4367 runner.on(EVENT_RUN_BEGIN, function() {
4368 process.stdout.write('\n');
4369 cursor.hide();
4370 });
4371
4372 // tests complete
4373 runner.on(EVENT_TEST_END, function() {
4374 complete++;
4375
4376 var percent = complete / total;
4377 var n = (width * percent) | 0;
4378 var i = width - n;
4379
4380 if (n === lastN && !options.verbose) {
4381 // Don't re-render the line if it hasn't changed
4382 return;
4383 }
4384 lastN = n;
4385
4386 cursor.CR();
4387 process.stdout.write('\u001b[J');
4388 process.stdout.write(color('progress', ' ' + options.open));
4389 process.stdout.write(Array(n).join(options.complete));
4390 process.stdout.write(Array(i).join(options.incomplete));
4391 process.stdout.write(color('progress', options.close));
4392 if (options.verbose) {
4393 process.stdout.write(color('progress', ' ' + complete + ' of ' + total));
4394 }
4395 });
4396
4397 // tests are complete, output some stats
4398 // and the failures if any
4399 runner.once(EVENT_RUN_END, function() {
4400 cursor.show();
4401 process.stdout.write('\n');
4402 self.epilogue();
4403 });
4404}
4405
4406/**
4407 * Inherit from `Base.prototype`.
4408 */
4409inherits(Progress, Base);
4410
4411Progress.description = 'a progress bar';
4412
4413}).call(this,require('_process'))
4414},{"../runner":34,"../utils":38,"./base":17,"_process":69}],30:[function(require,module,exports){
4415'use strict';
4416/**
4417 * @module Spec
4418 */
4419/**
4420 * Module dependencies.
4421 */
4422
4423var Base = require('./base');
4424var constants = require('../runner').constants;
4425var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
4426var EVENT_RUN_END = constants.EVENT_RUN_END;
4427var EVENT_SUITE_BEGIN = constants.EVENT_SUITE_BEGIN;
4428var EVENT_SUITE_END = constants.EVENT_SUITE_END;
4429var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
4430var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
4431var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
4432var inherits = require('../utils').inherits;
4433var color = Base.color;
4434
4435/**
4436 * Expose `Spec`.
4437 */
4438
4439exports = module.exports = Spec;
4440
4441/**
4442 * Constructs a new `Spec` reporter instance.
4443 *
4444 * @public
4445 * @class
4446 * @memberof Mocha.reporters
4447 * @extends Mocha.reporters.Base
4448 * @param {Runner} runner - Instance triggers reporter actions.
4449 * @param {Object} [options] - runner options
4450 */
4451function Spec(runner, options) {
4452 Base.call(this, runner, options);
4453
4454 var self = this;
4455 var indents = 0;
4456 var n = 0;
4457
4458 function indent() {
4459 return Array(indents).join(' ');
4460 }
4461
4462 runner.on(EVENT_RUN_BEGIN, function() {
4463 Base.consoleLog();
4464 });
4465
4466 runner.on(EVENT_SUITE_BEGIN, function(suite) {
4467 ++indents;
4468 Base.consoleLog(color('suite', '%s%s'), indent(), suite.title);
4469 });
4470
4471 runner.on(EVENT_SUITE_END, function() {
4472 --indents;
4473 if (indents === 1) {
4474 Base.consoleLog();
4475 }
4476 });
4477
4478 runner.on(EVENT_TEST_PENDING, function(test) {
4479 var fmt = indent() + color('pending', ' - %s');
4480 Base.consoleLog(fmt, test.title);
4481 });
4482
4483 runner.on(EVENT_TEST_PASS, function(test) {
4484 var fmt;
4485 if (test.speed === 'fast') {
4486 fmt =
4487 indent() +
4488 color('checkmark', ' ' + Base.symbols.ok) +
4489 color('pass', ' %s');
4490 Base.consoleLog(fmt, test.title);
4491 } else {
4492 fmt =
4493 indent() +
4494 color('checkmark', ' ' + Base.symbols.ok) +
4495 color('pass', ' %s') +
4496 color(test.speed, ' (%dms)');
4497 Base.consoleLog(fmt, test.title, test.duration);
4498 }
4499 });
4500
4501 runner.on(EVENT_TEST_FAIL, function(test) {
4502 Base.consoleLog(indent() + color('fail', ' %d) %s'), ++n, test.title);
4503 });
4504
4505 runner.once(EVENT_RUN_END, self.epilogue.bind(self));
4506}
4507
4508/**
4509 * Inherit from `Base.prototype`.
4510 */
4511inherits(Spec, Base);
4512
4513Spec.description = 'hierarchical & verbose [default]';
4514
4515},{"../runner":34,"../utils":38,"./base":17}],31:[function(require,module,exports){
4516(function (process){
4517'use strict';
4518/**
4519 * @module TAP
4520 */
4521/**
4522 * Module dependencies.
4523 */
4524
4525var util = require('util');
4526var Base = require('./base');
4527var constants = require('../runner').constants;
4528var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
4529var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
4530var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
4531var EVENT_RUN_END = constants.EVENT_RUN_END;
4532var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
4533var EVENT_TEST_END = constants.EVENT_TEST_END;
4534var inherits = require('../utils').inherits;
4535var sprintf = util.format;
4536
4537/**
4538 * Expose `TAP`.
4539 */
4540
4541exports = module.exports = TAP;
4542
4543/**
4544 * Constructs a new `TAP` reporter instance.
4545 *
4546 * @public
4547 * @class
4548 * @memberof Mocha.reporters
4549 * @extends Mocha.reporters.Base
4550 * @param {Runner} runner - Instance triggers reporter actions.
4551 * @param {Object} [options] - runner options
4552 */
4553function TAP(runner, options) {
4554 Base.call(this, runner, options);
4555
4556 var self = this;
4557 var n = 1;
4558
4559 var tapVersion = '12';
4560 if (options && options.reporterOptions) {
4561 if (options.reporterOptions.tapVersion) {
4562 tapVersion = options.reporterOptions.tapVersion.toString();
4563 }
4564 }
4565
4566 this._producer = createProducer(tapVersion);
4567
4568 runner.once(EVENT_RUN_BEGIN, function() {
4569 var ntests = runner.grepTotal(runner.suite);
4570 self._producer.writeVersion();
4571 self._producer.writePlan(ntests);
4572 });
4573
4574 runner.on(EVENT_TEST_END, function() {
4575 ++n;
4576 });
4577
4578 runner.on(EVENT_TEST_PENDING, function(test) {
4579 self._producer.writePending(n, test);
4580 });
4581
4582 runner.on(EVENT_TEST_PASS, function(test) {
4583 self._producer.writePass(n, test);
4584 });
4585
4586 runner.on(EVENT_TEST_FAIL, function(test, err) {
4587 self._producer.writeFail(n, test, err);
4588 });
4589
4590 runner.once(EVENT_RUN_END, function() {
4591 self._producer.writeEpilogue(runner.stats);
4592 });
4593}
4594
4595/**
4596 * Inherit from `Base.prototype`.
4597 */
4598inherits(TAP, Base);
4599
4600/**
4601 * Returns a TAP-safe title of `test`.
4602 *
4603 * @private
4604 * @param {Test} test - Test instance.
4605 * @return {String} title with any hash character removed
4606 */
4607function title(test) {
4608 return test.fullTitle().replace(/#/g, '');
4609}
4610
4611/**
4612 * Writes newline-terminated formatted string to reporter output stream.
4613 *
4614 * @private
4615 * @param {string} format - `printf`-like format string
4616 * @param {...*} [varArgs] - Format string arguments
4617 */
4618function println(format, varArgs) {
4619 var vargs = Array.from(arguments);
4620 vargs[0] += '\n';
4621 process.stdout.write(sprintf.apply(null, vargs));
4622}
4623
4624/**
4625 * Returns a `tapVersion`-appropriate TAP producer instance, if possible.
4626 *
4627 * @private
4628 * @param {string} tapVersion - Version of TAP specification to produce.
4629 * @returns {TAPProducer} specification-appropriate instance
4630 * @throws {Error} if specification version has no associated producer.
4631 */
4632function createProducer(tapVersion) {
4633 var producers = {
4634 '12': new TAP12Producer(),
4635 '13': new TAP13Producer()
4636 };
4637 var producer = producers[tapVersion];
4638
4639 if (!producer) {
4640 throw new Error(
4641 'invalid or unsupported TAP version: ' + JSON.stringify(tapVersion)
4642 );
4643 }
4644
4645 return producer;
4646}
4647
4648/**
4649 * @summary
4650 * Constructs a new TAPProducer.
4651 *
4652 * @description
4653 * <em>Only</em> to be used as an abstract base class.
4654 *
4655 * @private
4656 * @constructor
4657 */
4658function TAPProducer() {}
4659
4660/**
4661 * Writes the TAP version to reporter output stream.
4662 *
4663 * @abstract
4664 */
4665TAPProducer.prototype.writeVersion = function() {};
4666
4667/**
4668 * Writes the plan to reporter output stream.
4669 *
4670 * @abstract
4671 * @param {number} ntests - Number of tests that are planned to run.
4672 */
4673TAPProducer.prototype.writePlan = function(ntests) {
4674 println('%d..%d', 1, ntests);
4675};
4676
4677/**
4678 * Writes that test passed to reporter output stream.
4679 *
4680 * @abstract
4681 * @param {number} n - Index of test that passed.
4682 * @param {Test} test - Instance containing test information.
4683 */
4684TAPProducer.prototype.writePass = function(n, test) {
4685 println('ok %d %s', n, title(test));
4686};
4687
4688/**
4689 * Writes that test was skipped to reporter output stream.
4690 *
4691 * @abstract
4692 * @param {number} n - Index of test that was skipped.
4693 * @param {Test} test - Instance containing test information.
4694 */
4695TAPProducer.prototype.writePending = function(n, test) {
4696 println('ok %d %s # SKIP -', n, title(test));
4697};
4698
4699/**
4700 * Writes that test failed to reporter output stream.
4701 *
4702 * @abstract
4703 * @param {number} n - Index of test that failed.
4704 * @param {Test} test - Instance containing test information.
4705 * @param {Error} err - Reason the test failed.
4706 */
4707TAPProducer.prototype.writeFail = function(n, test, err) {
4708 println('not ok %d %s', n, title(test));
4709};
4710
4711/**
4712 * Writes the summary epilogue to reporter output stream.
4713 *
4714 * @abstract
4715 * @param {Object} stats - Object containing run statistics.
4716 */
4717TAPProducer.prototype.writeEpilogue = function(stats) {
4718 // :TBD: Why is this not counting pending tests?
4719 println('# tests ' + (stats.passes + stats.failures));
4720 println('# pass ' + stats.passes);
4721 // :TBD: Why are we not showing pending results?
4722 println('# fail ' + stats.failures);
4723};
4724
4725/**
4726 * @summary
4727 * Constructs a new TAP12Producer.
4728 *
4729 * @description
4730 * Produces output conforming to the TAP12 specification.
4731 *
4732 * @private
4733 * @constructor
4734 * @extends TAPProducer
4735 * @see {@link https://testanything.org/tap-specification.html|Specification}
4736 */
4737function TAP12Producer() {
4738 /**
4739 * Writes that test failed to reporter output stream, with error formatting.
4740 * @override
4741 */
4742 this.writeFail = function(n, test, err) {
4743 TAPProducer.prototype.writeFail.call(this, n, test, err);
4744 if (err.message) {
4745 println(err.message.replace(/^/gm, ' '));
4746 }
4747 if (err.stack) {
4748 println(err.stack.replace(/^/gm, ' '));
4749 }
4750 };
4751}
4752
4753/**
4754 * Inherit from `TAPProducer.prototype`.
4755 */
4756inherits(TAP12Producer, TAPProducer);
4757
4758/**
4759 * @summary
4760 * Constructs a new TAP13Producer.
4761 *
4762 * @description
4763 * Produces output conforming to the TAP13 specification.
4764 *
4765 * @private
4766 * @constructor
4767 * @extends TAPProducer
4768 * @see {@link https://testanything.org/tap-version-13-specification.html|Specification}
4769 */
4770function TAP13Producer() {
4771 /**
4772 * Writes the TAP version to reporter output stream.
4773 * @override
4774 */
4775 this.writeVersion = function() {
4776 println('TAP version 13');
4777 };
4778
4779 /**
4780 * Writes that test failed to reporter output stream, with error formatting.
4781 * @override
4782 */
4783 this.writeFail = function(n, test, err) {
4784 TAPProducer.prototype.writeFail.call(this, n, test, err);
4785 var emitYamlBlock = err.message != null || err.stack != null;
4786 if (emitYamlBlock) {
4787 println(indent(1) + '---');
4788 if (err.message) {
4789 println(indent(2) + 'message: |-');
4790 println(err.message.replace(/^/gm, indent(3)));
4791 }
4792 if (err.stack) {
4793 println(indent(2) + 'stack: |-');
4794 println(err.stack.replace(/^/gm, indent(3)));
4795 }
4796 println(indent(1) + '...');
4797 }
4798 };
4799
4800 function indent(level) {
4801 return Array(level + 1).join(' ');
4802 }
4803}
4804
4805/**
4806 * Inherit from `TAPProducer.prototype`.
4807 */
4808inherits(TAP13Producer, TAPProducer);
4809
4810TAP.description = 'TAP-compatible output';
4811
4812}).call(this,require('_process'))
4813},{"../runner":34,"../utils":38,"./base":17,"_process":69,"util":89}],32:[function(require,module,exports){
4814(function (process,global){
4815'use strict';
4816/**
4817 * @module XUnit
4818 */
4819/**
4820 * Module dependencies.
4821 */
4822
4823var Base = require('./base');
4824var utils = require('../utils');
4825var fs = require('fs');
4826var mkdirp = require('mkdirp');
4827var path = require('path');
4828var errors = require('../errors');
4829var createUnsupportedError = errors.createUnsupportedError;
4830var constants = require('../runner').constants;
4831var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
4832var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
4833var EVENT_RUN_END = constants.EVENT_RUN_END;
4834var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
4835var STATE_FAILED = require('../runnable').constants.STATE_FAILED;
4836var inherits = utils.inherits;
4837var escape = utils.escape;
4838
4839/**
4840 * Save timer references to avoid Sinon interfering (see GH-237).
4841 */
4842var Date = global.Date;
4843
4844/**
4845 * Expose `XUnit`.
4846 */
4847
4848exports = module.exports = XUnit;
4849
4850/**
4851 * Constructs a new `XUnit` reporter instance.
4852 *
4853 * @public
4854 * @class
4855 * @memberof Mocha.reporters
4856 * @extends Mocha.reporters.Base
4857 * @param {Runner} runner - Instance triggers reporter actions.
4858 * @param {Object} [options] - runner options
4859 */
4860function XUnit(runner, options) {
4861 Base.call(this, runner, options);
4862
4863 var stats = this.stats;
4864 var tests = [];
4865 var self = this;
4866
4867 // the name of the test suite, as it will appear in the resulting XML file
4868 var suiteName;
4869
4870 // the default name of the test suite if none is provided
4871 var DEFAULT_SUITE_NAME = 'Mocha Tests';
4872
4873 if (options && options.reporterOptions) {
4874 if (options.reporterOptions.output) {
4875 if (!fs.createWriteStream) {
4876 throw createUnsupportedError('file output not supported in browser');
4877 }
4878
4879 mkdirp.sync(path.dirname(options.reporterOptions.output));
4880 self.fileStream = fs.createWriteStream(options.reporterOptions.output);
4881 }
4882
4883 // get the suite name from the reporter options (if provided)
4884 suiteName = options.reporterOptions.suiteName;
4885 }
4886
4887 // fall back to the default suite name
4888 suiteName = suiteName || DEFAULT_SUITE_NAME;
4889
4890 runner.on(EVENT_TEST_PENDING, function(test) {
4891 tests.push(test);
4892 });
4893
4894 runner.on(EVENT_TEST_PASS, function(test) {
4895 tests.push(test);
4896 });
4897
4898 runner.on(EVENT_TEST_FAIL, function(test) {
4899 tests.push(test);
4900 });
4901
4902 runner.once(EVENT_RUN_END, function() {
4903 self.write(
4904 tag(
4905 'testsuite',
4906 {
4907 name: suiteName,
4908 tests: stats.tests,
4909 failures: 0,
4910 errors: stats.failures,
4911 skipped: stats.tests - stats.failures - stats.passes,
4912 timestamp: new Date().toUTCString(),
4913 time: stats.duration / 1000 || 0
4914 },
4915 false
4916 )
4917 );
4918
4919 tests.forEach(function(t) {
4920 self.test(t);
4921 });
4922
4923 self.write('</testsuite>');
4924 });
4925}
4926
4927/**
4928 * Inherit from `Base.prototype`.
4929 */
4930inherits(XUnit, Base);
4931
4932/**
4933 * Override done to close the stream (if it's a file).
4934 *
4935 * @param failures
4936 * @param {Function} fn
4937 */
4938XUnit.prototype.done = function(failures, fn) {
4939 if (this.fileStream) {
4940 this.fileStream.end(function() {
4941 fn(failures);
4942 });
4943 } else {
4944 fn(failures);
4945 }
4946};
4947
4948/**
4949 * Write out the given line.
4950 *
4951 * @param {string} line
4952 */
4953XUnit.prototype.write = function(line) {
4954 if (this.fileStream) {
4955 this.fileStream.write(line + '\n');
4956 } else if (typeof process === 'object' && process.stdout) {
4957 process.stdout.write(line + '\n');
4958 } else {
4959 Base.consoleLog(line);
4960 }
4961};
4962
4963/**
4964 * Output tag for the given `test.`
4965 *
4966 * @param {Test} test
4967 */
4968XUnit.prototype.test = function(test) {
4969 Base.useColors = false;
4970
4971 var attrs = {
4972 classname: test.parent.fullTitle(),
4973 name: test.title,
4974 time: test.duration / 1000 || 0
4975 };
4976
4977 if (test.state === STATE_FAILED) {
4978 var err = test.err;
4979 var diff =
4980 !Base.hideDiff && Base.showDiff(err)
4981 ? '\n' + Base.generateDiff(err.actual, err.expected)
4982 : '';
4983 this.write(
4984 tag(
4985 'testcase',
4986 attrs,
4987 false,
4988 tag(
4989 'failure',
4990 {},
4991 false,
4992 escape(err.message) + escape(diff) + '\n' + escape(err.stack)
4993 )
4994 )
4995 );
4996 } else if (test.isPending()) {
4997 this.write(tag('testcase', attrs, false, tag('skipped', {}, true)));
4998 } else {
4999 this.write(tag('testcase', attrs, true));
5000 }
5001};
5002
5003/**
5004 * HTML tag helper.
5005 *
5006 * @param name
5007 * @param attrs
5008 * @param close
5009 * @param content
5010 * @return {string}
5011 */
5012function tag(name, attrs, close, content) {
5013 var end = close ? '/>' : '>';
5014 var pairs = [];
5015 var tag;
5016
5017 for (var key in attrs) {
5018 if (Object.prototype.hasOwnProperty.call(attrs, key)) {
5019 pairs.push(key + '="' + escape(attrs[key]) + '"');
5020 }
5021 }
5022
5023 tag = '<' + name + (pairs.length ? ' ' + pairs.join(' ') : '') + end;
5024 if (content) {
5025 tag += content + '</' + name + end;
5026 }
5027 return tag;
5028}
5029
5030XUnit.description = 'XUnit-compatible XML output';
5031
5032}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
5033},{"../errors":6,"../runnable":33,"../runner":34,"../utils":38,"./base":17,"_process":69,"fs":42,"mkdirp":59,"path":42}],33:[function(require,module,exports){
5034(function (global){
5035'use strict';
5036
5037var EventEmitter = require('events').EventEmitter;
5038var Pending = require('./pending');
5039var debug = require('debug')('mocha:runnable');
5040var milliseconds = require('ms');
5041var utils = require('./utils');
5042var createInvalidExceptionError = require('./errors')
5043 .createInvalidExceptionError;
5044
5045/**
5046 * Save timer references to avoid Sinon interfering (see GH-237).
5047 */
5048var Date = global.Date;
5049var setTimeout = global.setTimeout;
5050var clearTimeout = global.clearTimeout;
5051var toString = Object.prototype.toString;
5052
5053module.exports = Runnable;
5054
5055/**
5056 * Initialize a new `Runnable` with the given `title` and callback `fn`.
5057 *
5058 * @class
5059 * @extends external:EventEmitter
5060 * @public
5061 * @param {String} title
5062 * @param {Function} fn
5063 */
5064function Runnable(title, fn) {
5065 this.title = title;
5066 this.fn = fn;
5067 this.body = (fn || '').toString();
5068 this.async = fn && fn.length;
5069 this.sync = !this.async;
5070 this._timeout = 2000;
5071 this._slow = 75;
5072 this._enableTimeouts = true;
5073 this.timedOut = false;
5074 this._retries = -1;
5075 this._currentRetry = 0;
5076 this.pending = false;
5077}
5078
5079/**
5080 * Inherit from `EventEmitter.prototype`.
5081 */
5082utils.inherits(Runnable, EventEmitter);
5083
5084/**
5085 * Get current timeout value in msecs.
5086 *
5087 * @private
5088 * @returns {number} current timeout threshold value
5089 */
5090/**
5091 * @summary
5092 * Set timeout threshold value (msecs).
5093 *
5094 * @description
5095 * A string argument can use shorthand (e.g., "2s") and will be converted.
5096 * The value will be clamped to range [<code>0</code>, <code>2^<sup>31</sup>-1</code>].
5097 * If clamped value matches either range endpoint, timeouts will be disabled.
5098 *
5099 * @private
5100 * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout#Maximum_delay_value}
5101 * @param {number|string} ms - Timeout threshold value.
5102 * @returns {Runnable} this
5103 * @chainable
5104 */
5105Runnable.prototype.timeout = function(ms) {
5106 if (!arguments.length) {
5107 return this._timeout;
5108 }
5109 if (typeof ms === 'string') {
5110 ms = milliseconds(ms);
5111 }
5112
5113 // Clamp to range
5114 var INT_MAX = Math.pow(2, 31) - 1;
5115 var range = [0, INT_MAX];
5116 ms = utils.clamp(ms, range);
5117
5118 // see #1652 for reasoning
5119 if (ms === range[0] || ms === range[1]) {
5120 this._enableTimeouts = false;
5121 }
5122 debug('timeout %d', ms);
5123 this._timeout = ms;
5124 if (this.timer) {
5125 this.resetTimeout();
5126 }
5127 return this;
5128};
5129
5130/**
5131 * Set or get slow `ms`.
5132 *
5133 * @private
5134 * @param {number|string} ms
5135 * @return {Runnable|number} ms or Runnable instance.
5136 */
5137Runnable.prototype.slow = function(ms) {
5138 if (!arguments.length || typeof ms === 'undefined') {
5139 return this._slow;
5140 }
5141 if (typeof ms === 'string') {
5142 ms = milliseconds(ms);
5143 }
5144 debug('slow %d', ms);
5145 this._slow = ms;
5146 return this;
5147};
5148
5149/**
5150 * Set and get whether timeout is `enabled`.
5151 *
5152 * @private
5153 * @param {boolean} enabled
5154 * @return {Runnable|boolean} enabled or Runnable instance.
5155 */
5156Runnable.prototype.enableTimeouts = function(enabled) {
5157 if (!arguments.length) {
5158 return this._enableTimeouts;
5159 }
5160 debug('enableTimeouts %s', enabled);
5161 this._enableTimeouts = enabled;
5162 return this;
5163};
5164
5165/**
5166 * Halt and mark as pending.
5167 *
5168 * @memberof Mocha.Runnable
5169 * @public
5170 */
5171Runnable.prototype.skip = function() {
5172 this.pending = true;
5173 throw new Pending('sync skip; aborting execution');
5174};
5175
5176/**
5177 * Check if this runnable or its parent suite is marked as pending.
5178 *
5179 * @private
5180 */
5181Runnable.prototype.isPending = function() {
5182 return this.pending || (this.parent && this.parent.isPending());
5183};
5184
5185/**
5186 * Return `true` if this Runnable has failed.
5187 * @return {boolean}
5188 * @private
5189 */
5190Runnable.prototype.isFailed = function() {
5191 return !this.isPending() && this.state === constants.STATE_FAILED;
5192};
5193
5194/**
5195 * Return `true` if this Runnable has passed.
5196 * @return {boolean}
5197 * @private
5198 */
5199Runnable.prototype.isPassed = function() {
5200 return !this.isPending() && this.state === constants.STATE_PASSED;
5201};
5202
5203/**
5204 * Set or get number of retries.
5205 *
5206 * @private
5207 */
5208Runnable.prototype.retries = function(n) {
5209 if (!arguments.length) {
5210 return this._retries;
5211 }
5212 this._retries = n;
5213};
5214
5215/**
5216 * Set or get current retry
5217 *
5218 * @private
5219 */
5220Runnable.prototype.currentRetry = function(n) {
5221 if (!arguments.length) {
5222 return this._currentRetry;
5223 }
5224 this._currentRetry = n;
5225};
5226
5227/**
5228 * Return the full title generated by recursively concatenating the parent's
5229 * full title.
5230 *
5231 * @memberof Mocha.Runnable
5232 * @public
5233 * @return {string}
5234 */
5235Runnable.prototype.fullTitle = function() {
5236 return this.titlePath().join(' ');
5237};
5238
5239/**
5240 * Return the title path generated by concatenating the parent's title path with the title.
5241 *
5242 * @memberof Mocha.Runnable
5243 * @public
5244 * @return {string}
5245 */
5246Runnable.prototype.titlePath = function() {
5247 return this.parent.titlePath().concat([this.title]);
5248};
5249
5250/**
5251 * Clear the timeout.
5252 *
5253 * @private
5254 */
5255Runnable.prototype.clearTimeout = function() {
5256 clearTimeout(this.timer);
5257};
5258
5259/**
5260 * Inspect the runnable void of private properties.
5261 *
5262 * @private
5263 * @return {string}
5264 */
5265Runnable.prototype.inspect = function() {
5266 return JSON.stringify(
5267 this,
5268 function(key, val) {
5269 if (key[0] === '_') {
5270 return;
5271 }
5272 if (key === 'parent') {
5273 return '#<Suite>';
5274 }
5275 if (key === 'ctx') {
5276 return '#<Context>';
5277 }
5278 return val;
5279 },
5280 2
5281 );
5282};
5283
5284/**
5285 * Reset the timeout.
5286 *
5287 * @private
5288 */
5289Runnable.prototype.resetTimeout = function() {
5290 var self = this;
5291 var ms = this.timeout() || 1e9;
5292
5293 if (!this._enableTimeouts) {
5294 return;
5295 }
5296 this.clearTimeout();
5297 this.timer = setTimeout(function() {
5298 if (!self._enableTimeouts) {
5299 return;
5300 }
5301 self.callback(self._timeoutError(ms));
5302 self.timedOut = true;
5303 }, ms);
5304};
5305
5306/**
5307 * Set or get a list of whitelisted globals for this test run.
5308 *
5309 * @private
5310 * @param {string[]} globals
5311 */
5312Runnable.prototype.globals = function(globals) {
5313 if (!arguments.length) {
5314 return this._allowedGlobals;
5315 }
5316 this._allowedGlobals = globals;
5317};
5318
5319/**
5320 * Run the test and invoke `fn(err)`.
5321 *
5322 * @param {Function} fn
5323 * @private
5324 */
5325Runnable.prototype.run = function(fn) {
5326 var self = this;
5327 var start = new Date();
5328 var ctx = this.ctx;
5329 var finished;
5330 var emitted;
5331
5332 // Sometimes the ctx exists, but it is not runnable
5333 if (ctx && ctx.runnable) {
5334 ctx.runnable(this);
5335 }
5336
5337 // called multiple times
5338 function multiple(err) {
5339 if (emitted) {
5340 return;
5341 }
5342 emitted = true;
5343 var msg = 'done() called multiple times';
5344 if (err && err.message) {
5345 err.message += " (and Mocha's " + msg + ')';
5346 self.emit('error', err);
5347 } else {
5348 self.emit('error', new Error(msg));
5349 }
5350 }
5351
5352 // finished
5353 function done(err) {
5354 var ms = self.timeout();
5355 if (self.timedOut) {
5356 return;
5357 }
5358
5359 if (finished) {
5360 return multiple(err);
5361 }
5362
5363 self.clearTimeout();
5364 self.duration = new Date() - start;
5365 finished = true;
5366 if (!err && self.duration > ms && self._enableTimeouts) {
5367 err = self._timeoutError(ms);
5368 }
5369 fn(err);
5370 }
5371
5372 // for .resetTimeout()
5373 this.callback = done;
5374
5375 // explicit async with `done` argument
5376 if (this.async) {
5377 this.resetTimeout();
5378
5379 // allows skip() to be used in an explicit async context
5380 this.skip = function asyncSkip() {
5381 this.pending = true;
5382 done();
5383 // halt execution, the uncaught handler will ignore the failure.
5384 throw new Pending('async skip; aborting execution');
5385 };
5386
5387 try {
5388 callFnAsync(this.fn);
5389 } catch (err) {
5390 // handles async runnables which actually run synchronously
5391 emitted = true;
5392 if (err instanceof Pending) {
5393 return; // done() is already called in this.skip()
5394 } else if (this.allowUncaught) {
5395 throw err;
5396 }
5397 done(Runnable.toValueOrError(err));
5398 }
5399 return;
5400 }
5401
5402 // sync or promise-returning
5403 try {
5404 if (this.isPending()) {
5405 done();
5406 } else {
5407 callFn(this.fn);
5408 }
5409 } catch (err) {
5410 emitted = true;
5411 if (err instanceof Pending) {
5412 return done();
5413 } else if (this.allowUncaught) {
5414 throw err;
5415 }
5416 done(Runnable.toValueOrError(err));
5417 }
5418
5419 function callFn(fn) {
5420 var result = fn.call(ctx);
5421 if (result && typeof result.then === 'function') {
5422 self.resetTimeout();
5423 result.then(
5424 function() {
5425 done();
5426 // Return null so libraries like bluebird do not warn about
5427 // subsequently constructed Promises.
5428 return null;
5429 },
5430 function(reason) {
5431 done(reason || new Error('Promise rejected with no or falsy reason'));
5432 }
5433 );
5434 } else {
5435 if (self.asyncOnly) {
5436 return done(
5437 new Error(
5438 '--async-only option in use without declaring `done()` or returning a promise'
5439 )
5440 );
5441 }
5442
5443 done();
5444 }
5445 }
5446
5447 function callFnAsync(fn) {
5448 var result = fn.call(ctx, function(err) {
5449 if (err instanceof Error || toString.call(err) === '[object Error]') {
5450 return done(err);
5451 }
5452 if (err) {
5453 if (Object.prototype.toString.call(err) === '[object Object]') {
5454 return done(
5455 new Error('done() invoked with non-Error: ' + JSON.stringify(err))
5456 );
5457 }
5458 return done(new Error('done() invoked with non-Error: ' + err));
5459 }
5460 if (result && utils.isPromise(result)) {
5461 return done(
5462 new Error(
5463 'Resolution method is overspecified. Specify a callback *or* return a Promise; not both.'
5464 )
5465 );
5466 }
5467
5468 done();
5469 });
5470 }
5471};
5472
5473/**
5474 * Instantiates a "timeout" error
5475 *
5476 * @param {number} ms - Timeout (in milliseconds)
5477 * @returns {Error} a "timeout" error
5478 * @private
5479 */
5480Runnable.prototype._timeoutError = function(ms) {
5481 var msg =
5482 'Timeout of ' +
5483 ms +
5484 'ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.';
5485 if (this.file) {
5486 msg += ' (' + this.file + ')';
5487 }
5488 return new Error(msg);
5489};
5490
5491var constants = utils.defineConstants(
5492 /**
5493 * {@link Runnable}-related constants.
5494 * @public
5495 * @memberof Runnable
5496 * @readonly
5497 * @static
5498 * @alias constants
5499 * @enum {string}
5500 */
5501 {
5502 /**
5503 * Value of `state` prop when a `Runnable` has failed
5504 */
5505 STATE_FAILED: 'failed',
5506 /**
5507 * Value of `state` prop when a `Runnable` has passed
5508 */
5509 STATE_PASSED: 'passed'
5510 }
5511);
5512
5513/**
5514 * Given `value`, return identity if truthy, otherwise create an "invalid exception" error and return that.
5515 * @param {*} [value] - Value to return, if present
5516 * @returns {*|Error} `value`, otherwise an `Error`
5517 * @private
5518 */
5519Runnable.toValueOrError = function(value) {
5520 return (
5521 value ||
5522 createInvalidExceptionError(
5523 'Runnable failed with falsy or undefined exception. Please throw an Error instead.',
5524 value
5525 )
5526 );
5527};
5528
5529Runnable.constants = constants;
5530
5531}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
5532},{"./errors":6,"./pending":16,"./utils":38,"debug":45,"events":50,"ms":60}],34:[function(require,module,exports){
5533(function (process,global){
5534'use strict';
5535
5536/**
5537 * Module dependencies.
5538 */
5539var util = require('util');
5540var EventEmitter = require('events').EventEmitter;
5541var Pending = require('./pending');
5542var utils = require('./utils');
5543var inherits = utils.inherits;
5544var debug = require('debug')('mocha:runner');
5545var Runnable = require('./runnable');
5546var Suite = require('./suite');
5547var HOOK_TYPE_BEFORE_EACH = Suite.constants.HOOK_TYPE_BEFORE_EACH;
5548var HOOK_TYPE_AFTER_EACH = Suite.constants.HOOK_TYPE_AFTER_EACH;
5549var HOOK_TYPE_AFTER_ALL = Suite.constants.HOOK_TYPE_AFTER_ALL;
5550var HOOK_TYPE_BEFORE_ALL = Suite.constants.HOOK_TYPE_BEFORE_ALL;
5551var EVENT_ROOT_SUITE_RUN = Suite.constants.EVENT_ROOT_SUITE_RUN;
5552var STATE_FAILED = Runnable.constants.STATE_FAILED;
5553var STATE_PASSED = Runnable.constants.STATE_PASSED;
5554var dQuote = utils.dQuote;
5555var ngettext = utils.ngettext;
5556var sQuote = utils.sQuote;
5557var stackFilter = utils.stackTraceFilter();
5558var stringify = utils.stringify;
5559var type = utils.type;
5560var errors = require('./errors');
5561var createInvalidExceptionError = errors.createInvalidExceptionError;
5562var createUnsupportedError = errors.createUnsupportedError;
5563
5564/**
5565 * Non-enumerable globals.
5566 * @readonly
5567 */
5568var globals = [
5569 'setTimeout',
5570 'clearTimeout',
5571 'setInterval',
5572 'clearInterval',
5573 'XMLHttpRequest',
5574 'Date',
5575 'setImmediate',
5576 'clearImmediate'
5577];
5578
5579var constants = utils.defineConstants(
5580 /**
5581 * {@link Runner}-related constants.
5582 * @public
5583 * @memberof Runner
5584 * @readonly
5585 * @alias constants
5586 * @static
5587 * @enum {string}
5588 */
5589 {
5590 /**
5591 * Emitted when {@link Hook} execution begins
5592 */
5593 EVENT_HOOK_BEGIN: 'hook',
5594 /**
5595 * Emitted when {@link Hook} execution ends
5596 */
5597 EVENT_HOOK_END: 'hook end',
5598 /**
5599 * Emitted when Root {@link Suite} execution begins (all files have been parsed and hooks/tests are ready for execution)
5600 */
5601 EVENT_RUN_BEGIN: 'start',
5602 /**
5603 * Emitted when Root {@link Suite} execution has been delayed via `delay` option
5604 */
5605 EVENT_DELAY_BEGIN: 'waiting',
5606 /**
5607 * Emitted when delayed Root {@link Suite} execution is triggered by user via `global.run()`
5608 */
5609 EVENT_DELAY_END: 'ready',
5610 /**
5611 * Emitted when Root {@link Suite} execution ends
5612 */
5613 EVENT_RUN_END: 'end',
5614 /**
5615 * Emitted when {@link Suite} execution begins
5616 */
5617 EVENT_SUITE_BEGIN: 'suite',
5618 /**
5619 * Emitted when {@link Suite} execution ends
5620 */
5621 EVENT_SUITE_END: 'suite end',
5622 /**
5623 * Emitted when {@link Test} execution begins
5624 */
5625 EVENT_TEST_BEGIN: 'test',
5626 /**
5627 * Emitted when {@link Test} execution ends
5628 */
5629 EVENT_TEST_END: 'test end',
5630 /**
5631 * Emitted when {@link Test} execution fails
5632 */
5633 EVENT_TEST_FAIL: 'fail',
5634 /**
5635 * Emitted when {@link Test} execution succeeds
5636 */
5637 EVENT_TEST_PASS: 'pass',
5638 /**
5639 * Emitted when {@link Test} becomes pending
5640 */
5641 EVENT_TEST_PENDING: 'pending',
5642 /**
5643 * Emitted when {@link Test} execution has failed, but will retry
5644 */
5645 EVENT_TEST_RETRY: 'retry'
5646 }
5647);
5648
5649module.exports = Runner;
5650
5651/**
5652 * Initialize a `Runner` at the Root {@link Suite}, which represents a hierarchy of {@link Suite|Suites} and {@link Test|Tests}.
5653 *
5654 * @extends external:EventEmitter
5655 * @public
5656 * @class
5657 * @param {Suite} suite Root suite
5658 * @param {boolean} [delay] Whether or not to delay execution of root suite
5659 * until ready.
5660 */
5661function Runner(suite, delay) {
5662 var self = this;
5663 this._globals = [];
5664 this._abort = false;
5665 this._delay = delay;
5666 this.suite = suite;
5667 this.started = false;
5668 this.total = suite.total();
5669 this.failures = 0;
5670 this.on(constants.EVENT_TEST_END, function(test) {
5671 self.checkGlobals(test);
5672 });
5673 this.on(constants.EVENT_HOOK_END, function(hook) {
5674 self.checkGlobals(hook);
5675 });
5676 this._defaultGrep = /.*/;
5677 this.grep(this._defaultGrep);
5678 this.globals(this.globalProps());
5679}
5680
5681/**
5682 * Wrapper for setImmediate, process.nextTick, or browser polyfill.
5683 *
5684 * @param {Function} fn
5685 * @private
5686 */
5687Runner.immediately = global.setImmediate || process.nextTick;
5688
5689/**
5690 * Inherit from `EventEmitter.prototype`.
5691 */
5692inherits(Runner, EventEmitter);
5693
5694/**
5695 * Run tests with full titles matching `re`. Updates runner.total
5696 * with number of tests matched.
5697 *
5698 * @public
5699 * @memberof Runner
5700 * @param {RegExp} re
5701 * @param {boolean} invert
5702 * @return {Runner} Runner instance.
5703 */
5704Runner.prototype.grep = function(re, invert) {
5705 debug('grep %s', re);
5706 this._grep = re;
5707 this._invert = invert;
5708 this.total = this.grepTotal(this.suite);
5709 return this;
5710};
5711
5712/**
5713 * Returns the number of tests matching the grep search for the
5714 * given suite.
5715 *
5716 * @memberof Runner
5717 * @public
5718 * @param {Suite} suite
5719 * @return {number}
5720 */
5721Runner.prototype.grepTotal = function(suite) {
5722 var self = this;
5723 var total = 0;
5724
5725 suite.eachTest(function(test) {
5726 var match = self._grep.test(test.fullTitle());
5727 if (self._invert) {
5728 match = !match;
5729 }
5730 if (match) {
5731 total++;
5732 }
5733 });
5734
5735 return total;
5736};
5737
5738/**
5739 * Return a list of global properties.
5740 *
5741 * @return {Array}
5742 * @private
5743 */
5744Runner.prototype.globalProps = function() {
5745 var props = Object.keys(global);
5746
5747 // non-enumerables
5748 for (var i = 0; i < globals.length; ++i) {
5749 if (~props.indexOf(globals[i])) {
5750 continue;
5751 }
5752 props.push(globals[i]);
5753 }
5754
5755 return props;
5756};
5757
5758/**
5759 * Allow the given `arr` of globals.
5760 *
5761 * @public
5762 * @memberof Runner
5763 * @param {Array} arr
5764 * @return {Runner} Runner instance.
5765 */
5766Runner.prototype.globals = function(arr) {
5767 if (!arguments.length) {
5768 return this._globals;
5769 }
5770 debug('globals %j', arr);
5771 this._globals = this._globals.concat(arr);
5772 return this;
5773};
5774
5775/**
5776 * Check for global variable leaks.
5777 *
5778 * @private
5779 */
5780Runner.prototype.checkGlobals = function(test) {
5781 if (!this.checkLeaks) {
5782 return;
5783 }
5784 var ok = this._globals;
5785
5786 var globals = this.globalProps();
5787 var leaks;
5788
5789 if (test) {
5790 ok = ok.concat(test._allowedGlobals || []);
5791 }
5792
5793 if (this.prevGlobalsLength === globals.length) {
5794 return;
5795 }
5796 this.prevGlobalsLength = globals.length;
5797
5798 leaks = filterLeaks(ok, globals);
5799 this._globals = this._globals.concat(leaks);
5800
5801 if (leaks.length) {
5802 var format = ngettext(
5803 leaks.length,
5804 'global leak detected: %s',
5805 'global leaks detected: %s'
5806 );
5807 var error = new Error(util.format(format, leaks.map(sQuote).join(', ')));
5808 this.fail(test, error);
5809 }
5810};
5811
5812/**
5813 * Fail the given `test`.
5814 *
5815 * @private
5816 * @param {Test} test
5817 * @param {Error} err
5818 */
5819Runner.prototype.fail = function(test, err) {
5820 if (test.isPending()) {
5821 return;
5822 }
5823
5824 ++this.failures;
5825 test.state = STATE_FAILED;
5826
5827 if (!isError(err)) {
5828 err = thrown2Error(err);
5829 }
5830
5831 try {
5832 err.stack =
5833 this.fullStackTrace || !err.stack ? err.stack : stackFilter(err.stack);
5834 } catch (ignore) {
5835 // some environments do not take kindly to monkeying with the stack
5836 }
5837
5838 this.emit(constants.EVENT_TEST_FAIL, test, err);
5839};
5840
5841/**
5842 * Fail the given `hook` with `err`.
5843 *
5844 * Hook failures work in the following pattern:
5845 * - If bail, run corresponding `after each` and `after` hooks,
5846 * then exit
5847 * - Failed `before` hook skips all tests in a suite and subsuites,
5848 * but jumps to corresponding `after` hook
5849 * - Failed `before each` hook skips remaining tests in a
5850 * suite and jumps to corresponding `after each` hook,
5851 * which is run only once
5852 * - Failed `after` hook does not alter execution order
5853 * - Failed `after each` hook skips remaining tests in a
5854 * suite and subsuites, but executes other `after each`
5855 * hooks
5856 *
5857 * @private
5858 * @param {Hook} hook
5859 * @param {Error} err
5860 */
5861Runner.prototype.failHook = function(hook, err) {
5862 hook.originalTitle = hook.originalTitle || hook.title;
5863 if (hook.ctx && hook.ctx.currentTest) {
5864 hook.title =
5865 hook.originalTitle + ' for ' + dQuote(hook.ctx.currentTest.title);
5866 } else {
5867 var parentTitle;
5868 if (hook.parent.title) {
5869 parentTitle = hook.parent.title;
5870 } else {
5871 parentTitle = hook.parent.root ? '{root}' : '';
5872 }
5873 hook.title = hook.originalTitle + ' in ' + dQuote(parentTitle);
5874 }
5875
5876 this.fail(hook, err);
5877};
5878
5879/**
5880 * Run hook `name` callbacks and then invoke `fn()`.
5881 *
5882 * @private
5883 * @param {string} name
5884 * @param {Function} fn
5885 */
5886
5887Runner.prototype.hook = function(name, fn) {
5888 var suite = this.suite;
5889 var hooks = suite.getHooks(name);
5890 var self = this;
5891
5892 function next(i) {
5893 var hook = hooks[i];
5894 if (!hook) {
5895 return fn();
5896 }
5897 self.currentRunnable = hook;
5898
5899 if (name === HOOK_TYPE_BEFORE_ALL) {
5900 hook.ctx.currentTest = hook.parent.tests[0];
5901 } else if (name === HOOK_TYPE_AFTER_ALL) {
5902 hook.ctx.currentTest = hook.parent.tests[hook.parent.tests.length - 1];
5903 } else {
5904 hook.ctx.currentTest = self.test;
5905 }
5906
5907 hook.allowUncaught = self.allowUncaught;
5908
5909 self.emit(constants.EVENT_HOOK_BEGIN, hook);
5910
5911 if (!hook.listeners('error').length) {
5912 hook.on('error', function(err) {
5913 self.failHook(hook, err);
5914 });
5915 }
5916
5917 hook.run(function(err) {
5918 var testError = hook.error();
5919 if (testError) {
5920 self.fail(self.test, testError);
5921 }
5922 // conditional skip
5923 if (hook.pending) {
5924 if (name === HOOK_TYPE_AFTER_EACH) {
5925 // TODO define and implement use case
5926 if (self.test) {
5927 self.test.pending = true;
5928 }
5929 } else if (name === HOOK_TYPE_BEFORE_EACH) {
5930 if (self.test) {
5931 self.test.pending = true;
5932 }
5933 self.emit(constants.EVENT_HOOK_END, hook);
5934 hook.pending = false; // activates hook for next test
5935 return fn(new Error('abort hookDown'));
5936 } else if (name === HOOK_TYPE_BEFORE_ALL) {
5937 suite.tests.forEach(function(test) {
5938 test.pending = true;
5939 });
5940 suite.suites.forEach(function(suite) {
5941 suite.pending = true;
5942 });
5943 } else {
5944 hook.pending = false;
5945 var errForbid = createUnsupportedError('`this.skip` forbidden');
5946 self.failHook(hook, errForbid);
5947 return fn(errForbid);
5948 }
5949 } else if (err) {
5950 self.failHook(hook, err);
5951 // stop executing hooks, notify callee of hook err
5952 return fn(err);
5953 }
5954 self.emit(constants.EVENT_HOOK_END, hook);
5955 delete hook.ctx.currentTest;
5956 next(++i);
5957 });
5958 }
5959
5960 Runner.immediately(function() {
5961 next(0);
5962 });
5963};
5964
5965/**
5966 * Run hook `name` for the given array of `suites`
5967 * in order, and callback `fn(err, errSuite)`.
5968 *
5969 * @private
5970 * @param {string} name
5971 * @param {Array} suites
5972 * @param {Function} fn
5973 */
5974Runner.prototype.hooks = function(name, suites, fn) {
5975 var self = this;
5976 var orig = this.suite;
5977
5978 function next(suite) {
5979 self.suite = suite;
5980
5981 if (!suite) {
5982 self.suite = orig;
5983 return fn();
5984 }
5985
5986 self.hook(name, function(err) {
5987 if (err) {
5988 var errSuite = self.suite;
5989 self.suite = orig;
5990 return fn(err, errSuite);
5991 }
5992
5993 next(suites.pop());
5994 });
5995 }
5996
5997 next(suites.pop());
5998};
5999
6000/**
6001 * Run hooks from the top level down.
6002 *
6003 * @param {String} name
6004 * @param {Function} fn
6005 * @private
6006 */
6007Runner.prototype.hookUp = function(name, fn) {
6008 var suites = [this.suite].concat(this.parents()).reverse();
6009 this.hooks(name, suites, fn);
6010};
6011
6012/**
6013 * Run hooks from the bottom up.
6014 *
6015 * @param {String} name
6016 * @param {Function} fn
6017 * @private
6018 */
6019Runner.prototype.hookDown = function(name, fn) {
6020 var suites = [this.suite].concat(this.parents());
6021 this.hooks(name, suites, fn);
6022};
6023
6024/**
6025 * Return an array of parent Suites from
6026 * closest to furthest.
6027 *
6028 * @return {Array}
6029 * @private
6030 */
6031Runner.prototype.parents = function() {
6032 var suite = this.suite;
6033 var suites = [];
6034 while (suite.parent) {
6035 suite = suite.parent;
6036 suites.push(suite);
6037 }
6038 return suites;
6039};
6040
6041/**
6042 * Run the current test and callback `fn(err)`.
6043 *
6044 * @param {Function} fn
6045 * @private
6046 */
6047Runner.prototype.runTest = function(fn) {
6048 var self = this;
6049 var test = this.test;
6050
6051 if (!test) {
6052 return;
6053 }
6054
6055 var suite = this.parents().reverse()[0] || this.suite;
6056 if (this.forbidOnly && suite.hasOnly()) {
6057 fn(new Error('`.only` forbidden'));
6058 return;
6059 }
6060 if (this.asyncOnly) {
6061 test.asyncOnly = true;
6062 }
6063 test.on('error', function(err) {
6064 if (err instanceof Pending) {
6065 return;
6066 }
6067 self.fail(test, err);
6068 });
6069 if (this.allowUncaught) {
6070 test.allowUncaught = true;
6071 return test.run(fn);
6072 }
6073 try {
6074 test.run(fn);
6075 } catch (err) {
6076 fn(err);
6077 }
6078};
6079
6080/**
6081 * Run tests in the given `suite` and invoke the callback `fn()` when complete.
6082 *
6083 * @private
6084 * @param {Suite} suite
6085 * @param {Function} fn
6086 */
6087Runner.prototype.runTests = function(suite, fn) {
6088 var self = this;
6089 var tests = suite.tests.slice();
6090 var test;
6091
6092 function hookErr(_, errSuite, after) {
6093 // before/after Each hook for errSuite failed:
6094 var orig = self.suite;
6095
6096 // for failed 'after each' hook start from errSuite parent,
6097 // otherwise start from errSuite itself
6098 self.suite = after ? errSuite.parent : errSuite;
6099
6100 if (self.suite) {
6101 // call hookUp afterEach
6102 self.hookUp(HOOK_TYPE_AFTER_EACH, function(err2, errSuite2) {
6103 self.suite = orig;
6104 // some hooks may fail even now
6105 if (err2) {
6106 return hookErr(err2, errSuite2, true);
6107 }
6108 // report error suite
6109 fn(errSuite);
6110 });
6111 } else {
6112 // there is no need calling other 'after each' hooks
6113 self.suite = orig;
6114 fn(errSuite);
6115 }
6116 }
6117
6118 function next(err, errSuite) {
6119 // if we bail after first err
6120 if (self.failures && suite._bail) {
6121 tests = [];
6122 }
6123
6124 if (self._abort) {
6125 return fn();
6126 }
6127
6128 if (err) {
6129 return hookErr(err, errSuite, true);
6130 }
6131
6132 // next test
6133 test = tests.shift();
6134
6135 // all done
6136 if (!test) {
6137 return fn();
6138 }
6139
6140 // grep
6141 var match = self._grep.test(test.fullTitle());
6142 if (self._invert) {
6143 match = !match;
6144 }
6145 if (!match) {
6146 // Run immediately only if we have defined a grep. When we
6147 // define a grep — It can cause maximum callstack error if
6148 // the grep is doing a large recursive loop by neglecting
6149 // all tests. The run immediately function also comes with
6150 // a performance cost. So we don't want to run immediately
6151 // if we run the whole test suite, because running the whole
6152 // test suite don't do any immediate recursive loops. Thus,
6153 // allowing a JS runtime to breathe.
6154 if (self._grep !== self._defaultGrep) {
6155 Runner.immediately(next);
6156 } else {
6157 next();
6158 }
6159 return;
6160 }
6161
6162 // static skip, no hooks are executed
6163 if (test.isPending()) {
6164 if (self.forbidPending) {
6165 test.isPending = alwaysFalse;
6166 self.fail(test, new Error('Pending test forbidden'));
6167 delete test.isPending;
6168 } else {
6169 self.emit(constants.EVENT_TEST_PENDING, test);
6170 }
6171 self.emit(constants.EVENT_TEST_END, test);
6172 return next();
6173 }
6174
6175 // execute test and hook(s)
6176 self.emit(constants.EVENT_TEST_BEGIN, (self.test = test));
6177 self.hookDown(HOOK_TYPE_BEFORE_EACH, function(err, errSuite) {
6178 // conditional skip within beforeEach
6179 if (test.isPending()) {
6180 if (self.forbidPending) {
6181 test.isPending = alwaysFalse;
6182 self.fail(test, new Error('Pending test forbidden'));
6183 delete test.isPending;
6184 } else {
6185 self.emit(constants.EVENT_TEST_PENDING, test);
6186 }
6187 self.emit(constants.EVENT_TEST_END, test);
6188 // skip inner afterEach hooks below errSuite level
6189 var origSuite = self.suite;
6190 self.suite = errSuite;
6191 return self.hookUp(HOOK_TYPE_AFTER_EACH, function(e, eSuite) {
6192 self.suite = origSuite;
6193 next(e, eSuite);
6194 });
6195 }
6196 if (err) {
6197 return hookErr(err, errSuite, false);
6198 }
6199 self.currentRunnable = self.test;
6200 self.runTest(function(err) {
6201 test = self.test;
6202 // conditional skip within it
6203 if (test.pending) {
6204 if (self.forbidPending) {
6205 test.isPending = alwaysFalse;
6206 self.fail(test, new Error('Pending test forbidden'));
6207 delete test.isPending;
6208 } else {
6209 self.emit(constants.EVENT_TEST_PENDING, test);
6210 }
6211 self.emit(constants.EVENT_TEST_END, test);
6212 return self.hookUp(HOOK_TYPE_AFTER_EACH, next);
6213 } else if (err) {
6214 var retry = test.currentRetry();
6215 if (retry < test.retries()) {
6216 var clonedTest = test.clone();
6217 clonedTest.currentRetry(retry + 1);
6218 tests.unshift(clonedTest);
6219
6220 self.emit(constants.EVENT_TEST_RETRY, test, err);
6221
6222 // Early return + hook trigger so that it doesn't
6223 // increment the count wrong
6224 return self.hookUp(HOOK_TYPE_AFTER_EACH, next);
6225 } else {
6226 self.fail(test, err);
6227 }
6228 self.emit(constants.EVENT_TEST_END, test);
6229 return self.hookUp(HOOK_TYPE_AFTER_EACH, next);
6230 }
6231
6232 test.state = STATE_PASSED;
6233 self.emit(constants.EVENT_TEST_PASS, test);
6234 self.emit(constants.EVENT_TEST_END, test);
6235 self.hookUp(HOOK_TYPE_AFTER_EACH, next);
6236 });
6237 });
6238 }
6239
6240 this.next = next;
6241 this.hookErr = hookErr;
6242 next();
6243};
6244
6245function alwaysFalse() {
6246 return false;
6247}
6248
6249/**
6250 * Run the given `suite` and invoke the callback `fn()` when complete.
6251 *
6252 * @private
6253 * @param {Suite} suite
6254 * @param {Function} fn
6255 */
6256Runner.prototype.runSuite = function(suite, fn) {
6257 var i = 0;
6258 var self = this;
6259 var total = this.grepTotal(suite);
6260 var afterAllHookCalled = false;
6261
6262 debug('run suite %s', suite.fullTitle());
6263
6264 if (!total || (self.failures && suite._bail)) {
6265 return fn();
6266 }
6267
6268 this.emit(constants.EVENT_SUITE_BEGIN, (this.suite = suite));
6269
6270 function next(errSuite) {
6271 if (errSuite) {
6272 // current suite failed on a hook from errSuite
6273 if (errSuite === suite) {
6274 // if errSuite is current suite
6275 // continue to the next sibling suite
6276 return done();
6277 }
6278 // errSuite is among the parents of current suite
6279 // stop execution of errSuite and all sub-suites
6280 return done(errSuite);
6281 }
6282
6283 if (self._abort) {
6284 return done();
6285 }
6286
6287 var curr = suite.suites[i++];
6288 if (!curr) {
6289 return done();
6290 }
6291
6292 // Avoid grep neglecting large number of tests causing a
6293 // huge recursive loop and thus a maximum call stack error.
6294 // See comment in `this.runTests()` for more information.
6295 if (self._grep !== self._defaultGrep) {
6296 Runner.immediately(function() {
6297 self.runSuite(curr, next);
6298 });
6299 } else {
6300 self.runSuite(curr, next);
6301 }
6302 }
6303
6304 function done(errSuite) {
6305 self.suite = suite;
6306 self.nextSuite = next;
6307
6308 if (afterAllHookCalled) {
6309 fn(errSuite);
6310 } else {
6311 // mark that the afterAll block has been called once
6312 // and so can be skipped if there is an error in it.
6313 afterAllHookCalled = true;
6314
6315 // remove reference to test
6316 delete self.test;
6317
6318 self.hook(HOOK_TYPE_AFTER_ALL, function() {
6319 self.emit(constants.EVENT_SUITE_END, suite);
6320 fn(errSuite);
6321 });
6322 }
6323 }
6324
6325 this.nextSuite = next;
6326
6327 this.hook(HOOK_TYPE_BEFORE_ALL, function(err) {
6328 if (err) {
6329 return done();
6330 }
6331 self.runTests(suite, next);
6332 });
6333};
6334
6335/**
6336 * Handle uncaught exceptions.
6337 *
6338 * @param {Error} err
6339 * @private
6340 */
6341Runner.prototype.uncaught = function(err) {
6342 if (err instanceof Pending) {
6343 return;
6344 }
6345 if (this.allowUncaught) {
6346 throw err;
6347 }
6348
6349 if (err) {
6350 debug('uncaught exception %O', err);
6351 } else {
6352 debug('uncaught undefined/falsy exception');
6353 err = createInvalidExceptionError(
6354 'Caught falsy/undefined exception which would otherwise be uncaught. No stack trace found; try a debugger',
6355 err
6356 );
6357 }
6358
6359 if (!isError(err)) {
6360 err = thrown2Error(err);
6361 }
6362 err.uncaught = true;
6363
6364 var runnable = this.currentRunnable;
6365
6366 if (!runnable) {
6367 runnable = new Runnable('Uncaught error outside test suite');
6368 runnable.parent = this.suite;
6369
6370 if (this.started) {
6371 this.fail(runnable, err);
6372 } else {
6373 // Can't recover from this failure
6374 this.emit(constants.EVENT_RUN_BEGIN);
6375 this.fail(runnable, err);
6376 this.emit(constants.EVENT_RUN_END);
6377 }
6378
6379 return;
6380 }
6381
6382 runnable.clearTimeout();
6383
6384 if (runnable.isFailed()) {
6385 // Ignore error if already failed
6386 return;
6387 } else if (runnable.isPending()) {
6388 // report 'pending test' retrospectively as failed
6389 runnable.isPending = alwaysFalse;
6390 this.fail(runnable, err);
6391 delete runnable.isPending;
6392 return;
6393 }
6394
6395 // we cannot recover gracefully if a Runnable has already passed
6396 // then fails asynchronously
6397 var alreadyPassed = runnable.isPassed();
6398 // this will change the state to "failed" regardless of the current value
6399 this.fail(runnable, err);
6400 if (!alreadyPassed) {
6401 // recover from test
6402 if (runnable.type === constants.EVENT_TEST_BEGIN) {
6403 this.emit(constants.EVENT_TEST_END, runnable);
6404 this.hookUp(HOOK_TYPE_AFTER_EACH, this.next);
6405 return;
6406 }
6407 debug(runnable);
6408
6409 // recover from hooks
6410 var errSuite = this.suite;
6411
6412 // XXX how about a less awful way to determine this?
6413 // if hook failure is in afterEach block
6414 if (runnable.fullTitle().indexOf('after each') > -1) {
6415 return this.hookErr(err, errSuite, true);
6416 }
6417 // if hook failure is in beforeEach block
6418 if (runnable.fullTitle().indexOf('before each') > -1) {
6419 return this.hookErr(err, errSuite, false);
6420 }
6421 // if hook failure is in after or before blocks
6422 return this.nextSuite(errSuite);
6423 }
6424
6425 // bail
6426 this.abort();
6427};
6428
6429/**
6430 * Run the root suite and invoke `fn(failures)`
6431 * on completion.
6432 *
6433 * @public
6434 * @memberof Runner
6435 * @param {Function} fn
6436 * @return {Runner} Runner instance.
6437 */
6438Runner.prototype.run = function(fn) {
6439 var self = this;
6440 var rootSuite = this.suite;
6441
6442 fn = fn || function() {};
6443
6444 function uncaught(err) {
6445 self.uncaught(err);
6446 }
6447
6448 function start() {
6449 // If there is an `only` filter
6450 if (rootSuite.hasOnly()) {
6451 rootSuite.filterOnly();
6452 }
6453 self.started = true;
6454 if (self._delay) {
6455 self.emit(constants.EVENT_DELAY_END);
6456 }
6457 self.emit(constants.EVENT_RUN_BEGIN);
6458
6459 self.runSuite(rootSuite, function() {
6460 debug('finished running');
6461 self.emit(constants.EVENT_RUN_END);
6462 });
6463 }
6464
6465 debug(constants.EVENT_RUN_BEGIN);
6466
6467 // references cleanup to avoid memory leaks
6468 this.on(constants.EVENT_SUITE_END, function(suite) {
6469 suite.cleanReferences();
6470 });
6471
6472 // callback
6473 this.on(constants.EVENT_RUN_END, function() {
6474 debug(constants.EVENT_RUN_END);
6475 process.removeListener('uncaughtException', uncaught);
6476 process.on('uncaughtException', function(err) {
6477 if (err instanceof Pending) {
6478 return;
6479 }
6480 throw err;
6481 });
6482 fn(self.failures);
6483 });
6484
6485 // uncaught exception
6486 process.on('uncaughtException', uncaught);
6487
6488 if (this._delay) {
6489 // for reporters, I guess.
6490 // might be nice to debounce some dots while we wait.
6491 this.emit(constants.EVENT_DELAY_BEGIN, rootSuite);
6492 rootSuite.once(EVENT_ROOT_SUITE_RUN, start);
6493 } else {
6494 start();
6495 }
6496
6497 return this;
6498};
6499
6500/**
6501 * Cleanly abort execution.
6502 *
6503 * @memberof Runner
6504 * @public
6505 * @return {Runner} Runner instance.
6506 */
6507Runner.prototype.abort = function() {
6508 debug('aborting');
6509 this._abort = true;
6510
6511 return this;
6512};
6513
6514/**
6515 * Filter leaks with the given globals flagged as `ok`.
6516 *
6517 * @private
6518 * @param {Array} ok
6519 * @param {Array} globals
6520 * @return {Array}
6521 */
6522function filterLeaks(ok, globals) {
6523 return globals.filter(function(key) {
6524 // Firefox and Chrome exposes iframes as index inside the window object
6525 if (/^\d+/.test(key)) {
6526 return false;
6527 }
6528
6529 // in firefox
6530 // if runner runs in an iframe, this iframe's window.getInterface method
6531 // not init at first it is assigned in some seconds
6532 if (global.navigator && /^getInterface/.test(key)) {
6533 return false;
6534 }
6535
6536 // an iframe could be approached by window[iframeIndex]
6537 // in ie6,7,8 and opera, iframeIndex is enumerable, this could cause leak
6538 if (global.navigator && /^\d+/.test(key)) {
6539 return false;
6540 }
6541
6542 // Opera and IE expose global variables for HTML element IDs (issue #243)
6543 if (/^mocha-/.test(key)) {
6544 return false;
6545 }
6546
6547 var matched = ok.filter(function(ok) {
6548 if (~ok.indexOf('*')) {
6549 return key.indexOf(ok.split('*')[0]) === 0;
6550 }
6551 return key === ok;
6552 });
6553 return !matched.length && (!global.navigator || key !== 'onerror');
6554 });
6555}
6556
6557/**
6558 * Check if argument is an instance of Error object or a duck-typed equivalent.
6559 *
6560 * @private
6561 * @param {Object} err - object to check
6562 * @param {string} err.message - error message
6563 * @returns {boolean}
6564 */
6565function isError(err) {
6566 return err instanceof Error || (err && typeof err.message === 'string');
6567}
6568
6569/**
6570 *
6571 * Converts thrown non-extensible type into proper Error.
6572 *
6573 * @private
6574 * @param {*} thrown - Non-extensible type thrown by code
6575 * @return {Error}
6576 */
6577function thrown2Error(err) {
6578 return new Error(
6579 'the ' + type(err) + ' ' + stringify(err) + ' was thrown, throw an Error :)'
6580 );
6581}
6582
6583Runner.constants = constants;
6584
6585/**
6586 * Node.js' `EventEmitter`
6587 * @external EventEmitter
6588 * @see {@link https://nodejs.org/api/events.html#events_class_eventemitter}
6589 */
6590
6591}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
6592},{"./errors":6,"./pending":16,"./runnable":33,"./suite":36,"./utils":38,"_process":69,"debug":45,"events":50,"util":89}],35:[function(require,module,exports){
6593(function (global){
6594'use strict';
6595
6596/**
6597 * Provides a factory function for a {@link StatsCollector} object.
6598 * @module
6599 */
6600
6601var constants = require('./runner').constants;
6602var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
6603var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
6604var EVENT_SUITE_BEGIN = constants.EVENT_SUITE_BEGIN;
6605var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
6606var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
6607var EVENT_RUN_END = constants.EVENT_RUN_END;
6608var EVENT_TEST_END = constants.EVENT_TEST_END;
6609
6610/**
6611 * Test statistics collector.
6612 *
6613 * @public
6614 * @typedef {Object} StatsCollector
6615 * @property {number} suites - integer count of suites run.
6616 * @property {number} tests - integer count of tests run.
6617 * @property {number} passes - integer count of passing tests.
6618 * @property {number} pending - integer count of pending tests.
6619 * @property {number} failures - integer count of failed tests.
6620 * @property {Date} start - time when testing began.
6621 * @property {Date} end - time when testing concluded.
6622 * @property {number} duration - number of msecs that testing took.
6623 */
6624
6625var Date = global.Date;
6626
6627/**
6628 * Provides stats such as test duration, number of tests passed / failed etc., by listening for events emitted by `runner`.
6629 *
6630 * @private
6631 * @param {Runner} runner - Runner instance
6632 * @throws {TypeError} If falsy `runner`
6633 */
6634function createStatsCollector(runner) {
6635 /**
6636 * @type StatsCollector
6637 */
6638 var stats = {
6639 suites: 0,
6640 tests: 0,
6641 passes: 0,
6642 pending: 0,
6643 failures: 0
6644 };
6645
6646 if (!runner) {
6647 throw new TypeError('Missing runner argument');
6648 }
6649
6650 runner.stats = stats;
6651
6652 runner.once(EVENT_RUN_BEGIN, function() {
6653 stats.start = new Date();
6654 });
6655 runner.on(EVENT_SUITE_BEGIN, function(suite) {
6656 suite.root || stats.suites++;
6657 });
6658 runner.on(EVENT_TEST_PASS, function() {
6659 stats.passes++;
6660 });
6661 runner.on(EVENT_TEST_FAIL, function() {
6662 stats.failures++;
6663 });
6664 runner.on(EVENT_TEST_PENDING, function() {
6665 stats.pending++;
6666 });
6667 runner.on(EVENT_TEST_END, function() {
6668 stats.tests++;
6669 });
6670 runner.once(EVENT_RUN_END, function() {
6671 stats.end = new Date();
6672 stats.duration = stats.end - stats.start;
6673 });
6674}
6675
6676module.exports = createStatsCollector;
6677
6678}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
6679},{"./runner":34}],36:[function(require,module,exports){
6680'use strict';
6681
6682/**
6683 * Module dependencies.
6684 */
6685var EventEmitter = require('events').EventEmitter;
6686var Hook = require('./hook');
6687var utils = require('./utils');
6688var inherits = utils.inherits;
6689var debug = require('debug')('mocha:suite');
6690var milliseconds = require('ms');
6691var errors = require('./errors');
6692var createInvalidArgumentTypeError = errors.createInvalidArgumentTypeError;
6693
6694/**
6695 * Expose `Suite`.
6696 */
6697
6698exports = module.exports = Suite;
6699
6700/**
6701 * Create a new `Suite` with the given `title` and parent `Suite`.
6702 *
6703 * @public
6704 * @param {Suite} parent - Parent suite (required!)
6705 * @param {string} title - Title
6706 * @return {Suite}
6707 */
6708Suite.create = function(parent, title) {
6709 var suite = new Suite(title, parent.ctx);
6710 suite.parent = parent;
6711 title = suite.fullTitle();
6712 parent.addSuite(suite);
6713 return suite;
6714};
6715
6716/**
6717 * Constructs a new `Suite` instance with the given `title`, `ctx`, and `isRoot`.
6718 *
6719 * @public
6720 * @class
6721 * @extends EventEmitter
6722 * @see {@link https://nodejs.org/api/events.html#events_class_eventemitter|EventEmitter}
6723 * @param {string} title - Suite title.
6724 * @param {Context} parentContext - Parent context instance.
6725 * @param {boolean} [isRoot=false] - Whether this is the root suite.
6726 */
6727function Suite(title, parentContext, isRoot) {
6728 if (!utils.isString(title)) {
6729 throw createInvalidArgumentTypeError(
6730 'Suite argument "title" must be a string. Received type "' +
6731 typeof title +
6732 '"',
6733 'title',
6734 'string'
6735 );
6736 }
6737 this.title = title;
6738 function Context() {}
6739 Context.prototype = parentContext;
6740 this.ctx = new Context();
6741 this.suites = [];
6742 this.tests = [];
6743 this.pending = false;
6744 this._beforeEach = [];
6745 this._beforeAll = [];
6746 this._afterEach = [];
6747 this._afterAll = [];
6748 this.root = isRoot === true;
6749 this._timeout = 2000;
6750 this._enableTimeouts = true;
6751 this._slow = 75;
6752 this._bail = false;
6753 this._retries = -1;
6754 this._onlyTests = [];
6755 this._onlySuites = [];
6756 this.delayed = false;
6757
6758 this.on('newListener', function(event) {
6759 if (deprecatedEvents[event]) {
6760 utils.deprecate(
6761 'Event "' +
6762 event +
6763 '" is deprecated. Please let the Mocha team know about your use case: https://git.io/v6Lwm'
6764 );
6765 }
6766 });
6767}
6768
6769/**
6770 * Inherit from `EventEmitter.prototype`.
6771 */
6772inherits(Suite, EventEmitter);
6773
6774/**
6775 * Return a clone of this `Suite`.
6776 *
6777 * @private
6778 * @return {Suite}
6779 */
6780Suite.prototype.clone = function() {
6781 var suite = new Suite(this.title);
6782 debug('clone');
6783 suite.ctx = this.ctx;
6784 suite.root = this.root;
6785 suite.timeout(this.timeout());
6786 suite.retries(this.retries());
6787 suite.enableTimeouts(this.enableTimeouts());
6788 suite.slow(this.slow());
6789 suite.bail(this.bail());
6790 return suite;
6791};
6792
6793/**
6794 * Set or get timeout `ms` or short-hand such as "2s".
6795 *
6796 * @private
6797 * @todo Do not attempt to set value if `ms` is undefined
6798 * @param {number|string} ms
6799 * @return {Suite|number} for chaining
6800 */
6801Suite.prototype.timeout = function(ms) {
6802 if (!arguments.length) {
6803 return this._timeout;
6804 }
6805 if (ms.toString() === '0') {
6806 this._enableTimeouts = false;
6807 }
6808 if (typeof ms === 'string') {
6809 ms = milliseconds(ms);
6810 }
6811 debug('timeout %d', ms);
6812 this._timeout = parseInt(ms, 10);
6813 return this;
6814};
6815
6816/**
6817 * Set or get number of times to retry a failed test.
6818 *
6819 * @private
6820 * @param {number|string} n
6821 * @return {Suite|number} for chaining
6822 */
6823Suite.prototype.retries = function(n) {
6824 if (!arguments.length) {
6825 return this._retries;
6826 }
6827 debug('retries %d', n);
6828 this._retries = parseInt(n, 10) || 0;
6829 return this;
6830};
6831
6832/**
6833 * Set or get timeout to `enabled`.
6834 *
6835 * @private
6836 * @param {boolean} enabled
6837 * @return {Suite|boolean} self or enabled
6838 */
6839Suite.prototype.enableTimeouts = function(enabled) {
6840 if (!arguments.length) {
6841 return this._enableTimeouts;
6842 }
6843 debug('enableTimeouts %s', enabled);
6844 this._enableTimeouts = enabled;
6845 return this;
6846};
6847
6848/**
6849 * Set or get slow `ms` or short-hand such as "2s".
6850 *
6851 * @private
6852 * @param {number|string} ms
6853 * @return {Suite|number} for chaining
6854 */
6855Suite.prototype.slow = function(ms) {
6856 if (!arguments.length) {
6857 return this._slow;
6858 }
6859 if (typeof ms === 'string') {
6860 ms = milliseconds(ms);
6861 }
6862 debug('slow %d', ms);
6863 this._slow = ms;
6864 return this;
6865};
6866
6867/**
6868 * Set or get whether to bail after first error.
6869 *
6870 * @private
6871 * @param {boolean} bail
6872 * @return {Suite|number} for chaining
6873 */
6874Suite.prototype.bail = function(bail) {
6875 if (!arguments.length) {
6876 return this._bail;
6877 }
6878 debug('bail %s', bail);
6879 this._bail = bail;
6880 return this;
6881};
6882
6883/**
6884 * Check if this suite or its parent suite is marked as pending.
6885 *
6886 * @private
6887 */
6888Suite.prototype.isPending = function() {
6889 return this.pending || (this.parent && this.parent.isPending());
6890};
6891
6892/**
6893 * Generic hook-creator.
6894 * @private
6895 * @param {string} title - Title of hook
6896 * @param {Function} fn - Hook callback
6897 * @returns {Hook} A new hook
6898 */
6899Suite.prototype._createHook = function(title, fn) {
6900 var hook = new Hook(title, fn);
6901 hook.parent = this;
6902 hook.timeout(this.timeout());
6903 hook.retries(this.retries());
6904 hook.enableTimeouts(this.enableTimeouts());
6905 hook.slow(this.slow());
6906 hook.ctx = this.ctx;
6907 hook.file = this.file;
6908 return hook;
6909};
6910
6911/**
6912 * Run `fn(test[, done])` before running tests.
6913 *
6914 * @private
6915 * @param {string} title
6916 * @param {Function} fn
6917 * @return {Suite} for chaining
6918 */
6919Suite.prototype.beforeAll = function(title, fn) {
6920 if (this.isPending()) {
6921 return this;
6922 }
6923 if (typeof title === 'function') {
6924 fn = title;
6925 title = fn.name;
6926 }
6927 title = '"before all" hook' + (title ? ': ' + title : '');
6928
6929 var hook = this._createHook(title, fn);
6930 this._beforeAll.push(hook);
6931 this.emit(constants.EVENT_SUITE_ADD_HOOK_BEFORE_ALL, hook);
6932 return this;
6933};
6934
6935/**
6936 * Run `fn(test[, done])` after running tests.
6937 *
6938 * @private
6939 * @param {string} title
6940 * @param {Function} fn
6941 * @return {Suite} for chaining
6942 */
6943Suite.prototype.afterAll = function(title, fn) {
6944 if (this.isPending()) {
6945 return this;
6946 }
6947 if (typeof title === 'function') {
6948 fn = title;
6949 title = fn.name;
6950 }
6951 title = '"after all" hook' + (title ? ': ' + title : '');
6952
6953 var hook = this._createHook(title, fn);
6954 this._afterAll.push(hook);
6955 this.emit(constants.EVENT_SUITE_ADD_HOOK_AFTER_ALL, hook);
6956 return this;
6957};
6958
6959/**
6960 * Run `fn(test[, done])` before each test case.
6961 *
6962 * @private
6963 * @param {string} title
6964 * @param {Function} fn
6965 * @return {Suite} for chaining
6966 */
6967Suite.prototype.beforeEach = function(title, fn) {
6968 if (this.isPending()) {
6969 return this;
6970 }
6971 if (typeof title === 'function') {
6972 fn = title;
6973 title = fn.name;
6974 }
6975 title = '"before each" hook' + (title ? ': ' + title : '');
6976
6977 var hook = this._createHook(title, fn);
6978 this._beforeEach.push(hook);
6979 this.emit(constants.EVENT_SUITE_ADD_HOOK_BEFORE_EACH, hook);
6980 return this;
6981};
6982
6983/**
6984 * Run `fn(test[, done])` after each test case.
6985 *
6986 * @private
6987 * @param {string} title
6988 * @param {Function} fn
6989 * @return {Suite} for chaining
6990 */
6991Suite.prototype.afterEach = function(title, fn) {
6992 if (this.isPending()) {
6993 return this;
6994 }
6995 if (typeof title === 'function') {
6996 fn = title;
6997 title = fn.name;
6998 }
6999 title = '"after each" hook' + (title ? ': ' + title : '');
7000
7001 var hook = this._createHook(title, fn);
7002 this._afterEach.push(hook);
7003 this.emit(constants.EVENT_SUITE_ADD_HOOK_AFTER_EACH, hook);
7004 return this;
7005};
7006
7007/**
7008 * Add a test `suite`.
7009 *
7010 * @private
7011 * @param {Suite} suite
7012 * @return {Suite} for chaining
7013 */
7014Suite.prototype.addSuite = function(suite) {
7015 suite.parent = this;
7016 suite.root = false;
7017 suite.timeout(this.timeout());
7018 suite.retries(this.retries());
7019 suite.enableTimeouts(this.enableTimeouts());
7020 suite.slow(this.slow());
7021 suite.bail(this.bail());
7022 this.suites.push(suite);
7023 this.emit(constants.EVENT_SUITE_ADD_SUITE, suite);
7024 return this;
7025};
7026
7027/**
7028 * Add a `test` to this suite.
7029 *
7030 * @private
7031 * @param {Test} test
7032 * @return {Suite} for chaining
7033 */
7034Suite.prototype.addTest = function(test) {
7035 test.parent = this;
7036 test.timeout(this.timeout());
7037 test.retries(this.retries());
7038 test.enableTimeouts(this.enableTimeouts());
7039 test.slow(this.slow());
7040 test.ctx = this.ctx;
7041 this.tests.push(test);
7042 this.emit(constants.EVENT_SUITE_ADD_TEST, test);
7043 return this;
7044};
7045
7046/**
7047 * Return the full title generated by recursively concatenating the parent's
7048 * full title.
7049 *
7050 * @memberof Suite
7051 * @public
7052 * @return {string}
7053 */
7054Suite.prototype.fullTitle = function() {
7055 return this.titlePath().join(' ');
7056};
7057
7058/**
7059 * Return the title path generated by recursively concatenating the parent's
7060 * title path.
7061 *
7062 * @memberof Suite
7063 * @public
7064 * @return {string}
7065 */
7066Suite.prototype.titlePath = function() {
7067 var result = [];
7068 if (this.parent) {
7069 result = result.concat(this.parent.titlePath());
7070 }
7071 if (!this.root) {
7072 result.push(this.title);
7073 }
7074 return result;
7075};
7076
7077/**
7078 * Return the total number of tests.
7079 *
7080 * @memberof Suite
7081 * @public
7082 * @return {number}
7083 */
7084Suite.prototype.total = function() {
7085 return (
7086 this.suites.reduce(function(sum, suite) {
7087 return sum + suite.total();
7088 }, 0) + this.tests.length
7089 );
7090};
7091
7092/**
7093 * Iterates through each suite recursively to find all tests. Applies a
7094 * function in the format `fn(test)`.
7095 *
7096 * @private
7097 * @param {Function} fn
7098 * @return {Suite}
7099 */
7100Suite.prototype.eachTest = function(fn) {
7101 this.tests.forEach(fn);
7102 this.suites.forEach(function(suite) {
7103 suite.eachTest(fn);
7104 });
7105 return this;
7106};
7107
7108/**
7109 * This will run the root suite if we happen to be running in delayed mode.
7110 * @private
7111 */
7112Suite.prototype.run = function run() {
7113 if (this.root) {
7114 this.emit(constants.EVENT_ROOT_SUITE_RUN);
7115 }
7116};
7117
7118/**
7119 * Determines whether a suite has an `only` test or suite as a descendant.
7120 *
7121 * @private
7122 * @returns {Boolean}
7123 */
7124Suite.prototype.hasOnly = function hasOnly() {
7125 return (
7126 this._onlyTests.length > 0 ||
7127 this._onlySuites.length > 0 ||
7128 this.suites.some(function(suite) {
7129 return suite.hasOnly();
7130 })
7131 );
7132};
7133
7134/**
7135 * Filter suites based on `isOnly` logic.
7136 *
7137 * @private
7138 * @returns {Boolean}
7139 */
7140Suite.prototype.filterOnly = function filterOnly() {
7141 if (this._onlyTests.length) {
7142 // If the suite contains `only` tests, run those and ignore any nested suites.
7143 this.tests = this._onlyTests;
7144 this.suites = [];
7145 } else {
7146 // Otherwise, do not run any of the tests in this suite.
7147 this.tests = [];
7148 this._onlySuites.forEach(function(onlySuite) {
7149 // If there are other `only` tests/suites nested in the current `only` suite, then filter that `only` suite.
7150 // Otherwise, all of the tests on this `only` suite should be run, so don't filter it.
7151 if (onlySuite.hasOnly()) {
7152 onlySuite.filterOnly();
7153 }
7154 });
7155 // Run the `only` suites, as well as any other suites that have `only` tests/suites as descendants.
7156 var onlySuites = this._onlySuites;
7157 this.suites = this.suites.filter(function(childSuite) {
7158 return onlySuites.indexOf(childSuite) !== -1 || childSuite.filterOnly();
7159 });
7160 }
7161 // Keep the suite only if there is something to run
7162 return this.tests.length > 0 || this.suites.length > 0;
7163};
7164
7165/**
7166 * Adds a suite to the list of subsuites marked `only`.
7167 *
7168 * @private
7169 * @param {Suite} suite
7170 */
7171Suite.prototype.appendOnlySuite = function(suite) {
7172 this._onlySuites.push(suite);
7173};
7174
7175/**
7176 * Adds a test to the list of tests marked `only`.
7177 *
7178 * @private
7179 * @param {Test} test
7180 */
7181Suite.prototype.appendOnlyTest = function(test) {
7182 this._onlyTests.push(test);
7183};
7184
7185/**
7186 * Returns the array of hooks by hook name; see `HOOK_TYPE_*` constants.
7187 * @private
7188 */
7189Suite.prototype.getHooks = function getHooks(name) {
7190 return this['_' + name];
7191};
7192
7193/**
7194 * Cleans up the references to all the deferred functions
7195 * (before/after/beforeEach/afterEach) and tests of a Suite.
7196 * These must be deleted otherwise a memory leak can happen,
7197 * as those functions may reference variables from closures,
7198 * thus those variables can never be garbage collected as long
7199 * as the deferred functions exist.
7200 *
7201 * @private
7202 */
7203Suite.prototype.cleanReferences = function cleanReferences() {
7204 function cleanArrReferences(arr) {
7205 for (var i = 0; i < arr.length; i++) {
7206 delete arr[i].fn;
7207 }
7208 }
7209
7210 if (Array.isArray(this._beforeAll)) {
7211 cleanArrReferences(this._beforeAll);
7212 }
7213
7214 if (Array.isArray(this._beforeEach)) {
7215 cleanArrReferences(this._beforeEach);
7216 }
7217
7218 if (Array.isArray(this._afterAll)) {
7219 cleanArrReferences(this._afterAll);
7220 }
7221
7222 if (Array.isArray(this._afterEach)) {
7223 cleanArrReferences(this._afterEach);
7224 }
7225
7226 for (var i = 0; i < this.tests.length; i++) {
7227 delete this.tests[i].fn;
7228 }
7229};
7230
7231var constants = utils.defineConstants(
7232 /**
7233 * {@link Suite}-related constants.
7234 * @public
7235 * @memberof Suite
7236 * @alias constants
7237 * @readonly
7238 * @static
7239 * @enum {string}
7240 */
7241 {
7242 /**
7243 * Event emitted after a test file has been loaded Not emitted in browser.
7244 */
7245 EVENT_FILE_POST_REQUIRE: 'post-require',
7246 /**
7247 * Event emitted before a test file has been loaded. In browser, this is emitted once an interface has been selected.
7248 */
7249 EVENT_FILE_PRE_REQUIRE: 'pre-require',
7250 /**
7251 * Event emitted immediately after a test file has been loaded. Not emitted in browser.
7252 */
7253 EVENT_FILE_REQUIRE: 'require',
7254 /**
7255 * Event emitted when `global.run()` is called (use with `delay` option)
7256 */
7257 EVENT_ROOT_SUITE_RUN: 'run',
7258
7259 /**
7260 * Namespace for collection of a `Suite`'s "after all" hooks
7261 */
7262 HOOK_TYPE_AFTER_ALL: 'afterAll',
7263 /**
7264 * Namespace for collection of a `Suite`'s "after each" hooks
7265 */
7266 HOOK_TYPE_AFTER_EACH: 'afterEach',
7267 /**
7268 * Namespace for collection of a `Suite`'s "before all" hooks
7269 */
7270 HOOK_TYPE_BEFORE_ALL: 'beforeAll',
7271 /**
7272 * Namespace for collection of a `Suite`'s "before all" hooks
7273 */
7274 HOOK_TYPE_BEFORE_EACH: 'beforeEach',
7275
7276 // the following events are all deprecated
7277
7278 /**
7279 * Emitted after an "after all" `Hook` has been added to a `Suite`. Deprecated
7280 */
7281 EVENT_SUITE_ADD_HOOK_AFTER_ALL: 'afterAll',
7282 /**
7283 * Emitted after an "after each" `Hook` has been added to a `Suite` Deprecated
7284 */
7285 EVENT_SUITE_ADD_HOOK_AFTER_EACH: 'afterEach',
7286 /**
7287 * Emitted after an "before all" `Hook` has been added to a `Suite` Deprecated
7288 */
7289 EVENT_SUITE_ADD_HOOK_BEFORE_ALL: 'beforeAll',
7290 /**
7291 * Emitted after an "before each" `Hook` has been added to a `Suite` Deprecated
7292 */
7293 EVENT_SUITE_ADD_HOOK_BEFORE_EACH: 'beforeEach',
7294 /**
7295 * Emitted after a child `Suite` has been added to a `Suite`. Deprecated
7296 */
7297 EVENT_SUITE_ADD_SUITE: 'suite',
7298 /**
7299 * Emitted after a `Test` has been added to a `Suite`. Deprecated
7300 */
7301 EVENT_SUITE_ADD_TEST: 'test'
7302 }
7303);
7304
7305/**
7306 * @summary There are no known use cases for these events.
7307 * @desc This is a `Set`-like object having all keys being the constant's string value and the value being `true`.
7308 * @todo Remove eventually
7309 * @type {Object<string,boolean>}
7310 * @ignore
7311 */
7312var deprecatedEvents = Object.keys(constants)
7313 .filter(function(constant) {
7314 return constant.substring(0, 15) === 'EVENT_SUITE_ADD';
7315 })
7316 .reduce(function(acc, constant) {
7317 acc[constants[constant]] = true;
7318 return acc;
7319 }, utils.createMap());
7320
7321Suite.constants = constants;
7322
7323},{"./errors":6,"./hook":7,"./utils":38,"debug":45,"events":50,"ms":60}],37:[function(require,module,exports){
7324'use strict';
7325var Runnable = require('./runnable');
7326var utils = require('./utils');
7327var errors = require('./errors');
7328var createInvalidArgumentTypeError = errors.createInvalidArgumentTypeError;
7329var isString = utils.isString;
7330
7331module.exports = Test;
7332
7333/**
7334 * Initialize a new `Test` with the given `title` and callback `fn`.
7335 *
7336 * @public
7337 * @class
7338 * @extends Runnable
7339 * @param {String} title - Test title (required)
7340 * @param {Function} [fn] - Test callback. If omitted, the Test is considered "pending"
7341 */
7342function Test(title, fn) {
7343 if (!isString(title)) {
7344 throw createInvalidArgumentTypeError(
7345 'Test argument "title" should be a string. Received type "' +
7346 typeof title +
7347 '"',
7348 'title',
7349 'string'
7350 );
7351 }
7352 Runnable.call(this, title, fn);
7353 this.pending = !fn;
7354 this.type = 'test';
7355}
7356
7357/**
7358 * Inherit from `Runnable.prototype`.
7359 */
7360utils.inherits(Test, Runnable);
7361
7362Test.prototype.clone = function() {
7363 var test = new Test(this.title, this.fn);
7364 test.timeout(this.timeout());
7365 test.slow(this.slow());
7366 test.enableTimeouts(this.enableTimeouts());
7367 test.retries(this.retries());
7368 test.currentRetry(this.currentRetry());
7369 test.globals(this.globals());
7370 test.parent = this.parent;
7371 test.file = this.file;
7372 test.ctx = this.ctx;
7373 return test;
7374};
7375
7376},{"./errors":6,"./runnable":33,"./utils":38}],38:[function(require,module,exports){
7377(function (process,Buffer){
7378'use strict';
7379
7380/**
7381 * Various utility functions used throughout Mocha's codebase.
7382 * @module utils
7383 */
7384
7385/**
7386 * Module dependencies.
7387 */
7388
7389var fs = require('fs');
7390var path = require('path');
7391var util = require('util');
7392var glob = require('glob');
7393var he = require('he');
7394var errors = require('./errors');
7395var createNoFilesMatchPatternError = errors.createNoFilesMatchPatternError;
7396var createMissingArgumentError = errors.createMissingArgumentError;
7397
7398var assign = (exports.assign = require('object.assign').getPolyfill());
7399
7400/**
7401 * Inherit the prototype methods from one constructor into another.
7402 *
7403 * @param {function} ctor - Constructor function which needs to inherit the
7404 * prototype.
7405 * @param {function} superCtor - Constructor function to inherit prototype from.
7406 * @throws {TypeError} if either constructor is null, or if super constructor
7407 * lacks a prototype.
7408 */
7409exports.inherits = util.inherits;
7410
7411/**
7412 * Escape special characters in the given string of html.
7413 *
7414 * @private
7415 * @param {string} html
7416 * @return {string}
7417 */
7418exports.escape = function(html) {
7419 return he.encode(String(html), {useNamedReferences: false});
7420};
7421
7422/**
7423 * Test if the given obj is type of string.
7424 *
7425 * @private
7426 * @param {Object} obj
7427 * @return {boolean}
7428 */
7429exports.isString = function(obj) {
7430 return typeof obj === 'string';
7431};
7432
7433/**
7434 * Compute a slug from the given `str`.
7435 *
7436 * @private
7437 * @param {string} str
7438 * @return {string}
7439 */
7440exports.slug = function(str) {
7441 return str
7442 .toLowerCase()
7443 .replace(/ +/g, '-')
7444 .replace(/[^-\w]/g, '');
7445};
7446
7447/**
7448 * Strip the function definition from `str`, and re-indent for pre whitespace.
7449 *
7450 * @param {string} str
7451 * @return {string}
7452 */
7453exports.clean = function(str) {
7454 str = str
7455 .replace(/\r\n?|[\n\u2028\u2029]/g, '\n')
7456 .replace(/^\uFEFF/, '')
7457 // (traditional)-> space/name parameters body (lambda)-> parameters body multi-statement/single keep body content
7458 .replace(
7459 /^function(?:\s*|\s+[^(]*)\([^)]*\)\s*\{((?:.|\n)*?)\s*\}$|^\([^)]*\)\s*=>\s*(?:\{((?:.|\n)*?)\s*\}|((?:.|\n)*))$/,
7460 '$1$2$3'
7461 );
7462
7463 var spaces = str.match(/^\n?( *)/)[1].length;
7464 var tabs = str.match(/^\n?(\t*)/)[1].length;
7465 var re = new RegExp(
7466 '^\n?' + (tabs ? '\t' : ' ') + '{' + (tabs || spaces) + '}',
7467 'gm'
7468 );
7469
7470 str = str.replace(re, '');
7471
7472 return str.trim();
7473};
7474
7475/**
7476 * Parse the given `qs`.
7477 *
7478 * @private
7479 * @param {string} qs
7480 * @return {Object}
7481 */
7482exports.parseQuery = function(qs) {
7483 return qs
7484 .replace('?', '')
7485 .split('&')
7486 .reduce(function(obj, pair) {
7487 var i = pair.indexOf('=');
7488 var key = pair.slice(0, i);
7489 var val = pair.slice(++i);
7490
7491 // Due to how the URLSearchParams API treats spaces
7492 obj[key] = decodeURIComponent(val.replace(/\+/g, '%20'));
7493
7494 return obj;
7495 }, {});
7496};
7497
7498/**
7499 * Highlight the given string of `js`.
7500 *
7501 * @private
7502 * @param {string} js
7503 * @return {string}
7504 */
7505function highlight(js) {
7506 return js
7507 .replace(/</g, '&lt;')
7508 .replace(/>/g, '&gt;')
7509 .replace(/\/\/(.*)/gm, '<span class="comment">//$1</span>')
7510 .replace(/('.*?')/gm, '<span class="string">$1</span>')
7511 .replace(/(\d+\.\d+)/gm, '<span class="number">$1</span>')
7512 .replace(/(\d+)/gm, '<span class="number">$1</span>')
7513 .replace(
7514 /\bnew[ \t]+(\w+)/gm,
7515 '<span class="keyword">new</span> <span class="init">$1</span>'
7516 )
7517 .replace(
7518 /\b(function|new|throw|return|var|if|else)\b/gm,
7519 '<span class="keyword">$1</span>'
7520 );
7521}
7522
7523/**
7524 * Highlight the contents of tag `name`.
7525 *
7526 * @private
7527 * @param {string} name
7528 */
7529exports.highlightTags = function(name) {
7530 var code = document.getElementById('mocha').getElementsByTagName(name);
7531 for (var i = 0, len = code.length; i < len; ++i) {
7532 code[i].innerHTML = highlight(code[i].innerHTML);
7533 }
7534};
7535
7536/**
7537 * If a value could have properties, and has none, this function is called,
7538 * which returns a string representation of the empty value.
7539 *
7540 * Functions w/ no properties return `'[Function]'`
7541 * Arrays w/ length === 0 return `'[]'`
7542 * Objects w/ no properties return `'{}'`
7543 * All else: return result of `value.toString()`
7544 *
7545 * @private
7546 * @param {*} value The value to inspect.
7547 * @param {string} typeHint The type of the value
7548 * @returns {string}
7549 */
7550function emptyRepresentation(value, typeHint) {
7551 switch (typeHint) {
7552 case 'function':
7553 return '[Function]';
7554 case 'object':
7555 return '{}';
7556 case 'array':
7557 return '[]';
7558 default:
7559 return value.toString();
7560 }
7561}
7562
7563/**
7564 * Takes some variable and asks `Object.prototype.toString()` what it thinks it
7565 * is.
7566 *
7567 * @private
7568 * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString
7569 * @param {*} value The value to test.
7570 * @returns {string} Computed type
7571 * @example
7572 * type({}) // 'object'
7573 * type([]) // 'array'
7574 * type(1) // 'number'
7575 * type(false) // 'boolean'
7576 * type(Infinity) // 'number'
7577 * type(null) // 'null'
7578 * type(new Date()) // 'date'
7579 * type(/foo/) // 'regexp'
7580 * type('type') // 'string'
7581 * type(global) // 'global'
7582 * type(new String('foo') // 'object'
7583 */
7584var type = (exports.type = function type(value) {
7585 if (value === undefined) {
7586 return 'undefined';
7587 } else if (value === null) {
7588 return 'null';
7589 } else if (Buffer.isBuffer(value)) {
7590 return 'buffer';
7591 }
7592 return Object.prototype.toString
7593 .call(value)
7594 .replace(/^\[.+\s(.+?)]$/, '$1')
7595 .toLowerCase();
7596});
7597
7598/**
7599 * Stringify `value`. Different behavior depending on type of value:
7600 *
7601 * - If `value` is undefined or null, return `'[undefined]'` or `'[null]'`, respectively.
7602 * - If `value` is not an object, function or array, return result of `value.toString()` wrapped in double-quotes.
7603 * - If `value` is an *empty* object, function, or array, return result of function
7604 * {@link emptyRepresentation}.
7605 * - If `value` has properties, call {@link exports.canonicalize} on it, then return result of
7606 * JSON.stringify().
7607 *
7608 * @private
7609 * @see exports.type
7610 * @param {*} value
7611 * @return {string}
7612 */
7613exports.stringify = function(value) {
7614 var typeHint = type(value);
7615
7616 if (!~['object', 'array', 'function'].indexOf(typeHint)) {
7617 if (typeHint === 'buffer') {
7618 var json = Buffer.prototype.toJSON.call(value);
7619 // Based on the toJSON result
7620 return jsonStringify(
7621 json.data && json.type ? json.data : json,
7622 2
7623 ).replace(/,(\n|$)/g, '$1');
7624 }
7625
7626 // IE7/IE8 has a bizarre String constructor; needs to be coerced
7627 // into an array and back to obj.
7628 if (typeHint === 'string' && typeof value === 'object') {
7629 value = value.split('').reduce(function(acc, char, idx) {
7630 acc[idx] = char;
7631 return acc;
7632 }, {});
7633 typeHint = 'object';
7634 } else {
7635 return jsonStringify(value);
7636 }
7637 }
7638
7639 for (var prop in value) {
7640 if (Object.prototype.hasOwnProperty.call(value, prop)) {
7641 return jsonStringify(
7642 exports.canonicalize(value, null, typeHint),
7643 2
7644 ).replace(/,(\n|$)/g, '$1');
7645 }
7646 }
7647
7648 return emptyRepresentation(value, typeHint);
7649};
7650
7651/**
7652 * like JSON.stringify but more sense.
7653 *
7654 * @private
7655 * @param {Object} object
7656 * @param {number=} spaces
7657 * @param {number=} depth
7658 * @returns {*}
7659 */
7660function jsonStringify(object, spaces, depth) {
7661 if (typeof spaces === 'undefined') {
7662 // primitive types
7663 return _stringify(object);
7664 }
7665
7666 depth = depth || 1;
7667 var space = spaces * depth;
7668 var str = Array.isArray(object) ? '[' : '{';
7669 var end = Array.isArray(object) ? ']' : '}';
7670 var length =
7671 typeof object.length === 'number'
7672 ? object.length
7673 : Object.keys(object).length;
7674 // `.repeat()` polyfill
7675 function repeat(s, n) {
7676 return new Array(n).join(s);
7677 }
7678
7679 function _stringify(val) {
7680 switch (type(val)) {
7681 case 'null':
7682 case 'undefined':
7683 val = '[' + val + ']';
7684 break;
7685 case 'array':
7686 case 'object':
7687 val = jsonStringify(val, spaces, depth + 1);
7688 break;
7689 case 'boolean':
7690 case 'regexp':
7691 case 'symbol':
7692 case 'number':
7693 val =
7694 val === 0 && 1 / val === -Infinity // `-0`
7695 ? '-0'
7696 : val.toString();
7697 break;
7698 case 'date':
7699 var sDate = isNaN(val.getTime()) ? val.toString() : val.toISOString();
7700 val = '[Date: ' + sDate + ']';
7701 break;
7702 case 'buffer':
7703 var json = val.toJSON();
7704 // Based on the toJSON result
7705 json = json.data && json.type ? json.data : json;
7706 val = '[Buffer: ' + jsonStringify(json, 2, depth + 1) + ']';
7707 break;
7708 default:
7709 val =
7710 val === '[Function]' || val === '[Circular]'
7711 ? val
7712 : JSON.stringify(val); // string
7713 }
7714 return val;
7715 }
7716
7717 for (var i in object) {
7718 if (!Object.prototype.hasOwnProperty.call(object, i)) {
7719 continue; // not my business
7720 }
7721 --length;
7722 str +=
7723 '\n ' +
7724 repeat(' ', space) +
7725 (Array.isArray(object) ? '' : '"' + i + '": ') + // key
7726 _stringify(object[i]) + // value
7727 (length ? ',' : ''); // comma
7728 }
7729
7730 return (
7731 str +
7732 // [], {}
7733 (str.length !== 1 ? '\n' + repeat(' ', --space) + end : end)
7734 );
7735}
7736
7737/**
7738 * Return a new Thing that has the keys in sorted order. Recursive.
7739 *
7740 * If the Thing...
7741 * - has already been seen, return string `'[Circular]'`
7742 * - is `undefined`, return string `'[undefined]'`
7743 * - is `null`, return value `null`
7744 * - is some other primitive, return the value
7745 * - is not a primitive or an `Array`, `Object`, or `Function`, return the value of the Thing's `toString()` method
7746 * - is a non-empty `Array`, `Object`, or `Function`, return the result of calling this function again.
7747 * - is an empty `Array`, `Object`, or `Function`, return the result of calling `emptyRepresentation()`
7748 *
7749 * @private
7750 * @see {@link exports.stringify}
7751 * @param {*} value Thing to inspect. May or may not have properties.
7752 * @param {Array} [stack=[]] Stack of seen values
7753 * @param {string} [typeHint] Type hint
7754 * @return {(Object|Array|Function|string|undefined)}
7755 */
7756exports.canonicalize = function canonicalize(value, stack, typeHint) {
7757 var canonicalizedObj;
7758 /* eslint-disable no-unused-vars */
7759 var prop;
7760 /* eslint-enable no-unused-vars */
7761 typeHint = typeHint || type(value);
7762 function withStack(value, fn) {
7763 stack.push(value);
7764 fn();
7765 stack.pop();
7766 }
7767
7768 stack = stack || [];
7769
7770 if (stack.indexOf(value) !== -1) {
7771 return '[Circular]';
7772 }
7773
7774 switch (typeHint) {
7775 case 'undefined':
7776 case 'buffer':
7777 case 'null':
7778 canonicalizedObj = value;
7779 break;
7780 case 'array':
7781 withStack(value, function() {
7782 canonicalizedObj = value.map(function(item) {
7783 return exports.canonicalize(item, stack);
7784 });
7785 });
7786 break;
7787 case 'function':
7788 /* eslint-disable guard-for-in */
7789 for (prop in value) {
7790 canonicalizedObj = {};
7791 break;
7792 }
7793 /* eslint-enable guard-for-in */
7794 if (!canonicalizedObj) {
7795 canonicalizedObj = emptyRepresentation(value, typeHint);
7796 break;
7797 }
7798 /* falls through */
7799 case 'object':
7800 canonicalizedObj = canonicalizedObj || {};
7801 withStack(value, function() {
7802 Object.keys(value)
7803 .sort()
7804 .forEach(function(key) {
7805 canonicalizedObj[key] = exports.canonicalize(value[key], stack);
7806 });
7807 });
7808 break;
7809 case 'date':
7810 case 'number':
7811 case 'regexp':
7812 case 'boolean':
7813 case 'symbol':
7814 canonicalizedObj = value;
7815 break;
7816 default:
7817 canonicalizedObj = value + '';
7818 }
7819
7820 return canonicalizedObj;
7821};
7822
7823/**
7824 * Determines if pathname has a matching file extension.
7825 *
7826 * @private
7827 * @param {string} pathname - Pathname to check for match.
7828 * @param {string[]} exts - List of file extensions (sans period).
7829 * @return {boolean} whether file extension matches.
7830 * @example
7831 * hasMatchingExtname('foo.html', ['js', 'css']); // => false
7832 */
7833function hasMatchingExtname(pathname, exts) {
7834 var suffix = path.extname(pathname).slice(1);
7835 return exts.some(function(element) {
7836 return suffix === element;
7837 });
7838}
7839
7840/**
7841 * Determines if pathname would be a "hidden" file (or directory) on UN*X.
7842 *
7843 * @description
7844 * On UN*X, pathnames beginning with a full stop (aka dot) are hidden during
7845 * typical usage. Dotfiles, plain-text configuration files, are prime examples.
7846 *
7847 * @see {@link http://xahlee.info/UnixResource_dir/writ/unix_origin_of_dot_filename.html|Origin of Dot File Names}
7848 *
7849 * @private
7850 * @param {string} pathname - Pathname to check for match.
7851 * @return {boolean} whether pathname would be considered a hidden file.
7852 * @example
7853 * isHiddenOnUnix('.profile'); // => true
7854 */
7855function isHiddenOnUnix(pathname) {
7856 return path.basename(pathname)[0] === '.';
7857}
7858
7859/**
7860 * Lookup file names at the given `path`.
7861 *
7862 * @description
7863 * Filenames are returned in _traversal_ order by the OS/filesystem.
7864 * **Make no assumption that the names will be sorted in any fashion.**
7865 *
7866 * @public
7867 * @memberof Mocha.utils
7868 * @param {string} filepath - Base path to start searching from.
7869 * @param {string[]} [extensions=[]] - File extensions to look for.
7870 * @param {boolean} [recursive=false] - Whether to recurse into subdirectories.
7871 * @return {string[]} An array of paths.
7872 * @throws {Error} if no files match pattern.
7873 * @throws {TypeError} if `filepath` is directory and `extensions` not provided.
7874 */
7875exports.lookupFiles = function lookupFiles(filepath, extensions, recursive) {
7876 extensions = extensions || [];
7877 recursive = recursive || false;
7878 var files = [];
7879 var stat;
7880
7881 if (!fs.existsSync(filepath)) {
7882 var pattern;
7883 if (glob.hasMagic(filepath)) {
7884 // Handle glob as is without extensions
7885 pattern = filepath;
7886 } else {
7887 // glob pattern e.g. 'filepath+(.js|.ts)'
7888 var strExtensions = extensions
7889 .map(function(v) {
7890 return '.' + v;
7891 })
7892 .join('|');
7893 pattern = filepath + '+(' + strExtensions + ')';
7894 }
7895 files = glob.sync(pattern, {nodir: true});
7896 if (!files.length) {
7897 throw createNoFilesMatchPatternError(
7898 'Cannot find any files matching pattern ' + exports.dQuote(filepath),
7899 filepath
7900 );
7901 }
7902 return files;
7903 }
7904
7905 // Handle file
7906 try {
7907 stat = fs.statSync(filepath);
7908 if (stat.isFile()) {
7909 return filepath;
7910 }
7911 } catch (err) {
7912 // ignore error
7913 return;
7914 }
7915
7916 // Handle directory
7917 fs.readdirSync(filepath).forEach(function(dirent) {
7918 var pathname = path.join(filepath, dirent);
7919 var stat;
7920
7921 try {
7922 stat = fs.statSync(pathname);
7923 if (stat.isDirectory()) {
7924 if (recursive) {
7925 files = files.concat(lookupFiles(pathname, extensions, recursive));
7926 }
7927 return;
7928 }
7929 } catch (err) {
7930 // ignore error
7931 return;
7932 }
7933 if (!extensions.length) {
7934 throw createMissingArgumentError(
7935 util.format(
7936 'Argument %s required when argument %s is a directory',
7937 exports.sQuote('extensions'),
7938 exports.sQuote('filepath')
7939 ),
7940 'extensions',
7941 'array'
7942 );
7943 }
7944
7945 if (
7946 !stat.isFile() ||
7947 !hasMatchingExtname(pathname, extensions) ||
7948 isHiddenOnUnix(pathname)
7949 ) {
7950 return;
7951 }
7952 files.push(pathname);
7953 });
7954
7955 return files;
7956};
7957
7958/**
7959 * process.emitWarning or a polyfill
7960 * @see https://nodejs.org/api/process.html#process_process_emitwarning_warning_options
7961 * @ignore
7962 */
7963function emitWarning(msg, type) {
7964 if (process.emitWarning) {
7965 process.emitWarning(msg, type);
7966 } else {
7967 process.nextTick(function() {
7968 console.warn(type + ': ' + msg);
7969 });
7970 }
7971}
7972
7973/**
7974 * Show a deprecation warning. Each distinct message is only displayed once.
7975 * Ignores empty messages.
7976 *
7977 * @param {string} [msg] - Warning to print
7978 * @private
7979 */
7980exports.deprecate = function deprecate(msg) {
7981 msg = String(msg);
7982 if (msg && !deprecate.cache[msg]) {
7983 deprecate.cache[msg] = true;
7984 emitWarning(msg, 'DeprecationWarning');
7985 }
7986};
7987exports.deprecate.cache = {};
7988
7989/**
7990 * Show a generic warning.
7991 * Ignores empty messages.
7992 *
7993 * @param {string} [msg] - Warning to print
7994 * @private
7995 */
7996exports.warn = function warn(msg) {
7997 if (msg) {
7998 emitWarning(msg);
7999 }
8000};
8001
8002/**
8003 * @summary
8004 * This Filter based on `mocha-clean` module.(see: `github.com/rstacruz/mocha-clean`)
8005 * @description
8006 * When invoking this function you get a filter function that get the Error.stack as an input,
8007 * and return a prettify output.
8008 * (i.e: strip Mocha and internal node functions from stack trace).
8009 * @returns {Function}
8010 */
8011exports.stackTraceFilter = function() {
8012 // TODO: Replace with `process.browser`
8013 var is = typeof document === 'undefined' ? {node: true} : {browser: true};
8014 var slash = path.sep;
8015 var cwd;
8016 if (is.node) {
8017 cwd = process.cwd() + slash;
8018 } else {
8019 cwd = (typeof location === 'undefined'
8020 ? window.location
8021 : location
8022 ).href.replace(/\/[^/]*$/, '/');
8023 slash = '/';
8024 }
8025
8026 function isMochaInternal(line) {
8027 return (
8028 ~line.indexOf('node_modules' + slash + 'mocha' + slash) ||
8029 ~line.indexOf(slash + 'mocha.js') ||
8030 ~line.indexOf(slash + 'mocha.min.js')
8031 );
8032 }
8033
8034 function isNodeInternal(line) {
8035 return (
8036 ~line.indexOf('(timers.js:') ||
8037 ~line.indexOf('(events.js:') ||
8038 ~line.indexOf('(node.js:') ||
8039 ~line.indexOf('(module.js:') ||
8040 ~line.indexOf('GeneratorFunctionPrototype.next (native)') ||
8041 false
8042 );
8043 }
8044
8045 return function(stack) {
8046 stack = stack.split('\n');
8047
8048 stack = stack.reduce(function(list, line) {
8049 if (isMochaInternal(line)) {
8050 return list;
8051 }
8052
8053 if (is.node && isNodeInternal(line)) {
8054 return list;
8055 }
8056
8057 // Clean up cwd(absolute)
8058 if (/:\d+:\d+\)?$/.test(line)) {
8059 line = line.replace('(' + cwd, '(');
8060 }
8061
8062 list.push(line);
8063 return list;
8064 }, []);
8065
8066 return stack.join('\n');
8067 };
8068};
8069
8070/**
8071 * Crude, but effective.
8072 * @public
8073 * @param {*} value
8074 * @returns {boolean} Whether or not `value` is a Promise
8075 */
8076exports.isPromise = function isPromise(value) {
8077 return (
8078 typeof value === 'object' &&
8079 value !== null &&
8080 typeof value.then === 'function'
8081 );
8082};
8083
8084/**
8085 * Clamps a numeric value to an inclusive range.
8086 *
8087 * @param {number} value - Value to be clamped.
8088 * @param {numer[]} range - Two element array specifying [min, max] range.
8089 * @returns {number} clamped value
8090 */
8091exports.clamp = function clamp(value, range) {
8092 return Math.min(Math.max(value, range[0]), range[1]);
8093};
8094
8095/**
8096 * Single quote text by combining with undirectional ASCII quotation marks.
8097 *
8098 * @description
8099 * Provides a simple means of markup for quoting text to be used in output.
8100 * Use this to quote names of variables, methods, and packages.
8101 *
8102 * <samp>package 'foo' cannot be found</samp>
8103 *
8104 * @private
8105 * @param {string} str - Value to be quoted.
8106 * @returns {string} quoted value
8107 * @example
8108 * sQuote('n') // => 'n'
8109 */
8110exports.sQuote = function(str) {
8111 return "'" + str + "'";
8112};
8113
8114/**
8115 * Double quote text by combining with undirectional ASCII quotation marks.
8116 *
8117 * @description
8118 * Provides a simple means of markup for quoting text to be used in output.
8119 * Use this to quote names of datatypes, classes, pathnames, and strings.
8120 *
8121 * <samp>argument 'value' must be "string" or "number"</samp>
8122 *
8123 * @private
8124 * @param {string} str - Value to be quoted.
8125 * @returns {string} quoted value
8126 * @example
8127 * dQuote('number') // => "number"
8128 */
8129exports.dQuote = function(str) {
8130 return '"' + str + '"';
8131};
8132
8133/**
8134 * Provides simplistic message translation for dealing with plurality.
8135 *
8136 * @description
8137 * Use this to create messages which need to be singular or plural.
8138 * Some languages have several plural forms, so _complete_ message clauses
8139 * are preferable to generating the message on the fly.
8140 *
8141 * @private
8142 * @param {number} n - Non-negative integer
8143 * @param {string} msg1 - Message to be used in English for `n = 1`
8144 * @param {string} msg2 - Message to be used in English for `n = 0, 2, 3, ...`
8145 * @returns {string} message corresponding to value of `n`
8146 * @example
8147 * var sprintf = require('util').format;
8148 * var pkgs = ['one', 'two'];
8149 * var msg = sprintf(
8150 * ngettext(
8151 * pkgs.length,
8152 * 'cannot load package: %s',
8153 * 'cannot load packages: %s'
8154 * ),
8155 * pkgs.map(sQuote).join(', ')
8156 * );
8157 * console.log(msg); // => cannot load packages: 'one', 'two'
8158 */
8159exports.ngettext = function(n, msg1, msg2) {
8160 if (typeof n === 'number' && n >= 0) {
8161 return n === 1 ? msg1 : msg2;
8162 }
8163};
8164
8165/**
8166 * It's a noop.
8167 * @public
8168 */
8169exports.noop = function() {};
8170
8171/**
8172 * Creates a map-like object.
8173 *
8174 * @description
8175 * A "map" is an object with no prototype, for our purposes. In some cases
8176 * this would be more appropriate than a `Map`, especially if your environment
8177 * doesn't support it. Recommended for use in Mocha's public APIs.
8178 *
8179 * @public
8180 * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map|MDN:Map}
8181 * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create#Custom_and_Null_objects|MDN:Object.create - Custom objects}
8182 * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign|MDN:Object.assign}
8183 * @param {...*} [obj] - Arguments to `Object.assign()`.
8184 * @returns {Object} An object with no prototype, having `...obj` properties
8185 */
8186exports.createMap = function(obj) {
8187 return assign.apply(
8188 null,
8189 [Object.create(null)].concat(Array.prototype.slice.call(arguments))
8190 );
8191};
8192
8193/**
8194 * Creates a read-only map-like object.
8195 *
8196 * @description
8197 * This differs from {@link module:utils.createMap createMap} only in that
8198 * the argument must be non-empty, because the result is frozen.
8199 *
8200 * @see {@link module:utils.createMap createMap}
8201 * @param {...*} [obj] - Arguments to `Object.assign()`.
8202 * @returns {Object} A frozen object with no prototype, having `...obj` properties
8203 * @throws {TypeError} if argument is not a non-empty object.
8204 */
8205exports.defineConstants = function(obj) {
8206 if (type(obj) !== 'object' || !Object.keys(obj).length) {
8207 throw new TypeError('Invalid argument; expected a non-empty object');
8208 }
8209 return Object.freeze(exports.createMap(obj));
8210};
8211
8212}).call(this,require('_process'),require("buffer").Buffer)
8213},{"./errors":6,"_process":69,"buffer":43,"fs":42,"glob":42,"he":54,"object.assign":65,"path":42,"util":89}],39:[function(require,module,exports){
8214'use strict'
8215
8216exports.byteLength = byteLength
8217exports.toByteArray = toByteArray
8218exports.fromByteArray = fromByteArray
8219
8220var lookup = []
8221var revLookup = []
8222var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
8223
8224var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
8225for (var i = 0, len = code.length; i < len; ++i) {
8226 lookup[i] = code[i]
8227 revLookup[code.charCodeAt(i)] = i
8228}
8229
8230// Support decoding URL-safe base64 strings, as Node.js does.
8231// See: https://en.wikipedia.org/wiki/Base64#URL_applications
8232revLookup['-'.charCodeAt(0)] = 62
8233revLookup['_'.charCodeAt(0)] = 63
8234
8235function getLens (b64) {
8236 var len = b64.length
8237
8238 if (len % 4 > 0) {
8239 throw new Error('Invalid string. Length must be a multiple of 4')
8240 }
8241
8242 // Trim off extra bytes after placeholder bytes are found
8243 // See: https://github.com/beatgammit/base64-js/issues/42
8244 var validLen = b64.indexOf('=')
8245 if (validLen === -1) validLen = len
8246
8247 var placeHoldersLen = validLen === len
8248 ? 0
8249 : 4 - (validLen % 4)
8250
8251 return [validLen, placeHoldersLen]
8252}
8253
8254// base64 is 4/3 + up to two characters of the original data
8255function byteLength (b64) {
8256 var lens = getLens(b64)
8257 var validLen = lens[0]
8258 var placeHoldersLen = lens[1]
8259 return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
8260}
8261
8262function _byteLength (b64, validLen, placeHoldersLen) {
8263 return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
8264}
8265
8266function toByteArray (b64) {
8267 var tmp
8268 var lens = getLens(b64)
8269 var validLen = lens[0]
8270 var placeHoldersLen = lens[1]
8271
8272 var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
8273
8274 var curByte = 0
8275
8276 // if there are placeholders, only get up to the last complete 4 chars
8277 var len = placeHoldersLen > 0
8278 ? validLen - 4
8279 : validLen
8280
8281 for (var i = 0; i < len; i += 4) {
8282 tmp =
8283 (revLookup[b64.charCodeAt(i)] << 18) |
8284 (revLookup[b64.charCodeAt(i + 1)] << 12) |
8285 (revLookup[b64.charCodeAt(i + 2)] << 6) |
8286 revLookup[b64.charCodeAt(i + 3)]
8287 arr[curByte++] = (tmp >> 16) & 0xFF
8288 arr[curByte++] = (tmp >> 8) & 0xFF
8289 arr[curByte++] = tmp & 0xFF
8290 }
8291
8292 if (placeHoldersLen === 2) {
8293 tmp =
8294 (revLookup[b64.charCodeAt(i)] << 2) |
8295 (revLookup[b64.charCodeAt(i + 1)] >> 4)
8296 arr[curByte++] = tmp & 0xFF
8297 }
8298
8299 if (placeHoldersLen === 1) {
8300 tmp =
8301 (revLookup[b64.charCodeAt(i)] << 10) |
8302 (revLookup[b64.charCodeAt(i + 1)] << 4) |
8303 (revLookup[b64.charCodeAt(i + 2)] >> 2)
8304 arr[curByte++] = (tmp >> 8) & 0xFF
8305 arr[curByte++] = tmp & 0xFF
8306 }
8307
8308 return arr
8309}
8310
8311function tripletToBase64 (num) {
8312 return lookup[num >> 18 & 0x3F] +
8313 lookup[num >> 12 & 0x3F] +
8314 lookup[num >> 6 & 0x3F] +
8315 lookup[num & 0x3F]
8316}
8317
8318function encodeChunk (uint8, start, end) {
8319 var tmp
8320 var output = []
8321 for (var i = start; i < end; i += 3) {
8322 tmp =
8323 ((uint8[i] << 16) & 0xFF0000) +
8324 ((uint8[i + 1] << 8) & 0xFF00) +
8325 (uint8[i + 2] & 0xFF)
8326 output.push(tripletToBase64(tmp))
8327 }
8328 return output.join('')
8329}
8330
8331function fromByteArray (uint8) {
8332 var tmp
8333 var len = uint8.length
8334 var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
8335 var parts = []
8336 var maxChunkLength = 16383 // must be multiple of 3
8337
8338 // go through the array every three bytes, we'll deal with trailing stuff later
8339 for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
8340 parts.push(encodeChunk(
8341 uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
8342 ))
8343 }
8344
8345 // pad the end with zeros, but make sure to not forget the extra bytes
8346 if (extraBytes === 1) {
8347 tmp = uint8[len - 1]
8348 parts.push(
8349 lookup[tmp >> 2] +
8350 lookup[(tmp << 4) & 0x3F] +
8351 '=='
8352 )
8353 } else if (extraBytes === 2) {
8354 tmp = (uint8[len - 2] << 8) + uint8[len - 1]
8355 parts.push(
8356 lookup[tmp >> 10] +
8357 lookup[(tmp >> 4) & 0x3F] +
8358 lookup[(tmp << 2) & 0x3F] +
8359 '='
8360 )
8361 }
8362
8363 return parts.join('')
8364}
8365
8366},{}],40:[function(require,module,exports){
8367
8368},{}],41:[function(require,module,exports){
8369(function (process){
8370var WritableStream = require('stream').Writable
8371var inherits = require('util').inherits
8372
8373module.exports = BrowserStdout
8374
8375
8376inherits(BrowserStdout, WritableStream)
8377
8378function BrowserStdout(opts) {
8379 if (!(this instanceof BrowserStdout)) return new BrowserStdout(opts)
8380
8381 opts = opts || {}
8382 WritableStream.call(this, opts)
8383 this.label = (opts.label !== undefined) ? opts.label : 'stdout'
8384}
8385
8386BrowserStdout.prototype._write = function(chunks, encoding, cb) {
8387 var output = chunks.toString ? chunks.toString() : chunks
8388 if (this.label === false) {
8389 console.log(output)
8390 } else {
8391 console.log(this.label+':', output)
8392 }
8393 process.nextTick(cb)
8394}
8395
8396}).call(this,require('_process'))
8397},{"_process":69,"stream":84,"util":89}],42:[function(require,module,exports){
8398arguments[4][40][0].apply(exports,arguments)
8399},{"dup":40}],43:[function(require,module,exports){
8400(function (Buffer){
8401/*!
8402 * The buffer module from node.js, for the browser.
8403 *
8404 * @author Feross Aboukhadijeh <https://feross.org>
8405 * @license MIT
8406 */
8407/* eslint-disable no-proto */
8408
8409'use strict'
8410
8411var base64 = require('base64-js')
8412var ieee754 = require('ieee754')
8413
8414exports.Buffer = Buffer
8415exports.SlowBuffer = SlowBuffer
8416exports.INSPECT_MAX_BYTES = 50
8417
8418var K_MAX_LENGTH = 0x7fffffff
8419exports.kMaxLength = K_MAX_LENGTH
8420
8421/**
8422 * If `Buffer.TYPED_ARRAY_SUPPORT`:
8423 * === true Use Uint8Array implementation (fastest)
8424 * === false Print warning and recommend using `buffer` v4.x which has an Object
8425 * implementation (most compatible, even IE6)
8426 *
8427 * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
8428 * Opera 11.6+, iOS 4.2+.
8429 *
8430 * We report that the browser does not support typed arrays if the are not subclassable
8431 * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`
8432 * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support
8433 * for __proto__ and has a buggy typed array implementation.
8434 */
8435Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport()
8436
8437if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&
8438 typeof console.error === 'function') {
8439 console.error(
8440 'This browser lacks typed array (Uint8Array) support which is required by ' +
8441 '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'
8442 )
8443}
8444
8445function typedArraySupport () {
8446 // Can typed array instances can be augmented?
8447 try {
8448 var arr = new Uint8Array(1)
8449 arr.__proto__ = { __proto__: Uint8Array.prototype, foo: function () { return 42 } }
8450 return arr.foo() === 42
8451 } catch (e) {
8452 return false
8453 }
8454}
8455
8456Object.defineProperty(Buffer.prototype, 'parent', {
8457 enumerable: true,
8458 get: function () {
8459 if (!Buffer.isBuffer(this)) return undefined
8460 return this.buffer
8461 }
8462})
8463
8464Object.defineProperty(Buffer.prototype, 'offset', {
8465 enumerable: true,
8466 get: function () {
8467 if (!Buffer.isBuffer(this)) return undefined
8468 return this.byteOffset
8469 }
8470})
8471
8472function createBuffer (length) {
8473 if (length > K_MAX_LENGTH) {
8474 throw new RangeError('The value "' + length + '" is invalid for option "size"')
8475 }
8476 // Return an augmented `Uint8Array` instance
8477 var buf = new Uint8Array(length)
8478 buf.__proto__ = Buffer.prototype
8479 return buf
8480}
8481
8482/**
8483 * The Buffer constructor returns instances of `Uint8Array` that have their
8484 * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
8485 * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
8486 * and the `Uint8Array` methods. Square bracket notation works as expected -- it
8487 * returns a single octet.
8488 *
8489 * The `Uint8Array` prototype remains unmodified.
8490 */
8491
8492function Buffer (arg, encodingOrOffset, length) {
8493 // Common case.
8494 if (typeof arg === 'number') {
8495 if (typeof encodingOrOffset === 'string') {
8496 throw new TypeError(
8497 'The "string" argument must be of type string. Received type number'
8498 )
8499 }
8500 return allocUnsafe(arg)
8501 }
8502 return from(arg, encodingOrOffset, length)
8503}
8504
8505// Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
8506if (typeof Symbol !== 'undefined' && Symbol.species != null &&
8507 Buffer[Symbol.species] === Buffer) {
8508 Object.defineProperty(Buffer, Symbol.species, {
8509 value: null,
8510 configurable: true,
8511 enumerable: false,
8512 writable: false
8513 })
8514}
8515
8516Buffer.poolSize = 8192 // not used by this implementation
8517
8518function from (value, encodingOrOffset, length) {
8519 if (typeof value === 'string') {
8520 return fromString(value, encodingOrOffset)
8521 }
8522
8523 if (ArrayBuffer.isView(value)) {
8524 return fromArrayLike(value)
8525 }
8526
8527 if (value == null) {
8528 throw TypeError(
8529 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
8530 'or Array-like Object. Received type ' + (typeof value)
8531 )
8532 }
8533
8534 if (isInstance(value, ArrayBuffer) ||
8535 (value && isInstance(value.buffer, ArrayBuffer))) {
8536 return fromArrayBuffer(value, encodingOrOffset, length)
8537 }
8538
8539 if (typeof value === 'number') {
8540 throw new TypeError(
8541 'The "value" argument must not be of type number. Received type number'
8542 )
8543 }
8544
8545 var valueOf = value.valueOf && value.valueOf()
8546 if (valueOf != null && valueOf !== value) {
8547 return Buffer.from(valueOf, encodingOrOffset, length)
8548 }
8549
8550 var b = fromObject(value)
8551 if (b) return b
8552
8553 if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&
8554 typeof value[Symbol.toPrimitive] === 'function') {
8555 return Buffer.from(
8556 value[Symbol.toPrimitive]('string'), encodingOrOffset, length
8557 )
8558 }
8559
8560 throw new TypeError(
8561 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
8562 'or Array-like Object. Received type ' + (typeof value)
8563 )
8564}
8565
8566/**
8567 * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
8568 * if value is a number.
8569 * Buffer.from(str[, encoding])
8570 * Buffer.from(array)
8571 * Buffer.from(buffer)
8572 * Buffer.from(arrayBuffer[, byteOffset[, length]])
8573 **/
8574Buffer.from = function (value, encodingOrOffset, length) {
8575 return from(value, encodingOrOffset, length)
8576}
8577
8578// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:
8579// https://github.com/feross/buffer/pull/148
8580Buffer.prototype.__proto__ = Uint8Array.prototype
8581Buffer.__proto__ = Uint8Array
8582
8583function assertSize (size) {
8584 if (typeof size !== 'number') {
8585 throw new TypeError('"size" argument must be of type number')
8586 } else if (size < 0) {
8587 throw new RangeError('The value "' + size + '" is invalid for option "size"')
8588 }
8589}
8590
8591function alloc (size, fill, encoding) {
8592 assertSize(size)
8593 if (size <= 0) {
8594 return createBuffer(size)
8595 }
8596 if (fill !== undefined) {
8597 // Only pay attention to encoding if it's a string. This
8598 // prevents accidentally sending in a number that would
8599 // be interpretted as a start offset.
8600 return typeof encoding === 'string'
8601 ? createBuffer(size).fill(fill, encoding)
8602 : createBuffer(size).fill(fill)
8603 }
8604 return createBuffer(size)
8605}
8606
8607/**
8608 * Creates a new filled Buffer instance.
8609 * alloc(size[, fill[, encoding]])
8610 **/
8611Buffer.alloc = function (size, fill, encoding) {
8612 return alloc(size, fill, encoding)
8613}
8614
8615function allocUnsafe (size) {
8616 assertSize(size)
8617 return createBuffer(size < 0 ? 0 : checked(size) | 0)
8618}
8619
8620/**
8621 * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
8622 * */
8623Buffer.allocUnsafe = function (size) {
8624 return allocUnsafe(size)
8625}
8626/**
8627 * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
8628 */
8629Buffer.allocUnsafeSlow = function (size) {
8630 return allocUnsafe(size)
8631}
8632
8633function fromString (string, encoding) {
8634 if (typeof encoding !== 'string' || encoding === '') {
8635 encoding = 'utf8'
8636 }
8637
8638 if (!Buffer.isEncoding(encoding)) {
8639 throw new TypeError('Unknown encoding: ' + encoding)
8640 }
8641
8642 var length = byteLength(string, encoding) | 0
8643 var buf = createBuffer(length)
8644
8645 var actual = buf.write(string, encoding)
8646
8647 if (actual !== length) {
8648 // Writing a hex string, for example, that contains invalid characters will
8649 // cause everything after the first invalid character to be ignored. (e.g.
8650 // 'abxxcd' will be treated as 'ab')
8651 buf = buf.slice(0, actual)
8652 }
8653
8654 return buf
8655}
8656
8657function fromArrayLike (array) {
8658 var length = array.length < 0 ? 0 : checked(array.length) | 0
8659 var buf = createBuffer(length)
8660 for (var i = 0; i < length; i += 1) {
8661 buf[i] = array[i] & 255
8662 }
8663 return buf
8664}
8665
8666function fromArrayBuffer (array, byteOffset, length) {
8667 if (byteOffset < 0 || array.byteLength < byteOffset) {
8668 throw new RangeError('"offset" is outside of buffer bounds')
8669 }
8670
8671 if (array.byteLength < byteOffset + (length || 0)) {
8672 throw new RangeError('"length" is outside of buffer bounds')
8673 }
8674
8675 var buf
8676 if (byteOffset === undefined && length === undefined) {
8677 buf = new Uint8Array(array)
8678 } else if (length === undefined) {
8679 buf = new Uint8Array(array, byteOffset)
8680 } else {
8681 buf = new Uint8Array(array, byteOffset, length)
8682 }
8683
8684 // Return an augmented `Uint8Array` instance
8685 buf.__proto__ = Buffer.prototype
8686 return buf
8687}
8688
8689function fromObject (obj) {
8690 if (Buffer.isBuffer(obj)) {
8691 var len = checked(obj.length) | 0
8692 var buf = createBuffer(len)
8693
8694 if (buf.length === 0) {
8695 return buf
8696 }
8697
8698 obj.copy(buf, 0, 0, len)
8699 return buf
8700 }
8701
8702 if (obj.length !== undefined) {
8703 if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {
8704 return createBuffer(0)
8705 }
8706 return fromArrayLike(obj)
8707 }
8708
8709 if (obj.type === 'Buffer' && Array.isArray(obj.data)) {
8710 return fromArrayLike(obj.data)
8711 }
8712}
8713
8714function checked (length) {
8715 // Note: cannot use `length < K_MAX_LENGTH` here because that fails when
8716 // length is NaN (which is otherwise coerced to zero.)
8717 if (length >= K_MAX_LENGTH) {
8718 throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
8719 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')
8720 }
8721 return length | 0
8722}
8723
8724function SlowBuffer (length) {
8725 if (+length != length) { // eslint-disable-line eqeqeq
8726 length = 0
8727 }
8728 return Buffer.alloc(+length)
8729}
8730
8731Buffer.isBuffer = function isBuffer (b) {
8732 return b != null && b._isBuffer === true &&
8733 b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false
8734}
8735
8736Buffer.compare = function compare (a, b) {
8737 if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength)
8738 if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength)
8739 if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
8740 throw new TypeError(
8741 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
8742 )
8743 }
8744
8745 if (a === b) return 0
8746
8747 var x = a.length
8748 var y = b.length
8749
8750 for (var i = 0, len = Math.min(x, y); i < len; ++i) {
8751 if (a[i] !== b[i]) {
8752 x = a[i]
8753 y = b[i]
8754 break
8755 }
8756 }
8757
8758 if (x < y) return -1
8759 if (y < x) return 1
8760 return 0
8761}
8762
8763Buffer.isEncoding = function isEncoding (encoding) {
8764 switch (String(encoding).toLowerCase()) {
8765 case 'hex':
8766 case 'utf8':
8767 case 'utf-8':
8768 case 'ascii':
8769 case 'latin1':
8770 case 'binary':
8771 case 'base64':
8772 case 'ucs2':
8773 case 'ucs-2':
8774 case 'utf16le':
8775 case 'utf-16le':
8776 return true
8777 default:
8778 return false
8779 }
8780}
8781
8782Buffer.concat = function concat (list, length) {
8783 if (!Array.isArray(list)) {
8784 throw new TypeError('"list" argument must be an Array of Buffers')
8785 }
8786
8787 if (list.length === 0) {
8788 return Buffer.alloc(0)
8789 }
8790
8791 var i
8792 if (length === undefined) {
8793 length = 0
8794 for (i = 0; i < list.length; ++i) {
8795 length += list[i].length
8796 }
8797 }
8798
8799 var buffer = Buffer.allocUnsafe(length)
8800 var pos = 0
8801 for (i = 0; i < list.length; ++i) {
8802 var buf = list[i]
8803 if (isInstance(buf, Uint8Array)) {
8804 buf = Buffer.from(buf)
8805 }
8806 if (!Buffer.isBuffer(buf)) {
8807 throw new TypeError('"list" argument must be an Array of Buffers')
8808 }
8809 buf.copy(buffer, pos)
8810 pos += buf.length
8811 }
8812 return buffer
8813}
8814
8815function byteLength (string, encoding) {
8816 if (Buffer.isBuffer(string)) {
8817 return string.length
8818 }
8819 if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {
8820 return string.byteLength
8821 }
8822 if (typeof string !== 'string') {
8823 throw new TypeError(
8824 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' +
8825 'Received type ' + typeof string
8826 )
8827 }
8828
8829 var len = string.length
8830 var mustMatch = (arguments.length > 2 && arguments[2] === true)
8831 if (!mustMatch && len === 0) return 0
8832
8833 // Use a for loop to avoid recursion
8834 var loweredCase = false
8835 for (;;) {
8836 switch (encoding) {
8837 case 'ascii':
8838 case 'latin1':
8839 case 'binary':
8840 return len
8841 case 'utf8':
8842 case 'utf-8':
8843 return utf8ToBytes(string).length
8844 case 'ucs2':
8845 case 'ucs-2':
8846 case 'utf16le':
8847 case 'utf-16le':
8848 return len * 2
8849 case 'hex':
8850 return len >>> 1
8851 case 'base64':
8852 return base64ToBytes(string).length
8853 default:
8854 if (loweredCase) {
8855 return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8
8856 }
8857 encoding = ('' + encoding).toLowerCase()
8858 loweredCase = true
8859 }
8860 }
8861}
8862Buffer.byteLength = byteLength
8863
8864function slowToString (encoding, start, end) {
8865 var loweredCase = false
8866
8867 // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
8868 // property of a typed array.
8869
8870 // This behaves neither like String nor Uint8Array in that we set start/end
8871 // to their upper/lower bounds if the value passed is out of range.
8872 // undefined is handled specially as per ECMA-262 6th Edition,
8873 // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
8874 if (start === undefined || start < 0) {
8875 start = 0
8876 }
8877 // Return early if start > this.length. Done here to prevent potential uint32
8878 // coercion fail below.
8879 if (start > this.length) {
8880 return ''
8881 }
8882
8883 if (end === undefined || end > this.length) {
8884 end = this.length
8885 }
8886
8887 if (end <= 0) {
8888 return ''
8889 }
8890
8891 // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
8892 end >>>= 0
8893 start >>>= 0
8894
8895 if (end <= start) {
8896 return ''
8897 }
8898
8899 if (!encoding) encoding = 'utf8'
8900
8901 while (true) {
8902 switch (encoding) {
8903 case 'hex':
8904 return hexSlice(this, start, end)
8905
8906 case 'utf8':
8907 case 'utf-8':
8908 return utf8Slice(this, start, end)
8909
8910 case 'ascii':
8911 return asciiSlice(this, start, end)
8912
8913 case 'latin1':
8914 case 'binary':
8915 return latin1Slice(this, start, end)
8916
8917 case 'base64':
8918 return base64Slice(this, start, end)
8919
8920 case 'ucs2':
8921 case 'ucs-2':
8922 case 'utf16le':
8923 case 'utf-16le':
8924 return utf16leSlice(this, start, end)
8925
8926 default:
8927 if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
8928 encoding = (encoding + '').toLowerCase()
8929 loweredCase = true
8930 }
8931 }
8932}
8933
8934// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)
8935// to detect a Buffer instance. It's not possible to use `instanceof Buffer`
8936// reliably in a browserify context because there could be multiple different
8937// copies of the 'buffer' package in use. This method works even for Buffer
8938// instances that were created from another copy of the `buffer` package.
8939// See: https://github.com/feross/buffer/issues/154
8940Buffer.prototype._isBuffer = true
8941
8942function swap (b, n, m) {
8943 var i = b[n]
8944 b[n] = b[m]
8945 b[m] = i
8946}
8947
8948Buffer.prototype.swap16 = function swap16 () {
8949 var len = this.length
8950 if (len % 2 !== 0) {
8951 throw new RangeError('Buffer size must be a multiple of 16-bits')
8952 }
8953 for (var i = 0; i < len; i += 2) {
8954 swap(this, i, i + 1)
8955 }
8956 return this
8957}
8958
8959Buffer.prototype.swap32 = function swap32 () {
8960 var len = this.length
8961 if (len % 4 !== 0) {
8962 throw new RangeError('Buffer size must be a multiple of 32-bits')
8963 }
8964 for (var i = 0; i < len; i += 4) {
8965 swap(this, i, i + 3)
8966 swap(this, i + 1, i + 2)
8967 }
8968 return this
8969}
8970
8971Buffer.prototype.swap64 = function swap64 () {
8972 var len = this.length
8973 if (len % 8 !== 0) {
8974 throw new RangeError('Buffer size must be a multiple of 64-bits')
8975 }
8976 for (var i = 0; i < len; i += 8) {
8977 swap(this, i, i + 7)
8978 swap(this, i + 1, i + 6)
8979 swap(this, i + 2, i + 5)
8980 swap(this, i + 3, i + 4)
8981 }
8982 return this
8983}
8984
8985Buffer.prototype.toString = function toString () {
8986 var length = this.length
8987 if (length === 0) return ''
8988 if (arguments.length === 0) return utf8Slice(this, 0, length)
8989 return slowToString.apply(this, arguments)
8990}
8991
8992Buffer.prototype.toLocaleString = Buffer.prototype.toString
8993
8994Buffer.prototype.equals = function equals (b) {
8995 if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
8996 if (this === b) return true
8997 return Buffer.compare(this, b) === 0
8998}
8999
9000Buffer.prototype.inspect = function inspect () {
9001 var str = ''
9002 var max = exports.INSPECT_MAX_BYTES
9003 str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()
9004 if (this.length > max) str += ' ... '
9005 return '<Buffer ' + str + '>'
9006}
9007
9008Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
9009 if (isInstance(target, Uint8Array)) {
9010 target = Buffer.from(target, target.offset, target.byteLength)
9011 }
9012 if (!Buffer.isBuffer(target)) {
9013 throw new TypeError(
9014 'The "target" argument must be one of type Buffer or Uint8Array. ' +
9015 'Received type ' + (typeof target)
9016 )
9017 }
9018
9019 if (start === undefined) {
9020 start = 0
9021 }
9022 if (end === undefined) {
9023 end = target ? target.length : 0
9024 }
9025 if (thisStart === undefined) {
9026 thisStart = 0
9027 }
9028 if (thisEnd === undefined) {
9029 thisEnd = this.length
9030 }
9031
9032 if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
9033 throw new RangeError('out of range index')
9034 }
9035
9036 if (thisStart >= thisEnd && start >= end) {
9037 return 0
9038 }
9039 if (thisStart >= thisEnd) {
9040 return -1
9041 }
9042 if (start >= end) {
9043 return 1
9044 }
9045
9046 start >>>= 0
9047 end >>>= 0
9048 thisStart >>>= 0
9049 thisEnd >>>= 0
9050
9051 if (this === target) return 0
9052
9053 var x = thisEnd - thisStart
9054 var y = end - start
9055 var len = Math.min(x, y)
9056
9057 var thisCopy = this.slice(thisStart, thisEnd)
9058 var targetCopy = target.slice(start, end)
9059
9060 for (var i = 0; i < len; ++i) {
9061 if (thisCopy[i] !== targetCopy[i]) {
9062 x = thisCopy[i]
9063 y = targetCopy[i]
9064 break
9065 }
9066 }
9067
9068 if (x < y) return -1
9069 if (y < x) return 1
9070 return 0
9071}
9072
9073// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
9074// OR the last index of `val` in `buffer` at offset <= `byteOffset`.
9075//
9076// Arguments:
9077// - buffer - a Buffer to search
9078// - val - a string, Buffer, or number
9079// - byteOffset - an index into `buffer`; will be clamped to an int32
9080// - encoding - an optional encoding, relevant is val is a string
9081// - dir - true for indexOf, false for lastIndexOf
9082function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
9083 // Empty buffer means no match
9084 if (buffer.length === 0) return -1
9085
9086 // Normalize byteOffset
9087 if (typeof byteOffset === 'string') {
9088 encoding = byteOffset
9089 byteOffset = 0
9090 } else if (byteOffset > 0x7fffffff) {
9091 byteOffset = 0x7fffffff
9092 } else if (byteOffset < -0x80000000) {
9093 byteOffset = -0x80000000
9094 }
9095 byteOffset = +byteOffset // Coerce to Number.
9096 if (numberIsNaN(byteOffset)) {
9097 // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
9098 byteOffset = dir ? 0 : (buffer.length - 1)
9099 }
9100
9101 // Normalize byteOffset: negative offsets start from the end of the buffer
9102 if (byteOffset < 0) byteOffset = buffer.length + byteOffset
9103 if (byteOffset >= buffer.length) {
9104 if (dir) return -1
9105 else byteOffset = buffer.length - 1
9106 } else if (byteOffset < 0) {
9107 if (dir) byteOffset = 0
9108 else return -1
9109 }
9110
9111 // Normalize val
9112 if (typeof val === 'string') {
9113 val = Buffer.from(val, encoding)
9114 }
9115
9116 // Finally, search either indexOf (if dir is true) or lastIndexOf
9117 if (Buffer.isBuffer(val)) {
9118 // Special case: looking for empty string/buffer always fails
9119 if (val.length === 0) {
9120 return -1
9121 }
9122 return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
9123 } else if (typeof val === 'number') {
9124 val = val & 0xFF // Search for a byte value [0-255]
9125 if (typeof Uint8Array.prototype.indexOf === 'function') {
9126 if (dir) {
9127 return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
9128 } else {
9129 return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
9130 }
9131 }
9132 return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
9133 }
9134
9135 throw new TypeError('val must be string, number or Buffer')
9136}
9137
9138function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
9139 var indexSize = 1
9140 var arrLength = arr.length
9141 var valLength = val.length
9142
9143 if (encoding !== undefined) {
9144 encoding = String(encoding).toLowerCase()
9145 if (encoding === 'ucs2' || encoding === 'ucs-2' ||
9146 encoding === 'utf16le' || encoding === 'utf-16le') {
9147 if (arr.length < 2 || val.length < 2) {
9148 return -1
9149 }
9150 indexSize = 2
9151 arrLength /= 2
9152 valLength /= 2
9153 byteOffset /= 2
9154 }
9155 }
9156
9157 function read (buf, i) {
9158 if (indexSize === 1) {
9159 return buf[i]
9160 } else {
9161 return buf.readUInt16BE(i * indexSize)
9162 }
9163 }
9164
9165 var i
9166 if (dir) {
9167 var foundIndex = -1
9168 for (i = byteOffset; i < arrLength; i++) {
9169 if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
9170 if (foundIndex === -1) foundIndex = i
9171 if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
9172 } else {
9173 if (foundIndex !== -1) i -= i - foundIndex
9174 foundIndex = -1
9175 }
9176 }
9177 } else {
9178 if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
9179 for (i = byteOffset; i >= 0; i--) {
9180 var found = true
9181 for (var j = 0; j < valLength; j++) {
9182 if (read(arr, i + j) !== read(val, j)) {
9183 found = false
9184 break
9185 }
9186 }
9187 if (found) return i
9188 }
9189 }
9190
9191 return -1
9192}
9193
9194Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
9195 return this.indexOf(val, byteOffset, encoding) !== -1
9196}
9197
9198Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
9199 return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
9200}
9201
9202Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
9203 return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
9204}
9205
9206function hexWrite (buf, string, offset, length) {
9207 offset = Number(offset) || 0
9208 var remaining = buf.length - offset
9209 if (!length) {
9210 length = remaining
9211 } else {
9212 length = Number(length)
9213 if (length > remaining) {
9214 length = remaining
9215 }
9216 }
9217
9218 var strLen = string.length
9219
9220 if (length > strLen / 2) {
9221 length = strLen / 2
9222 }
9223 for (var i = 0; i < length; ++i) {
9224 var parsed = parseInt(string.substr(i * 2, 2), 16)
9225 if (numberIsNaN(parsed)) return i
9226 buf[offset + i] = parsed
9227 }
9228 return i
9229}
9230
9231function utf8Write (buf, string, offset, length) {
9232 return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
9233}
9234
9235function asciiWrite (buf, string, offset, length) {
9236 return blitBuffer(asciiToBytes(string), buf, offset, length)
9237}
9238
9239function latin1Write (buf, string, offset, length) {
9240 return asciiWrite(buf, string, offset, length)
9241}
9242
9243function base64Write (buf, string, offset, length) {
9244 return blitBuffer(base64ToBytes(string), buf, offset, length)
9245}
9246
9247function ucs2Write (buf, string, offset, length) {
9248 return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
9249}
9250
9251Buffer.prototype.write = function write (string, offset, length, encoding) {
9252 // Buffer#write(string)
9253 if (offset === undefined) {
9254 encoding = 'utf8'
9255 length = this.length
9256 offset = 0
9257 // Buffer#write(string, encoding)
9258 } else if (length === undefined && typeof offset === 'string') {
9259 encoding = offset
9260 length = this.length
9261 offset = 0
9262 // Buffer#write(string, offset[, length][, encoding])
9263 } else if (isFinite(offset)) {
9264 offset = offset >>> 0
9265 if (isFinite(length)) {
9266 length = length >>> 0
9267 if (encoding === undefined) encoding = 'utf8'
9268 } else {
9269 encoding = length
9270 length = undefined
9271 }
9272 } else {
9273 throw new Error(
9274 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
9275 )
9276 }
9277
9278 var remaining = this.length - offset
9279 if (length === undefined || length > remaining) length = remaining
9280
9281 if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
9282 throw new RangeError('Attempt to write outside buffer bounds')
9283 }
9284
9285 if (!encoding) encoding = 'utf8'
9286
9287 var loweredCase = false
9288 for (;;) {
9289 switch (encoding) {
9290 case 'hex':
9291 return hexWrite(this, string, offset, length)
9292
9293 case 'utf8':
9294 case 'utf-8':
9295 return utf8Write(this, string, offset, length)
9296
9297 case 'ascii':
9298 return asciiWrite(this, string, offset, length)
9299
9300 case 'latin1':
9301 case 'binary':
9302 return latin1Write(this, string, offset, length)
9303
9304 case 'base64':
9305 // Warning: maxLength not taken into account in base64Write
9306 return base64Write(this, string, offset, length)
9307
9308 case 'ucs2':
9309 case 'ucs-2':
9310 case 'utf16le':
9311 case 'utf-16le':
9312 return ucs2Write(this, string, offset, length)
9313
9314 default:
9315 if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
9316 encoding = ('' + encoding).toLowerCase()
9317 loweredCase = true
9318 }
9319 }
9320}
9321
9322Buffer.prototype.toJSON = function toJSON () {
9323 return {
9324 type: 'Buffer',
9325 data: Array.prototype.slice.call(this._arr || this, 0)
9326 }
9327}
9328
9329function base64Slice (buf, start, end) {
9330 if (start === 0 && end === buf.length) {
9331 return base64.fromByteArray(buf)
9332 } else {
9333 return base64.fromByteArray(buf.slice(start, end))
9334 }
9335}
9336
9337function utf8Slice (buf, start, end) {
9338 end = Math.min(buf.length, end)
9339 var res = []
9340
9341 var i = start
9342 while (i < end) {
9343 var firstByte = buf[i]
9344 var codePoint = null
9345 var bytesPerSequence = (firstByte > 0xEF) ? 4
9346 : (firstByte > 0xDF) ? 3
9347 : (firstByte > 0xBF) ? 2
9348 : 1
9349
9350 if (i + bytesPerSequence <= end) {
9351 var secondByte, thirdByte, fourthByte, tempCodePoint
9352
9353 switch (bytesPerSequence) {
9354 case 1:
9355 if (firstByte < 0x80) {
9356 codePoint = firstByte
9357 }
9358 break
9359 case 2:
9360 secondByte = buf[i + 1]
9361 if ((secondByte & 0xC0) === 0x80) {
9362 tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
9363 if (tempCodePoint > 0x7F) {
9364 codePoint = tempCodePoint
9365 }
9366 }
9367 break
9368 case 3:
9369 secondByte = buf[i + 1]
9370 thirdByte = buf[i + 2]
9371 if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
9372 tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
9373 if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
9374 codePoint = tempCodePoint
9375 }
9376 }
9377 break
9378 case 4:
9379 secondByte = buf[i + 1]
9380 thirdByte = buf[i + 2]
9381 fourthByte = buf[i + 3]
9382 if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
9383 tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
9384 if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
9385 codePoint = tempCodePoint
9386 }
9387 }
9388 }
9389 }
9390
9391 if (codePoint === null) {
9392 // we did not generate a valid codePoint so insert a
9393 // replacement char (U+FFFD) and advance only 1 byte
9394 codePoint = 0xFFFD
9395 bytesPerSequence = 1
9396 } else if (codePoint > 0xFFFF) {
9397 // encode to utf16 (surrogate pair dance)
9398 codePoint -= 0x10000
9399 res.push(codePoint >>> 10 & 0x3FF | 0xD800)
9400 codePoint = 0xDC00 | codePoint & 0x3FF
9401 }
9402
9403 res.push(codePoint)
9404 i += bytesPerSequence
9405 }
9406
9407 return decodeCodePointsArray(res)
9408}
9409
9410// Based on http://stackoverflow.com/a/22747272/680742, the browser with
9411// the lowest limit is Chrome, with 0x10000 args.
9412// We go 1 magnitude less, for safety
9413var MAX_ARGUMENTS_LENGTH = 0x1000
9414
9415function decodeCodePointsArray (codePoints) {
9416 var len = codePoints.length
9417 if (len <= MAX_ARGUMENTS_LENGTH) {
9418 return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
9419 }
9420
9421 // Decode in chunks to avoid "call stack size exceeded".
9422 var res = ''
9423 var i = 0
9424 while (i < len) {
9425 res += String.fromCharCode.apply(
9426 String,
9427 codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
9428 )
9429 }
9430 return res
9431}
9432
9433function asciiSlice (buf, start, end) {
9434 var ret = ''
9435 end = Math.min(buf.length, end)
9436
9437 for (var i = start; i < end; ++i) {
9438 ret += String.fromCharCode(buf[i] & 0x7F)
9439 }
9440 return ret
9441}
9442
9443function latin1Slice (buf, start, end) {
9444 var ret = ''
9445 end = Math.min(buf.length, end)
9446
9447 for (var i = start; i < end; ++i) {
9448 ret += String.fromCharCode(buf[i])
9449 }
9450 return ret
9451}
9452
9453function hexSlice (buf, start, end) {
9454 var len = buf.length
9455
9456 if (!start || start < 0) start = 0
9457 if (!end || end < 0 || end > len) end = len
9458
9459 var out = ''
9460 for (var i = start; i < end; ++i) {
9461 out += toHex(buf[i])
9462 }
9463 return out
9464}
9465
9466function utf16leSlice (buf, start, end) {
9467 var bytes = buf.slice(start, end)
9468 var res = ''
9469 for (var i = 0; i < bytes.length; i += 2) {
9470 res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))
9471 }
9472 return res
9473}
9474
9475Buffer.prototype.slice = function slice (start, end) {
9476 var len = this.length
9477 start = ~~start
9478 end = end === undefined ? len : ~~end
9479
9480 if (start < 0) {
9481 start += len
9482 if (start < 0) start = 0
9483 } else if (start > len) {
9484 start = len
9485 }
9486
9487 if (end < 0) {
9488 end += len
9489 if (end < 0) end = 0
9490 } else if (end > len) {
9491 end = len
9492 }
9493
9494 if (end < start) end = start
9495
9496 var newBuf = this.subarray(start, end)
9497 // Return an augmented `Uint8Array` instance
9498 newBuf.__proto__ = Buffer.prototype
9499 return newBuf
9500}
9501
9502/*
9503 * Need to make sure that buffer isn't trying to write out of bounds.
9504 */
9505function checkOffset (offset, ext, length) {
9506 if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
9507 if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
9508}
9509
9510Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
9511 offset = offset >>> 0
9512 byteLength = byteLength >>> 0
9513 if (!noAssert) checkOffset(offset, byteLength, this.length)
9514
9515 var val = this[offset]
9516 var mul = 1
9517 var i = 0
9518 while (++i < byteLength && (mul *= 0x100)) {
9519 val += this[offset + i] * mul
9520 }
9521
9522 return val
9523}
9524
9525Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
9526 offset = offset >>> 0
9527 byteLength = byteLength >>> 0
9528 if (!noAssert) {
9529 checkOffset(offset, byteLength, this.length)
9530 }
9531
9532 var val = this[offset + --byteLength]
9533 var mul = 1
9534 while (byteLength > 0 && (mul *= 0x100)) {
9535 val += this[offset + --byteLength] * mul
9536 }
9537
9538 return val
9539}
9540
9541Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
9542 offset = offset >>> 0
9543 if (!noAssert) checkOffset(offset, 1, this.length)
9544 return this[offset]
9545}
9546
9547Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
9548 offset = offset >>> 0
9549 if (!noAssert) checkOffset(offset, 2, this.length)
9550 return this[offset] | (this[offset + 1] << 8)
9551}
9552
9553Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
9554 offset = offset >>> 0
9555 if (!noAssert) checkOffset(offset, 2, this.length)
9556 return (this[offset] << 8) | this[offset + 1]
9557}
9558
9559Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
9560 offset = offset >>> 0
9561 if (!noAssert) checkOffset(offset, 4, this.length)
9562
9563 return ((this[offset]) |
9564 (this[offset + 1] << 8) |
9565 (this[offset + 2] << 16)) +
9566 (this[offset + 3] * 0x1000000)
9567}
9568
9569Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
9570 offset = offset >>> 0
9571 if (!noAssert) checkOffset(offset, 4, this.length)
9572
9573 return (this[offset] * 0x1000000) +
9574 ((this[offset + 1] << 16) |
9575 (this[offset + 2] << 8) |
9576 this[offset + 3])
9577}
9578
9579Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
9580 offset = offset >>> 0
9581 byteLength = byteLength >>> 0
9582 if (!noAssert) checkOffset(offset, byteLength, this.length)
9583
9584 var val = this[offset]
9585 var mul = 1
9586 var i = 0
9587 while (++i < byteLength && (mul *= 0x100)) {
9588 val += this[offset + i] * mul
9589 }
9590 mul *= 0x80
9591
9592 if (val >= mul) val -= Math.pow(2, 8 * byteLength)
9593
9594 return val
9595}
9596
9597Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
9598 offset = offset >>> 0
9599 byteLength = byteLength >>> 0
9600 if (!noAssert) checkOffset(offset, byteLength, this.length)
9601
9602 var i = byteLength
9603 var mul = 1
9604 var val = this[offset + --i]
9605 while (i > 0 && (mul *= 0x100)) {
9606 val += this[offset + --i] * mul
9607 }
9608 mul *= 0x80
9609
9610 if (val >= mul) val -= Math.pow(2, 8 * byteLength)
9611
9612 return val
9613}
9614
9615Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
9616 offset = offset >>> 0
9617 if (!noAssert) checkOffset(offset, 1, this.length)
9618 if (!(this[offset] & 0x80)) return (this[offset])
9619 return ((0xff - this[offset] + 1) * -1)
9620}
9621
9622Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
9623 offset = offset >>> 0
9624 if (!noAssert) checkOffset(offset, 2, this.length)
9625 var val = this[offset] | (this[offset + 1] << 8)
9626 return (val & 0x8000) ? val | 0xFFFF0000 : val
9627}
9628
9629Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
9630 offset = offset >>> 0
9631 if (!noAssert) checkOffset(offset, 2, this.length)
9632 var val = this[offset + 1] | (this[offset] << 8)
9633 return (val & 0x8000) ? val | 0xFFFF0000 : val
9634}
9635
9636Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
9637 offset = offset >>> 0
9638 if (!noAssert) checkOffset(offset, 4, this.length)
9639
9640 return (this[offset]) |
9641 (this[offset + 1] << 8) |
9642 (this[offset + 2] << 16) |
9643 (this[offset + 3] << 24)
9644}
9645
9646Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
9647 offset = offset >>> 0
9648 if (!noAssert) checkOffset(offset, 4, this.length)
9649
9650 return (this[offset] << 24) |
9651 (this[offset + 1] << 16) |
9652 (this[offset + 2] << 8) |
9653 (this[offset + 3])
9654}
9655
9656Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
9657 offset = offset >>> 0
9658 if (!noAssert) checkOffset(offset, 4, this.length)
9659 return ieee754.read(this, offset, true, 23, 4)
9660}
9661
9662Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
9663 offset = offset >>> 0
9664 if (!noAssert) checkOffset(offset, 4, this.length)
9665 return ieee754.read(this, offset, false, 23, 4)
9666}
9667
9668Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
9669 offset = offset >>> 0
9670 if (!noAssert) checkOffset(offset, 8, this.length)
9671 return ieee754.read(this, offset, true, 52, 8)
9672}
9673
9674Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
9675 offset = offset >>> 0
9676 if (!noAssert) checkOffset(offset, 8, this.length)
9677 return ieee754.read(this, offset, false, 52, 8)
9678}
9679
9680function checkInt (buf, value, offset, ext, max, min) {
9681 if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
9682 if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
9683 if (offset + ext > buf.length) throw new RangeError('Index out of range')
9684}
9685
9686Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
9687 value = +value
9688 offset = offset >>> 0
9689 byteLength = byteLength >>> 0
9690 if (!noAssert) {
9691 var maxBytes = Math.pow(2, 8 * byteLength) - 1
9692 checkInt(this, value, offset, byteLength, maxBytes, 0)
9693 }
9694
9695 var mul = 1
9696 var i = 0
9697 this[offset] = value & 0xFF
9698 while (++i < byteLength && (mul *= 0x100)) {
9699 this[offset + i] = (value / mul) & 0xFF
9700 }
9701
9702 return offset + byteLength
9703}
9704
9705Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
9706 value = +value
9707 offset = offset >>> 0
9708 byteLength = byteLength >>> 0
9709 if (!noAssert) {
9710 var maxBytes = Math.pow(2, 8 * byteLength) - 1
9711 checkInt(this, value, offset, byteLength, maxBytes, 0)
9712 }
9713
9714 var i = byteLength - 1
9715 var mul = 1
9716 this[offset + i] = value & 0xFF
9717 while (--i >= 0 && (mul *= 0x100)) {
9718 this[offset + i] = (value / mul) & 0xFF
9719 }
9720
9721 return offset + byteLength
9722}
9723
9724Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
9725 value = +value
9726 offset = offset >>> 0
9727 if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
9728 this[offset] = (value & 0xff)
9729 return offset + 1
9730}
9731
9732Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
9733 value = +value
9734 offset = offset >>> 0
9735 if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
9736 this[offset] = (value & 0xff)
9737 this[offset + 1] = (value >>> 8)
9738 return offset + 2
9739}
9740
9741Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
9742 value = +value
9743 offset = offset >>> 0
9744 if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
9745 this[offset] = (value >>> 8)
9746 this[offset + 1] = (value & 0xff)
9747 return offset + 2
9748}
9749
9750Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
9751 value = +value
9752 offset = offset >>> 0
9753 if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
9754 this[offset + 3] = (value >>> 24)
9755 this[offset + 2] = (value >>> 16)
9756 this[offset + 1] = (value >>> 8)
9757 this[offset] = (value & 0xff)
9758 return offset + 4
9759}
9760
9761Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
9762 value = +value
9763 offset = offset >>> 0
9764 if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
9765 this[offset] = (value >>> 24)
9766 this[offset + 1] = (value >>> 16)
9767 this[offset + 2] = (value >>> 8)
9768 this[offset + 3] = (value & 0xff)
9769 return offset + 4
9770}
9771
9772Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
9773 value = +value
9774 offset = offset >>> 0
9775 if (!noAssert) {
9776 var limit = Math.pow(2, (8 * byteLength) - 1)
9777
9778 checkInt(this, value, offset, byteLength, limit - 1, -limit)
9779 }
9780
9781 var i = 0
9782 var mul = 1
9783 var sub = 0
9784 this[offset] = value & 0xFF
9785 while (++i < byteLength && (mul *= 0x100)) {
9786 if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
9787 sub = 1
9788 }
9789 this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
9790 }
9791
9792 return offset + byteLength
9793}
9794
9795Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
9796 value = +value
9797 offset = offset >>> 0
9798 if (!noAssert) {
9799 var limit = Math.pow(2, (8 * byteLength) - 1)
9800
9801 checkInt(this, value, offset, byteLength, limit - 1, -limit)
9802 }
9803
9804 var i = byteLength - 1
9805 var mul = 1
9806 var sub = 0
9807 this[offset + i] = value & 0xFF
9808 while (--i >= 0 && (mul *= 0x100)) {
9809 if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
9810 sub = 1
9811 }
9812 this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
9813 }
9814
9815 return offset + byteLength
9816}
9817
9818Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
9819 value = +value
9820 offset = offset >>> 0
9821 if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
9822 if (value < 0) value = 0xff + value + 1
9823 this[offset] = (value & 0xff)
9824 return offset + 1
9825}
9826
9827Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
9828 value = +value
9829 offset = offset >>> 0
9830 if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
9831 this[offset] = (value & 0xff)
9832 this[offset + 1] = (value >>> 8)
9833 return offset + 2
9834}
9835
9836Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
9837 value = +value
9838 offset = offset >>> 0
9839 if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
9840 this[offset] = (value >>> 8)
9841 this[offset + 1] = (value & 0xff)
9842 return offset + 2
9843}
9844
9845Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
9846 value = +value
9847 offset = offset >>> 0
9848 if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
9849 this[offset] = (value & 0xff)
9850 this[offset + 1] = (value >>> 8)
9851 this[offset + 2] = (value >>> 16)
9852 this[offset + 3] = (value >>> 24)
9853 return offset + 4
9854}
9855
9856Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
9857 value = +value
9858 offset = offset >>> 0
9859 if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
9860 if (value < 0) value = 0xffffffff + value + 1
9861 this[offset] = (value >>> 24)
9862 this[offset + 1] = (value >>> 16)
9863 this[offset + 2] = (value >>> 8)
9864 this[offset + 3] = (value & 0xff)
9865 return offset + 4
9866}
9867
9868function checkIEEE754 (buf, value, offset, ext, max, min) {
9869 if (offset + ext > buf.length) throw new RangeError('Index out of range')
9870 if (offset < 0) throw new RangeError('Index out of range')
9871}
9872
9873function writeFloat (buf, value, offset, littleEndian, noAssert) {
9874 value = +value
9875 offset = offset >>> 0
9876 if (!noAssert) {
9877 checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
9878 }
9879 ieee754.write(buf, value, offset, littleEndian, 23, 4)
9880 return offset + 4
9881}
9882
9883Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
9884 return writeFloat(this, value, offset, true, noAssert)
9885}
9886
9887Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
9888 return writeFloat(this, value, offset, false, noAssert)
9889}
9890
9891function writeDouble (buf, value, offset, littleEndian, noAssert) {
9892 value = +value
9893 offset = offset >>> 0
9894 if (!noAssert) {
9895 checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
9896 }
9897 ieee754.write(buf, value, offset, littleEndian, 52, 8)
9898 return offset + 8
9899}
9900
9901Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
9902 return writeDouble(this, value, offset, true, noAssert)
9903}
9904
9905Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
9906 return writeDouble(this, value, offset, false, noAssert)
9907}
9908
9909// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
9910Buffer.prototype.copy = function copy (target, targetStart, start, end) {
9911 if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')
9912 if (!start) start = 0
9913 if (!end && end !== 0) end = this.length
9914 if (targetStart >= target.length) targetStart = target.length
9915 if (!targetStart) targetStart = 0
9916 if (end > 0 && end < start) end = start
9917
9918 // Copy 0 bytes; we're done
9919 if (end === start) return 0
9920 if (target.length === 0 || this.length === 0) return 0
9921
9922 // Fatal error conditions
9923 if (targetStart < 0) {
9924 throw new RangeError('targetStart out of bounds')
9925 }
9926 if (start < 0 || start >= this.length) throw new RangeError('Index out of range')
9927 if (end < 0) throw new RangeError('sourceEnd out of bounds')
9928
9929 // Are we oob?
9930 if (end > this.length) end = this.length
9931 if (target.length - targetStart < end - start) {
9932 end = target.length - targetStart + start
9933 }
9934
9935 var len = end - start
9936
9937 if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {
9938 // Use built-in when available, missing from IE11
9939 this.copyWithin(targetStart, start, end)
9940 } else if (this === target && start < targetStart && targetStart < end) {
9941 // descending copy from end
9942 for (var i = len - 1; i >= 0; --i) {
9943 target[i + targetStart] = this[i + start]
9944 }
9945 } else {
9946 Uint8Array.prototype.set.call(
9947 target,
9948 this.subarray(start, end),
9949 targetStart
9950 )
9951 }
9952
9953 return len
9954}
9955
9956// Usage:
9957// buffer.fill(number[, offset[, end]])
9958// buffer.fill(buffer[, offset[, end]])
9959// buffer.fill(string[, offset[, end]][, encoding])
9960Buffer.prototype.fill = function fill (val, start, end, encoding) {
9961 // Handle string cases:
9962 if (typeof val === 'string') {
9963 if (typeof start === 'string') {
9964 encoding = start
9965 start = 0
9966 end = this.length
9967 } else if (typeof end === 'string') {
9968 encoding = end
9969 end = this.length
9970 }
9971 if (encoding !== undefined && typeof encoding !== 'string') {
9972 throw new TypeError('encoding must be a string')
9973 }
9974 if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
9975 throw new TypeError('Unknown encoding: ' + encoding)
9976 }
9977 if (val.length === 1) {
9978 var code = val.charCodeAt(0)
9979 if ((encoding === 'utf8' && code < 128) ||
9980 encoding === 'latin1') {
9981 // Fast path: If `val` fits into a single byte, use that numeric value.
9982 val = code
9983 }
9984 }
9985 } else if (typeof val === 'number') {
9986 val = val & 255
9987 }
9988
9989 // Invalid ranges are not set to a default, so can range check early.
9990 if (start < 0 || this.length < start || this.length < end) {
9991 throw new RangeError('Out of range index')
9992 }
9993
9994 if (end <= start) {
9995 return this
9996 }
9997
9998 start = start >>> 0
9999 end = end === undefined ? this.length : end >>> 0
10000
10001 if (!val) val = 0
10002
10003 var i
10004 if (typeof val === 'number') {
10005 for (i = start; i < end; ++i) {
10006 this[i] = val
10007 }
10008 } else {
10009 var bytes = Buffer.isBuffer(val)
10010 ? val
10011 : Buffer.from(val, encoding)
10012 var len = bytes.length
10013 if (len === 0) {
10014 throw new TypeError('The value "' + val +
10015 '" is invalid for argument "value"')
10016 }
10017 for (i = 0; i < end - start; ++i) {
10018 this[i + start] = bytes[i % len]
10019 }
10020 }
10021
10022 return this
10023}
10024
10025// HELPER FUNCTIONS
10026// ================
10027
10028var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g
10029
10030function base64clean (str) {
10031 // Node takes equal signs as end of the Base64 encoding
10032 str = str.split('=')[0]
10033 // Node strips out invalid characters like \n and \t from the string, base64-js does not
10034 str = str.trim().replace(INVALID_BASE64_RE, '')
10035 // Node converts strings with length < 2 to ''
10036 if (str.length < 2) return ''
10037 // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
10038 while (str.length % 4 !== 0) {
10039 str = str + '='
10040 }
10041 return str
10042}
10043
10044function toHex (n) {
10045 if (n < 16) return '0' + n.toString(16)
10046 return n.toString(16)
10047}
10048
10049function utf8ToBytes (string, units) {
10050 units = units || Infinity
10051 var codePoint
10052 var length = string.length
10053 var leadSurrogate = null
10054 var bytes = []
10055
10056 for (var i = 0; i < length; ++i) {
10057 codePoint = string.charCodeAt(i)
10058
10059 // is surrogate component
10060 if (codePoint > 0xD7FF && codePoint < 0xE000) {
10061 // last char was a lead
10062 if (!leadSurrogate) {
10063 // no lead yet
10064 if (codePoint > 0xDBFF) {
10065 // unexpected trail
10066 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
10067 continue
10068 } else if (i + 1 === length) {
10069 // unpaired lead
10070 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
10071 continue
10072 }
10073
10074 // valid lead
10075 leadSurrogate = codePoint
10076
10077 continue
10078 }
10079
10080 // 2 leads in a row
10081 if (codePoint < 0xDC00) {
10082 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
10083 leadSurrogate = codePoint
10084 continue
10085 }
10086
10087 // valid surrogate pair
10088 codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
10089 } else if (leadSurrogate) {
10090 // valid bmp char, but last char was a lead
10091 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
10092 }
10093
10094 leadSurrogate = null
10095
10096 // encode utf8
10097 if (codePoint < 0x80) {
10098 if ((units -= 1) < 0) break
10099 bytes.push(codePoint)
10100 } else if (codePoint < 0x800) {
10101 if ((units -= 2) < 0) break
10102 bytes.push(
10103 codePoint >> 0x6 | 0xC0,
10104 codePoint & 0x3F | 0x80
10105 )
10106 } else if (codePoint < 0x10000) {
10107 if ((units -= 3) < 0) break
10108 bytes.push(
10109 codePoint >> 0xC | 0xE0,
10110 codePoint >> 0x6 & 0x3F | 0x80,
10111 codePoint & 0x3F | 0x80
10112 )
10113 } else if (codePoint < 0x110000) {
10114 if ((units -= 4) < 0) break
10115 bytes.push(
10116 codePoint >> 0x12 | 0xF0,
10117 codePoint >> 0xC & 0x3F | 0x80,
10118 codePoint >> 0x6 & 0x3F | 0x80,
10119 codePoint & 0x3F | 0x80
10120 )
10121 } else {
10122 throw new Error('Invalid code point')
10123 }
10124 }
10125
10126 return bytes
10127}
10128
10129function asciiToBytes (str) {
10130 var byteArray = []
10131 for (var i = 0; i < str.length; ++i) {
10132 // Node's code seems to be doing this and not & 0x7F..
10133 byteArray.push(str.charCodeAt(i) & 0xFF)
10134 }
10135 return byteArray
10136}
10137
10138function utf16leToBytes (str, units) {
10139 var c, hi, lo
10140 var byteArray = []
10141 for (var i = 0; i < str.length; ++i) {
10142 if ((units -= 2) < 0) break
10143
10144 c = str.charCodeAt(i)
10145 hi = c >> 8
10146 lo = c % 256
10147 byteArray.push(lo)
10148 byteArray.push(hi)
10149 }
10150
10151 return byteArray
10152}
10153
10154function base64ToBytes (str) {
10155 return base64.toByteArray(base64clean(str))
10156}
10157
10158function blitBuffer (src, dst, offset, length) {
10159 for (var i = 0; i < length; ++i) {
10160 if ((i + offset >= dst.length) || (i >= src.length)) break
10161 dst[i + offset] = src[i]
10162 }
10163 return i
10164}
10165
10166// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass
10167// the `instanceof` check but they should be treated as of that type.
10168// See: https://github.com/feross/buffer/issues/166
10169function isInstance (obj, type) {
10170 return obj instanceof type ||
10171 (obj != null && obj.constructor != null && obj.constructor.name != null &&
10172 obj.constructor.name === type.name)
10173}
10174function numberIsNaN (obj) {
10175 // For IE11 support
10176 return obj !== obj // eslint-disable-line no-self-compare
10177}
10178
10179}).call(this,require("buffer").Buffer)
10180},{"base64-js":39,"buffer":43,"ieee754":55}],44:[function(require,module,exports){
10181(function (Buffer){
10182// Copyright Joyent, Inc. and other Node contributors.
10183//
10184// Permission is hereby granted, free of charge, to any person obtaining a
10185// copy of this software and associated documentation files (the
10186// "Software"), to deal in the Software without restriction, including
10187// without limitation the rights to use, copy, modify, merge, publish,
10188// distribute, sublicense, and/or sell copies of the Software, and to permit
10189// persons to whom the Software is furnished to do so, subject to the
10190// following conditions:
10191//
10192// The above copyright notice and this permission notice shall be included
10193// in all copies or substantial portions of the Software.
10194//
10195// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
10196// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
10197// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
10198// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
10199// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
10200// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
10201// USE OR OTHER DEALINGS IN THE SOFTWARE.
10202
10203// NOTE: These type checking functions intentionally don't use `instanceof`
10204// because it is fragile and can be easily faked with `Object.create()`.
10205
10206function isArray(arg) {
10207 if (Array.isArray) {
10208 return Array.isArray(arg);
10209 }
10210 return objectToString(arg) === '[object Array]';
10211}
10212exports.isArray = isArray;
10213
10214function isBoolean(arg) {
10215 return typeof arg === 'boolean';
10216}
10217exports.isBoolean = isBoolean;
10218
10219function isNull(arg) {
10220 return arg === null;
10221}
10222exports.isNull = isNull;
10223
10224function isNullOrUndefined(arg) {
10225 return arg == null;
10226}
10227exports.isNullOrUndefined = isNullOrUndefined;
10228
10229function isNumber(arg) {
10230 return typeof arg === 'number';
10231}
10232exports.isNumber = isNumber;
10233
10234function isString(arg) {
10235 return typeof arg === 'string';
10236}
10237exports.isString = isString;
10238
10239function isSymbol(arg) {
10240 return typeof arg === 'symbol';
10241}
10242exports.isSymbol = isSymbol;
10243
10244function isUndefined(arg) {
10245 return arg === void 0;
10246}
10247exports.isUndefined = isUndefined;
10248
10249function isRegExp(re) {
10250 return objectToString(re) === '[object RegExp]';
10251}
10252exports.isRegExp = isRegExp;
10253
10254function isObject(arg) {
10255 return typeof arg === 'object' && arg !== null;
10256}
10257exports.isObject = isObject;
10258
10259function isDate(d) {
10260 return objectToString(d) === '[object Date]';
10261}
10262exports.isDate = isDate;
10263
10264function isError(e) {
10265 return (objectToString(e) === '[object Error]' || e instanceof Error);
10266}
10267exports.isError = isError;
10268
10269function isFunction(arg) {
10270 return typeof arg === 'function';
10271}
10272exports.isFunction = isFunction;
10273
10274function isPrimitive(arg) {
10275 return arg === null ||
10276 typeof arg === 'boolean' ||
10277 typeof arg === 'number' ||
10278 typeof arg === 'string' ||
10279 typeof arg === 'symbol' || // ES6 symbol
10280 typeof arg === 'undefined';
10281}
10282exports.isPrimitive = isPrimitive;
10283
10284exports.isBuffer = Buffer.isBuffer;
10285
10286function objectToString(o) {
10287 return Object.prototype.toString.call(o);
10288}
10289
10290}).call(this,{"isBuffer":require("../../is-buffer/index.js")})
10291},{"../../is-buffer/index.js":57}],45:[function(require,module,exports){
10292(function (process){
10293"use strict";
10294
10295function _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); }
10296
10297/* eslint-env browser */
10298
10299/**
10300 * This is the web browser implementation of `debug()`.
10301 */
10302exports.log = log;
10303exports.formatArgs = formatArgs;
10304exports.save = save;
10305exports.load = load;
10306exports.useColors = useColors;
10307exports.storage = localstorage();
10308/**
10309 * Colors.
10310 */
10311
10312exports.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'];
10313/**
10314 * Currently only WebKit-based Web Inspectors, Firefox >= v31,
10315 * and the Firebug extension (any Firefox version) are known
10316 * to support "%c" CSS customizations.
10317 *
10318 * TODO: add a `localStorage` variable to explicitly enable/disable colors
10319 */
10320// eslint-disable-next-line complexity
10321
10322function useColors() {
10323 // NB: In an Electron preload script, document will be defined but not fully
10324 // initialized. Since we know we're in Chrome, we'll just detect this case
10325 // explicitly
10326 if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
10327 return true;
10328 } // Internet Explorer and Edge do not support colors.
10329
10330
10331 if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
10332 return false;
10333 } // Is webkit? http://stackoverflow.com/a/16459606/376773
10334 // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
10335
10336
10337 return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
10338 typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
10339 // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
10340 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
10341 typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
10342}
10343/**
10344 * Colorize log arguments if enabled.
10345 *
10346 * @api public
10347 */
10348
10349
10350function formatArgs(args) {
10351 args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);
10352
10353 if (!this.useColors) {
10354 return;
10355 }
10356
10357 var c = 'color: ' + this.color;
10358 args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other
10359 // arguments passed either before or after the %c, so we need to
10360 // figure out the correct index to insert the CSS into
10361
10362 var index = 0;
10363 var lastC = 0;
10364 args[0].replace(/%[a-zA-Z%]/g, function (match) {
10365 if (match === '%%') {
10366 return;
10367 }
10368
10369 index++;
10370
10371 if (match === '%c') {
10372 // We only are interested in the *last* %c
10373 // (the user may have provided their own)
10374 lastC = index;
10375 }
10376 });
10377 args.splice(lastC, 0, c);
10378}
10379/**
10380 * Invokes `console.log()` when available.
10381 * No-op when `console.log` is not a "function".
10382 *
10383 * @api public
10384 */
10385
10386
10387function log() {
10388 var _console;
10389
10390 // This hackery is required for IE8/9, where
10391 // the `console.log` function doesn't have 'apply'
10392 return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments);
10393}
10394/**
10395 * Save `namespaces`.
10396 *
10397 * @param {String} namespaces
10398 * @api private
10399 */
10400
10401
10402function save(namespaces) {
10403 try {
10404 if (namespaces) {
10405 exports.storage.setItem('debug', namespaces);
10406 } else {
10407 exports.storage.removeItem('debug');
10408 }
10409 } catch (error) {// Swallow
10410 // XXX (@Qix-) should we be logging these?
10411 }
10412}
10413/**
10414 * Load `namespaces`.
10415 *
10416 * @return {String} returns the previously persisted debug modes
10417 * @api private
10418 */
10419
10420
10421function load() {
10422 var r;
10423
10424 try {
10425 r = exports.storage.getItem('debug');
10426 } catch (error) {} // Swallow
10427 // XXX (@Qix-) should we be logging these?
10428 // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
10429
10430
10431 if (!r && typeof process !== 'undefined' && 'env' in process) {
10432 r = process.env.DEBUG;
10433 }
10434
10435 return r;
10436}
10437/**
10438 * Localstorage attempts to return the localstorage.
10439 *
10440 * This is necessary because safari throws
10441 * when a user disables cookies/localstorage
10442 * and you attempt to access it.
10443 *
10444 * @return {LocalStorage}
10445 * @api private
10446 */
10447
10448
10449function localstorage() {
10450 try {
10451 // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
10452 // The Browser also has localStorage in the global context.
10453 return localStorage;
10454 } catch (error) {// Swallow
10455 // XXX (@Qix-) should we be logging these?
10456 }
10457}
10458
10459module.exports = require('./common')(exports);
10460var formatters = module.exports.formatters;
10461/**
10462 * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
10463 */
10464
10465formatters.j = function (v) {
10466 try {
10467 return JSON.stringify(v);
10468 } catch (error) {
10469 return '[UnexpectedJSONParseError]: ' + error.message;
10470 }
10471};
10472
10473
10474}).call(this,require('_process'))
10475},{"./common":46,"_process":69}],46:[function(require,module,exports){
10476"use strict";
10477
10478/**
10479 * This is the common logic for both the Node.js and web browser
10480 * implementations of `debug()`.
10481 */
10482function setup(env) {
10483 createDebug.debug = createDebug;
10484 createDebug.default = createDebug;
10485 createDebug.coerce = coerce;
10486 createDebug.disable = disable;
10487 createDebug.enable = enable;
10488 createDebug.enabled = enabled;
10489 createDebug.humanize = require('ms');
10490 Object.keys(env).forEach(function (key) {
10491 createDebug[key] = env[key];
10492 });
10493 /**
10494 * Active `debug` instances.
10495 */
10496
10497 createDebug.instances = [];
10498 /**
10499 * The currently active debug mode names, and names to skip.
10500 */
10501
10502 createDebug.names = [];
10503 createDebug.skips = [];
10504 /**
10505 * Map of special "%n" handling functions, for the debug "format" argument.
10506 *
10507 * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
10508 */
10509
10510 createDebug.formatters = {};
10511 /**
10512 * Selects a color for a debug namespace
10513 * @param {String} namespace The namespace string for the for the debug instance to be colored
10514 * @return {Number|String} An ANSI color code for the given namespace
10515 * @api private
10516 */
10517
10518 function selectColor(namespace) {
10519 var hash = 0;
10520
10521 for (var i = 0; i < namespace.length; i++) {
10522 hash = (hash << 5) - hash + namespace.charCodeAt(i);
10523 hash |= 0; // Convert to 32bit integer
10524 }
10525
10526 return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
10527 }
10528
10529 createDebug.selectColor = selectColor;
10530 /**
10531 * Create a debugger with the given `namespace`.
10532 *
10533 * @param {String} namespace
10534 * @return {Function}
10535 * @api public
10536 */
10537
10538 function createDebug(namespace) {
10539 var prevTime;
10540
10541 function debug() {
10542 // Disabled?
10543 if (!debug.enabled) {
10544 return;
10545 }
10546
10547 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
10548 args[_key] = arguments[_key];
10549 }
10550
10551 var self = debug; // Set `diff` timestamp
10552
10553 var curr = Number(new Date());
10554 var ms = curr - (prevTime || curr);
10555 self.diff = ms;
10556 self.prev = prevTime;
10557 self.curr = curr;
10558 prevTime = curr;
10559 args[0] = createDebug.coerce(args[0]);
10560
10561 if (typeof args[0] !== 'string') {
10562 // Anything else let's inspect with %O
10563 args.unshift('%O');
10564 } // Apply any `formatters` transformations
10565
10566
10567 var index = 0;
10568 args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {
10569 // If we encounter an escaped % then don't increase the array index
10570 if (match === '%%') {
10571 return match;
10572 }
10573
10574 index++;
10575 var formatter = createDebug.formatters[format];
10576
10577 if (typeof formatter === 'function') {
10578 var val = args[index];
10579 match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format`
10580
10581 args.splice(index, 1);
10582 index--;
10583 }
10584
10585 return match;
10586 }); // Apply env-specific formatting (colors, etc.)
10587
10588 createDebug.formatArgs.call(self, args);
10589 var logFn = self.log || createDebug.log;
10590 logFn.apply(self, args);
10591 }
10592
10593 debug.namespace = namespace;
10594 debug.enabled = createDebug.enabled(namespace);
10595 debug.useColors = createDebug.useColors();
10596 debug.color = selectColor(namespace);
10597 debug.destroy = destroy;
10598 debug.extend = extend; // Debug.formatArgs = formatArgs;
10599 // debug.rawLog = rawLog;
10600 // env-specific initialization logic for debug instances
10601
10602 if (typeof createDebug.init === 'function') {
10603 createDebug.init(debug);
10604 }
10605
10606 createDebug.instances.push(debug);
10607 return debug;
10608 }
10609
10610 function destroy() {
10611 var index = createDebug.instances.indexOf(this);
10612
10613 if (index !== -1) {
10614 createDebug.instances.splice(index, 1);
10615 return true;
10616 }
10617
10618 return false;
10619 }
10620
10621 function extend(namespace, delimiter) {
10622 return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
10623 }
10624 /**
10625 * Enables a debug mode by namespaces. This can include modes
10626 * separated by a colon and wildcards.
10627 *
10628 * @param {String} namespaces
10629 * @api public
10630 */
10631
10632
10633 function enable(namespaces) {
10634 createDebug.save(namespaces);
10635 createDebug.names = [];
10636 createDebug.skips = [];
10637 var i;
10638 var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
10639 var len = split.length;
10640
10641 for (i = 0; i < len; i++) {
10642 if (!split[i]) {
10643 // ignore empty strings
10644 continue;
10645 }
10646
10647 namespaces = split[i].replace(/\*/g, '.*?');
10648
10649 if (namespaces[0] === '-') {
10650 createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
10651 } else {
10652 createDebug.names.push(new RegExp('^' + namespaces + '$'));
10653 }
10654 }
10655
10656 for (i = 0; i < createDebug.instances.length; i++) {
10657 var instance = createDebug.instances[i];
10658 instance.enabled = createDebug.enabled(instance.namespace);
10659 }
10660 }
10661 /**
10662 * Disable debug output.
10663 *
10664 * @api public
10665 */
10666
10667
10668 function disable() {
10669 createDebug.enable('');
10670 }
10671 /**
10672 * Returns true if the given mode name is enabled, false otherwise.
10673 *
10674 * @param {String} name
10675 * @return {Boolean}
10676 * @api public
10677 */
10678
10679
10680 function enabled(name) {
10681 if (name[name.length - 1] === '*') {
10682 return true;
10683 }
10684
10685 var i;
10686 var len;
10687
10688 for (i = 0, len = createDebug.skips.length; i < len; i++) {
10689 if (createDebug.skips[i].test(name)) {
10690 return false;
10691 }
10692 }
10693
10694 for (i = 0, len = createDebug.names.length; i < len; i++) {
10695 if (createDebug.names[i].test(name)) {
10696 return true;
10697 }
10698 }
10699
10700 return false;
10701 }
10702 /**
10703 * Coerce `val`.
10704 *
10705 * @param {Mixed} val
10706 * @return {Mixed}
10707 * @api private
10708 */
10709
10710
10711 function coerce(val) {
10712 if (val instanceof Error) {
10713 return val.stack || val.message;
10714 }
10715
10716 return val;
10717 }
10718
10719 createDebug.enable(createDebug.load());
10720 return createDebug;
10721}
10722
10723module.exports = setup;
10724
10725
10726},{"ms":60}],47:[function(require,module,exports){
10727'use strict';
10728
10729var keys = require('object-keys');
10730var hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol';
10731
10732var toStr = Object.prototype.toString;
10733var concat = Array.prototype.concat;
10734var origDefineProperty = Object.defineProperty;
10735
10736var isFunction = function (fn) {
10737 return typeof fn === 'function' && toStr.call(fn) === '[object Function]';
10738};
10739
10740var arePropertyDescriptorsSupported = function () {
10741 var obj = {};
10742 try {
10743 origDefineProperty(obj, 'x', { enumerable: false, value: obj });
10744 // eslint-disable-next-line no-unused-vars, no-restricted-syntax
10745 for (var _ in obj) { // jscs:ignore disallowUnusedVariables
10746 return false;
10747 }
10748 return obj.x === obj;
10749 } catch (e) { /* this is IE 8. */
10750 return false;
10751 }
10752};
10753var supportsDescriptors = origDefineProperty && arePropertyDescriptorsSupported();
10754
10755var defineProperty = function (object, name, value, predicate) {
10756 if (name in object && (!isFunction(predicate) || !predicate())) {
10757 return;
10758 }
10759 if (supportsDescriptors) {
10760 origDefineProperty(object, name, {
10761 configurable: true,
10762 enumerable: false,
10763 value: value,
10764 writable: true
10765 });
10766 } else {
10767 object[name] = value;
10768 }
10769};
10770
10771var defineProperties = function (object, map) {
10772 var predicates = arguments.length > 2 ? arguments[2] : {};
10773 var props = keys(map);
10774 if (hasSymbols) {
10775 props = concat.call(props, Object.getOwnPropertySymbols(map));
10776 }
10777 for (var i = 0; i < props.length; i += 1) {
10778 defineProperty(object, props[i], map[props[i]], predicates[props[i]]);
10779 }
10780};
10781
10782defineProperties.supportsDescriptors = !!supportsDescriptors;
10783
10784module.exports = defineProperties;
10785
10786},{"object-keys":62}],48:[function(require,module,exports){
10787/*!
10788
10789 diff v3.5.0
10790
10791Software License Agreement (BSD License)
10792
10793Copyright (c) 2009-2015, Kevin Decker <kpdecker@gmail.com>
10794
10795All rights reserved.
10796
10797Redistribution and use of this software in source and binary forms, with or without modification,
10798are permitted provided that the following conditions are met:
10799
10800* Redistributions of source code must retain the above
10801 copyright notice, this list of conditions and the
10802 following disclaimer.
10803
10804* Redistributions in binary form must reproduce the above
10805 copyright notice, this list of conditions and the
10806 following disclaimer in the documentation and/or other
10807 materials provided with the distribution.
10808
10809* Neither the name of Kevin Decker nor the names of its
10810 contributors may be used to endorse or promote products
10811 derived from this software without specific prior
10812 written permission.
10813
10814THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
10815IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
10816FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
10817CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
10818DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
10819DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
10820IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
10821OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
10822@license
10823*/
10824(function webpackUniversalModuleDefinition(root, factory) {
10825 if(typeof exports === 'object' && typeof module === 'object')
10826 module.exports = factory();
10827 else if(false)
10828 define([], factory);
10829 else if(typeof exports === 'object')
10830 exports["JsDiff"] = factory();
10831 else
10832 root["JsDiff"] = factory();
10833})(this, function() {
10834return /******/ (function(modules) { // webpackBootstrap
10835/******/ // The module cache
10836/******/ var installedModules = {};
10837
10838/******/ // The require function
10839/******/ function __webpack_require__(moduleId) {
10840
10841/******/ // Check if module is in cache
10842/******/ if(installedModules[moduleId])
10843/******/ return installedModules[moduleId].exports;
10844
10845/******/ // Create a new module (and put it into the cache)
10846/******/ var module = installedModules[moduleId] = {
10847/******/ exports: {},
10848/******/ id: moduleId,
10849/******/ loaded: false
10850/******/ };
10851
10852/******/ // Execute the module function
10853/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
10854
10855/******/ // Flag the module as loaded
10856/******/ module.loaded = true;
10857
10858/******/ // Return the exports of the module
10859/******/ return module.exports;
10860/******/ }
10861
10862
10863/******/ // expose the modules object (__webpack_modules__)
10864/******/ __webpack_require__.m = modules;
10865
10866/******/ // expose the module cache
10867/******/ __webpack_require__.c = installedModules;
10868
10869/******/ // __webpack_public_path__
10870/******/ __webpack_require__.p = "";
10871
10872/******/ // Load entry module and return exports
10873/******/ return __webpack_require__(0);
10874/******/ })
10875/************************************************************************/
10876/******/ ([
10877/* 0 */
10878/***/ (function(module, exports, __webpack_require__) {
10879
10880 /*istanbul ignore start*/'use strict';
10881
10882 exports.__esModule = true;
10883 exports.canonicalize = exports.convertChangesToXML = exports.convertChangesToDMP = exports.merge = exports.parsePatch = exports.applyPatches = exports.applyPatch = exports.createPatch = exports.createTwoFilesPatch = exports.structuredPatch = exports.diffArrays = exports.diffJson = exports.diffCss = exports.diffSentences = exports.diffTrimmedLines = exports.diffLines = exports.diffWordsWithSpace = exports.diffWords = exports.diffChars = exports.Diff = undefined;
10884
10885 /*istanbul ignore end*/var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
10886
10887 /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
10888
10889 /*istanbul ignore end*/var /*istanbul ignore start*/_character = __webpack_require__(2) /*istanbul ignore end*/;
10890
10891 var /*istanbul ignore start*/_word = __webpack_require__(3) /*istanbul ignore end*/;
10892
10893 var /*istanbul ignore start*/_line = __webpack_require__(5) /*istanbul ignore end*/;
10894
10895 var /*istanbul ignore start*/_sentence = __webpack_require__(6) /*istanbul ignore end*/;
10896
10897 var /*istanbul ignore start*/_css = __webpack_require__(7) /*istanbul ignore end*/;
10898
10899 var /*istanbul ignore start*/_json = __webpack_require__(8) /*istanbul ignore end*/;
10900
10901 var /*istanbul ignore start*/_array = __webpack_require__(9) /*istanbul ignore end*/;
10902
10903 var /*istanbul ignore start*/_apply = __webpack_require__(10) /*istanbul ignore end*/;
10904
10905 var /*istanbul ignore start*/_parse = __webpack_require__(11) /*istanbul ignore end*/;
10906
10907 var /*istanbul ignore start*/_merge = __webpack_require__(13) /*istanbul ignore end*/;
10908
10909 var /*istanbul ignore start*/_create = __webpack_require__(14) /*istanbul ignore end*/;
10910
10911 var /*istanbul ignore start*/_dmp = __webpack_require__(16) /*istanbul ignore end*/;
10912
10913 var /*istanbul ignore start*/_xml = __webpack_require__(17) /*istanbul ignore end*/;
10914
10915 /*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
10916
10917 /* See LICENSE file for terms of use */
10918
10919 /*
10920 * Text diff implementation.
10921 *
10922 * This library supports the following APIS:
10923 * JsDiff.diffChars: Character by character diff
10924 * JsDiff.diffWords: Word (as defined by \b regex) diff which ignores whitespace
10925 * JsDiff.diffLines: Line based diff
10926 *
10927 * JsDiff.diffCss: Diff targeted at CSS content
10928 *
10929 * These methods are based on the implementation proposed in
10930 * "An O(ND) Difference Algorithm and its Variations" (Myers, 1986).
10931 * http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927
10932 */
10933 exports. /*istanbul ignore end*/Diff = _base2['default'];
10934 /*istanbul ignore start*/exports. /*istanbul ignore end*/diffChars = _character.diffChars;
10935 /*istanbul ignore start*/exports. /*istanbul ignore end*/diffWords = _word.diffWords;
10936 /*istanbul ignore start*/exports. /*istanbul ignore end*/diffWordsWithSpace = _word.diffWordsWithSpace;
10937 /*istanbul ignore start*/exports. /*istanbul ignore end*/diffLines = _line.diffLines;
10938 /*istanbul ignore start*/exports. /*istanbul ignore end*/diffTrimmedLines = _line.diffTrimmedLines;
10939 /*istanbul ignore start*/exports. /*istanbul ignore end*/diffSentences = _sentence.diffSentences;
10940 /*istanbul ignore start*/exports. /*istanbul ignore end*/diffCss = _css.diffCss;
10941 /*istanbul ignore start*/exports. /*istanbul ignore end*/diffJson = _json.diffJson;
10942 /*istanbul ignore start*/exports. /*istanbul ignore end*/diffArrays = _array.diffArrays;
10943 /*istanbul ignore start*/exports. /*istanbul ignore end*/structuredPatch = _create.structuredPatch;
10944 /*istanbul ignore start*/exports. /*istanbul ignore end*/createTwoFilesPatch = _create.createTwoFilesPatch;
10945 /*istanbul ignore start*/exports. /*istanbul ignore end*/createPatch = _create.createPatch;
10946 /*istanbul ignore start*/exports. /*istanbul ignore end*/applyPatch = _apply.applyPatch;
10947 /*istanbul ignore start*/exports. /*istanbul ignore end*/applyPatches = _apply.applyPatches;
10948 /*istanbul ignore start*/exports. /*istanbul ignore end*/parsePatch = _parse.parsePatch;
10949 /*istanbul ignore start*/exports. /*istanbul ignore end*/merge = _merge.merge;
10950 /*istanbul ignore start*/exports. /*istanbul ignore end*/convertChangesToDMP = _dmp.convertChangesToDMP;
10951 /*istanbul ignore start*/exports. /*istanbul ignore end*/convertChangesToXML = _xml.convertChangesToXML;
10952 /*istanbul ignore start*/exports. /*istanbul ignore end*/canonicalize = _json.canonicalize;
10953
10954
10955
10956/***/ }),
10957/* 1 */
10958/***/ (function(module, exports) {
10959
10960 /*istanbul ignore start*/'use strict';
10961
10962 exports.__esModule = true;
10963 exports['default'] = /*istanbul ignore end*/Diff;
10964 function Diff() {}
10965
10966 Diff.prototype = {
10967 /*istanbul ignore start*/ /*istanbul ignore end*/diff: function diff(oldString, newString) {
10968 /*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
10969
10970 var callback = options.callback;
10971 if (typeof options === 'function') {
10972 callback = options;
10973 options = {};
10974 }
10975 this.options = options;
10976
10977 var self = this;
10978
10979 function done(value) {
10980 if (callback) {
10981 setTimeout(function () {
10982 callback(undefined, value);
10983 }, 0);
10984 return true;
10985 } else {
10986 return value;
10987 }
10988 }
10989
10990 // Allow subclasses to massage the input prior to running
10991 oldString = this.castInput(oldString);
10992 newString = this.castInput(newString);
10993
10994 oldString = this.removeEmpty(this.tokenize(oldString));
10995 newString = this.removeEmpty(this.tokenize(newString));
10996
10997 var newLen = newString.length,
10998 oldLen = oldString.length;
10999 var editLength = 1;
11000 var maxEditLength = newLen + oldLen;
11001 var bestPath = [{ newPos: -1, components: [] }];
11002
11003 // Seed editLength = 0, i.e. the content starts with the same values
11004 var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
11005 if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
11006 // Identity per the equality and tokenizer
11007 return done([{ value: this.join(newString), count: newString.length }]);
11008 }
11009
11010 // Main worker method. checks all permutations of a given edit length for acceptance.
11011 function execEditLength() {
11012 for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) {
11013 var basePath = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
11014 var addPath = bestPath[diagonalPath - 1],
11015 removePath = bestPath[diagonalPath + 1],
11016 _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
11017 if (addPath) {
11018 // No one else is going to attempt to use this value, clear it
11019 bestPath[diagonalPath - 1] = undefined;
11020 }
11021
11022 var canAdd = addPath && addPath.newPos + 1 < newLen,
11023 canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen;
11024 if (!canAdd && !canRemove) {
11025 // If this path is a terminal then prune
11026 bestPath[diagonalPath] = undefined;
11027 continue;
11028 }
11029
11030 // Select the diagonal that we want to branch from. We select the prior
11031 // path whose position in the new string is the farthest from the origin
11032 // and does not pass the bounds of the diff graph
11033 if (!canAdd || canRemove && addPath.newPos < removePath.newPos) {
11034 basePath = clonePath(removePath);
11035 self.pushComponent(basePath.components, undefined, true);
11036 } else {
11037 basePath = addPath; // No need to clone, we've pulled it from the list
11038 basePath.newPos++;
11039 self.pushComponent(basePath.components, true, undefined);
11040 }
11041
11042 _oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath);
11043
11044 // If we have hit the end of both strings, then we are done
11045 if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) {
11046 return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken));
11047 } else {
11048 // Otherwise track this path as a potential candidate and continue.
11049 bestPath[diagonalPath] = basePath;
11050 }
11051 }
11052
11053 editLength++;
11054 }
11055
11056 // Performs the length of edit iteration. Is a bit fugly as this has to support the
11057 // sync and async mode which is never fun. Loops over execEditLength until a value
11058 // is produced.
11059 if (callback) {
11060 (function exec() {
11061 setTimeout(function () {
11062 // This should not happen, but we want to be safe.
11063 /* istanbul ignore next */
11064 if (editLength > maxEditLength) {
11065 return callback();
11066 }
11067
11068 if (!execEditLength()) {
11069 exec();
11070 }
11071 }, 0);
11072 })();
11073 } else {
11074 while (editLength <= maxEditLength) {
11075 var ret = execEditLength();
11076 if (ret) {
11077 return ret;
11078 }
11079 }
11080 }
11081 },
11082 /*istanbul ignore start*/ /*istanbul ignore end*/pushComponent: function pushComponent(components, added, removed) {
11083 var last = components[components.length - 1];
11084 if (last && last.added === added && last.removed === removed) {
11085 // We need to clone here as the component clone operation is just
11086 // as shallow array clone
11087 components[components.length - 1] = { count: last.count + 1, added: added, removed: removed };
11088 } else {
11089 components.push({ count: 1, added: added, removed: removed });
11090 }
11091 },
11092 /*istanbul ignore start*/ /*istanbul ignore end*/extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) {
11093 var newLen = newString.length,
11094 oldLen = oldString.length,
11095 newPos = basePath.newPos,
11096 oldPos = newPos - diagonalPath,
11097 commonCount = 0;
11098 while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
11099 newPos++;
11100 oldPos++;
11101 commonCount++;
11102 }
11103
11104 if (commonCount) {
11105 basePath.components.push({ count: commonCount });
11106 }
11107
11108 basePath.newPos = newPos;
11109 return oldPos;
11110 },
11111 /*istanbul ignore start*/ /*istanbul ignore end*/equals: function equals(left, right) {
11112 if (this.options.comparator) {
11113 return this.options.comparator(left, right);
11114 } else {
11115 return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase();
11116 }
11117 },
11118 /*istanbul ignore start*/ /*istanbul ignore end*/removeEmpty: function removeEmpty(array) {
11119 var ret = [];
11120 for (var i = 0; i < array.length; i++) {
11121 if (array[i]) {
11122 ret.push(array[i]);
11123 }
11124 }
11125 return ret;
11126 },
11127 /*istanbul ignore start*/ /*istanbul ignore end*/castInput: function castInput(value) {
11128 return value;
11129 },
11130 /*istanbul ignore start*/ /*istanbul ignore end*/tokenize: function tokenize(value) {
11131 return value.split('');
11132 },
11133 /*istanbul ignore start*/ /*istanbul ignore end*/join: function join(chars) {
11134 return chars.join('');
11135 }
11136 };
11137
11138 function buildValues(diff, components, newString, oldString, useLongestToken) {
11139 var componentPos = 0,
11140 componentLen = components.length,
11141 newPos = 0,
11142 oldPos = 0;
11143
11144 for (; componentPos < componentLen; componentPos++) {
11145 var component = components[componentPos];
11146 if (!component.removed) {
11147 if (!component.added && useLongestToken) {
11148 var value = newString.slice(newPos, newPos + component.count);
11149 value = value.map(function (value, i) {
11150 var oldValue = oldString[oldPos + i];
11151 return oldValue.length > value.length ? oldValue : value;
11152 });
11153
11154 component.value = diff.join(value);
11155 } else {
11156 component.value = diff.join(newString.slice(newPos, newPos + component.count));
11157 }
11158 newPos += component.count;
11159
11160 // Common case
11161 if (!component.added) {
11162 oldPos += component.count;
11163 }
11164 } else {
11165 component.value = diff.join(oldString.slice(oldPos, oldPos + component.count));
11166 oldPos += component.count;
11167
11168 // Reverse add and remove so removes are output first to match common convention
11169 // The diffing algorithm is tied to add then remove output and this is the simplest
11170 // route to get the desired output with minimal overhead.
11171 if (componentPos && components[componentPos - 1].added) {
11172 var tmp = components[componentPos - 1];
11173 components[componentPos - 1] = components[componentPos];
11174 components[componentPos] = tmp;
11175 }
11176 }
11177 }
11178
11179 // Special case handle for when one terminal is ignored (i.e. whitespace).
11180 // For this case we merge the terminal into the prior string and drop the change.
11181 // This is only available for string mode.
11182 var lastComponent = components[componentLen - 1];
11183 if (componentLen > 1 && typeof lastComponent.value === 'string' && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) {
11184 components[componentLen - 2].value += lastComponent.value;
11185 components.pop();
11186 }
11187
11188 return components;
11189 }
11190
11191 function clonePath(path) {
11192 return { newPos: path.newPos, components: path.components.slice(0) };
11193 }
11194
11195
11196
11197/***/ }),
11198/* 2 */
11199/***/ (function(module, exports, __webpack_require__) {
11200
11201 /*istanbul ignore start*/'use strict';
11202
11203 exports.__esModule = true;
11204 exports.characterDiff = undefined;
11205 exports. /*istanbul ignore end*/diffChars = diffChars;
11206
11207 var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
11208
11209 /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
11210
11211 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
11212
11213 /*istanbul ignore end*/var characterDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/characterDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
11214 function diffChars(oldStr, newStr, options) {
11215 return characterDiff.diff(oldStr, newStr, options);
11216 }
11217
11218
11219
11220/***/ }),
11221/* 3 */
11222/***/ (function(module, exports, __webpack_require__) {
11223
11224 /*istanbul ignore start*/'use strict';
11225
11226 exports.__esModule = true;
11227 exports.wordDiff = undefined;
11228 exports. /*istanbul ignore end*/diffWords = diffWords;
11229 /*istanbul ignore start*/exports. /*istanbul ignore end*/diffWordsWithSpace = diffWordsWithSpace;
11230
11231 var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
11232
11233 /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
11234
11235 /*istanbul ignore end*/var /*istanbul ignore start*/_params = __webpack_require__(4) /*istanbul ignore end*/;
11236
11237 /*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
11238
11239 /*istanbul ignore end*/ // Based on https://en.wikipedia.org/wiki/Latin_script_in_Unicode
11240 //
11241 // Ranges and exceptions:
11242 // Latin-1 Supplement, 0080–00FF
11243 // - U+00D7 × Multiplication sign
11244 // - U+00F7 ÷ Division sign
11245 // Latin Extended-A, 0100–017F
11246 // Latin Extended-B, 0180–024F
11247 // IPA Extensions, 0250–02AF
11248 // Spacing Modifier Letters, 02B0–02FF
11249 // - U+02C7 ˇ &#711; Caron
11250 // - U+02D8 ˘ &#728; Breve
11251 // - U+02D9 ˙ &#729; Dot Above
11252 // - U+02DA ˚ &#730; Ring Above
11253 // - U+02DB ˛ &#731; Ogonek
11254 // - U+02DC ˜ &#732; Small Tilde
11255 // - U+02DD ˝ &#733; Double Acute Accent
11256 // Latin Extended Additional, 1E00–1EFF
11257 var extendedWordChars = /^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/;
11258
11259 var reWhitespace = /\S/;
11260
11261 var wordDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/wordDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
11262 wordDiff.equals = function (left, right) {
11263 if (this.options.ignoreCase) {
11264 left = left.toLowerCase();
11265 right = right.toLowerCase();
11266 }
11267 return left === right || this.options.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right);
11268 };
11269 wordDiff.tokenize = function (value) {
11270 var tokens = value.split(/(\s+|\b)/);
11271
11272 // Join the boundary splits that we do not consider to be boundaries. This is primarily the extended Latin character set.
11273 for (var i = 0; i < tokens.length - 1; i++) {
11274 // If we have an empty string in the next field and we have only word chars before and after, merge
11275 if (!tokens[i + 1] && tokens[i + 2] && extendedWordChars.test(tokens[i]) && extendedWordChars.test(tokens[i + 2])) {
11276 tokens[i] += tokens[i + 2];
11277 tokens.splice(i + 1, 2);
11278 i--;
11279 }
11280 }
11281
11282 return tokens;
11283 };
11284
11285 function diffWords(oldStr, newStr, options) {
11286 options = /*istanbul ignore start*/(0, _params.generateOptions) /*istanbul ignore end*/(options, { ignoreWhitespace: true });
11287 return wordDiff.diff(oldStr, newStr, options);
11288 }
11289
11290 function diffWordsWithSpace(oldStr, newStr, options) {
11291 return wordDiff.diff(oldStr, newStr, options);
11292 }
11293
11294
11295
11296/***/ }),
11297/* 4 */
11298/***/ (function(module, exports) {
11299
11300 /*istanbul ignore start*/'use strict';
11301
11302 exports.__esModule = true;
11303 exports. /*istanbul ignore end*/generateOptions = generateOptions;
11304 function generateOptions(options, defaults) {
11305 if (typeof options === 'function') {
11306 defaults.callback = options;
11307 } else if (options) {
11308 for (var name in options) {
11309 /* istanbul ignore else */
11310 if (options.hasOwnProperty(name)) {
11311 defaults[name] = options[name];
11312 }
11313 }
11314 }
11315 return defaults;
11316 }
11317
11318
11319
11320/***/ }),
11321/* 5 */
11322/***/ (function(module, exports, __webpack_require__) {
11323
11324 /*istanbul ignore start*/'use strict';
11325
11326 exports.__esModule = true;
11327 exports.lineDiff = undefined;
11328 exports. /*istanbul ignore end*/diffLines = diffLines;
11329 /*istanbul ignore start*/exports. /*istanbul ignore end*/diffTrimmedLines = diffTrimmedLines;
11330
11331 var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
11332
11333 /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
11334
11335 /*istanbul ignore end*/var /*istanbul ignore start*/_params = __webpack_require__(4) /*istanbul ignore end*/;
11336
11337 /*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
11338
11339 /*istanbul ignore end*/var lineDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/lineDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
11340 lineDiff.tokenize = function (value) {
11341 var retLines = [],
11342 linesAndNewlines = value.split(/(\n|\r\n)/);
11343
11344 // Ignore the final empty token that occurs if the string ends with a new line
11345 if (!linesAndNewlines[linesAndNewlines.length - 1]) {
11346 linesAndNewlines.pop();
11347 }
11348
11349 // Merge the content and line separators into single tokens
11350 for (var i = 0; i < linesAndNewlines.length; i++) {
11351 var line = linesAndNewlines[i];
11352
11353 if (i % 2 && !this.options.newlineIsToken) {
11354 retLines[retLines.length - 1] += line;
11355 } else {
11356 if (this.options.ignoreWhitespace) {
11357 line = line.trim();
11358 }
11359 retLines.push(line);
11360 }
11361 }
11362
11363 return retLines;
11364 };
11365
11366 function diffLines(oldStr, newStr, callback) {
11367 return lineDiff.diff(oldStr, newStr, callback);
11368 }
11369 function diffTrimmedLines(oldStr, newStr, callback) {
11370 var options = /*istanbul ignore start*/(0, _params.generateOptions) /*istanbul ignore end*/(callback, { ignoreWhitespace: true });
11371 return lineDiff.diff(oldStr, newStr, options);
11372 }
11373
11374
11375
11376/***/ }),
11377/* 6 */
11378/***/ (function(module, exports, __webpack_require__) {
11379
11380 /*istanbul ignore start*/'use strict';
11381
11382 exports.__esModule = true;
11383 exports.sentenceDiff = undefined;
11384 exports. /*istanbul ignore end*/diffSentences = diffSentences;
11385
11386 var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
11387
11388 /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
11389
11390 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
11391
11392 /*istanbul ignore end*/var sentenceDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/sentenceDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
11393 sentenceDiff.tokenize = function (value) {
11394 return value.split(/(\S.+?[.!?])(?=\s+|$)/);
11395 };
11396
11397 function diffSentences(oldStr, newStr, callback) {
11398 return sentenceDiff.diff(oldStr, newStr, callback);
11399 }
11400
11401
11402
11403/***/ }),
11404/* 7 */
11405/***/ (function(module, exports, __webpack_require__) {
11406
11407 /*istanbul ignore start*/'use strict';
11408
11409 exports.__esModule = true;
11410 exports.cssDiff = undefined;
11411 exports. /*istanbul ignore end*/diffCss = diffCss;
11412
11413 var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
11414
11415 /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
11416
11417 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
11418
11419 /*istanbul ignore end*/var cssDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/cssDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
11420 cssDiff.tokenize = function (value) {
11421 return value.split(/([{}:;,]|\s+)/);
11422 };
11423
11424 function diffCss(oldStr, newStr, callback) {
11425 return cssDiff.diff(oldStr, newStr, callback);
11426 }
11427
11428
11429
11430/***/ }),
11431/* 8 */
11432/***/ (function(module, exports, __webpack_require__) {
11433
11434 /*istanbul ignore start*/'use strict';
11435
11436 exports.__esModule = true;
11437 exports.jsonDiff = undefined;
11438
11439 var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
11440
11441 exports. /*istanbul ignore end*/diffJson = diffJson;
11442 /*istanbul ignore start*/exports. /*istanbul ignore end*/canonicalize = canonicalize;
11443
11444 var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
11445
11446 /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
11447
11448 /*istanbul ignore end*/var /*istanbul ignore start*/_line = __webpack_require__(5) /*istanbul ignore end*/;
11449
11450 /*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
11451
11452 /*istanbul ignore end*/var objectPrototypeToString = Object.prototype.toString;
11453
11454 var jsonDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/jsonDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
11455 // Discriminate between two lines of pretty-printed, serialized JSON where one of them has a
11456 // dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output:
11457 jsonDiff.useLongestToken = true;
11458
11459 jsonDiff.tokenize = /*istanbul ignore start*/_line.lineDiff /*istanbul ignore end*/.tokenize;
11460 jsonDiff.castInput = function (value) {
11461 /*istanbul ignore start*/var _options = /*istanbul ignore end*/this.options,
11462 undefinedReplacement = _options.undefinedReplacement,
11463 _options$stringifyRep = _options.stringifyReplacer,
11464 stringifyReplacer = _options$stringifyRep === undefined ? function (k, v) /*istanbul ignore start*/{
11465 return (/*istanbul ignore end*/typeof v === 'undefined' ? undefinedReplacement : v
11466 );
11467 } : _options$stringifyRep;
11468
11469
11470 return typeof value === 'string' ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, ' ');
11471 };
11472 jsonDiff.equals = function (left, right) {
11473 return (/*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/.prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1'))
11474 );
11475 };
11476
11477 function diffJson(oldObj, newObj, options) {
11478 return jsonDiff.diff(oldObj, newObj, options);
11479 }
11480
11481 // This function handles the presence of circular references by bailing out when encountering an
11482 // object that is already on the "stack" of items being processed. Accepts an optional replacer
11483 function canonicalize(obj, stack, replacementStack, replacer, key) {
11484 stack = stack || [];
11485 replacementStack = replacementStack || [];
11486
11487 if (replacer) {
11488 obj = replacer(key, obj);
11489 }
11490
11491 var i = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
11492
11493 for (i = 0; i < stack.length; i += 1) {
11494 if (stack[i] === obj) {
11495 return replacementStack[i];
11496 }
11497 }
11498
11499 var canonicalizedObj = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
11500
11501 if ('[object Array]' === objectPrototypeToString.call(obj)) {
11502 stack.push(obj);
11503 canonicalizedObj = new Array(obj.length);
11504 replacementStack.push(canonicalizedObj);
11505 for (i = 0; i < obj.length; i += 1) {
11506 canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, key);
11507 }
11508 stack.pop();
11509 replacementStack.pop();
11510 return canonicalizedObj;
11511 }
11512
11513 if (obj && obj.toJSON) {
11514 obj = obj.toJSON();
11515 }
11516
11517 if ( /*istanbul ignore start*/(typeof /*istanbul ignore end*/obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object' && obj !== null) {
11518 stack.push(obj);
11519 canonicalizedObj = {};
11520 replacementStack.push(canonicalizedObj);
11521 var sortedKeys = [],
11522 _key = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
11523 for (_key in obj) {
11524 /* istanbul ignore else */
11525 if (obj.hasOwnProperty(_key)) {
11526 sortedKeys.push(_key);
11527 }
11528 }
11529 sortedKeys.sort();
11530 for (i = 0; i < sortedKeys.length; i += 1) {
11531 _key = sortedKeys[i];
11532 canonicalizedObj[_key] = canonicalize(obj[_key], stack, replacementStack, replacer, _key);
11533 }
11534 stack.pop();
11535 replacementStack.pop();
11536 } else {
11537 canonicalizedObj = obj;
11538 }
11539 return canonicalizedObj;
11540 }
11541
11542
11543
11544/***/ }),
11545/* 9 */
11546/***/ (function(module, exports, __webpack_require__) {
11547
11548 /*istanbul ignore start*/'use strict';
11549
11550 exports.__esModule = true;
11551 exports.arrayDiff = undefined;
11552 exports. /*istanbul ignore end*/diffArrays = diffArrays;
11553
11554 var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
11555
11556 /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
11557
11558 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
11559
11560 /*istanbul ignore end*/var arrayDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/arrayDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
11561 arrayDiff.tokenize = function (value) {
11562 return value.slice();
11563 };
11564 arrayDiff.join = arrayDiff.removeEmpty = function (value) {
11565 return value;
11566 };
11567
11568 function diffArrays(oldArr, newArr, callback) {
11569 return arrayDiff.diff(oldArr, newArr, callback);
11570 }
11571
11572
11573
11574/***/ }),
11575/* 10 */
11576/***/ (function(module, exports, __webpack_require__) {
11577
11578 /*istanbul ignore start*/'use strict';
11579
11580 exports.__esModule = true;
11581 exports. /*istanbul ignore end*/applyPatch = applyPatch;
11582 /*istanbul ignore start*/exports. /*istanbul ignore end*/applyPatches = applyPatches;
11583
11584 var /*istanbul ignore start*/_parse = __webpack_require__(11) /*istanbul ignore end*/;
11585
11586 var /*istanbul ignore start*/_distanceIterator = __webpack_require__(12) /*istanbul ignore end*/;
11587
11588 /*istanbul ignore start*/var _distanceIterator2 = _interopRequireDefault(_distanceIterator);
11589
11590 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
11591
11592 /*istanbul ignore end*/function applyPatch(source, uniDiff) {
11593 /*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
11594
11595 if (typeof uniDiff === 'string') {
11596 uniDiff = /*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(uniDiff);
11597 }
11598
11599 if (Array.isArray(uniDiff)) {
11600 if (uniDiff.length > 1) {
11601 throw new Error('applyPatch only works with a single input.');
11602 }
11603
11604 uniDiff = uniDiff[0];
11605 }
11606
11607 // Apply the diff to the input
11608 var lines = source.split(/\r\n|[\n\v\f\r\x85]/),
11609 delimiters = source.match(/\r\n|[\n\v\f\r\x85]/g) || [],
11610 hunks = uniDiff.hunks,
11611 compareLine = options.compareLine || function (lineNumber, line, operation, patchContent) /*istanbul ignore start*/{
11612 return (/*istanbul ignore end*/line === patchContent
11613 );
11614 },
11615 errorCount = 0,
11616 fuzzFactor = options.fuzzFactor || 0,
11617 minLine = 0,
11618 offset = 0,
11619 removeEOFNL = /*istanbul ignore start*/void 0 /*istanbul ignore end*/,
11620 addEOFNL = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
11621
11622 /**
11623 * Checks if the hunk exactly fits on the provided location
11624 */
11625 function hunkFits(hunk, toPos) {
11626 for (var j = 0; j < hunk.lines.length; j++) {
11627 var line = hunk.lines[j],
11628 operation = line.length > 0 ? line[0] : ' ',
11629 content = line.length > 0 ? line.substr(1) : line;
11630
11631 if (operation === ' ' || operation === '-') {
11632 // Context sanity check
11633 if (!compareLine(toPos + 1, lines[toPos], operation, content)) {
11634 errorCount++;
11635
11636 if (errorCount > fuzzFactor) {
11637 return false;
11638 }
11639 }
11640 toPos++;
11641 }
11642 }
11643
11644 return true;
11645 }
11646
11647 // Search best fit offsets for each hunk based on the previous ones
11648 for (var i = 0; i < hunks.length; i++) {
11649 var hunk = hunks[i],
11650 maxLine = lines.length - hunk.oldLines,
11651 localOffset = 0,
11652 toPos = offset + hunk.oldStart - 1;
11653
11654 var iterator = /*istanbul ignore start*/(0, _distanceIterator2['default']) /*istanbul ignore end*/(toPos, minLine, maxLine);
11655
11656 for (; localOffset !== undefined; localOffset = iterator()) {
11657 if (hunkFits(hunk, toPos + localOffset)) {
11658 hunk.offset = offset += localOffset;
11659 break;
11660 }
11661 }
11662
11663 if (localOffset === undefined) {
11664 return false;
11665 }
11666
11667 // Set lower text limit to end of the current hunk, so next ones don't try
11668 // to fit over already patched text
11669 minLine = hunk.offset + hunk.oldStart + hunk.oldLines;
11670 }
11671
11672 // Apply patch hunks
11673 var diffOffset = 0;
11674 for (var _i = 0; _i < hunks.length; _i++) {
11675 var _hunk = hunks[_i],
11676 _toPos = _hunk.oldStart + _hunk.offset + diffOffset - 1;
11677 diffOffset += _hunk.newLines - _hunk.oldLines;
11678
11679 if (_toPos < 0) {
11680 // Creating a new file
11681 _toPos = 0;
11682 }
11683
11684 for (var j = 0; j < _hunk.lines.length; j++) {
11685 var line = _hunk.lines[j],
11686 operation = line.length > 0 ? line[0] : ' ',
11687 content = line.length > 0 ? line.substr(1) : line,
11688 delimiter = _hunk.linedelimiters[j];
11689
11690 if (operation === ' ') {
11691 _toPos++;
11692 } else if (operation === '-') {
11693 lines.splice(_toPos, 1);
11694 delimiters.splice(_toPos, 1);
11695 /* istanbul ignore else */
11696 } else if (operation === '+') {
11697 lines.splice(_toPos, 0, content);
11698 delimiters.splice(_toPos, 0, delimiter);
11699 _toPos++;
11700 } else if (operation === '\\') {
11701 var previousOperation = _hunk.lines[j - 1] ? _hunk.lines[j - 1][0] : null;
11702 if (previousOperation === '+') {
11703 removeEOFNL = true;
11704 } else if (previousOperation === '-') {
11705 addEOFNL = true;
11706 }
11707 }
11708 }
11709 }
11710
11711 // Handle EOFNL insertion/removal
11712 if (removeEOFNL) {
11713 while (!lines[lines.length - 1]) {
11714 lines.pop();
11715 delimiters.pop();
11716 }
11717 } else if (addEOFNL) {
11718 lines.push('');
11719 delimiters.push('\n');
11720 }
11721 for (var _k = 0; _k < lines.length - 1; _k++) {
11722 lines[_k] = lines[_k] + delimiters[_k];
11723 }
11724 return lines.join('');
11725 }
11726
11727 // Wrapper that supports multiple file patches via callbacks.
11728 function applyPatches(uniDiff, options) {
11729 if (typeof uniDiff === 'string') {
11730 uniDiff = /*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(uniDiff);
11731 }
11732
11733 var currentIndex = 0;
11734 function processIndex() {
11735 var index = uniDiff[currentIndex++];
11736 if (!index) {
11737 return options.complete();
11738 }
11739
11740 options.loadFile(index, function (err, data) {
11741 if (err) {
11742 return options.complete(err);
11743 }
11744
11745 var updatedContent = applyPatch(data, index, options);
11746 options.patched(index, updatedContent, function (err) {
11747 if (err) {
11748 return options.complete(err);
11749 }
11750
11751 processIndex();
11752 });
11753 });
11754 }
11755 processIndex();
11756 }
11757
11758
11759
11760/***/ }),
11761/* 11 */
11762/***/ (function(module, exports) {
11763
11764 /*istanbul ignore start*/'use strict';
11765
11766 exports.__esModule = true;
11767 exports. /*istanbul ignore end*/parsePatch = parsePatch;
11768 function parsePatch(uniDiff) {
11769 /*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
11770
11771 var diffstr = uniDiff.split(/\r\n|[\n\v\f\r\x85]/),
11772 delimiters = uniDiff.match(/\r\n|[\n\v\f\r\x85]/g) || [],
11773 list = [],
11774 i = 0;
11775
11776 function parseIndex() {
11777 var index = {};
11778 list.push(index);
11779
11780 // Parse diff metadata
11781 while (i < diffstr.length) {
11782 var line = diffstr[i];
11783
11784 // File header found, end parsing diff metadata
11785 if (/^(\-\-\-|\+\+\+|@@)\s/.test(line)) {
11786 break;
11787 }
11788
11789 // Diff index
11790 var header = /^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(line);
11791 if (header) {
11792 index.index = header[1];
11793 }
11794
11795 i++;
11796 }
11797
11798 // Parse file headers if they are defined. Unified diff requires them, but
11799 // there's no technical issues to have an isolated hunk without file header
11800 parseFileHeader(index);
11801 parseFileHeader(index);
11802
11803 // Parse hunks
11804 index.hunks = [];
11805
11806 while (i < diffstr.length) {
11807 var _line = diffstr[i];
11808
11809 if (/^(Index:|diff|\-\-\-|\+\+\+)\s/.test(_line)) {
11810 break;
11811 } else if (/^@@/.test(_line)) {
11812 index.hunks.push(parseHunk());
11813 } else if (_line && options.strict) {
11814 // Ignore unexpected content unless in strict mode
11815 throw new Error('Unknown line ' + (i + 1) + ' ' + JSON.stringify(_line));
11816 } else {
11817 i++;
11818 }
11819 }
11820 }
11821
11822 // Parses the --- and +++ headers, if none are found, no lines
11823 // are consumed.
11824 function parseFileHeader(index) {
11825 var fileHeader = /^(---|\+\+\+)\s+(.*)$/.exec(diffstr[i]);
11826 if (fileHeader) {
11827 var keyPrefix = fileHeader[1] === '---' ? 'old' : 'new';
11828 var data = fileHeader[2].split('\t', 2);
11829 var fileName = data[0].replace(/\\\\/g, '\\');
11830 if (/^".*"$/.test(fileName)) {
11831 fileName = fileName.substr(1, fileName.length - 2);
11832 }
11833 index[keyPrefix + 'FileName'] = fileName;
11834 index[keyPrefix + 'Header'] = (data[1] || '').trim();
11835
11836 i++;
11837 }
11838 }
11839
11840 // Parses a hunk
11841 // This assumes that we are at the start of a hunk.
11842 function parseHunk() {
11843 var chunkHeaderIndex = i,
11844 chunkHeaderLine = diffstr[i++],
11845 chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);
11846
11847 var hunk = {
11848 oldStart: +chunkHeader[1],
11849 oldLines: +chunkHeader[2] || 1,
11850 newStart: +chunkHeader[3],
11851 newLines: +chunkHeader[4] || 1,
11852 lines: [],
11853 linedelimiters: []
11854 };
11855
11856 var addCount = 0,
11857 removeCount = 0;
11858 for (; i < diffstr.length; i++) {
11859 // Lines starting with '---' could be mistaken for the "remove line" operation
11860 // But they could be the header for the next file. Therefore prune such cases out.
11861 if (diffstr[i].indexOf('--- ') === 0 && i + 2 < diffstr.length && diffstr[i + 1].indexOf('+++ ') === 0 && diffstr[i + 2].indexOf('@@') === 0) {
11862 break;
11863 }
11864 var operation = diffstr[i].length == 0 && i != diffstr.length - 1 ? ' ' : diffstr[i][0];
11865
11866 if (operation === '+' || operation === '-' || operation === ' ' || operation === '\\') {
11867 hunk.lines.push(diffstr[i]);
11868 hunk.linedelimiters.push(delimiters[i] || '\n');
11869
11870 if (operation === '+') {
11871 addCount++;
11872 } else if (operation === '-') {
11873 removeCount++;
11874 } else if (operation === ' ') {
11875 addCount++;
11876 removeCount++;
11877 }
11878 } else {
11879 break;
11880 }
11881 }
11882
11883 // Handle the empty block count case
11884 if (!addCount && hunk.newLines === 1) {
11885 hunk.newLines = 0;
11886 }
11887 if (!removeCount && hunk.oldLines === 1) {
11888 hunk.oldLines = 0;
11889 }
11890
11891 // Perform optional sanity checking
11892 if (options.strict) {
11893 if (addCount !== hunk.newLines) {
11894 throw new Error('Added line count did not match for hunk at line ' + (chunkHeaderIndex + 1));
11895 }
11896 if (removeCount !== hunk.oldLines) {
11897 throw new Error('Removed line count did not match for hunk at line ' + (chunkHeaderIndex + 1));
11898 }
11899 }
11900
11901 return hunk;
11902 }
11903
11904 while (i < diffstr.length) {
11905 parseIndex();
11906 }
11907
11908 return list;
11909 }
11910
11911
11912
11913/***/ }),
11914/* 12 */
11915/***/ (function(module, exports) {
11916
11917 /*istanbul ignore start*/"use strict";
11918
11919 exports.__esModule = true;
11920
11921 exports["default"] = /*istanbul ignore end*/function (start, minLine, maxLine) {
11922 var wantForward = true,
11923 backwardExhausted = false,
11924 forwardExhausted = false,
11925 localOffset = 1;
11926
11927 return function iterator() {
11928 if (wantForward && !forwardExhausted) {
11929 if (backwardExhausted) {
11930 localOffset++;
11931 } else {
11932 wantForward = false;
11933 }
11934
11935 // Check if trying to fit beyond text length, and if not, check it fits
11936 // after offset location (or desired location on first iteration)
11937 if (start + localOffset <= maxLine) {
11938 return localOffset;
11939 }
11940
11941 forwardExhausted = true;
11942 }
11943
11944 if (!backwardExhausted) {
11945 if (!forwardExhausted) {
11946 wantForward = true;
11947 }
11948
11949 // Check if trying to fit before text beginning, and if not, check it fits
11950 // before offset location
11951 if (minLine <= start - localOffset) {
11952 return -localOffset++;
11953 }
11954
11955 backwardExhausted = true;
11956 return iterator();
11957 }
11958
11959 // We tried to fit hunk before text beginning and beyond text length, then
11960 // hunk can't fit on the text. Return undefined
11961 };
11962 };
11963
11964
11965
11966/***/ }),
11967/* 13 */
11968/***/ (function(module, exports, __webpack_require__) {
11969
11970 /*istanbul ignore start*/'use strict';
11971
11972 exports.__esModule = true;
11973 exports. /*istanbul ignore end*/calcLineCount = calcLineCount;
11974 /*istanbul ignore start*/exports. /*istanbul ignore end*/merge = merge;
11975
11976 var /*istanbul ignore start*/_create = __webpack_require__(14) /*istanbul ignore end*/;
11977
11978 var /*istanbul ignore start*/_parse = __webpack_require__(11) /*istanbul ignore end*/;
11979
11980 var /*istanbul ignore start*/_array = __webpack_require__(15) /*istanbul ignore end*/;
11981
11982 /*istanbul ignore start*/function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
11983
11984 /*istanbul ignore end*/function calcLineCount(hunk) {
11985 /*istanbul ignore start*/var _calcOldNewLineCount = /*istanbul ignore end*/calcOldNewLineCount(hunk.lines),
11986 oldLines = _calcOldNewLineCount.oldLines,
11987 newLines = _calcOldNewLineCount.newLines;
11988
11989 if (oldLines !== undefined) {
11990 hunk.oldLines = oldLines;
11991 } else {
11992 delete hunk.oldLines;
11993 }
11994
11995 if (newLines !== undefined) {
11996 hunk.newLines = newLines;
11997 } else {
11998 delete hunk.newLines;
11999 }
12000 }
12001
12002 function merge(mine, theirs, base) {
12003 mine = loadPatch(mine, base);
12004 theirs = loadPatch(theirs, base);
12005
12006 var ret = {};
12007
12008 // For index we just let it pass through as it doesn't have any necessary meaning.
12009 // Leaving sanity checks on this to the API consumer that may know more about the
12010 // meaning in their own context.
12011 if (mine.index || theirs.index) {
12012 ret.index = mine.index || theirs.index;
12013 }
12014
12015 if (mine.newFileName || theirs.newFileName) {
12016 if (!fileNameChanged(mine)) {
12017 // No header or no change in ours, use theirs (and ours if theirs does not exist)
12018 ret.oldFileName = theirs.oldFileName || mine.oldFileName;
12019 ret.newFileName = theirs.newFileName || mine.newFileName;
12020 ret.oldHeader = theirs.oldHeader || mine.oldHeader;
12021 ret.newHeader = theirs.newHeader || mine.newHeader;
12022 } else if (!fileNameChanged(theirs)) {
12023 // No header or no change in theirs, use ours
12024 ret.oldFileName = mine.oldFileName;
12025 ret.newFileName = mine.newFileName;
12026 ret.oldHeader = mine.oldHeader;
12027 ret.newHeader = mine.newHeader;
12028 } else {
12029 // Both changed... figure it out
12030 ret.oldFileName = selectField(ret, mine.oldFileName, theirs.oldFileName);
12031 ret.newFileName = selectField(ret, mine.newFileName, theirs.newFileName);
12032 ret.oldHeader = selectField(ret, mine.oldHeader, theirs.oldHeader);
12033 ret.newHeader = selectField(ret, mine.newHeader, theirs.newHeader);
12034 }
12035 }
12036
12037 ret.hunks = [];
12038
12039 var mineIndex = 0,
12040 theirsIndex = 0,
12041 mineOffset = 0,
12042 theirsOffset = 0;
12043
12044 while (mineIndex < mine.hunks.length || theirsIndex < theirs.hunks.length) {
12045 var mineCurrent = mine.hunks[mineIndex] || { oldStart: Infinity },
12046 theirsCurrent = theirs.hunks[theirsIndex] || { oldStart: Infinity };
12047
12048 if (hunkBefore(mineCurrent, theirsCurrent)) {
12049 // This patch does not overlap with any of the others, yay.
12050 ret.hunks.push(cloneHunk(mineCurrent, mineOffset));
12051 mineIndex++;
12052 theirsOffset += mineCurrent.newLines - mineCurrent.oldLines;
12053 } else if (hunkBefore(theirsCurrent, mineCurrent)) {
12054 // This patch does not overlap with any of the others, yay.
12055 ret.hunks.push(cloneHunk(theirsCurrent, theirsOffset));
12056 theirsIndex++;
12057 mineOffset += theirsCurrent.newLines - theirsCurrent.oldLines;
12058 } else {
12059 // Overlap, merge as best we can
12060 var mergedHunk = {
12061 oldStart: Math.min(mineCurrent.oldStart, theirsCurrent.oldStart),
12062 oldLines: 0,
12063 newStart: Math.min(mineCurrent.newStart + mineOffset, theirsCurrent.oldStart + theirsOffset),
12064 newLines: 0,
12065 lines: []
12066 };
12067 mergeLines(mergedHunk, mineCurrent.oldStart, mineCurrent.lines, theirsCurrent.oldStart, theirsCurrent.lines);
12068 theirsIndex++;
12069 mineIndex++;
12070
12071 ret.hunks.push(mergedHunk);
12072 }
12073 }
12074
12075 return ret;
12076 }
12077
12078 function loadPatch(param, base) {
12079 if (typeof param === 'string') {
12080 if (/^@@/m.test(param) || /^Index:/m.test(param)) {
12081 return (/*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(param)[0]
12082 );
12083 }
12084
12085 if (!base) {
12086 throw new Error('Must provide a base reference or pass in a patch');
12087 }
12088 return (/*istanbul ignore start*/(0, _create.structuredPatch) /*istanbul ignore end*/(undefined, undefined, base, param)
12089 );
12090 }
12091
12092 return param;
12093 }
12094
12095 function fileNameChanged(patch) {
12096 return patch.newFileName && patch.newFileName !== patch.oldFileName;
12097 }
12098
12099 function selectField(index, mine, theirs) {
12100 if (mine === theirs) {
12101 return mine;
12102 } else {
12103 index.conflict = true;
12104 return { mine: mine, theirs: theirs };
12105 }
12106 }
12107
12108 function hunkBefore(test, check) {
12109 return test.oldStart < check.oldStart && test.oldStart + test.oldLines < check.oldStart;
12110 }
12111
12112 function cloneHunk(hunk, offset) {
12113 return {
12114 oldStart: hunk.oldStart, oldLines: hunk.oldLines,
12115 newStart: hunk.newStart + offset, newLines: hunk.newLines,
12116 lines: hunk.lines
12117 };
12118 }
12119
12120 function mergeLines(hunk, mineOffset, mineLines, theirOffset, theirLines) {
12121 // This will generally result in a conflicted hunk, but there are cases where the context
12122 // is the only overlap where we can successfully merge the content here.
12123 var mine = { offset: mineOffset, lines: mineLines, index: 0 },
12124 their = { offset: theirOffset, lines: theirLines, index: 0 };
12125
12126 // Handle any leading content
12127 insertLeading(hunk, mine, their);
12128 insertLeading(hunk, their, mine);
12129
12130 // Now in the overlap content. Scan through and select the best changes from each.
12131 while (mine.index < mine.lines.length && their.index < their.lines.length) {
12132 var mineCurrent = mine.lines[mine.index],
12133 theirCurrent = their.lines[their.index];
12134
12135 if ((mineCurrent[0] === '-' || mineCurrent[0] === '+') && (theirCurrent[0] === '-' || theirCurrent[0] === '+')) {
12136 // Both modified ...
12137 mutualChange(hunk, mine, their);
12138 } else if (mineCurrent[0] === '+' && theirCurrent[0] === ' ') {
12139 /*istanbul ignore start*/var _hunk$lines;
12140
12141 /*istanbul ignore end*/ // Mine inserted
12142 /*istanbul ignore start*/(_hunk$lines = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/collectChange(mine)));
12143 } else if (theirCurrent[0] === '+' && mineCurrent[0] === ' ') {
12144 /*istanbul ignore start*/var _hunk$lines2;
12145
12146 /*istanbul ignore end*/ // Theirs inserted
12147 /*istanbul ignore start*/(_hunk$lines2 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines2 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/collectChange(their)));
12148 } else if (mineCurrent[0] === '-' && theirCurrent[0] === ' ') {
12149 // Mine removed or edited
12150 removal(hunk, mine, their);
12151 } else if (theirCurrent[0] === '-' && mineCurrent[0] === ' ') {
12152 // Their removed or edited
12153 removal(hunk, their, mine, true);
12154 } else if (mineCurrent === theirCurrent) {
12155 // Context identity
12156 hunk.lines.push(mineCurrent);
12157 mine.index++;
12158 their.index++;
12159 } else {
12160 // Context mismatch
12161 conflict(hunk, collectChange(mine), collectChange(their));
12162 }
12163 }
12164
12165 // Now push anything that may be remaining
12166 insertTrailing(hunk, mine);
12167 insertTrailing(hunk, their);
12168
12169 calcLineCount(hunk);
12170 }
12171
12172 function mutualChange(hunk, mine, their) {
12173 var myChanges = collectChange(mine),
12174 theirChanges = collectChange(their);
12175
12176 if (allRemoves(myChanges) && allRemoves(theirChanges)) {
12177 // Special case for remove changes that are supersets of one another
12178 if ( /*istanbul ignore start*/(0, _array.arrayStartsWith) /*istanbul ignore end*/(myChanges, theirChanges) && skipRemoveSuperset(their, myChanges, myChanges.length - theirChanges.length)) {
12179 /*istanbul ignore start*/var _hunk$lines3;
12180
12181 /*istanbul ignore end*/ /*istanbul ignore start*/(_hunk$lines3 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines3 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/myChanges));
12182 return;
12183 } else if ( /*istanbul ignore start*/(0, _array.arrayStartsWith) /*istanbul ignore end*/(theirChanges, myChanges) && skipRemoveSuperset(mine, theirChanges, theirChanges.length - myChanges.length)) {
12184 /*istanbul ignore start*/var _hunk$lines4;
12185
12186 /*istanbul ignore end*/ /*istanbul ignore start*/(_hunk$lines4 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines4 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/theirChanges));
12187 return;
12188 }
12189 } else if ( /*istanbul ignore start*/(0, _array.arrayEqual) /*istanbul ignore end*/(myChanges, theirChanges)) {
12190 /*istanbul ignore start*/var _hunk$lines5;
12191
12192 /*istanbul ignore end*/ /*istanbul ignore start*/(_hunk$lines5 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines5 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/myChanges));
12193 return;
12194 }
12195
12196 conflict(hunk, myChanges, theirChanges);
12197 }
12198
12199 function removal(hunk, mine, their, swap) {
12200 var myChanges = collectChange(mine),
12201 theirChanges = collectContext(their, myChanges);
12202 if (theirChanges.merged) {
12203 /*istanbul ignore start*/var _hunk$lines6;
12204
12205 /*istanbul ignore end*/ /*istanbul ignore start*/(_hunk$lines6 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines6 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/theirChanges.merged));
12206 } else {
12207 conflict(hunk, swap ? theirChanges : myChanges, swap ? myChanges : theirChanges);
12208 }
12209 }
12210
12211 function conflict(hunk, mine, their) {
12212 hunk.conflict = true;
12213 hunk.lines.push({
12214 conflict: true,
12215 mine: mine,
12216 theirs: their
12217 });
12218 }
12219
12220 function insertLeading(hunk, insert, their) {
12221 while (insert.offset < their.offset && insert.index < insert.lines.length) {
12222 var line = insert.lines[insert.index++];
12223 hunk.lines.push(line);
12224 insert.offset++;
12225 }
12226 }
12227 function insertTrailing(hunk, insert) {
12228 while (insert.index < insert.lines.length) {
12229 var line = insert.lines[insert.index++];
12230 hunk.lines.push(line);
12231 }
12232 }
12233
12234 function collectChange(state) {
12235 var ret = [],
12236 operation = state.lines[state.index][0];
12237 while (state.index < state.lines.length) {
12238 var line = state.lines[state.index];
12239
12240 // Group additions that are immediately after subtractions and treat them as one "atomic" modify change.
12241 if (operation === '-' && line[0] === '+') {
12242 operation = '+';
12243 }
12244
12245 if (operation === line[0]) {
12246 ret.push(line);
12247 state.index++;
12248 } else {
12249 break;
12250 }
12251 }
12252
12253 return ret;
12254 }
12255 function collectContext(state, matchChanges) {
12256 var changes = [],
12257 merged = [],
12258 matchIndex = 0,
12259 contextChanges = false,
12260 conflicted = false;
12261 while (matchIndex < matchChanges.length && state.index < state.lines.length) {
12262 var change = state.lines[state.index],
12263 match = matchChanges[matchIndex];
12264
12265 // Once we've hit our add, then we are done
12266 if (match[0] === '+') {
12267 break;
12268 }
12269
12270 contextChanges = contextChanges || change[0] !== ' ';
12271
12272 merged.push(match);
12273 matchIndex++;
12274
12275 // Consume any additions in the other block as a conflict to attempt
12276 // to pull in the remaining context after this
12277 if (change[0] === '+') {
12278 conflicted = true;
12279
12280 while (change[0] === '+') {
12281 changes.push(change);
12282 change = state.lines[++state.index];
12283 }
12284 }
12285
12286 if (match.substr(1) === change.substr(1)) {
12287 changes.push(change);
12288 state.index++;
12289 } else {
12290 conflicted = true;
12291 }
12292 }
12293
12294 if ((matchChanges[matchIndex] || '')[0] === '+' && contextChanges) {
12295 conflicted = true;
12296 }
12297
12298 if (conflicted) {
12299 return changes;
12300 }
12301
12302 while (matchIndex < matchChanges.length) {
12303 merged.push(matchChanges[matchIndex++]);
12304 }
12305
12306 return {
12307 merged: merged,
12308 changes: changes
12309 };
12310 }
12311
12312 function allRemoves(changes) {
12313 return changes.reduce(function (prev, change) {
12314 return prev && change[0] === '-';
12315 }, true);
12316 }
12317 function skipRemoveSuperset(state, removeChanges, delta) {
12318 for (var i = 0; i < delta; i++) {
12319 var changeContent = removeChanges[removeChanges.length - delta + i].substr(1);
12320 if (state.lines[state.index + i] !== ' ' + changeContent) {
12321 return false;
12322 }
12323 }
12324
12325 state.index += delta;
12326 return true;
12327 }
12328
12329 function calcOldNewLineCount(lines) {
12330 var oldLines = 0;
12331 var newLines = 0;
12332
12333 lines.forEach(function (line) {
12334 if (typeof line !== 'string') {
12335 var myCount = calcOldNewLineCount(line.mine);
12336 var theirCount = calcOldNewLineCount(line.theirs);
12337
12338 if (oldLines !== undefined) {
12339 if (myCount.oldLines === theirCount.oldLines) {
12340 oldLines += myCount.oldLines;
12341 } else {
12342 oldLines = undefined;
12343 }
12344 }
12345
12346 if (newLines !== undefined) {
12347 if (myCount.newLines === theirCount.newLines) {
12348 newLines += myCount.newLines;
12349 } else {
12350 newLines = undefined;
12351 }
12352 }
12353 } else {
12354 if (newLines !== undefined && (line[0] === '+' || line[0] === ' ')) {
12355 newLines++;
12356 }
12357 if (oldLines !== undefined && (line[0] === '-' || line[0] === ' ')) {
12358 oldLines++;
12359 }
12360 }
12361 });
12362
12363 return { oldLines: oldLines, newLines: newLines };
12364 }
12365
12366
12367
12368/***/ }),
12369/* 14 */
12370/***/ (function(module, exports, __webpack_require__) {
12371
12372 /*istanbul ignore start*/'use strict';
12373
12374 exports.__esModule = true;
12375 exports. /*istanbul ignore end*/structuredPatch = structuredPatch;
12376 /*istanbul ignore start*/exports. /*istanbul ignore end*/createTwoFilesPatch = createTwoFilesPatch;
12377 /*istanbul ignore start*/exports. /*istanbul ignore end*/createPatch = createPatch;
12378
12379 var /*istanbul ignore start*/_line = __webpack_require__(5) /*istanbul ignore end*/;
12380
12381 /*istanbul ignore start*/function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
12382
12383 /*istanbul ignore end*/function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
12384 if (!options) {
12385 options = {};
12386 }
12387 if (typeof options.context === 'undefined') {
12388 options.context = 4;
12389 }
12390
12391 var diff = /*istanbul ignore start*/(0, _line.diffLines) /*istanbul ignore end*/(oldStr, newStr, options);
12392 diff.push({ value: '', lines: [] }); // Append an empty value to make cleanup easier
12393
12394 function contextLines(lines) {
12395 return lines.map(function (entry) {
12396 return ' ' + entry;
12397 });
12398 }
12399
12400 var hunks = [];
12401 var oldRangeStart = 0,
12402 newRangeStart = 0,
12403 curRange = [],
12404 oldLine = 1,
12405 newLine = 1;
12406
12407 /*istanbul ignore start*/var _loop = function _loop( /*istanbul ignore end*/i) {
12408 var current = diff[i],
12409 lines = current.lines || current.value.replace(/\n$/, '').split('\n');
12410 current.lines = lines;
12411
12412 if (current.added || current.removed) {
12413 /*istanbul ignore start*/var _curRange;
12414
12415 /*istanbul ignore end*/ // If we have previous context, start with that
12416 if (!oldRangeStart) {
12417 var prev = diff[i - 1];
12418 oldRangeStart = oldLine;
12419 newRangeStart = newLine;
12420
12421 if (prev) {
12422 curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : [];
12423 oldRangeStart -= curRange.length;
12424 newRangeStart -= curRange.length;
12425 }
12426 }
12427
12428 // Output our changes
12429 /*istanbul ignore start*/(_curRange = /*istanbul ignore end*/curRange).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_curRange /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/lines.map(function (entry) {
12430 return (current.added ? '+' : '-') + entry;
12431 })));
12432
12433 // Track the updated file position
12434 if (current.added) {
12435 newLine += lines.length;
12436 } else {
12437 oldLine += lines.length;
12438 }
12439 } else {
12440 // Identical context lines. Track line changes
12441 if (oldRangeStart) {
12442 // Close out any changes that have been output (or join overlapping)
12443 if (lines.length <= options.context * 2 && i < diff.length - 2) {
12444 /*istanbul ignore start*/var _curRange2;
12445
12446 /*istanbul ignore end*/ // Overlapping
12447 /*istanbul ignore start*/(_curRange2 = /*istanbul ignore end*/curRange).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_curRange2 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/contextLines(lines)));
12448 } else {
12449 /*istanbul ignore start*/var _curRange3;
12450
12451 /*istanbul ignore end*/ // end the range and output
12452 var contextSize = Math.min(lines.length, options.context);
12453 /*istanbul ignore start*/(_curRange3 = /*istanbul ignore end*/curRange).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_curRange3 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/contextLines(lines.slice(0, contextSize))));
12454
12455 var hunk = {
12456 oldStart: oldRangeStart,
12457 oldLines: oldLine - oldRangeStart + contextSize,
12458 newStart: newRangeStart,
12459 newLines: newLine - newRangeStart + contextSize,
12460 lines: curRange
12461 };
12462 if (i >= diff.length - 2 && lines.length <= options.context) {
12463 // EOF is inside this hunk
12464 var oldEOFNewline = /\n$/.test(oldStr);
12465 var newEOFNewline = /\n$/.test(newStr);
12466 if (lines.length == 0 && !oldEOFNewline) {
12467 // special case: old has no eol and no trailing context; no-nl can end up before adds
12468 curRange.splice(hunk.oldLines, 0, '\\ No newline at end of file');
12469 } else if (!oldEOFNewline || !newEOFNewline) {
12470 curRange.push('\\ No newline at end of file');
12471 }
12472 }
12473 hunks.push(hunk);
12474
12475 oldRangeStart = 0;
12476 newRangeStart = 0;
12477 curRange = [];
12478 }
12479 }
12480 oldLine += lines.length;
12481 newLine += lines.length;
12482 }
12483 };
12484
12485 for (var i = 0; i < diff.length; i++) {
12486 /*istanbul ignore start*/_loop( /*istanbul ignore end*/i);
12487 }
12488
12489 return {
12490 oldFileName: oldFileName, newFileName: newFileName,
12491 oldHeader: oldHeader, newHeader: newHeader,
12492 hunks: hunks
12493 };
12494 }
12495
12496 function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
12497 var diff = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options);
12498
12499 var ret = [];
12500 if (oldFileName == newFileName) {
12501 ret.push('Index: ' + oldFileName);
12502 }
12503 ret.push('===================================================================');
12504 ret.push('--- ' + diff.oldFileName + (typeof diff.oldHeader === 'undefined' ? '' : '\t' + diff.oldHeader));
12505 ret.push('+++ ' + diff.newFileName + (typeof diff.newHeader === 'undefined' ? '' : '\t' + diff.newHeader));
12506
12507 for (var i = 0; i < diff.hunks.length; i++) {
12508 var hunk = diff.hunks[i];
12509 ret.push('@@ -' + hunk.oldStart + ',' + hunk.oldLines + ' +' + hunk.newStart + ',' + hunk.newLines + ' @@');
12510 ret.push.apply(ret, hunk.lines);
12511 }
12512
12513 return ret.join('\n') + '\n';
12514 }
12515
12516 function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) {
12517 return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options);
12518 }
12519
12520
12521
12522/***/ }),
12523/* 15 */
12524/***/ (function(module, exports) {
12525
12526 /*istanbul ignore start*/"use strict";
12527
12528 exports.__esModule = true;
12529 exports. /*istanbul ignore end*/arrayEqual = arrayEqual;
12530 /*istanbul ignore start*/exports. /*istanbul ignore end*/arrayStartsWith = arrayStartsWith;
12531 function arrayEqual(a, b) {
12532 if (a.length !== b.length) {
12533 return false;
12534 }
12535
12536 return arrayStartsWith(a, b);
12537 }
12538
12539 function arrayStartsWith(array, start) {
12540 if (start.length > array.length) {
12541 return false;
12542 }
12543
12544 for (var i = 0; i < start.length; i++) {
12545 if (start[i] !== array[i]) {
12546 return false;
12547 }
12548 }
12549
12550 return true;
12551 }
12552
12553
12554
12555/***/ }),
12556/* 16 */
12557/***/ (function(module, exports) {
12558
12559 /*istanbul ignore start*/"use strict";
12560
12561 exports.__esModule = true;
12562 exports. /*istanbul ignore end*/convertChangesToDMP = convertChangesToDMP;
12563 // See: http://code.google.com/p/google-diff-match-patch/wiki/API
12564 function convertChangesToDMP(changes) {
12565 var ret = [],
12566 change = /*istanbul ignore start*/void 0 /*istanbul ignore end*/,
12567 operation = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
12568 for (var i = 0; i < changes.length; i++) {
12569 change = changes[i];
12570 if (change.added) {
12571 operation = 1;
12572 } else if (change.removed) {
12573 operation = -1;
12574 } else {
12575 operation = 0;
12576 }
12577
12578 ret.push([operation, change.value]);
12579 }
12580 return ret;
12581 }
12582
12583
12584
12585/***/ }),
12586/* 17 */
12587/***/ (function(module, exports) {
12588
12589 /*istanbul ignore start*/'use strict';
12590
12591 exports.__esModule = true;
12592 exports. /*istanbul ignore end*/convertChangesToXML = convertChangesToXML;
12593 function convertChangesToXML(changes) {
12594 var ret = [];
12595 for (var i = 0; i < changes.length; i++) {
12596 var change = changes[i];
12597 if (change.added) {
12598 ret.push('<ins>');
12599 } else if (change.removed) {
12600 ret.push('<del>');
12601 }
12602
12603 ret.push(escapeHTML(change.value));
12604
12605 if (change.added) {
12606 ret.push('</ins>');
12607 } else if (change.removed) {
12608 ret.push('</del>');
12609 }
12610 }
12611 return ret.join('');
12612 }
12613
12614 function escapeHTML(s) {
12615 var n = s;
12616 n = n.replace(/&/g, '&amp;');
12617 n = n.replace(/</g, '&lt;');
12618 n = n.replace(/>/g, '&gt;');
12619 n = n.replace(/"/g, '&quot;');
12620
12621 return n;
12622 }
12623
12624
12625
12626/***/ })
12627/******/ ])
12628});
12629;
12630},{}],49:[function(require,module,exports){
12631'use strict';
12632
12633var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
12634
12635module.exports = function (str) {
12636 if (typeof str !== 'string') {
12637 throw new TypeError('Expected a string');
12638 }
12639
12640 return str.replace(matchOperatorsRe, '\\$&');
12641};
12642
12643},{}],50:[function(require,module,exports){
12644// Copyright Joyent, Inc. and other Node contributors.
12645//
12646// Permission is hereby granted, free of charge, to any person obtaining a
12647// copy of this software and associated documentation files (the
12648// "Software"), to deal in the Software without restriction, including
12649// without limitation the rights to use, copy, modify, merge, publish,
12650// distribute, sublicense, and/or sell copies of the Software, and to permit
12651// persons to whom the Software is furnished to do so, subject to the
12652// following conditions:
12653//
12654// The above copyright notice and this permission notice shall be included
12655// in all copies or substantial portions of the Software.
12656//
12657// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
12658// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
12659// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
12660// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
12661// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
12662// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
12663// USE OR OTHER DEALINGS IN THE SOFTWARE.
12664
12665var objectCreate = Object.create || objectCreatePolyfill
12666var objectKeys = Object.keys || objectKeysPolyfill
12667var bind = Function.prototype.bind || functionBindPolyfill
12668
12669function EventEmitter() {
12670 if (!this._events || !Object.prototype.hasOwnProperty.call(this, '_events')) {
12671 this._events = objectCreate(null);
12672 this._eventsCount = 0;
12673 }
12674
12675 this._maxListeners = this._maxListeners || undefined;
12676}
12677module.exports = EventEmitter;
12678
12679// Backwards-compat with node 0.10.x
12680EventEmitter.EventEmitter = EventEmitter;
12681
12682EventEmitter.prototype._events = undefined;
12683EventEmitter.prototype._maxListeners = undefined;
12684
12685// By default EventEmitters will print a warning if more than 10 listeners are
12686// added to it. This is a useful default which helps finding memory leaks.
12687var defaultMaxListeners = 10;
12688
12689var hasDefineProperty;
12690try {
12691 var o = {};
12692 if (Object.defineProperty) Object.defineProperty(o, 'x', { value: 0 });
12693 hasDefineProperty = o.x === 0;
12694} catch (err) { hasDefineProperty = false }
12695if (hasDefineProperty) {
12696 Object.defineProperty(EventEmitter, 'defaultMaxListeners', {
12697 enumerable: true,
12698 get: function() {
12699 return defaultMaxListeners;
12700 },
12701 set: function(arg) {
12702 // check whether the input is a positive number (whose value is zero or
12703 // greater and not a NaN).
12704 if (typeof arg !== 'number' || arg < 0 || arg !== arg)
12705 throw new TypeError('"defaultMaxListeners" must be a positive number');
12706 defaultMaxListeners = arg;
12707 }
12708 });
12709} else {
12710 EventEmitter.defaultMaxListeners = defaultMaxListeners;
12711}
12712
12713// Obviously not all Emitters should be limited to 10. This function allows
12714// that to be increased. Set to zero for unlimited.
12715EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
12716 if (typeof n !== 'number' || n < 0 || isNaN(n))
12717 throw new TypeError('"n" argument must be a positive number');
12718 this._maxListeners = n;
12719 return this;
12720};
12721
12722function $getMaxListeners(that) {
12723 if (that._maxListeners === undefined)
12724 return EventEmitter.defaultMaxListeners;
12725 return that._maxListeners;
12726}
12727
12728EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
12729 return $getMaxListeners(this);
12730};
12731
12732// These standalone emit* functions are used to optimize calling of event
12733// handlers for fast cases because emit() itself often has a variable number of
12734// arguments and can be deoptimized because of that. These functions always have
12735// the same number of arguments and thus do not get deoptimized, so the code
12736// inside them can execute faster.
12737function emitNone(handler, isFn, self) {
12738 if (isFn)
12739 handler.call(self);
12740 else {
12741 var len = handler.length;
12742 var listeners = arrayClone(handler, len);
12743 for (var i = 0; i < len; ++i)
12744 listeners[i].call(self);
12745 }
12746}
12747function emitOne(handler, isFn, self, arg1) {
12748 if (isFn)
12749 handler.call(self, arg1);
12750 else {
12751 var len = handler.length;
12752 var listeners = arrayClone(handler, len);
12753 for (var i = 0; i < len; ++i)
12754 listeners[i].call(self, arg1);
12755 }
12756}
12757function emitTwo(handler, isFn, self, arg1, arg2) {
12758 if (isFn)
12759 handler.call(self, arg1, arg2);
12760 else {
12761 var len = handler.length;
12762 var listeners = arrayClone(handler, len);
12763 for (var i = 0; i < len; ++i)
12764 listeners[i].call(self, arg1, arg2);
12765 }
12766}
12767function emitThree(handler, isFn, self, arg1, arg2, arg3) {
12768 if (isFn)
12769 handler.call(self, arg1, arg2, arg3);
12770 else {
12771 var len = handler.length;
12772 var listeners = arrayClone(handler, len);
12773 for (var i = 0; i < len; ++i)
12774 listeners[i].call(self, arg1, arg2, arg3);
12775 }
12776}
12777
12778function emitMany(handler, isFn, self, args) {
12779 if (isFn)
12780 handler.apply(self, args);
12781 else {
12782 var len = handler.length;
12783 var listeners = arrayClone(handler, len);
12784 for (var i = 0; i < len; ++i)
12785 listeners[i].apply(self, args);
12786 }
12787}
12788
12789EventEmitter.prototype.emit = function emit(type) {
12790 var er, handler, len, args, i, events;
12791 var doError = (type === 'error');
12792
12793 events = this._events;
12794 if (events)
12795 doError = (doError && events.error == null);
12796 else if (!doError)
12797 return false;
12798
12799 // If there is no 'error' event listener then throw.
12800 if (doError) {
12801 if (arguments.length > 1)
12802 er = arguments[1];
12803 if (er instanceof Error) {
12804 throw er; // Unhandled 'error' event
12805 } else {
12806 // At least give some kind of context to the user
12807 var err = new Error('Unhandled "error" event. (' + er + ')');
12808 err.context = er;
12809 throw err;
12810 }
12811 return false;
12812 }
12813
12814 handler = events[type];
12815
12816 if (!handler)
12817 return false;
12818
12819 var isFn = typeof handler === 'function';
12820 len = arguments.length;
12821 switch (len) {
12822 // fast cases
12823 case 1:
12824 emitNone(handler, isFn, this);
12825 break;
12826 case 2:
12827 emitOne(handler, isFn, this, arguments[1]);
12828 break;
12829 case 3:
12830 emitTwo(handler, isFn, this, arguments[1], arguments[2]);
12831 break;
12832 case 4:
12833 emitThree(handler, isFn, this, arguments[1], arguments[2], arguments[3]);
12834 break;
12835 // slower
12836 default:
12837 args = new Array(len - 1);
12838 for (i = 1; i < len; i++)
12839 args[i - 1] = arguments[i];
12840 emitMany(handler, isFn, this, args);
12841 }
12842
12843 return true;
12844};
12845
12846function _addListener(target, type, listener, prepend) {
12847 var m;
12848 var events;
12849 var existing;
12850
12851 if (typeof listener !== 'function')
12852 throw new TypeError('"listener" argument must be a function');
12853
12854 events = target._events;
12855 if (!events) {
12856 events = target._events = objectCreate(null);
12857 target._eventsCount = 0;
12858 } else {
12859 // To avoid recursion in the case that type === "newListener"! Before
12860 // adding it to the listeners, first emit "newListener".
12861 if (events.newListener) {
12862 target.emit('newListener', type,
12863 listener.listener ? listener.listener : listener);
12864
12865 // Re-assign `events` because a newListener handler could have caused the
12866 // this._events to be assigned to a new object
12867 events = target._events;
12868 }
12869 existing = events[type];
12870 }
12871
12872 if (!existing) {
12873 // Optimize the case of one listener. Don't need the extra array object.
12874 existing = events[type] = listener;
12875 ++target._eventsCount;
12876 } else {
12877 if (typeof existing === 'function') {
12878 // Adding the second element, need to change to array.
12879 existing = events[type] =
12880 prepend ? [listener, existing] : [existing, listener];
12881 } else {
12882 // If we've already got an array, just append.
12883 if (prepend) {
12884 existing.unshift(listener);
12885 } else {
12886 existing.push(listener);
12887 }
12888 }
12889
12890 // Check for listener leak
12891 if (!existing.warned) {
12892 m = $getMaxListeners(target);
12893 if (m && m > 0 && existing.length > m) {
12894 existing.warned = true;
12895 var w = new Error('Possible EventEmitter memory leak detected. ' +
12896 existing.length + ' "' + String(type) + '" listeners ' +
12897 'added. Use emitter.setMaxListeners() to ' +
12898 'increase limit.');
12899 w.name = 'MaxListenersExceededWarning';
12900 w.emitter = target;
12901 w.type = type;
12902 w.count = existing.length;
12903 if (typeof console === 'object' && console.warn) {
12904 console.warn('%s: %s', w.name, w.message);
12905 }
12906 }
12907 }
12908 }
12909
12910 return target;
12911}
12912
12913EventEmitter.prototype.addListener = function addListener(type, listener) {
12914 return _addListener(this, type, listener, false);
12915};
12916
12917EventEmitter.prototype.on = EventEmitter.prototype.addListener;
12918
12919EventEmitter.prototype.prependListener =
12920 function prependListener(type, listener) {
12921 return _addListener(this, type, listener, true);
12922 };
12923
12924function onceWrapper() {
12925 if (!this.fired) {
12926 this.target.removeListener(this.type, this.wrapFn);
12927 this.fired = true;
12928 switch (arguments.length) {
12929 case 0:
12930 return this.listener.call(this.target);
12931 case 1:
12932 return this.listener.call(this.target, arguments[0]);
12933 case 2:
12934 return this.listener.call(this.target, arguments[0], arguments[1]);
12935 case 3:
12936 return this.listener.call(this.target, arguments[0], arguments[1],
12937 arguments[2]);
12938 default:
12939 var args = new Array(arguments.length);
12940 for (var i = 0; i < args.length; ++i)
12941 args[i] = arguments[i];
12942 this.listener.apply(this.target, args);
12943 }
12944 }
12945}
12946
12947function _onceWrap(target, type, listener) {
12948 var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };
12949 var wrapped = bind.call(onceWrapper, state);
12950 wrapped.listener = listener;
12951 state.wrapFn = wrapped;
12952 return wrapped;
12953}
12954
12955EventEmitter.prototype.once = function once(type, listener) {
12956 if (typeof listener !== 'function')
12957 throw new TypeError('"listener" argument must be a function');
12958 this.on(type, _onceWrap(this, type, listener));
12959 return this;
12960};
12961
12962EventEmitter.prototype.prependOnceListener =
12963 function prependOnceListener(type, listener) {
12964 if (typeof listener !== 'function')
12965 throw new TypeError('"listener" argument must be a function');
12966 this.prependListener(type, _onceWrap(this, type, listener));
12967 return this;
12968 };
12969
12970// Emits a 'removeListener' event if and only if the listener was removed.
12971EventEmitter.prototype.removeListener =
12972 function removeListener(type, listener) {
12973 var list, events, position, i, originalListener;
12974
12975 if (typeof listener !== 'function')
12976 throw new TypeError('"listener" argument must be a function');
12977
12978 events = this._events;
12979 if (!events)
12980 return this;
12981
12982 list = events[type];
12983 if (!list)
12984 return this;
12985
12986 if (list === listener || list.listener === listener) {
12987 if (--this._eventsCount === 0)
12988 this._events = objectCreate(null);
12989 else {
12990 delete events[type];
12991 if (events.removeListener)
12992 this.emit('removeListener', type, list.listener || listener);
12993 }
12994 } else if (typeof list !== 'function') {
12995 position = -1;
12996
12997 for (i = list.length - 1; i >= 0; i--) {
12998 if (list[i] === listener || list[i].listener === listener) {
12999 originalListener = list[i].listener;
13000 position = i;
13001 break;
13002 }
13003 }
13004
13005 if (position < 0)
13006 return this;
13007
13008 if (position === 0)
13009 list.shift();
13010 else
13011 spliceOne(list, position);
13012
13013 if (list.length === 1)
13014 events[type] = list[0];
13015
13016 if (events.removeListener)
13017 this.emit('removeListener', type, originalListener || listener);
13018 }
13019
13020 return this;
13021 };
13022
13023EventEmitter.prototype.removeAllListeners =
13024 function removeAllListeners(type) {
13025 var listeners, events, i;
13026
13027 events = this._events;
13028 if (!events)
13029 return this;
13030
13031 // not listening for removeListener, no need to emit
13032 if (!events.removeListener) {
13033 if (arguments.length === 0) {
13034 this._events = objectCreate(null);
13035 this._eventsCount = 0;
13036 } else if (events[type]) {
13037 if (--this._eventsCount === 0)
13038 this._events = objectCreate(null);
13039 else
13040 delete events[type];
13041 }
13042 return this;
13043 }
13044
13045 // emit removeListener for all listeners on all events
13046 if (arguments.length === 0) {
13047 var keys = objectKeys(events);
13048 var key;
13049 for (i = 0; i < keys.length; ++i) {
13050 key = keys[i];
13051 if (key === 'removeListener') continue;
13052 this.removeAllListeners(key);
13053 }
13054 this.removeAllListeners('removeListener');
13055 this._events = objectCreate(null);
13056 this._eventsCount = 0;
13057 return this;
13058 }
13059
13060 listeners = events[type];
13061
13062 if (typeof listeners === 'function') {
13063 this.removeListener(type, listeners);
13064 } else if (listeners) {
13065 // LIFO order
13066 for (i = listeners.length - 1; i >= 0; i--) {
13067 this.removeListener(type, listeners[i]);
13068 }
13069 }
13070
13071 return this;
13072 };
13073
13074function _listeners(target, type, unwrap) {
13075 var events = target._events;
13076
13077 if (!events)
13078 return [];
13079
13080 var evlistener = events[type];
13081 if (!evlistener)
13082 return [];
13083
13084 if (typeof evlistener === 'function')
13085 return unwrap ? [evlistener.listener || evlistener] : [evlistener];
13086
13087 return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
13088}
13089
13090EventEmitter.prototype.listeners = function listeners(type) {
13091 return _listeners(this, type, true);
13092};
13093
13094EventEmitter.prototype.rawListeners = function rawListeners(type) {
13095 return _listeners(this, type, false);
13096};
13097
13098EventEmitter.listenerCount = function(emitter, type) {
13099 if (typeof emitter.listenerCount === 'function') {
13100 return emitter.listenerCount(type);
13101 } else {
13102 return listenerCount.call(emitter, type);
13103 }
13104};
13105
13106EventEmitter.prototype.listenerCount = listenerCount;
13107function listenerCount(type) {
13108 var events = this._events;
13109
13110 if (events) {
13111 var evlistener = events[type];
13112
13113 if (typeof evlistener === 'function') {
13114 return 1;
13115 } else if (evlistener) {
13116 return evlistener.length;
13117 }
13118 }
13119
13120 return 0;
13121}
13122
13123EventEmitter.prototype.eventNames = function eventNames() {
13124 return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : [];
13125};
13126
13127// About 1.5x faster than the two-arg version of Array#splice().
13128function spliceOne(list, index) {
13129 for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1)
13130 list[i] = list[k];
13131 list.pop();
13132}
13133
13134function arrayClone(arr, n) {
13135 var copy = new Array(n);
13136 for (var i = 0; i < n; ++i)
13137 copy[i] = arr[i];
13138 return copy;
13139}
13140
13141function unwrapListeners(arr) {
13142 var ret = new Array(arr.length);
13143 for (var i = 0; i < ret.length; ++i) {
13144 ret[i] = arr[i].listener || arr[i];
13145 }
13146 return ret;
13147}
13148
13149function objectCreatePolyfill(proto) {
13150 var F = function() {};
13151 F.prototype = proto;
13152 return new F;
13153}
13154function objectKeysPolyfill(obj) {
13155 var keys = [];
13156 for (var k in obj) if (Object.prototype.hasOwnProperty.call(obj, k)) {
13157 keys.push(k);
13158 }
13159 return k;
13160}
13161function functionBindPolyfill(context) {
13162 var fn = this;
13163 return function () {
13164 return fn.apply(context, arguments);
13165 };
13166}
13167
13168},{}],51:[function(require,module,exports){
13169'use strict';
13170
13171/* eslint no-invalid-this: 1 */
13172
13173var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
13174var slice = Array.prototype.slice;
13175var toStr = Object.prototype.toString;
13176var funcType = '[object Function]';
13177
13178module.exports = function bind(that) {
13179 var target = this;
13180 if (typeof target !== 'function' || toStr.call(target) !== funcType) {
13181 throw new TypeError(ERROR_MESSAGE + target);
13182 }
13183 var args = slice.call(arguments, 1);
13184
13185 var bound;
13186 var binder = function () {
13187 if (this instanceof bound) {
13188 var result = target.apply(
13189 this,
13190 args.concat(slice.call(arguments))
13191 );
13192 if (Object(result) === result) {
13193 return result;
13194 }
13195 return this;
13196 } else {
13197 return target.apply(
13198 that,
13199 args.concat(slice.call(arguments))
13200 );
13201 }
13202 };
13203
13204 var boundLength = Math.max(0, target.length - args.length);
13205 var boundArgs = [];
13206 for (var i = 0; i < boundLength; i++) {
13207 boundArgs.push('$' + i);
13208 }
13209
13210 bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
13211
13212 if (target.prototype) {
13213 var Empty = function Empty() {};
13214 Empty.prototype = target.prototype;
13215 bound.prototype = new Empty();
13216 Empty.prototype = null;
13217 }
13218
13219 return bound;
13220};
13221
13222},{}],52:[function(require,module,exports){
13223'use strict';
13224
13225var implementation = require('./implementation');
13226
13227module.exports = Function.prototype.bind || implementation;
13228
13229},{"./implementation":51}],53:[function(require,module,exports){
13230'use strict';
13231
13232/* eslint complexity: [2, 17], max-statements: [2, 33] */
13233module.exports = function hasSymbols() {
13234 if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
13235 if (typeof Symbol.iterator === 'symbol') { return true; }
13236
13237 var obj = {};
13238 var sym = Symbol('test');
13239 var symObj = Object(sym);
13240 if (typeof sym === 'string') { return false; }
13241
13242 if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
13243 if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
13244
13245 // temp disabled per https://github.com/ljharb/object.assign/issues/17
13246 // if (sym instanceof Symbol) { return false; }
13247 // temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
13248 // if (!(symObj instanceof Symbol)) { return false; }
13249
13250 // if (typeof Symbol.prototype.toString !== 'function') { return false; }
13251 // if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
13252
13253 var symVal = 42;
13254 obj[sym] = symVal;
13255 for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax
13256 if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
13257
13258 if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
13259
13260 var syms = Object.getOwnPropertySymbols(obj);
13261 if (syms.length !== 1 || syms[0] !== sym) { return false; }
13262
13263 if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
13264
13265 if (typeof Object.getOwnPropertyDescriptor === 'function') {
13266 var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
13267 if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
13268 }
13269
13270 return true;
13271};
13272
13273},{}],54:[function(require,module,exports){
13274(function (global){
13275/*! https://mths.be/he v1.2.0 by @mathias | MIT license */
13276;(function(root) {
13277
13278 // Detect free variables `exports`.
13279 var freeExports = typeof exports == 'object' && exports;
13280
13281 // Detect free variable `module`.
13282 var freeModule = typeof module == 'object' && module &&
13283 module.exports == freeExports && module;
13284
13285 // Detect free variable `global`, from Node.js or Browserified code,
13286 // and use it as `root`.
13287 var freeGlobal = typeof global == 'object' && global;
13288 if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {
13289 root = freeGlobal;
13290 }
13291
13292 /*--------------------------------------------------------------------------*/
13293
13294 // All astral symbols.
13295 var regexAstralSymbols = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
13296 // All ASCII symbols (not just printable ASCII) except those listed in the
13297 // first column of the overrides table.
13298 // https://html.spec.whatwg.org/multipage/syntax.html#table-charref-overrides
13299 var regexAsciiWhitelist = /[\x01-\x7F]/g;
13300 // All BMP symbols that are not ASCII newlines, printable ASCII symbols, or
13301 // code points listed in the first column of the overrides table on
13302 // https://html.spec.whatwg.org/multipage/syntax.html#table-charref-overrides.
13303 var regexBmpWhitelist = /[\x01-\t\x0B\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g;
13304
13305 var regexEncodeNonAscii = /<\u20D2|=\u20E5|>\u20D2|\u205F\u200A|\u219D\u0338|\u2202\u0338|\u2220\u20D2|\u2229\uFE00|\u222A\uFE00|\u223C\u20D2|\u223D\u0331|\u223E\u0333|\u2242\u0338|\u224B\u0338|\u224D\u20D2|\u224E\u0338|\u224F\u0338|\u2250\u0338|\u2261\u20E5|\u2264\u20D2|\u2265\u20D2|\u2266\u0338|\u2267\u0338|\u2268\uFE00|\u2269\uFE00|\u226A\u0338|\u226A\u20D2|\u226B\u0338|\u226B\u20D2|\u227F\u0338|\u2282\u20D2|\u2283\u20D2|\u228A\uFE00|\u228B\uFE00|\u228F\u0338|\u2290\u0338|\u2293\uFE00|\u2294\uFE00|\u22B4\u20D2|\u22B5\u20D2|\u22D8\u0338|\u22D9\u0338|\u22DA\uFE00|\u22DB\uFE00|\u22F5\u0338|\u22F9\u0338|\u2933\u0338|\u29CF\u0338|\u29D0\u0338|\u2A6D\u0338|\u2A70\u0338|\u2A7D\u0338|\u2A7E\u0338|\u2AA1\u0338|\u2AA2\u0338|\u2AAC\uFE00|\u2AAD\uFE00|\u2AAF\u0338|\u2AB0\u0338|\u2AC5\u0338|\u2AC6\u0338|\u2ACB\uFE00|\u2ACC\uFE00|\u2AFD\u20E5|[\xA0-\u0113\u0116-\u0122\u0124-\u012B\u012E-\u014D\u0150-\u017E\u0192\u01B5\u01F5\u0237\u02C6\u02C7\u02D8-\u02DD\u0311\u0391-\u03A1\u03A3-\u03A9\u03B1-\u03C9\u03D1\u03D2\u03D5\u03D6\u03DC\u03DD\u03F0\u03F1\u03F5\u03F6\u0401-\u040C\u040E-\u044F\u0451-\u045C\u045E\u045F\u2002-\u2005\u2007-\u2010\u2013-\u2016\u2018-\u201A\u201C-\u201E\u2020-\u2022\u2025\u2026\u2030-\u2035\u2039\u203A\u203E\u2041\u2043\u2044\u204F\u2057\u205F-\u2063\u20AC\u20DB\u20DC\u2102\u2105\u210A-\u2113\u2115-\u211E\u2122\u2124\u2127-\u2129\u212C\u212D\u212F-\u2131\u2133-\u2138\u2145-\u2148\u2153-\u215E\u2190-\u219B\u219D-\u21A7\u21A9-\u21AE\u21B0-\u21B3\u21B5-\u21B7\u21BA-\u21DB\u21DD\u21E4\u21E5\u21F5\u21FD-\u2205\u2207-\u2209\u220B\u220C\u220F-\u2214\u2216-\u2218\u221A\u221D-\u2238\u223A-\u2257\u2259\u225A\u225C\u225F-\u2262\u2264-\u228B\u228D-\u229B\u229D-\u22A5\u22A7-\u22B0\u22B2-\u22BB\u22BD-\u22DB\u22DE-\u22E3\u22E6-\u22F7\u22F9-\u22FE\u2305\u2306\u2308-\u2310\u2312\u2313\u2315\u2316\u231C-\u231F\u2322\u2323\u232D\u232E\u2336\u233D\u233F\u237C\u23B0\u23B1\u23B4-\u23B6\u23DC-\u23DF\u23E2\u23E7\u2423\u24C8\u2500\u2502\u250C\u2510\u2514\u2518\u251C\u2524\u252C\u2534\u253C\u2550-\u256C\u2580\u2584\u2588\u2591-\u2593\u25A1\u25AA\u25AB\u25AD\u25AE\u25B1\u25B3-\u25B5\u25B8\u25B9\u25BD-\u25BF\u25C2\u25C3\u25CA\u25CB\u25EC\u25EF\u25F8-\u25FC\u2605\u2606\u260E\u2640\u2642\u2660\u2663\u2665\u2666\u266A\u266D-\u266F\u2713\u2717\u2720\u2736\u2758\u2772\u2773\u27C8\u27C9\u27E6-\u27ED\u27F5-\u27FA\u27FC\u27FF\u2902-\u2905\u290C-\u2913\u2916\u2919-\u2920\u2923-\u292A\u2933\u2935-\u2939\u293C\u293D\u2945\u2948-\u294B\u294E-\u2976\u2978\u2979\u297B-\u297F\u2985\u2986\u298B-\u2996\u299A\u299C\u299D\u29A4-\u29B7\u29B9\u29BB\u29BC\u29BE-\u29C5\u29C9\u29CD-\u29D0\u29DC-\u29DE\u29E3-\u29E5\u29EB\u29F4\u29F6\u2A00-\u2A02\u2A04\u2A06\u2A0C\u2A0D\u2A10-\u2A17\u2A22-\u2A27\u2A29\u2A2A\u2A2D-\u2A31\u2A33-\u2A3C\u2A3F\u2A40\u2A42-\u2A4D\u2A50\u2A53-\u2A58\u2A5A-\u2A5D\u2A5F\u2A66\u2A6A\u2A6D-\u2A75\u2A77-\u2A9A\u2A9D-\u2AA2\u2AA4-\u2AB0\u2AB3-\u2AC8\u2ACB\u2ACC\u2ACF-\u2ADB\u2AE4\u2AE6-\u2AE9\u2AEB-\u2AF3\u2AFD\uFB00-\uFB04]|\uD835[\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDCCF\uDD04\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDD6B]/g;
13306 var encodeMap = {'\xAD':'shy','\u200C':'zwnj','\u200D':'zwj','\u200E':'lrm','\u2063':'ic','\u2062':'it','\u2061':'af','\u200F':'rlm','\u200B':'ZeroWidthSpace','\u2060':'NoBreak','\u0311':'DownBreve','\u20DB':'tdot','\u20DC':'DotDot','\t':'Tab','\n':'NewLine','\u2008':'puncsp','\u205F':'MediumSpace','\u2009':'thinsp','\u200A':'hairsp','\u2004':'emsp13','\u2002':'ensp','\u2005':'emsp14','\u2003':'emsp','\u2007':'numsp','\xA0':'nbsp','\u205F\u200A':'ThickSpace','\u203E':'oline','_':'lowbar','\u2010':'dash','\u2013':'ndash','\u2014':'mdash','\u2015':'horbar',',':'comma',';':'semi','\u204F':'bsemi',':':'colon','\u2A74':'Colone','!':'excl','\xA1':'iexcl','?':'quest','\xBF':'iquest','.':'period','\u2025':'nldr','\u2026':'mldr','\xB7':'middot','\'':'apos','\u2018':'lsquo','\u2019':'rsquo','\u201A':'sbquo','\u2039':'lsaquo','\u203A':'rsaquo','"':'quot','\u201C':'ldquo','\u201D':'rdquo','\u201E':'bdquo','\xAB':'laquo','\xBB':'raquo','(':'lpar',')':'rpar','[':'lsqb',']':'rsqb','{':'lcub','}':'rcub','\u2308':'lceil','\u2309':'rceil','\u230A':'lfloor','\u230B':'rfloor','\u2985':'lopar','\u2986':'ropar','\u298B':'lbrke','\u298C':'rbrke','\u298D':'lbrkslu','\u298E':'rbrksld','\u298F':'lbrksld','\u2990':'rbrkslu','\u2991':'langd','\u2992':'rangd','\u2993':'lparlt','\u2994':'rpargt','\u2995':'gtlPar','\u2996':'ltrPar','\u27E6':'lobrk','\u27E7':'robrk','\u27E8':'lang','\u27E9':'rang','\u27EA':'Lang','\u27EB':'Rang','\u27EC':'loang','\u27ED':'roang','\u2772':'lbbrk','\u2773':'rbbrk','\u2016':'Vert','\xA7':'sect','\xB6':'para','@':'commat','*':'ast','/':'sol','undefined':null,'&':'amp','#':'num','%':'percnt','\u2030':'permil','\u2031':'pertenk','\u2020':'dagger','\u2021':'Dagger','\u2022':'bull','\u2043':'hybull','\u2032':'prime','\u2033':'Prime','\u2034':'tprime','\u2057':'qprime','\u2035':'bprime','\u2041':'caret','`':'grave','\xB4':'acute','\u02DC':'tilde','^':'Hat','\xAF':'macr','\u02D8':'breve','\u02D9':'dot','\xA8':'die','\u02DA':'ring','\u02DD':'dblac','\xB8':'cedil','\u02DB':'ogon','\u02C6':'circ','\u02C7':'caron','\xB0':'deg','\xA9':'copy','\xAE':'reg','\u2117':'copysr','\u2118':'wp','\u211E':'rx','\u2127':'mho','\u2129':'iiota','\u2190':'larr','\u219A':'nlarr','\u2192':'rarr','\u219B':'nrarr','\u2191':'uarr','\u2193':'darr','\u2194':'harr','\u21AE':'nharr','\u2195':'varr','\u2196':'nwarr','\u2197':'nearr','\u2198':'searr','\u2199':'swarr','\u219D':'rarrw','\u219D\u0338':'nrarrw','\u219E':'Larr','\u219F':'Uarr','\u21A0':'Rarr','\u21A1':'Darr','\u21A2':'larrtl','\u21A3':'rarrtl','\u21A4':'mapstoleft','\u21A5':'mapstoup','\u21A6':'map','\u21A7':'mapstodown','\u21A9':'larrhk','\u21AA':'rarrhk','\u21AB':'larrlp','\u21AC':'rarrlp','\u21AD':'harrw','\u21B0':'lsh','\u21B1':'rsh','\u21B2':'ldsh','\u21B3':'rdsh','\u21B5':'crarr','\u21B6':'cularr','\u21B7':'curarr','\u21BA':'olarr','\u21BB':'orarr','\u21BC':'lharu','\u21BD':'lhard','\u21BE':'uharr','\u21BF':'uharl','\u21C0':'rharu','\u21C1':'rhard','\u21C2':'dharr','\u21C3':'dharl','\u21C4':'rlarr','\u21C5':'udarr','\u21C6':'lrarr','\u21C7':'llarr','\u21C8':'uuarr','\u21C9':'rrarr','\u21CA':'ddarr','\u21CB':'lrhar','\u21CC':'rlhar','\u21D0':'lArr','\u21CD':'nlArr','\u21D1':'uArr','\u21D2':'rArr','\u21CF':'nrArr','\u21D3':'dArr','\u21D4':'iff','\u21CE':'nhArr','\u21D5':'vArr','\u21D6':'nwArr','\u21D7':'neArr','\u21D8':'seArr','\u21D9':'swArr','\u21DA':'lAarr','\u21DB':'rAarr','\u21DD':'zigrarr','\u21E4':'larrb','\u21E5':'rarrb','\u21F5':'duarr','\u21FD':'loarr','\u21FE':'roarr','\u21FF':'hoarr','\u2200':'forall','\u2201':'comp','\u2202':'part','\u2202\u0338':'npart','\u2203':'exist','\u2204':'nexist','\u2205':'empty','\u2207':'Del','\u2208':'in','\u2209':'notin','\u220B':'ni','\u220C':'notni','\u03F6':'bepsi','\u220F':'prod','\u2210':'coprod','\u2211':'sum','+':'plus','\xB1':'pm','\xF7':'div','\xD7':'times','<':'lt','\u226E':'nlt','<\u20D2':'nvlt','=':'equals','\u2260':'ne','=\u20E5':'bne','\u2A75':'Equal','>':'gt','\u226F':'ngt','>\u20D2':'nvgt','\xAC':'not','|':'vert','\xA6':'brvbar','\u2212':'minus','\u2213':'mp','\u2214':'plusdo','\u2044':'frasl','\u2216':'setmn','\u2217':'lowast','\u2218':'compfn','\u221A':'Sqrt','\u221D':'prop','\u221E':'infin','\u221F':'angrt','\u2220':'ang','\u2220\u20D2':'nang','\u2221':'angmsd','\u2222':'angsph','\u2223':'mid','\u2224':'nmid','\u2225':'par','\u2226':'npar','\u2227':'and','\u2228':'or','\u2229':'cap','\u2229\uFE00':'caps','\u222A':'cup','\u222A\uFE00':'cups','\u222B':'int','\u222C':'Int','\u222D':'tint','\u2A0C':'qint','\u222E':'oint','\u222F':'Conint','\u2230':'Cconint','\u2231':'cwint','\u2232':'cwconint','\u2233':'awconint','\u2234':'there4','\u2235':'becaus','\u2236':'ratio','\u2237':'Colon','\u2238':'minusd','\u223A':'mDDot','\u223B':'homtht','\u223C':'sim','\u2241':'nsim','\u223C\u20D2':'nvsim','\u223D':'bsim','\u223D\u0331':'race','\u223E':'ac','\u223E\u0333':'acE','\u223F':'acd','\u2240':'wr','\u2242':'esim','\u2242\u0338':'nesim','\u2243':'sime','\u2244':'nsime','\u2245':'cong','\u2247':'ncong','\u2246':'simne','\u2248':'ap','\u2249':'nap','\u224A':'ape','\u224B':'apid','\u224B\u0338':'napid','\u224C':'bcong','\u224D':'CupCap','\u226D':'NotCupCap','\u224D\u20D2':'nvap','\u224E':'bump','\u224E\u0338':'nbump','\u224F':'bumpe','\u224F\u0338':'nbumpe','\u2250':'doteq','\u2250\u0338':'nedot','\u2251':'eDot','\u2252':'efDot','\u2253':'erDot','\u2254':'colone','\u2255':'ecolon','\u2256':'ecir','\u2257':'cire','\u2259':'wedgeq','\u225A':'veeeq','\u225C':'trie','\u225F':'equest','\u2261':'equiv','\u2262':'nequiv','\u2261\u20E5':'bnequiv','\u2264':'le','\u2270':'nle','\u2264\u20D2':'nvle','\u2265':'ge','\u2271':'nge','\u2265\u20D2':'nvge','\u2266':'lE','\u2266\u0338':'nlE','\u2267':'gE','\u2267\u0338':'ngE','\u2268\uFE00':'lvnE','\u2268':'lnE','\u2269':'gnE','\u2269\uFE00':'gvnE','\u226A':'ll','\u226A\u0338':'nLtv','\u226A\u20D2':'nLt','\u226B':'gg','\u226B\u0338':'nGtv','\u226B\u20D2':'nGt','\u226C':'twixt','\u2272':'lsim','\u2274':'nlsim','\u2273':'gsim','\u2275':'ngsim','\u2276':'lg','\u2278':'ntlg','\u2277':'gl','\u2279':'ntgl','\u227A':'pr','\u2280':'npr','\u227B':'sc','\u2281':'nsc','\u227C':'prcue','\u22E0':'nprcue','\u227D':'sccue','\u22E1':'nsccue','\u227E':'prsim','\u227F':'scsim','\u227F\u0338':'NotSucceedsTilde','\u2282':'sub','\u2284':'nsub','\u2282\u20D2':'vnsub','\u2283':'sup','\u2285':'nsup','\u2283\u20D2':'vnsup','\u2286':'sube','\u2288':'nsube','\u2287':'supe','\u2289':'nsupe','\u228A\uFE00':'vsubne','\u228A':'subne','\u228B\uFE00':'vsupne','\u228B':'supne','\u228D':'cupdot','\u228E':'uplus','\u228F':'sqsub','\u228F\u0338':'NotSquareSubset','\u2290':'sqsup','\u2290\u0338':'NotSquareSuperset','\u2291':'sqsube','\u22E2':'nsqsube','\u2292':'sqsupe','\u22E3':'nsqsupe','\u2293':'sqcap','\u2293\uFE00':'sqcaps','\u2294':'sqcup','\u2294\uFE00':'sqcups','\u2295':'oplus','\u2296':'ominus','\u2297':'otimes','\u2298':'osol','\u2299':'odot','\u229A':'ocir','\u229B':'oast','\u229D':'odash','\u229E':'plusb','\u229F':'minusb','\u22A0':'timesb','\u22A1':'sdotb','\u22A2':'vdash','\u22AC':'nvdash','\u22A3':'dashv','\u22A4':'top','\u22A5':'bot','\u22A7':'models','\u22A8':'vDash','\u22AD':'nvDash','\u22A9':'Vdash','\u22AE':'nVdash','\u22AA':'Vvdash','\u22AB':'VDash','\u22AF':'nVDash','\u22B0':'prurel','\u22B2':'vltri','\u22EA':'nltri','\u22B3':'vrtri','\u22EB':'nrtri','\u22B4':'ltrie','\u22EC':'nltrie','\u22B4\u20D2':'nvltrie','\u22B5':'rtrie','\u22ED':'nrtrie','\u22B5\u20D2':'nvrtrie','\u22B6':'origof','\u22B7':'imof','\u22B8':'mumap','\u22B9':'hercon','\u22BA':'intcal','\u22BB':'veebar','\u22BD':'barvee','\u22BE':'angrtvb','\u22BF':'lrtri','\u22C0':'Wedge','\u22C1':'Vee','\u22C2':'xcap','\u22C3':'xcup','\u22C4':'diam','\u22C5':'sdot','\u22C6':'Star','\u22C7':'divonx','\u22C8':'bowtie','\u22C9':'ltimes','\u22CA':'rtimes','\u22CB':'lthree','\u22CC':'rthree','\u22CD':'bsime','\u22CE':'cuvee','\u22CF':'cuwed','\u22D0':'Sub','\u22D1':'Sup','\u22D2':'Cap','\u22D3':'Cup','\u22D4':'fork','\u22D5':'epar','\u22D6':'ltdot','\u22D7':'gtdot','\u22D8':'Ll','\u22D8\u0338':'nLl','\u22D9':'Gg','\u22D9\u0338':'nGg','\u22DA\uFE00':'lesg','\u22DA':'leg','\u22DB':'gel','\u22DB\uFE00':'gesl','\u22DE':'cuepr','\u22DF':'cuesc','\u22E6':'lnsim','\u22E7':'gnsim','\u22E8':'prnsim','\u22E9':'scnsim','\u22EE':'vellip','\u22EF':'ctdot','\u22F0':'utdot','\u22F1':'dtdot','\u22F2':'disin','\u22F3':'isinsv','\u22F4':'isins','\u22F5':'isindot','\u22F5\u0338':'notindot','\u22F6':'notinvc','\u22F7':'notinvb','\u22F9':'isinE','\u22F9\u0338':'notinE','\u22FA':'nisd','\u22FB':'xnis','\u22FC':'nis','\u22FD':'notnivc','\u22FE':'notnivb','\u2305':'barwed','\u2306':'Barwed','\u230C':'drcrop','\u230D':'dlcrop','\u230E':'urcrop','\u230F':'ulcrop','\u2310':'bnot','\u2312':'profline','\u2313':'profsurf','\u2315':'telrec','\u2316':'target','\u231C':'ulcorn','\u231D':'urcorn','\u231E':'dlcorn','\u231F':'drcorn','\u2322':'frown','\u2323':'smile','\u232D':'cylcty','\u232E':'profalar','\u2336':'topbot','\u233D':'ovbar','\u233F':'solbar','\u237C':'angzarr','\u23B0':'lmoust','\u23B1':'rmoust','\u23B4':'tbrk','\u23B5':'bbrk','\u23B6':'bbrktbrk','\u23DC':'OverParenthesis','\u23DD':'UnderParenthesis','\u23DE':'OverBrace','\u23DF':'UnderBrace','\u23E2':'trpezium','\u23E7':'elinters','\u2423':'blank','\u2500':'boxh','\u2502':'boxv','\u250C':'boxdr','\u2510':'boxdl','\u2514':'boxur','\u2518':'boxul','\u251C':'boxvr','\u2524':'boxvl','\u252C':'boxhd','\u2534':'boxhu','\u253C':'boxvh','\u2550':'boxH','\u2551':'boxV','\u2552':'boxdR','\u2553':'boxDr','\u2554':'boxDR','\u2555':'boxdL','\u2556':'boxDl','\u2557':'boxDL','\u2558':'boxuR','\u2559':'boxUr','\u255A':'boxUR','\u255B':'boxuL','\u255C':'boxUl','\u255D':'boxUL','\u255E':'boxvR','\u255F':'boxVr','\u2560':'boxVR','\u2561':'boxvL','\u2562':'boxVl','\u2563':'boxVL','\u2564':'boxHd','\u2565':'boxhD','\u2566':'boxHD','\u2567':'boxHu','\u2568':'boxhU','\u2569':'boxHU','\u256A':'boxvH','\u256B':'boxVh','\u256C':'boxVH','\u2580':'uhblk','\u2584':'lhblk','\u2588':'block','\u2591':'blk14','\u2592':'blk12','\u2593':'blk34','\u25A1':'squ','\u25AA':'squf','\u25AB':'EmptyVerySmallSquare','\u25AD':'rect','\u25AE':'marker','\u25B1':'fltns','\u25B3':'xutri','\u25B4':'utrif','\u25B5':'utri','\u25B8':'rtrif','\u25B9':'rtri','\u25BD':'xdtri','\u25BE':'dtrif','\u25BF':'dtri','\u25C2':'ltrif','\u25C3':'ltri','\u25CA':'loz','\u25CB':'cir','\u25EC':'tridot','\u25EF':'xcirc','\u25F8':'ultri','\u25F9':'urtri','\u25FA':'lltri','\u25FB':'EmptySmallSquare','\u25FC':'FilledSmallSquare','\u2605':'starf','\u2606':'star','\u260E':'phone','\u2640':'female','\u2642':'male','\u2660':'spades','\u2663':'clubs','\u2665':'hearts','\u2666':'diams','\u266A':'sung','\u2713':'check','\u2717':'cross','\u2720':'malt','\u2736':'sext','\u2758':'VerticalSeparator','\u27C8':'bsolhsub','\u27C9':'suphsol','\u27F5':'xlarr','\u27F6':'xrarr','\u27F7':'xharr','\u27F8':'xlArr','\u27F9':'xrArr','\u27FA':'xhArr','\u27FC':'xmap','\u27FF':'dzigrarr','\u2902':'nvlArr','\u2903':'nvrArr','\u2904':'nvHarr','\u2905':'Map','\u290C':'lbarr','\u290D':'rbarr','\u290E':'lBarr','\u290F':'rBarr','\u2910':'RBarr','\u2911':'DDotrahd','\u2912':'UpArrowBar','\u2913':'DownArrowBar','\u2916':'Rarrtl','\u2919':'latail','\u291A':'ratail','\u291B':'lAtail','\u291C':'rAtail','\u291D':'larrfs','\u291E':'rarrfs','\u291F':'larrbfs','\u2920':'rarrbfs','\u2923':'nwarhk','\u2924':'nearhk','\u2925':'searhk','\u2926':'swarhk','\u2927':'nwnear','\u2928':'toea','\u2929':'tosa','\u292A':'swnwar','\u2933':'rarrc','\u2933\u0338':'nrarrc','\u2935':'cudarrr','\u2936':'ldca','\u2937':'rdca','\u2938':'cudarrl','\u2939':'larrpl','\u293C':'curarrm','\u293D':'cularrp','\u2945':'rarrpl','\u2948':'harrcir','\u2949':'Uarrocir','\u294A':'lurdshar','\u294B':'ldrushar','\u294E':'LeftRightVector','\u294F':'RightUpDownVector','\u2950':'DownLeftRightVector','\u2951':'LeftUpDownVector','\u2952':'LeftVectorBar','\u2953':'RightVectorBar','\u2954':'RightUpVectorBar','\u2955':'RightDownVectorBar','\u2956':'DownLeftVectorBar','\u2957':'DownRightVectorBar','\u2958':'LeftUpVectorBar','\u2959':'LeftDownVectorBar','\u295A':'LeftTeeVector','\u295B':'RightTeeVector','\u295C':'RightUpTeeVector','\u295D':'RightDownTeeVector','\u295E':'DownLeftTeeVector','\u295F':'DownRightTeeVector','\u2960':'LeftUpTeeVector','\u2961':'LeftDownTeeVector','\u2962':'lHar','\u2963':'uHar','\u2964':'rHar','\u2965':'dHar','\u2966':'luruhar','\u2967':'ldrdhar','\u2968':'ruluhar','\u2969':'rdldhar','\u296A':'lharul','\u296B':'llhard','\u296C':'rharul','\u296D':'lrhard','\u296E':'udhar','\u296F':'duhar','\u2970':'RoundImplies','\u2971':'erarr','\u2972':'simrarr','\u2973':'larrsim','\u2974':'rarrsim','\u2975':'rarrap','\u2976':'ltlarr','\u2978':'gtrarr','\u2979':'subrarr','\u297B':'suplarr','\u297C':'lfisht','\u297D':'rfisht','\u297E':'ufisht','\u297F':'dfisht','\u299A':'vzigzag','\u299C':'vangrt','\u299D':'angrtvbd','\u29A4':'ange','\u29A5':'range','\u29A6':'dwangle','\u29A7':'uwangle','\u29A8':'angmsdaa','\u29A9':'angmsdab','\u29AA':'angmsdac','\u29AB':'angmsdad','\u29AC':'angmsdae','\u29AD':'angmsdaf','\u29AE':'angmsdag','\u29AF':'angmsdah','\u29B0':'bemptyv','\u29B1':'demptyv','\u29B2':'cemptyv','\u29B3':'raemptyv','\u29B4':'laemptyv','\u29B5':'ohbar','\u29B6':'omid','\u29B7':'opar','\u29B9':'operp','\u29BB':'olcross','\u29BC':'odsold','\u29BE':'olcir','\u29BF':'ofcir','\u29C0':'olt','\u29C1':'ogt','\u29C2':'cirscir','\u29C3':'cirE','\u29C4':'solb','\u29C5':'bsolb','\u29C9':'boxbox','\u29CD':'trisb','\u29CE':'rtriltri','\u29CF':'LeftTriangleBar','\u29CF\u0338':'NotLeftTriangleBar','\u29D0':'RightTriangleBar','\u29D0\u0338':'NotRightTriangleBar','\u29DC':'iinfin','\u29DD':'infintie','\u29DE':'nvinfin','\u29E3':'eparsl','\u29E4':'smeparsl','\u29E5':'eqvparsl','\u29EB':'lozf','\u29F4':'RuleDelayed','\u29F6':'dsol','\u2A00':'xodot','\u2A01':'xoplus','\u2A02':'xotime','\u2A04':'xuplus','\u2A06':'xsqcup','\u2A0D':'fpartint','\u2A10':'cirfnint','\u2A11':'awint','\u2A12':'rppolint','\u2A13':'scpolint','\u2A14':'npolint','\u2A15':'pointint','\u2A16':'quatint','\u2A17':'intlarhk','\u2A22':'pluscir','\u2A23':'plusacir','\u2A24':'simplus','\u2A25':'plusdu','\u2A26':'plussim','\u2A27':'plustwo','\u2A29':'mcomma','\u2A2A':'minusdu','\u2A2D':'loplus','\u2A2E':'roplus','\u2A2F':'Cross','\u2A30':'timesd','\u2A31':'timesbar','\u2A33':'smashp','\u2A34':'lotimes','\u2A35':'rotimes','\u2A36':'otimesas','\u2A37':'Otimes','\u2A38':'odiv','\u2A39':'triplus','\u2A3A':'triminus','\u2A3B':'tritime','\u2A3C':'iprod','\u2A3F':'amalg','\u2A40':'capdot','\u2A42':'ncup','\u2A43':'ncap','\u2A44':'capand','\u2A45':'cupor','\u2A46':'cupcap','\u2A47':'capcup','\u2A48':'cupbrcap','\u2A49':'capbrcup','\u2A4A':'cupcup','\u2A4B':'capcap','\u2A4C':'ccups','\u2A4D':'ccaps','\u2A50':'ccupssm','\u2A53':'And','\u2A54':'Or','\u2A55':'andand','\u2A56':'oror','\u2A57':'orslope','\u2A58':'andslope','\u2A5A':'andv','\u2A5B':'orv','\u2A5C':'andd','\u2A5D':'ord','\u2A5F':'wedbar','\u2A66':'sdote','\u2A6A':'simdot','\u2A6D':'congdot','\u2A6D\u0338':'ncongdot','\u2A6E':'easter','\u2A6F':'apacir','\u2A70':'apE','\u2A70\u0338':'napE','\u2A71':'eplus','\u2A72':'pluse','\u2A73':'Esim','\u2A77':'eDDot','\u2A78':'equivDD','\u2A79':'ltcir','\u2A7A':'gtcir','\u2A7B':'ltquest','\u2A7C':'gtquest','\u2A7D':'les','\u2A7D\u0338':'nles','\u2A7E':'ges','\u2A7E\u0338':'nges','\u2A7F':'lesdot','\u2A80':'gesdot','\u2A81':'lesdoto','\u2A82':'gesdoto','\u2A83':'lesdotor','\u2A84':'gesdotol','\u2A85':'lap','\u2A86':'gap','\u2A87':'lne','\u2A88':'gne','\u2A89':'lnap','\u2A8A':'gnap','\u2A8B':'lEg','\u2A8C':'gEl','\u2A8D':'lsime','\u2A8E':'gsime','\u2A8F':'lsimg','\u2A90':'gsiml','\u2A91':'lgE','\u2A92':'glE','\u2A93':'lesges','\u2A94':'gesles','\u2A95':'els','\u2A96':'egs','\u2A97':'elsdot','\u2A98':'egsdot','\u2A99':'el','\u2A9A':'eg','\u2A9D':'siml','\u2A9E':'simg','\u2A9F':'simlE','\u2AA0':'simgE','\u2AA1':'LessLess','\u2AA1\u0338':'NotNestedLessLess','\u2AA2':'GreaterGreater','\u2AA2\u0338':'NotNestedGreaterGreater','\u2AA4':'glj','\u2AA5':'gla','\u2AA6':'ltcc','\u2AA7':'gtcc','\u2AA8':'lescc','\u2AA9':'gescc','\u2AAA':'smt','\u2AAB':'lat','\u2AAC':'smte','\u2AAC\uFE00':'smtes','\u2AAD':'late','\u2AAD\uFE00':'lates','\u2AAE':'bumpE','\u2AAF':'pre','\u2AAF\u0338':'npre','\u2AB0':'sce','\u2AB0\u0338':'nsce','\u2AB3':'prE','\u2AB4':'scE','\u2AB5':'prnE','\u2AB6':'scnE','\u2AB7':'prap','\u2AB8':'scap','\u2AB9':'prnap','\u2ABA':'scnap','\u2ABB':'Pr','\u2ABC':'Sc','\u2ABD':'subdot','\u2ABE':'supdot','\u2ABF':'subplus','\u2AC0':'supplus','\u2AC1':'submult','\u2AC2':'supmult','\u2AC3':'subedot','\u2AC4':'supedot','\u2AC5':'subE','\u2AC5\u0338':'nsubE','\u2AC6':'supE','\u2AC6\u0338':'nsupE','\u2AC7':'subsim','\u2AC8':'supsim','\u2ACB\uFE00':'vsubnE','\u2ACB':'subnE','\u2ACC\uFE00':'vsupnE','\u2ACC':'supnE','\u2ACF':'csub','\u2AD0':'csup','\u2AD1':'csube','\u2AD2':'csupe','\u2AD3':'subsup','\u2AD4':'supsub','\u2AD5':'subsub','\u2AD6':'supsup','\u2AD7':'suphsub','\u2AD8':'supdsub','\u2AD9':'forkv','\u2ADA':'topfork','\u2ADB':'mlcp','\u2AE4':'Dashv','\u2AE6':'Vdashl','\u2AE7':'Barv','\u2AE8':'vBar','\u2AE9':'vBarv','\u2AEB':'Vbar','\u2AEC':'Not','\u2AED':'bNot','\u2AEE':'rnmid','\u2AEF':'cirmid','\u2AF0':'midcir','\u2AF1':'topcir','\u2AF2':'nhpar','\u2AF3':'parsim','\u2AFD':'parsl','\u2AFD\u20E5':'nparsl','\u266D':'flat','\u266E':'natur','\u266F':'sharp','\xA4':'curren','\xA2':'cent','$':'dollar','\xA3':'pound','\xA5':'yen','\u20AC':'euro','\xB9':'sup1','\xBD':'half','\u2153':'frac13','\xBC':'frac14','\u2155':'frac15','\u2159':'frac16','\u215B':'frac18','\xB2':'sup2','\u2154':'frac23','\u2156':'frac25','\xB3':'sup3','\xBE':'frac34','\u2157':'frac35','\u215C':'frac38','\u2158':'frac45','\u215A':'frac56','\u215D':'frac58','\u215E':'frac78','\uD835\uDCB6':'ascr','\uD835\uDD52':'aopf','\uD835\uDD1E':'afr','\uD835\uDD38':'Aopf','\uD835\uDD04':'Afr','\uD835\uDC9C':'Ascr','\xAA':'ordf','\xE1':'aacute','\xC1':'Aacute','\xE0':'agrave','\xC0':'Agrave','\u0103':'abreve','\u0102':'Abreve','\xE2':'acirc','\xC2':'Acirc','\xE5':'aring','\xC5':'angst','\xE4':'auml','\xC4':'Auml','\xE3':'atilde','\xC3':'Atilde','\u0105':'aogon','\u0104':'Aogon','\u0101':'amacr','\u0100':'Amacr','\xE6':'aelig','\xC6':'AElig','\uD835\uDCB7':'bscr','\uD835\uDD53':'bopf','\uD835\uDD1F':'bfr','\uD835\uDD39':'Bopf','\u212C':'Bscr','\uD835\uDD05':'Bfr','\uD835\uDD20':'cfr','\uD835\uDCB8':'cscr','\uD835\uDD54':'copf','\u212D':'Cfr','\uD835\uDC9E':'Cscr','\u2102':'Copf','\u0107':'cacute','\u0106':'Cacute','\u0109':'ccirc','\u0108':'Ccirc','\u010D':'ccaron','\u010C':'Ccaron','\u010B':'cdot','\u010A':'Cdot','\xE7':'ccedil','\xC7':'Ccedil','\u2105':'incare','\uD835\uDD21':'dfr','\u2146':'dd','\uD835\uDD55':'dopf','\uD835\uDCB9':'dscr','\uD835\uDC9F':'Dscr','\uD835\uDD07':'Dfr','\u2145':'DD','\uD835\uDD3B':'Dopf','\u010F':'dcaron','\u010E':'Dcaron','\u0111':'dstrok','\u0110':'Dstrok','\xF0':'eth','\xD0':'ETH','\u2147':'ee','\u212F':'escr','\uD835\uDD22':'efr','\uD835\uDD56':'eopf','\u2130':'Escr','\uD835\uDD08':'Efr','\uD835\uDD3C':'Eopf','\xE9':'eacute','\xC9':'Eacute','\xE8':'egrave','\xC8':'Egrave','\xEA':'ecirc','\xCA':'Ecirc','\u011B':'ecaron','\u011A':'Ecaron','\xEB':'euml','\xCB':'Euml','\u0117':'edot','\u0116':'Edot','\u0119':'eogon','\u0118':'Eogon','\u0113':'emacr','\u0112':'Emacr','\uD835\uDD23':'ffr','\uD835\uDD57':'fopf','\uD835\uDCBB':'fscr','\uD835\uDD09':'Ffr','\uD835\uDD3D':'Fopf','\u2131':'Fscr','\uFB00':'fflig','\uFB03':'ffilig','\uFB04':'ffllig','\uFB01':'filig','fj':'fjlig','\uFB02':'fllig','\u0192':'fnof','\u210A':'gscr','\uD835\uDD58':'gopf','\uD835\uDD24':'gfr','\uD835\uDCA2':'Gscr','\uD835\uDD3E':'Gopf','\uD835\uDD0A':'Gfr','\u01F5':'gacute','\u011F':'gbreve','\u011E':'Gbreve','\u011D':'gcirc','\u011C':'Gcirc','\u0121':'gdot','\u0120':'Gdot','\u0122':'Gcedil','\uD835\uDD25':'hfr','\u210E':'planckh','\uD835\uDCBD':'hscr','\uD835\uDD59':'hopf','\u210B':'Hscr','\u210C':'Hfr','\u210D':'Hopf','\u0125':'hcirc','\u0124':'Hcirc','\u210F':'hbar','\u0127':'hstrok','\u0126':'Hstrok','\uD835\uDD5A':'iopf','\uD835\uDD26':'ifr','\uD835\uDCBE':'iscr','\u2148':'ii','\uD835\uDD40':'Iopf','\u2110':'Iscr','\u2111':'Im','\xED':'iacute','\xCD':'Iacute','\xEC':'igrave','\xCC':'Igrave','\xEE':'icirc','\xCE':'Icirc','\xEF':'iuml','\xCF':'Iuml','\u0129':'itilde','\u0128':'Itilde','\u0130':'Idot','\u012F':'iogon','\u012E':'Iogon','\u012B':'imacr','\u012A':'Imacr','\u0133':'ijlig','\u0132':'IJlig','\u0131':'imath','\uD835\uDCBF':'jscr','\uD835\uDD5B':'jopf','\uD835\uDD27':'jfr','\uD835\uDCA5':'Jscr','\uD835\uDD0D':'Jfr','\uD835\uDD41':'Jopf','\u0135':'jcirc','\u0134':'Jcirc','\u0237':'jmath','\uD835\uDD5C':'kopf','\uD835\uDCC0':'kscr','\uD835\uDD28':'kfr','\uD835\uDCA6':'Kscr','\uD835\uDD42':'Kopf','\uD835\uDD0E':'Kfr','\u0137':'kcedil','\u0136':'Kcedil','\uD835\uDD29':'lfr','\uD835\uDCC1':'lscr','\u2113':'ell','\uD835\uDD5D':'lopf','\u2112':'Lscr','\uD835\uDD0F':'Lfr','\uD835\uDD43':'Lopf','\u013A':'lacute','\u0139':'Lacute','\u013E':'lcaron','\u013D':'Lcaron','\u013C':'lcedil','\u013B':'Lcedil','\u0142':'lstrok','\u0141':'Lstrok','\u0140':'lmidot','\u013F':'Lmidot','\uD835\uDD2A':'mfr','\uD835\uDD5E':'mopf','\uD835\uDCC2':'mscr','\uD835\uDD10':'Mfr','\uD835\uDD44':'Mopf','\u2133':'Mscr','\uD835\uDD2B':'nfr','\uD835\uDD5F':'nopf','\uD835\uDCC3':'nscr','\u2115':'Nopf','\uD835\uDCA9':'Nscr','\uD835\uDD11':'Nfr','\u0144':'nacute','\u0143':'Nacute','\u0148':'ncaron','\u0147':'Ncaron','\xF1':'ntilde','\xD1':'Ntilde','\u0146':'ncedil','\u0145':'Ncedil','\u2116':'numero','\u014B':'eng','\u014A':'ENG','\uD835\uDD60':'oopf','\uD835\uDD2C':'ofr','\u2134':'oscr','\uD835\uDCAA':'Oscr','\uD835\uDD12':'Ofr','\uD835\uDD46':'Oopf','\xBA':'ordm','\xF3':'oacute','\xD3':'Oacute','\xF2':'ograve','\xD2':'Ograve','\xF4':'ocirc','\xD4':'Ocirc','\xF6':'ouml','\xD6':'Ouml','\u0151':'odblac','\u0150':'Odblac','\xF5':'otilde','\xD5':'Otilde','\xF8':'oslash','\xD8':'Oslash','\u014D':'omacr','\u014C':'Omacr','\u0153':'oelig','\u0152':'OElig','\uD835\uDD2D':'pfr','\uD835\uDCC5':'pscr','\uD835\uDD61':'popf','\u2119':'Popf','\uD835\uDD13':'Pfr','\uD835\uDCAB':'Pscr','\uD835\uDD62':'qopf','\uD835\uDD2E':'qfr','\uD835\uDCC6':'qscr','\uD835\uDCAC':'Qscr','\uD835\uDD14':'Qfr','\u211A':'Qopf','\u0138':'kgreen','\uD835\uDD2F':'rfr','\uD835\uDD63':'ropf','\uD835\uDCC7':'rscr','\u211B':'Rscr','\u211C':'Re','\u211D':'Ropf','\u0155':'racute','\u0154':'Racute','\u0159':'rcaron','\u0158':'Rcaron','\u0157':'rcedil','\u0156':'Rcedil','\uD835\uDD64':'sopf','\uD835\uDCC8':'sscr','\uD835\uDD30':'sfr','\uD835\uDD4A':'Sopf','\uD835\uDD16':'Sfr','\uD835\uDCAE':'Sscr','\u24C8':'oS','\u015B':'sacute','\u015A':'Sacute','\u015D':'scirc','\u015C':'Scirc','\u0161':'scaron','\u0160':'Scaron','\u015F':'scedil','\u015E':'Scedil','\xDF':'szlig','\uD835\uDD31':'tfr','\uD835\uDCC9':'tscr','\uD835\uDD65':'topf','\uD835\uDCAF':'Tscr','\uD835\uDD17':'Tfr','\uD835\uDD4B':'Topf','\u0165':'tcaron','\u0164':'Tcaron','\u0163':'tcedil','\u0162':'Tcedil','\u2122':'trade','\u0167':'tstrok','\u0166':'Tstrok','\uD835\uDCCA':'uscr','\uD835\uDD66':'uopf','\uD835\uDD32':'ufr','\uD835\uDD4C':'Uopf','\uD835\uDD18':'Ufr','\uD835\uDCB0':'Uscr','\xFA':'uacute','\xDA':'Uacute','\xF9':'ugrave','\xD9':'Ugrave','\u016D':'ubreve','\u016C':'Ubreve','\xFB':'ucirc','\xDB':'Ucirc','\u016F':'uring','\u016E':'Uring','\xFC':'uuml','\xDC':'Uuml','\u0171':'udblac','\u0170':'Udblac','\u0169':'utilde','\u0168':'Utilde','\u0173':'uogon','\u0172':'Uogon','\u016B':'umacr','\u016A':'Umacr','\uD835\uDD33':'vfr','\uD835\uDD67':'vopf','\uD835\uDCCB':'vscr','\uD835\uDD19':'Vfr','\uD835\uDD4D':'Vopf','\uD835\uDCB1':'Vscr','\uD835\uDD68':'wopf','\uD835\uDCCC':'wscr','\uD835\uDD34':'wfr','\uD835\uDCB2':'Wscr','\uD835\uDD4E':'Wopf','\uD835\uDD1A':'Wfr','\u0175':'wcirc','\u0174':'Wcirc','\uD835\uDD35':'xfr','\uD835\uDCCD':'xscr','\uD835\uDD69':'xopf','\uD835\uDD4F':'Xopf','\uD835\uDD1B':'Xfr','\uD835\uDCB3':'Xscr','\uD835\uDD36':'yfr','\uD835\uDCCE':'yscr','\uD835\uDD6A':'yopf','\uD835\uDCB4':'Yscr','\uD835\uDD1C':'Yfr','\uD835\uDD50':'Yopf','\xFD':'yacute','\xDD':'Yacute','\u0177':'ycirc','\u0176':'Ycirc','\xFF':'yuml','\u0178':'Yuml','\uD835\uDCCF':'zscr','\uD835\uDD37':'zfr','\uD835\uDD6B':'zopf','\u2128':'Zfr','\u2124':'Zopf','\uD835\uDCB5':'Zscr','\u017A':'zacute','\u0179':'Zacute','\u017E':'zcaron','\u017D':'Zcaron','\u017C':'zdot','\u017B':'Zdot','\u01B5':'imped','\xFE':'thorn','\xDE':'THORN','\u0149':'napos','\u03B1':'alpha','\u0391':'Alpha','\u03B2':'beta','\u0392':'Beta','\u03B3':'gamma','\u0393':'Gamma','\u03B4':'delta','\u0394':'Delta','\u03B5':'epsi','\u03F5':'epsiv','\u0395':'Epsilon','\u03DD':'gammad','\u03DC':'Gammad','\u03B6':'zeta','\u0396':'Zeta','\u03B7':'eta','\u0397':'Eta','\u03B8':'theta','\u03D1':'thetav','\u0398':'Theta','\u03B9':'iota','\u0399':'Iota','\u03BA':'kappa','\u03F0':'kappav','\u039A':'Kappa','\u03BB':'lambda','\u039B':'Lambda','\u03BC':'mu','\xB5':'micro','\u039C':'Mu','\u03BD':'nu','\u039D':'Nu','\u03BE':'xi','\u039E':'Xi','\u03BF':'omicron','\u039F':'Omicron','\u03C0':'pi','\u03D6':'piv','\u03A0':'Pi','\u03C1':'rho','\u03F1':'rhov','\u03A1':'Rho','\u03C3':'sigma','\u03A3':'Sigma','\u03C2':'sigmaf','\u03C4':'tau','\u03A4':'Tau','\u03C5':'upsi','\u03A5':'Upsilon','\u03D2':'Upsi','\u03C6':'phi','\u03D5':'phiv','\u03A6':'Phi','\u03C7':'chi','\u03A7':'Chi','\u03C8':'psi','\u03A8':'Psi','\u03C9':'omega','\u03A9':'ohm','\u0430':'acy','\u0410':'Acy','\u0431':'bcy','\u0411':'Bcy','\u0432':'vcy','\u0412':'Vcy','\u0433':'gcy','\u0413':'Gcy','\u0453':'gjcy','\u0403':'GJcy','\u0434':'dcy','\u0414':'Dcy','\u0452':'djcy','\u0402':'DJcy','\u0435':'iecy','\u0415':'IEcy','\u0451':'iocy','\u0401':'IOcy','\u0454':'jukcy','\u0404':'Jukcy','\u0436':'zhcy','\u0416':'ZHcy','\u0437':'zcy','\u0417':'Zcy','\u0455':'dscy','\u0405':'DScy','\u0438':'icy','\u0418':'Icy','\u0456':'iukcy','\u0406':'Iukcy','\u0457':'yicy','\u0407':'YIcy','\u0439':'jcy','\u0419':'Jcy','\u0458':'jsercy','\u0408':'Jsercy','\u043A':'kcy','\u041A':'Kcy','\u045C':'kjcy','\u040C':'KJcy','\u043B':'lcy','\u041B':'Lcy','\u0459':'ljcy','\u0409':'LJcy','\u043C':'mcy','\u041C':'Mcy','\u043D':'ncy','\u041D':'Ncy','\u045A':'njcy','\u040A':'NJcy','\u043E':'ocy','\u041E':'Ocy','\u043F':'pcy','\u041F':'Pcy','\u0440':'rcy','\u0420':'Rcy','\u0441':'scy','\u0421':'Scy','\u0442':'tcy','\u0422':'Tcy','\u045B':'tshcy','\u040B':'TSHcy','\u0443':'ucy','\u0423':'Ucy','\u045E':'ubrcy','\u040E':'Ubrcy','\u0444':'fcy','\u0424':'Fcy','\u0445':'khcy','\u0425':'KHcy','\u0446':'tscy','\u0426':'TScy','\u0447':'chcy','\u0427':'CHcy','\u045F':'dzcy','\u040F':'DZcy','\u0448':'shcy','\u0428':'SHcy','\u0449':'shchcy','\u0429':'SHCHcy','\u044A':'hardcy','\u042A':'HARDcy','\u044B':'ycy','\u042B':'Ycy','\u044C':'softcy','\u042C':'SOFTcy','\u044D':'ecy','\u042D':'Ecy','\u044E':'yucy','\u042E':'YUcy','\u044F':'yacy','\u042F':'YAcy','\u2135':'aleph','\u2136':'beth','\u2137':'gimel','\u2138':'daleth'};
13307
13308 var regexEscape = /["&'<>`]/g;
13309 var escapeMap = {
13310 '"': '&quot;',
13311 '&': '&amp;',
13312 '\'': '&#x27;',
13313 '<': '&lt;',
13314 // See https://mathiasbynens.be/notes/ambiguous-ampersands: in HTML, the
13315 // following is not strictly necessary unless it’s part of a tag or an
13316 // unquoted attribute value. We’re only escaping it to support those
13317 // situations, and for XML support.
13318 '>': '&gt;',
13319 // In Internet Explorer ≤ 8, the backtick character can be used
13320 // to break out of (un)quoted attribute values or HTML comments.
13321 // See http://html5sec.org/#102, http://html5sec.org/#108, and
13322 // http://html5sec.org/#133.
13323 '`': '&#x60;'
13324 };
13325
13326 var regexInvalidEntity = /&#(?:[xX][^a-fA-F0-9]|[^0-9xX])/;
13327 var regexInvalidRawCodePoint = /[\0-\x08\x0B\x0E-\x1F\x7F-\x9F\uFDD0-\uFDEF\uFFFE\uFFFF]|[\uD83F\uD87F\uD8BF\uD8FF\uD93F\uD97F\uD9BF\uD9FF\uDA3F\uDA7F\uDABF\uDAFF\uDB3F\uDB7F\uDBBF\uDBFF][\uDFFE\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
13328 var regexDecode = /&(CounterClockwiseContourIntegral|DoubleLongLeftRightArrow|ClockwiseContourIntegral|NotNestedGreaterGreater|NotSquareSupersetEqual|DiacriticalDoubleAcute|NotRightTriangleEqual|NotSucceedsSlantEqual|NotPrecedesSlantEqual|CloseCurlyDoubleQuote|NegativeVeryThinSpace|DoubleContourIntegral|FilledVerySmallSquare|CapitalDifferentialD|OpenCurlyDoubleQuote|EmptyVerySmallSquare|NestedGreaterGreater|DoubleLongRightArrow|NotLeftTriangleEqual|NotGreaterSlantEqual|ReverseUpEquilibrium|DoubleLeftRightArrow|NotSquareSubsetEqual|NotDoubleVerticalBar|RightArrowLeftArrow|NotGreaterFullEqual|NotRightTriangleBar|SquareSupersetEqual|DownLeftRightVector|DoubleLongLeftArrow|leftrightsquigarrow|LeftArrowRightArrow|NegativeMediumSpace|blacktriangleright|RightDownVectorBar|PrecedesSlantEqual|RightDoubleBracket|SucceedsSlantEqual|NotLeftTriangleBar|RightTriangleEqual|SquareIntersection|RightDownTeeVector|ReverseEquilibrium|NegativeThickSpace|longleftrightarrow|Longleftrightarrow|LongLeftRightArrow|DownRightTeeVector|DownRightVectorBar|GreaterSlantEqual|SquareSubsetEqual|LeftDownVectorBar|LeftDoubleBracket|VerticalSeparator|rightleftharpoons|NotGreaterGreater|NotSquareSuperset|blacktriangleleft|blacktriangledown|NegativeThinSpace|LeftDownTeeVector|NotLessSlantEqual|leftrightharpoons|DoubleUpDownArrow|DoubleVerticalBar|LeftTriangleEqual|FilledSmallSquare|twoheadrightarrow|NotNestedLessLess|DownLeftTeeVector|DownLeftVectorBar|RightAngleBracket|NotTildeFullEqual|NotReverseElement|RightUpDownVector|DiacriticalTilde|NotSucceedsTilde|circlearrowright|NotPrecedesEqual|rightharpoondown|DoubleRightArrow|NotSucceedsEqual|NonBreakingSpace|NotRightTriangle|LessEqualGreater|RightUpTeeVector|LeftAngleBracket|GreaterFullEqual|DownArrowUpArrow|RightUpVectorBar|twoheadleftarrow|GreaterEqualLess|downharpoonright|RightTriangleBar|ntrianglerighteq|NotSupersetEqual|LeftUpDownVector|DiacriticalAcute|rightrightarrows|vartriangleright|UpArrowDownArrow|DiacriticalGrave|UnderParenthesis|EmptySmallSquare|LeftUpVectorBar|leftrightarrows|DownRightVector|downharpoonleft|trianglerighteq|ShortRightArrow|OverParenthesis|DoubleLeftArrow|DoubleDownArrow|NotSquareSubset|bigtriangledown|ntrianglelefteq|UpperRightArrow|curvearrowright|vartriangleleft|NotLeftTriangle|nleftrightarrow|LowerRightArrow|NotHumpDownHump|NotGreaterTilde|rightthreetimes|LeftUpTeeVector|NotGreaterEqual|straightepsilon|LeftTriangleBar|rightsquigarrow|ContourIntegral|rightleftarrows|CloseCurlyQuote|RightDownVector|LeftRightVector|nLeftrightarrow|leftharpoondown|circlearrowleft|SquareSuperset|OpenCurlyQuote|hookrightarrow|HorizontalLine|DiacriticalDot|NotLessGreater|ntriangleright|DoubleRightTee|InvisibleComma|InvisibleTimes|LowerLeftArrow|DownLeftVector|NotSubsetEqual|curvearrowleft|trianglelefteq|NotVerticalBar|TildeFullEqual|downdownarrows|NotGreaterLess|RightTeeVector|ZeroWidthSpace|looparrowright|LongRightArrow|doublebarwedge|ShortLeftArrow|ShortDownArrow|RightVectorBar|GreaterGreater|ReverseElement|rightharpoonup|LessSlantEqual|leftthreetimes|upharpoonright|rightarrowtail|LeftDownVector|Longrightarrow|NestedLessLess|UpperLeftArrow|nshortparallel|leftleftarrows|leftrightarrow|Leftrightarrow|LeftRightArrow|longrightarrow|upharpoonleft|RightArrowBar|ApplyFunction|LeftTeeVector|leftarrowtail|NotEqualTilde|varsubsetneqq|varsupsetneqq|RightTeeArrow|SucceedsEqual|SucceedsTilde|LeftVectorBar|SupersetEqual|hookleftarrow|DifferentialD|VerticalTilde|VeryThinSpace|blacktriangle|bigtriangleup|LessFullEqual|divideontimes|leftharpoonup|UpEquilibrium|ntriangleleft|RightTriangle|measuredangle|shortparallel|longleftarrow|Longleftarrow|LongLeftArrow|DoubleLeftTee|Poincareplane|PrecedesEqual|triangleright|DoubleUpArrow|RightUpVector|fallingdotseq|looparrowleft|PrecedesTilde|NotTildeEqual|NotTildeTilde|smallsetminus|Proportional|triangleleft|triangledown|UnderBracket|NotHumpEqual|exponentiale|ExponentialE|NotLessTilde|HilbertSpace|RightCeiling|blacklozenge|varsupsetneq|HumpDownHump|GreaterEqual|VerticalLine|LeftTeeArrow|NotLessEqual|DownTeeArrow|LeftTriangle|varsubsetneq|Intersection|NotCongruent|DownArrowBar|LeftUpVector|LeftArrowBar|risingdotseq|GreaterTilde|RoundImplies|SquareSubset|ShortUpArrow|NotSuperset|quaternions|precnapprox|backepsilon|preccurlyeq|OverBracket|blacksquare|MediumSpace|VerticalBar|circledcirc|circleddash|CircleMinus|CircleTimes|LessGreater|curlyeqprec|curlyeqsucc|diamondsuit|UpDownArrow|Updownarrow|RuleDelayed|Rrightarrow|updownarrow|RightVector|nRightarrow|nrightarrow|eqslantless|LeftCeiling|Equilibrium|SmallCircle|expectation|NotSucceeds|thickapprox|GreaterLess|SquareUnion|NotPrecedes|NotLessLess|straightphi|succnapprox|succcurlyeq|SubsetEqual|sqsupseteq|Proportion|Laplacetrf|ImaginaryI|supsetneqq|NotGreater|gtreqqless|NotElement|ThickSpace|TildeEqual|TildeTilde|Fouriertrf|rmoustache|EqualTilde|eqslantgtr|UnderBrace|LeftVector|UpArrowBar|nLeftarrow|nsubseteqq|subsetneqq|nsupseteqq|nleftarrow|succapprox|lessapprox|UpTeeArrow|upuparrows|curlywedge|lesseqqgtr|varepsilon|varnothing|RightFloor|complement|CirclePlus|sqsubseteq|Lleftarrow|circledast|RightArrow|Rightarrow|rightarrow|lmoustache|Bernoullis|precapprox|mapstoleft|mapstodown|longmapsto|dotsquare|downarrow|DoubleDot|nsubseteq|supsetneq|leftarrow|nsupseteq|subsetneq|ThinSpace|ngeqslant|subseteqq|HumpEqual|NotSubset|triangleq|NotCupCap|lesseqgtr|heartsuit|TripleDot|Leftarrow|Coproduct|Congruent|varpropto|complexes|gvertneqq|LeftArrow|LessTilde|supseteqq|MinusPlus|CircleDot|nleqslant|NotExists|gtreqless|nparallel|UnionPlus|LeftFloor|checkmark|CenterDot|centerdot|Mellintrf|gtrapprox|bigotimes|OverBrace|spadesuit|therefore|pitchfork|rationals|PlusMinus|Backslash|Therefore|DownBreve|backsimeq|backprime|DownArrow|nshortmid|Downarrow|lvertneqq|eqvparsl|imagline|imagpart|infintie|integers|Integral|intercal|LessLess|Uarrocir|intlarhk|sqsupset|angmsdaf|sqsubset|llcorner|vartheta|cupbrcap|lnapprox|Superset|SuchThat|succnsim|succneqq|angmsdag|biguplus|curlyvee|trpezium|Succeeds|NotTilde|bigwedge|angmsdah|angrtvbd|triminus|cwconint|fpartint|lrcorner|smeparsl|subseteq|urcorner|lurdshar|laemptyv|DDotrahd|approxeq|ldrushar|awconint|mapstoup|backcong|shortmid|triangle|geqslant|gesdotol|timesbar|circledR|circledS|setminus|multimap|naturals|scpolint|ncongdot|RightTee|boxminus|gnapprox|boxtimes|andslope|thicksim|angmsdaa|varsigma|cirfnint|rtriltri|angmsdab|rppolint|angmsdac|barwedge|drbkarow|clubsuit|thetasym|bsolhsub|capbrcup|dzigrarr|doteqdot|DotEqual|dotminus|UnderBar|NotEqual|realpart|otimesas|ulcorner|hksearow|hkswarow|parallel|PartialD|elinters|emptyset|plusacir|bbrktbrk|angmsdad|pointint|bigoplus|angmsdae|Precedes|bigsqcup|varkappa|notindot|supseteq|precneqq|precnsim|profalar|profline|profsurf|leqslant|lesdotor|raemptyv|subplus|notnivb|notnivc|subrarr|zigrarr|vzigzag|submult|subedot|Element|between|cirscir|larrbfs|larrsim|lotimes|lbrksld|lbrkslu|lozenge|ldrdhar|dbkarow|bigcirc|epsilon|simrarr|simplus|ltquest|Epsilon|luruhar|gtquest|maltese|npolint|eqcolon|npreceq|bigodot|ddagger|gtrless|bnequiv|harrcir|ddotseq|equivDD|backsim|demptyv|nsqsube|nsqsupe|Upsilon|nsubset|upsilon|minusdu|nsucceq|swarrow|nsupset|coloneq|searrow|boxplus|napprox|natural|asympeq|alefsym|congdot|nearrow|bigstar|diamond|supplus|tritime|LeftTee|nvinfin|triplus|NewLine|nvltrie|nvrtrie|nwarrow|nexists|Diamond|ruluhar|Implies|supmult|angzarr|suplarr|suphsub|questeq|because|digamma|Because|olcross|bemptyv|omicron|Omicron|rotimes|NoBreak|intprod|angrtvb|orderof|uwangle|suphsol|lesdoto|orslope|DownTee|realine|cudarrl|rdldhar|OverBar|supedot|lessdot|supdsub|topfork|succsim|rbrkslu|rbrksld|pertenk|cudarrr|isindot|planckh|lessgtr|pluscir|gesdoto|plussim|plustwo|lesssim|cularrp|rarrsim|Cayleys|notinva|notinvb|notinvc|UpArrow|Uparrow|uparrow|NotLess|dwangle|precsim|Product|curarrm|Cconint|dotplus|rarrbfs|ccupssm|Cedilla|cemptyv|notniva|quatint|frac35|frac38|frac45|frac56|frac58|frac78|tridot|xoplus|gacute|gammad|Gammad|lfisht|lfloor|bigcup|sqsupe|gbreve|Gbreve|lharul|sqsube|sqcups|Gcedil|apacir|llhard|lmidot|Lmidot|lmoust|andand|sqcaps|approx|Abreve|spades|circeq|tprime|divide|topcir|Assign|topbot|gesdot|divonx|xuplus|timesd|gesles|atilde|solbar|SOFTcy|loplus|timesb|lowast|lowbar|dlcorn|dlcrop|softcy|dollar|lparlt|thksim|lrhard|Atilde|lsaquo|smashp|bigvee|thinsp|wreath|bkarow|lsquor|lstrok|Lstrok|lthree|ltimes|ltlarr|DotDot|simdot|ltrPar|weierp|xsqcup|angmsd|sigmav|sigmaf|zeetrf|Zcaron|zcaron|mapsto|vsupne|thetav|cirmid|marker|mcomma|Zacute|vsubnE|there4|gtlPar|vsubne|bottom|gtrarr|SHCHcy|shchcy|midast|midcir|middot|minusb|minusd|gtrdot|bowtie|sfrown|mnplus|models|colone|seswar|Colone|mstpos|searhk|gtrsim|nacute|Nacute|boxbox|telrec|hairsp|Tcedil|nbumpe|scnsim|ncaron|Ncaron|ncedil|Ncedil|hamilt|Scedil|nearhk|hardcy|HARDcy|tcedil|Tcaron|commat|nequiv|nesear|tcaron|target|hearts|nexist|varrho|scedil|Scaron|scaron|hellip|Sacute|sacute|hercon|swnwar|compfn|rtimes|rthree|rsquor|rsaquo|zacute|wedgeq|homtht|barvee|barwed|Barwed|rpargt|horbar|conint|swarhk|roplus|nltrie|hslash|hstrok|Hstrok|rmoust|Conint|bprime|hybull|hyphen|iacute|Iacute|supsup|supsub|supsim|varphi|coprod|brvbar|agrave|Supset|supset|igrave|Igrave|notinE|Agrave|iiiint|iinfin|copysr|wedbar|Verbar|vangrt|becaus|incare|verbar|inodot|bullet|drcorn|intcal|drcrop|cularr|vellip|Utilde|bumpeq|cupcap|dstrok|Dstrok|CupCap|cupcup|cupdot|eacute|Eacute|supdot|iquest|easter|ecaron|Ecaron|ecolon|isinsv|utilde|itilde|Itilde|curarr|succeq|Bumpeq|cacute|ulcrop|nparsl|Cacute|nprcue|egrave|Egrave|nrarrc|nrarrw|subsup|subsub|nrtrie|jsercy|nsccue|Jsercy|kappav|kcedil|Kcedil|subsim|ulcorn|nsimeq|egsdot|veebar|kgreen|capand|elsdot|Subset|subset|curren|aacute|lacute|Lacute|emptyv|ntilde|Ntilde|lagran|lambda|Lambda|capcap|Ugrave|langle|subdot|emsp13|numero|emsp14|nvdash|nvDash|nVdash|nVDash|ugrave|ufisht|nvHarr|larrfs|nvlArr|larrhk|larrlp|larrpl|nvrArr|Udblac|nwarhk|larrtl|nwnear|oacute|Oacute|latail|lAtail|sstarf|lbrace|odblac|Odblac|lbrack|udblac|odsold|eparsl|lcaron|Lcaron|ograve|Ograve|lcedil|Lcedil|Aacute|ssmile|ssetmn|squarf|ldquor|capcup|ominus|cylcty|rharul|eqcirc|dagger|rfloor|rfisht|Dagger|daleth|equals|origof|capdot|equest|dcaron|Dcaron|rdquor|oslash|Oslash|otilde|Otilde|otimes|Otimes|urcrop|Ubreve|ubreve|Yacute|Uacute|uacute|Rcedil|rcedil|urcorn|parsim|Rcaron|Vdashl|rcaron|Tstrok|percnt|period|permil|Exists|yacute|rbrack|rbrace|phmmat|ccaron|Ccaron|planck|ccedil|plankv|tstrok|female|plusdo|plusdu|ffilig|plusmn|ffllig|Ccedil|rAtail|dfisht|bernou|ratail|Rarrtl|rarrtl|angsph|rarrpl|rarrlp|rarrhk|xwedge|xotime|forall|ForAll|Vvdash|vsupnE|preceq|bigcap|frac12|frac13|frac14|primes|rarrfs|prnsim|frac15|Square|frac16|square|lesdot|frac18|frac23|propto|prurel|rarrap|rangle|puncsp|frac25|Racute|qprime|racute|lesges|frac34|abreve|AElig|eqsim|utdot|setmn|urtri|Equal|Uring|seArr|uring|searr|dashv|Dashv|mumap|nabla|iogon|Iogon|sdote|sdotb|scsim|napid|napos|equiv|natur|Acirc|dblac|erarr|nbump|iprod|erDot|ucirc|awint|esdot|angrt|ncong|isinE|scnap|Scirc|scirc|ndash|isins|Ubrcy|nearr|neArr|isinv|nedot|ubrcy|acute|Ycirc|iukcy|Iukcy|xutri|nesim|caret|jcirc|Jcirc|caron|twixt|ddarr|sccue|exist|jmath|sbquo|ngeqq|angst|ccaps|lceil|ngsim|UpTee|delta|Delta|rtrif|nharr|nhArr|nhpar|rtrie|jukcy|Jukcy|kappa|rsquo|Kappa|nlarr|nlArr|TSHcy|rrarr|aogon|Aogon|fflig|xrarr|tshcy|ccirc|nleqq|filig|upsih|nless|dharl|nlsim|fjlig|ropar|nltri|dharr|robrk|roarr|fllig|fltns|roang|rnmid|subnE|subne|lAarr|trisb|Ccirc|acirc|ccups|blank|VDash|forkv|Vdash|langd|cedil|blk12|blk14|laquo|strns|diams|notin|vDash|larrb|blk34|block|disin|uplus|vdash|vBarv|aelig|starf|Wedge|check|xrArr|lates|lbarr|lBarr|notni|lbbrk|bcong|frasl|lbrke|frown|vrtri|vprop|vnsup|gamma|Gamma|wedge|xodot|bdquo|srarr|doteq|ldquo|boxdl|boxdL|gcirc|Gcirc|boxDl|boxDL|boxdr|boxdR|boxDr|TRADE|trade|rlhar|boxDR|vnsub|npart|vltri|rlarr|boxhd|boxhD|nprec|gescc|nrarr|nrArr|boxHd|boxHD|boxhu|boxhU|nrtri|boxHu|clubs|boxHU|times|colon|Colon|gimel|xlArr|Tilde|nsime|tilde|nsmid|nspar|THORN|thorn|xlarr|nsube|nsubE|thkap|xhArr|comma|nsucc|boxul|boxuL|nsupe|nsupE|gneqq|gnsim|boxUl|boxUL|grave|boxur|boxuR|boxUr|boxUR|lescc|angle|bepsi|boxvh|varpi|boxvH|numsp|Theta|gsime|gsiml|theta|boxVh|boxVH|boxvl|gtcir|gtdot|boxvL|boxVl|boxVL|crarr|cross|Cross|nvsim|boxvr|nwarr|nwArr|sqsup|dtdot|Uogon|lhard|lharu|dtrif|ocirc|Ocirc|lhblk|duarr|odash|sqsub|Hacek|sqcup|llarr|duhar|oelig|OElig|ofcir|boxvR|uogon|lltri|boxVr|csube|uuarr|ohbar|csupe|ctdot|olarr|olcir|harrw|oline|sqcap|omacr|Omacr|omega|Omega|boxVR|aleph|lneqq|lnsim|loang|loarr|rharu|lobrk|hcirc|operp|oplus|rhard|Hcirc|orarr|Union|order|ecirc|Ecirc|cuepr|szlig|cuesc|breve|reals|eDDot|Breve|hoarr|lopar|utrif|rdquo|Umacr|umacr|efDot|swArr|ultri|alpha|rceil|ovbar|swarr|Wcirc|wcirc|smtes|smile|bsemi|lrarr|aring|parsl|lrhar|bsime|uhblk|lrtri|cupor|Aring|uharr|uharl|slarr|rbrke|bsolb|lsime|rbbrk|RBarr|lsimg|phone|rBarr|rbarr|icirc|lsquo|Icirc|emacr|Emacr|ratio|simne|plusb|simlE|simgE|simeq|pluse|ltcir|ltdot|empty|xharr|xdtri|iexcl|Alpha|ltrie|rarrw|pound|ltrif|xcirc|bumpe|prcue|bumpE|asymp|amacr|cuvee|Sigma|sigma|iiint|udhar|iiota|ijlig|IJlig|supnE|imacr|Imacr|prime|Prime|image|prnap|eogon|Eogon|rarrc|mdash|mDDot|cuwed|imath|supne|imped|Amacr|udarr|prsim|micro|rarrb|cwint|raquo|infin|eplus|range|rangd|Ucirc|radic|minus|amalg|veeeq|rAarr|epsiv|ycirc|quest|sharp|quot|zwnj|Qscr|race|qscr|Qopf|qopf|qint|rang|Rang|Zscr|zscr|Zopf|zopf|rarr|rArr|Rarr|Pscr|pscr|prop|prod|prnE|prec|ZHcy|zhcy|prap|Zeta|zeta|Popf|popf|Zdot|plus|zdot|Yuml|yuml|phiv|YUcy|yucy|Yscr|yscr|perp|Yopf|yopf|part|para|YIcy|Ouml|rcub|yicy|YAcy|rdca|ouml|osol|Oscr|rdsh|yacy|real|oscr|xvee|andd|rect|andv|Xscr|oror|ordm|ordf|xscr|ange|aopf|Aopf|rHar|Xopf|opar|Oopf|xopf|xnis|rhov|oopf|omid|xmap|oint|apid|apos|ogon|ascr|Ascr|odot|odiv|xcup|xcap|ocir|oast|nvlt|nvle|nvgt|nvge|nvap|Wscr|wscr|auml|ntlg|ntgl|nsup|nsub|nsim|Nscr|nscr|nsce|Wopf|ring|npre|wopf|npar|Auml|Barv|bbrk|Nopf|nopf|nmid|nLtv|beta|ropf|Ropf|Beta|beth|nles|rpar|nleq|bnot|bNot|nldr|NJcy|rscr|Rscr|Vscr|vscr|rsqb|njcy|bopf|nisd|Bopf|rtri|Vopf|nGtv|ngtr|vopf|boxh|boxH|boxv|nges|ngeq|boxV|bscr|scap|Bscr|bsim|Vert|vert|bsol|bull|bump|caps|cdot|ncup|scnE|ncap|nbsp|napE|Cdot|cent|sdot|Vbar|nang|vBar|chcy|Mscr|mscr|sect|semi|CHcy|Mopf|mopf|sext|circ|cire|mldr|mlcp|cirE|comp|shcy|SHcy|vArr|varr|cong|copf|Copf|copy|COPY|malt|male|macr|lvnE|cscr|ltri|sime|ltcc|simg|Cscr|siml|csub|Uuml|lsqb|lsim|uuml|csup|Lscr|lscr|utri|smid|lpar|cups|smte|lozf|darr|Lopf|Uscr|solb|lopf|sopf|Sopf|lneq|uscr|spar|dArr|lnap|Darr|dash|Sqrt|LJcy|ljcy|lHar|dHar|Upsi|upsi|diam|lesg|djcy|DJcy|leqq|dopf|Dopf|dscr|Dscr|dscy|ldsh|ldca|squf|DScy|sscr|Sscr|dsol|lcub|late|star|Star|Uopf|Larr|lArr|larr|uopf|dtri|dzcy|sube|subE|Lang|lang|Kscr|kscr|Kopf|kopf|KJcy|kjcy|KHcy|khcy|DZcy|ecir|edot|eDot|Jscr|jscr|succ|Jopf|jopf|Edot|uHar|emsp|ensp|Iuml|iuml|eopf|isin|Iscr|iscr|Eopf|epar|sung|epsi|escr|sup1|sup2|sup3|Iota|iota|supe|supE|Iopf|iopf|IOcy|iocy|Escr|esim|Esim|imof|Uarr|QUOT|uArr|uarr|euml|IEcy|iecy|Idot|Euml|euro|excl|Hscr|hscr|Hopf|hopf|TScy|tscy|Tscr|hbar|tscr|flat|tbrk|fnof|hArr|harr|half|fopf|Fopf|tdot|gvnE|fork|trie|gtcc|fscr|Fscr|gdot|gsim|Gscr|gscr|Gopf|gopf|gneq|Gdot|tosa|gnap|Topf|topf|geqq|toea|GJcy|gjcy|tint|gesl|mid|Sfr|ggg|top|ges|gla|glE|glj|geq|gne|gEl|gel|gnE|Gcy|gcy|gap|Tfr|tfr|Tcy|tcy|Hat|Tau|Ffr|tau|Tab|hfr|Hfr|ffr|Fcy|fcy|icy|Icy|iff|ETH|eth|ifr|Ifr|Eta|eta|int|Int|Sup|sup|ucy|Ucy|Sum|sum|jcy|ENG|ufr|Ufr|eng|Jcy|jfr|els|ell|egs|Efr|efr|Jfr|uml|kcy|Kcy|Ecy|ecy|kfr|Kfr|lap|Sub|sub|lat|lcy|Lcy|leg|Dot|dot|lEg|leq|les|squ|div|die|lfr|Lfr|lgE|Dfr|dfr|Del|deg|Dcy|dcy|lne|lnE|sol|loz|smt|Cup|lrm|cup|lsh|Lsh|sim|shy|map|Map|mcy|Mcy|mfr|Mfr|mho|gfr|Gfr|sfr|cir|Chi|chi|nap|Cfr|vcy|Vcy|cfr|Scy|scy|ncy|Ncy|vee|Vee|Cap|cap|nfr|scE|sce|Nfr|nge|ngE|nGg|vfr|Vfr|ngt|bot|nGt|nis|niv|Rsh|rsh|nle|nlE|bne|Bfr|bfr|nLl|nlt|nLt|Bcy|bcy|not|Not|rlm|wfr|Wfr|npr|nsc|num|ocy|ast|Ocy|ofr|xfr|Xfr|Ofr|ogt|ohm|apE|olt|Rho|ape|rho|Rfr|rfr|ord|REG|ang|reg|orv|And|and|AMP|Rcy|amp|Afr|ycy|Ycy|yen|yfr|Yfr|rcy|par|pcy|Pcy|pfr|Pfr|phi|Phi|afr|Acy|acy|zcy|Zcy|piv|acE|acd|zfr|Zfr|pre|prE|psi|Psi|qfr|Qfr|zwj|Or|ge|Gg|gt|gg|el|oS|lt|Lt|LT|Re|lg|gl|eg|ne|Im|it|le|DD|wp|wr|nu|Nu|dd|lE|Sc|sc|pi|Pi|ee|af|ll|Ll|rx|gE|xi|pm|Xi|ic|pr|Pr|in|ni|mp|mu|ac|Mu|or|ap|Gt|GT|ii);|&(Aacute|Agrave|Atilde|Ccedil|Eacute|Egrave|Iacute|Igrave|Ntilde|Oacute|Ograve|Oslash|Otilde|Uacute|Ugrave|Yacute|aacute|agrave|atilde|brvbar|ccedil|curren|divide|eacute|egrave|frac12|frac14|frac34|iacute|igrave|iquest|middot|ntilde|oacute|ograve|oslash|otilde|plusmn|uacute|ugrave|yacute|AElig|Acirc|Aring|Ecirc|Icirc|Ocirc|THORN|Ucirc|acirc|acute|aelig|aring|cedil|ecirc|icirc|iexcl|laquo|micro|ocirc|pound|raquo|szlig|thorn|times|ucirc|Auml|COPY|Euml|Iuml|Ouml|QUOT|Uuml|auml|cent|copy|euml|iuml|macr|nbsp|ordf|ordm|ouml|para|quot|sect|sup1|sup2|sup3|uuml|yuml|AMP|ETH|REG|amp|deg|eth|not|reg|shy|uml|yen|GT|LT|gt|lt)(?!;)([=a-zA-Z0-9]?)|&#([0-9]+)(;?)|&#[xX]([a-fA-F0-9]+)(;?)|&([0-9a-zA-Z]+)/g;
13329 var decodeMap = {'aacute':'\xE1','Aacute':'\xC1','abreve':'\u0103','Abreve':'\u0102','ac':'\u223E','acd':'\u223F','acE':'\u223E\u0333','acirc':'\xE2','Acirc':'\xC2','acute':'\xB4','acy':'\u0430','Acy':'\u0410','aelig':'\xE6','AElig':'\xC6','af':'\u2061','afr':'\uD835\uDD1E','Afr':'\uD835\uDD04','agrave':'\xE0','Agrave':'\xC0','alefsym':'\u2135','aleph':'\u2135','alpha':'\u03B1','Alpha':'\u0391','amacr':'\u0101','Amacr':'\u0100','amalg':'\u2A3F','amp':'&','AMP':'&','and':'\u2227','And':'\u2A53','andand':'\u2A55','andd':'\u2A5C','andslope':'\u2A58','andv':'\u2A5A','ang':'\u2220','ange':'\u29A4','angle':'\u2220','angmsd':'\u2221','angmsdaa':'\u29A8','angmsdab':'\u29A9','angmsdac':'\u29AA','angmsdad':'\u29AB','angmsdae':'\u29AC','angmsdaf':'\u29AD','angmsdag':'\u29AE','angmsdah':'\u29AF','angrt':'\u221F','angrtvb':'\u22BE','angrtvbd':'\u299D','angsph':'\u2222','angst':'\xC5','angzarr':'\u237C','aogon':'\u0105','Aogon':'\u0104','aopf':'\uD835\uDD52','Aopf':'\uD835\uDD38','ap':'\u2248','apacir':'\u2A6F','ape':'\u224A','apE':'\u2A70','apid':'\u224B','apos':'\'','ApplyFunction':'\u2061','approx':'\u2248','approxeq':'\u224A','aring':'\xE5','Aring':'\xC5','ascr':'\uD835\uDCB6','Ascr':'\uD835\uDC9C','Assign':'\u2254','ast':'*','asymp':'\u2248','asympeq':'\u224D','atilde':'\xE3','Atilde':'\xC3','auml':'\xE4','Auml':'\xC4','awconint':'\u2233','awint':'\u2A11','backcong':'\u224C','backepsilon':'\u03F6','backprime':'\u2035','backsim':'\u223D','backsimeq':'\u22CD','Backslash':'\u2216','Barv':'\u2AE7','barvee':'\u22BD','barwed':'\u2305','Barwed':'\u2306','barwedge':'\u2305','bbrk':'\u23B5','bbrktbrk':'\u23B6','bcong':'\u224C','bcy':'\u0431','Bcy':'\u0411','bdquo':'\u201E','becaus':'\u2235','because':'\u2235','Because':'\u2235','bemptyv':'\u29B0','bepsi':'\u03F6','bernou':'\u212C','Bernoullis':'\u212C','beta':'\u03B2','Beta':'\u0392','beth':'\u2136','between':'\u226C','bfr':'\uD835\uDD1F','Bfr':'\uD835\uDD05','bigcap':'\u22C2','bigcirc':'\u25EF','bigcup':'\u22C3','bigodot':'\u2A00','bigoplus':'\u2A01','bigotimes':'\u2A02','bigsqcup':'\u2A06','bigstar':'\u2605','bigtriangledown':'\u25BD','bigtriangleup':'\u25B3','biguplus':'\u2A04','bigvee':'\u22C1','bigwedge':'\u22C0','bkarow':'\u290D','blacklozenge':'\u29EB','blacksquare':'\u25AA','blacktriangle':'\u25B4','blacktriangledown':'\u25BE','blacktriangleleft':'\u25C2','blacktriangleright':'\u25B8','blank':'\u2423','blk12':'\u2592','blk14':'\u2591','blk34':'\u2593','block':'\u2588','bne':'=\u20E5','bnequiv':'\u2261\u20E5','bnot':'\u2310','bNot':'\u2AED','bopf':'\uD835\uDD53','Bopf':'\uD835\uDD39','bot':'\u22A5','bottom':'\u22A5','bowtie':'\u22C8','boxbox':'\u29C9','boxdl':'\u2510','boxdL':'\u2555','boxDl':'\u2556','boxDL':'\u2557','boxdr':'\u250C','boxdR':'\u2552','boxDr':'\u2553','boxDR':'\u2554','boxh':'\u2500','boxH':'\u2550','boxhd':'\u252C','boxhD':'\u2565','boxHd':'\u2564','boxHD':'\u2566','boxhu':'\u2534','boxhU':'\u2568','boxHu':'\u2567','boxHU':'\u2569','boxminus':'\u229F','boxplus':'\u229E','boxtimes':'\u22A0','boxul':'\u2518','boxuL':'\u255B','boxUl':'\u255C','boxUL':'\u255D','boxur':'\u2514','boxuR':'\u2558','boxUr':'\u2559','boxUR':'\u255A','boxv':'\u2502','boxV':'\u2551','boxvh':'\u253C','boxvH':'\u256A','boxVh':'\u256B','boxVH':'\u256C','boxvl':'\u2524','boxvL':'\u2561','boxVl':'\u2562','boxVL':'\u2563','boxvr':'\u251C','boxvR':'\u255E','boxVr':'\u255F','boxVR':'\u2560','bprime':'\u2035','breve':'\u02D8','Breve':'\u02D8','brvbar':'\xA6','bscr':'\uD835\uDCB7','Bscr':'\u212C','bsemi':'\u204F','bsim':'\u223D','bsime':'\u22CD','bsol':'\\','bsolb':'\u29C5','bsolhsub':'\u27C8','bull':'\u2022','bullet':'\u2022','bump':'\u224E','bumpe':'\u224F','bumpE':'\u2AAE','bumpeq':'\u224F','Bumpeq':'\u224E','cacute':'\u0107','Cacute':'\u0106','cap':'\u2229','Cap':'\u22D2','capand':'\u2A44','capbrcup':'\u2A49','capcap':'\u2A4B','capcup':'\u2A47','capdot':'\u2A40','CapitalDifferentialD':'\u2145','caps':'\u2229\uFE00','caret':'\u2041','caron':'\u02C7','Cayleys':'\u212D','ccaps':'\u2A4D','ccaron':'\u010D','Ccaron':'\u010C','ccedil':'\xE7','Ccedil':'\xC7','ccirc':'\u0109','Ccirc':'\u0108','Cconint':'\u2230','ccups':'\u2A4C','ccupssm':'\u2A50','cdot':'\u010B','Cdot':'\u010A','cedil':'\xB8','Cedilla':'\xB8','cemptyv':'\u29B2','cent':'\xA2','centerdot':'\xB7','CenterDot':'\xB7','cfr':'\uD835\uDD20','Cfr':'\u212D','chcy':'\u0447','CHcy':'\u0427','check':'\u2713','checkmark':'\u2713','chi':'\u03C7','Chi':'\u03A7','cir':'\u25CB','circ':'\u02C6','circeq':'\u2257','circlearrowleft':'\u21BA','circlearrowright':'\u21BB','circledast':'\u229B','circledcirc':'\u229A','circleddash':'\u229D','CircleDot':'\u2299','circledR':'\xAE','circledS':'\u24C8','CircleMinus':'\u2296','CirclePlus':'\u2295','CircleTimes':'\u2297','cire':'\u2257','cirE':'\u29C3','cirfnint':'\u2A10','cirmid':'\u2AEF','cirscir':'\u29C2','ClockwiseContourIntegral':'\u2232','CloseCurlyDoubleQuote':'\u201D','CloseCurlyQuote':'\u2019','clubs':'\u2663','clubsuit':'\u2663','colon':':','Colon':'\u2237','colone':'\u2254','Colone':'\u2A74','coloneq':'\u2254','comma':',','commat':'@','comp':'\u2201','compfn':'\u2218','complement':'\u2201','complexes':'\u2102','cong':'\u2245','congdot':'\u2A6D','Congruent':'\u2261','conint':'\u222E','Conint':'\u222F','ContourIntegral':'\u222E','copf':'\uD835\uDD54','Copf':'\u2102','coprod':'\u2210','Coproduct':'\u2210','copy':'\xA9','COPY':'\xA9','copysr':'\u2117','CounterClockwiseContourIntegral':'\u2233','crarr':'\u21B5','cross':'\u2717','Cross':'\u2A2F','cscr':'\uD835\uDCB8','Cscr':'\uD835\uDC9E','csub':'\u2ACF','csube':'\u2AD1','csup':'\u2AD0','csupe':'\u2AD2','ctdot':'\u22EF','cudarrl':'\u2938','cudarrr':'\u2935','cuepr':'\u22DE','cuesc':'\u22DF','cularr':'\u21B6','cularrp':'\u293D','cup':'\u222A','Cup':'\u22D3','cupbrcap':'\u2A48','cupcap':'\u2A46','CupCap':'\u224D','cupcup':'\u2A4A','cupdot':'\u228D','cupor':'\u2A45','cups':'\u222A\uFE00','curarr':'\u21B7','curarrm':'\u293C','curlyeqprec':'\u22DE','curlyeqsucc':'\u22DF','curlyvee':'\u22CE','curlywedge':'\u22CF','curren':'\xA4','curvearrowleft':'\u21B6','curvearrowright':'\u21B7','cuvee':'\u22CE','cuwed':'\u22CF','cwconint':'\u2232','cwint':'\u2231','cylcty':'\u232D','dagger':'\u2020','Dagger':'\u2021','daleth':'\u2138','darr':'\u2193','dArr':'\u21D3','Darr':'\u21A1','dash':'\u2010','dashv':'\u22A3','Dashv':'\u2AE4','dbkarow':'\u290F','dblac':'\u02DD','dcaron':'\u010F','Dcaron':'\u010E','dcy':'\u0434','Dcy':'\u0414','dd':'\u2146','DD':'\u2145','ddagger':'\u2021','ddarr':'\u21CA','DDotrahd':'\u2911','ddotseq':'\u2A77','deg':'\xB0','Del':'\u2207','delta':'\u03B4','Delta':'\u0394','demptyv':'\u29B1','dfisht':'\u297F','dfr':'\uD835\uDD21','Dfr':'\uD835\uDD07','dHar':'\u2965','dharl':'\u21C3','dharr':'\u21C2','DiacriticalAcute':'\xB4','DiacriticalDot':'\u02D9','DiacriticalDoubleAcute':'\u02DD','DiacriticalGrave':'`','DiacriticalTilde':'\u02DC','diam':'\u22C4','diamond':'\u22C4','Diamond':'\u22C4','diamondsuit':'\u2666','diams':'\u2666','die':'\xA8','DifferentialD':'\u2146','digamma':'\u03DD','disin':'\u22F2','div':'\xF7','divide':'\xF7','divideontimes':'\u22C7','divonx':'\u22C7','djcy':'\u0452','DJcy':'\u0402','dlcorn':'\u231E','dlcrop':'\u230D','dollar':'$','dopf':'\uD835\uDD55','Dopf':'\uD835\uDD3B','dot':'\u02D9','Dot':'\xA8','DotDot':'\u20DC','doteq':'\u2250','doteqdot':'\u2251','DotEqual':'\u2250','dotminus':'\u2238','dotplus':'\u2214','dotsquare':'\u22A1','doublebarwedge':'\u2306','DoubleContourIntegral':'\u222F','DoubleDot':'\xA8','DoubleDownArrow':'\u21D3','DoubleLeftArrow':'\u21D0','DoubleLeftRightArrow':'\u21D4','DoubleLeftTee':'\u2AE4','DoubleLongLeftArrow':'\u27F8','DoubleLongLeftRightArrow':'\u27FA','DoubleLongRightArrow':'\u27F9','DoubleRightArrow':'\u21D2','DoubleRightTee':'\u22A8','DoubleUpArrow':'\u21D1','DoubleUpDownArrow':'\u21D5','DoubleVerticalBar':'\u2225','downarrow':'\u2193','Downarrow':'\u21D3','DownArrow':'\u2193','DownArrowBar':'\u2913','DownArrowUpArrow':'\u21F5','DownBreve':'\u0311','downdownarrows':'\u21CA','downharpoonleft':'\u21C3','downharpoonright':'\u21C2','DownLeftRightVector':'\u2950','DownLeftTeeVector':'\u295E','DownLeftVector':'\u21BD','DownLeftVectorBar':'\u2956','DownRightTeeVector':'\u295F','DownRightVector':'\u21C1','DownRightVectorBar':'\u2957','DownTee':'\u22A4','DownTeeArrow':'\u21A7','drbkarow':'\u2910','drcorn':'\u231F','drcrop':'\u230C','dscr':'\uD835\uDCB9','Dscr':'\uD835\uDC9F','dscy':'\u0455','DScy':'\u0405','dsol':'\u29F6','dstrok':'\u0111','Dstrok':'\u0110','dtdot':'\u22F1','dtri':'\u25BF','dtrif':'\u25BE','duarr':'\u21F5','duhar':'\u296F','dwangle':'\u29A6','dzcy':'\u045F','DZcy':'\u040F','dzigrarr':'\u27FF','eacute':'\xE9','Eacute':'\xC9','easter':'\u2A6E','ecaron':'\u011B','Ecaron':'\u011A','ecir':'\u2256','ecirc':'\xEA','Ecirc':'\xCA','ecolon':'\u2255','ecy':'\u044D','Ecy':'\u042D','eDDot':'\u2A77','edot':'\u0117','eDot':'\u2251','Edot':'\u0116','ee':'\u2147','efDot':'\u2252','efr':'\uD835\uDD22','Efr':'\uD835\uDD08','eg':'\u2A9A','egrave':'\xE8','Egrave':'\xC8','egs':'\u2A96','egsdot':'\u2A98','el':'\u2A99','Element':'\u2208','elinters':'\u23E7','ell':'\u2113','els':'\u2A95','elsdot':'\u2A97','emacr':'\u0113','Emacr':'\u0112','empty':'\u2205','emptyset':'\u2205','EmptySmallSquare':'\u25FB','emptyv':'\u2205','EmptyVerySmallSquare':'\u25AB','emsp':'\u2003','emsp13':'\u2004','emsp14':'\u2005','eng':'\u014B','ENG':'\u014A','ensp':'\u2002','eogon':'\u0119','Eogon':'\u0118','eopf':'\uD835\uDD56','Eopf':'\uD835\uDD3C','epar':'\u22D5','eparsl':'\u29E3','eplus':'\u2A71','epsi':'\u03B5','epsilon':'\u03B5','Epsilon':'\u0395','epsiv':'\u03F5','eqcirc':'\u2256','eqcolon':'\u2255','eqsim':'\u2242','eqslantgtr':'\u2A96','eqslantless':'\u2A95','Equal':'\u2A75','equals':'=','EqualTilde':'\u2242','equest':'\u225F','Equilibrium':'\u21CC','equiv':'\u2261','equivDD':'\u2A78','eqvparsl':'\u29E5','erarr':'\u2971','erDot':'\u2253','escr':'\u212F','Escr':'\u2130','esdot':'\u2250','esim':'\u2242','Esim':'\u2A73','eta':'\u03B7','Eta':'\u0397','eth':'\xF0','ETH':'\xD0','euml':'\xEB','Euml':'\xCB','euro':'\u20AC','excl':'!','exist':'\u2203','Exists':'\u2203','expectation':'\u2130','exponentiale':'\u2147','ExponentialE':'\u2147','fallingdotseq':'\u2252','fcy':'\u0444','Fcy':'\u0424','female':'\u2640','ffilig':'\uFB03','fflig':'\uFB00','ffllig':'\uFB04','ffr':'\uD835\uDD23','Ffr':'\uD835\uDD09','filig':'\uFB01','FilledSmallSquare':'\u25FC','FilledVerySmallSquare':'\u25AA','fjlig':'fj','flat':'\u266D','fllig':'\uFB02','fltns':'\u25B1','fnof':'\u0192','fopf':'\uD835\uDD57','Fopf':'\uD835\uDD3D','forall':'\u2200','ForAll':'\u2200','fork':'\u22D4','forkv':'\u2AD9','Fouriertrf':'\u2131','fpartint':'\u2A0D','frac12':'\xBD','frac13':'\u2153','frac14':'\xBC','frac15':'\u2155','frac16':'\u2159','frac18':'\u215B','frac23':'\u2154','frac25':'\u2156','frac34':'\xBE','frac35':'\u2157','frac38':'\u215C','frac45':'\u2158','frac56':'\u215A','frac58':'\u215D','frac78':'\u215E','frasl':'\u2044','frown':'\u2322','fscr':'\uD835\uDCBB','Fscr':'\u2131','gacute':'\u01F5','gamma':'\u03B3','Gamma':'\u0393','gammad':'\u03DD','Gammad':'\u03DC','gap':'\u2A86','gbreve':'\u011F','Gbreve':'\u011E','Gcedil':'\u0122','gcirc':'\u011D','Gcirc':'\u011C','gcy':'\u0433','Gcy':'\u0413','gdot':'\u0121','Gdot':'\u0120','ge':'\u2265','gE':'\u2267','gel':'\u22DB','gEl':'\u2A8C','geq':'\u2265','geqq':'\u2267','geqslant':'\u2A7E','ges':'\u2A7E','gescc':'\u2AA9','gesdot':'\u2A80','gesdoto':'\u2A82','gesdotol':'\u2A84','gesl':'\u22DB\uFE00','gesles':'\u2A94','gfr':'\uD835\uDD24','Gfr':'\uD835\uDD0A','gg':'\u226B','Gg':'\u22D9','ggg':'\u22D9','gimel':'\u2137','gjcy':'\u0453','GJcy':'\u0403','gl':'\u2277','gla':'\u2AA5','glE':'\u2A92','glj':'\u2AA4','gnap':'\u2A8A','gnapprox':'\u2A8A','gne':'\u2A88','gnE':'\u2269','gneq':'\u2A88','gneqq':'\u2269','gnsim':'\u22E7','gopf':'\uD835\uDD58','Gopf':'\uD835\uDD3E','grave':'`','GreaterEqual':'\u2265','GreaterEqualLess':'\u22DB','GreaterFullEqual':'\u2267','GreaterGreater':'\u2AA2','GreaterLess':'\u2277','GreaterSlantEqual':'\u2A7E','GreaterTilde':'\u2273','gscr':'\u210A','Gscr':'\uD835\uDCA2','gsim':'\u2273','gsime':'\u2A8E','gsiml':'\u2A90','gt':'>','Gt':'\u226B','GT':'>','gtcc':'\u2AA7','gtcir':'\u2A7A','gtdot':'\u22D7','gtlPar':'\u2995','gtquest':'\u2A7C','gtrapprox':'\u2A86','gtrarr':'\u2978','gtrdot':'\u22D7','gtreqless':'\u22DB','gtreqqless':'\u2A8C','gtrless':'\u2277','gtrsim':'\u2273','gvertneqq':'\u2269\uFE00','gvnE':'\u2269\uFE00','Hacek':'\u02C7','hairsp':'\u200A','half':'\xBD','hamilt':'\u210B','hardcy':'\u044A','HARDcy':'\u042A','harr':'\u2194','hArr':'\u21D4','harrcir':'\u2948','harrw':'\u21AD','Hat':'^','hbar':'\u210F','hcirc':'\u0125','Hcirc':'\u0124','hearts':'\u2665','heartsuit':'\u2665','hellip':'\u2026','hercon':'\u22B9','hfr':'\uD835\uDD25','Hfr':'\u210C','HilbertSpace':'\u210B','hksearow':'\u2925','hkswarow':'\u2926','hoarr':'\u21FF','homtht':'\u223B','hookleftarrow':'\u21A9','hookrightarrow':'\u21AA','hopf':'\uD835\uDD59','Hopf':'\u210D','horbar':'\u2015','HorizontalLine':'\u2500','hscr':'\uD835\uDCBD','Hscr':'\u210B','hslash':'\u210F','hstrok':'\u0127','Hstrok':'\u0126','HumpDownHump':'\u224E','HumpEqual':'\u224F','hybull':'\u2043','hyphen':'\u2010','iacute':'\xED','Iacute':'\xCD','ic':'\u2063','icirc':'\xEE','Icirc':'\xCE','icy':'\u0438','Icy':'\u0418','Idot':'\u0130','iecy':'\u0435','IEcy':'\u0415','iexcl':'\xA1','iff':'\u21D4','ifr':'\uD835\uDD26','Ifr':'\u2111','igrave':'\xEC','Igrave':'\xCC','ii':'\u2148','iiiint':'\u2A0C','iiint':'\u222D','iinfin':'\u29DC','iiota':'\u2129','ijlig':'\u0133','IJlig':'\u0132','Im':'\u2111','imacr':'\u012B','Imacr':'\u012A','image':'\u2111','ImaginaryI':'\u2148','imagline':'\u2110','imagpart':'\u2111','imath':'\u0131','imof':'\u22B7','imped':'\u01B5','Implies':'\u21D2','in':'\u2208','incare':'\u2105','infin':'\u221E','infintie':'\u29DD','inodot':'\u0131','int':'\u222B','Int':'\u222C','intcal':'\u22BA','integers':'\u2124','Integral':'\u222B','intercal':'\u22BA','Intersection':'\u22C2','intlarhk':'\u2A17','intprod':'\u2A3C','InvisibleComma':'\u2063','InvisibleTimes':'\u2062','iocy':'\u0451','IOcy':'\u0401','iogon':'\u012F','Iogon':'\u012E','iopf':'\uD835\uDD5A','Iopf':'\uD835\uDD40','iota':'\u03B9','Iota':'\u0399','iprod':'\u2A3C','iquest':'\xBF','iscr':'\uD835\uDCBE','Iscr':'\u2110','isin':'\u2208','isindot':'\u22F5','isinE':'\u22F9','isins':'\u22F4','isinsv':'\u22F3','isinv':'\u2208','it':'\u2062','itilde':'\u0129','Itilde':'\u0128','iukcy':'\u0456','Iukcy':'\u0406','iuml':'\xEF','Iuml':'\xCF','jcirc':'\u0135','Jcirc':'\u0134','jcy':'\u0439','Jcy':'\u0419','jfr':'\uD835\uDD27','Jfr':'\uD835\uDD0D','jmath':'\u0237','jopf':'\uD835\uDD5B','Jopf':'\uD835\uDD41','jscr':'\uD835\uDCBF','Jscr':'\uD835\uDCA5','jsercy':'\u0458','Jsercy':'\u0408','jukcy':'\u0454','Jukcy':'\u0404','kappa':'\u03BA','Kappa':'\u039A','kappav':'\u03F0','kcedil':'\u0137','Kcedil':'\u0136','kcy':'\u043A','Kcy':'\u041A','kfr':'\uD835\uDD28','Kfr':'\uD835\uDD0E','kgreen':'\u0138','khcy':'\u0445','KHcy':'\u0425','kjcy':'\u045C','KJcy':'\u040C','kopf':'\uD835\uDD5C','Kopf':'\uD835\uDD42','kscr':'\uD835\uDCC0','Kscr':'\uD835\uDCA6','lAarr':'\u21DA','lacute':'\u013A','Lacute':'\u0139','laemptyv':'\u29B4','lagran':'\u2112','lambda':'\u03BB','Lambda':'\u039B','lang':'\u27E8','Lang':'\u27EA','langd':'\u2991','langle':'\u27E8','lap':'\u2A85','Laplacetrf':'\u2112','laquo':'\xAB','larr':'\u2190','lArr':'\u21D0','Larr':'\u219E','larrb':'\u21E4','larrbfs':'\u291F','larrfs':'\u291D','larrhk':'\u21A9','larrlp':'\u21AB','larrpl':'\u2939','larrsim':'\u2973','larrtl':'\u21A2','lat':'\u2AAB','latail':'\u2919','lAtail':'\u291B','late':'\u2AAD','lates':'\u2AAD\uFE00','lbarr':'\u290C','lBarr':'\u290E','lbbrk':'\u2772','lbrace':'{','lbrack':'[','lbrke':'\u298B','lbrksld':'\u298F','lbrkslu':'\u298D','lcaron':'\u013E','Lcaron':'\u013D','lcedil':'\u013C','Lcedil':'\u013B','lceil':'\u2308','lcub':'{','lcy':'\u043B','Lcy':'\u041B','ldca':'\u2936','ldquo':'\u201C','ldquor':'\u201E','ldrdhar':'\u2967','ldrushar':'\u294B','ldsh':'\u21B2','le':'\u2264','lE':'\u2266','LeftAngleBracket':'\u27E8','leftarrow':'\u2190','Leftarrow':'\u21D0','LeftArrow':'\u2190','LeftArrowBar':'\u21E4','LeftArrowRightArrow':'\u21C6','leftarrowtail':'\u21A2','LeftCeiling':'\u2308','LeftDoubleBracket':'\u27E6','LeftDownTeeVector':'\u2961','LeftDownVector':'\u21C3','LeftDownVectorBar':'\u2959','LeftFloor':'\u230A','leftharpoondown':'\u21BD','leftharpoonup':'\u21BC','leftleftarrows':'\u21C7','leftrightarrow':'\u2194','Leftrightarrow':'\u21D4','LeftRightArrow':'\u2194','leftrightarrows':'\u21C6','leftrightharpoons':'\u21CB','leftrightsquigarrow':'\u21AD','LeftRightVector':'\u294E','LeftTee':'\u22A3','LeftTeeArrow':'\u21A4','LeftTeeVector':'\u295A','leftthreetimes':'\u22CB','LeftTriangle':'\u22B2','LeftTriangleBar':'\u29CF','LeftTriangleEqual':'\u22B4','LeftUpDownVector':'\u2951','LeftUpTeeVector':'\u2960','LeftUpVector':'\u21BF','LeftUpVectorBar':'\u2958','LeftVector':'\u21BC','LeftVectorBar':'\u2952','leg':'\u22DA','lEg':'\u2A8B','leq':'\u2264','leqq':'\u2266','leqslant':'\u2A7D','les':'\u2A7D','lescc':'\u2AA8','lesdot':'\u2A7F','lesdoto':'\u2A81','lesdotor':'\u2A83','lesg':'\u22DA\uFE00','lesges':'\u2A93','lessapprox':'\u2A85','lessdot':'\u22D6','lesseqgtr':'\u22DA','lesseqqgtr':'\u2A8B','LessEqualGreater':'\u22DA','LessFullEqual':'\u2266','LessGreater':'\u2276','lessgtr':'\u2276','LessLess':'\u2AA1','lesssim':'\u2272','LessSlantEqual':'\u2A7D','LessTilde':'\u2272','lfisht':'\u297C','lfloor':'\u230A','lfr':'\uD835\uDD29','Lfr':'\uD835\uDD0F','lg':'\u2276','lgE':'\u2A91','lHar':'\u2962','lhard':'\u21BD','lharu':'\u21BC','lharul':'\u296A','lhblk':'\u2584','ljcy':'\u0459','LJcy':'\u0409','ll':'\u226A','Ll':'\u22D8','llarr':'\u21C7','llcorner':'\u231E','Lleftarrow':'\u21DA','llhard':'\u296B','lltri':'\u25FA','lmidot':'\u0140','Lmidot':'\u013F','lmoust':'\u23B0','lmoustache':'\u23B0','lnap':'\u2A89','lnapprox':'\u2A89','lne':'\u2A87','lnE':'\u2268','lneq':'\u2A87','lneqq':'\u2268','lnsim':'\u22E6','loang':'\u27EC','loarr':'\u21FD','lobrk':'\u27E6','longleftarrow':'\u27F5','Longleftarrow':'\u27F8','LongLeftArrow':'\u27F5','longleftrightarrow':'\u27F7','Longleftrightarrow':'\u27FA','LongLeftRightArrow':'\u27F7','longmapsto':'\u27FC','longrightarrow':'\u27F6','Longrightarrow':'\u27F9','LongRightArrow':'\u27F6','looparrowleft':'\u21AB','looparrowright':'\u21AC','lopar':'\u2985','lopf':'\uD835\uDD5D','Lopf':'\uD835\uDD43','loplus':'\u2A2D','lotimes':'\u2A34','lowast':'\u2217','lowbar':'_','LowerLeftArrow':'\u2199','LowerRightArrow':'\u2198','loz':'\u25CA','lozenge':'\u25CA','lozf':'\u29EB','lpar':'(','lparlt':'\u2993','lrarr':'\u21C6','lrcorner':'\u231F','lrhar':'\u21CB','lrhard':'\u296D','lrm':'\u200E','lrtri':'\u22BF','lsaquo':'\u2039','lscr':'\uD835\uDCC1','Lscr':'\u2112','lsh':'\u21B0','Lsh':'\u21B0','lsim':'\u2272','lsime':'\u2A8D','lsimg':'\u2A8F','lsqb':'[','lsquo':'\u2018','lsquor':'\u201A','lstrok':'\u0142','Lstrok':'\u0141','lt':'<','Lt':'\u226A','LT':'<','ltcc':'\u2AA6','ltcir':'\u2A79','ltdot':'\u22D6','lthree':'\u22CB','ltimes':'\u22C9','ltlarr':'\u2976','ltquest':'\u2A7B','ltri':'\u25C3','ltrie':'\u22B4','ltrif':'\u25C2','ltrPar':'\u2996','lurdshar':'\u294A','luruhar':'\u2966','lvertneqq':'\u2268\uFE00','lvnE':'\u2268\uFE00','macr':'\xAF','male':'\u2642','malt':'\u2720','maltese':'\u2720','map':'\u21A6','Map':'\u2905','mapsto':'\u21A6','mapstodown':'\u21A7','mapstoleft':'\u21A4','mapstoup':'\u21A5','marker':'\u25AE','mcomma':'\u2A29','mcy':'\u043C','Mcy':'\u041C','mdash':'\u2014','mDDot':'\u223A','measuredangle':'\u2221','MediumSpace':'\u205F','Mellintrf':'\u2133','mfr':'\uD835\uDD2A','Mfr':'\uD835\uDD10','mho':'\u2127','micro':'\xB5','mid':'\u2223','midast':'*','midcir':'\u2AF0','middot':'\xB7','minus':'\u2212','minusb':'\u229F','minusd':'\u2238','minusdu':'\u2A2A','MinusPlus':'\u2213','mlcp':'\u2ADB','mldr':'\u2026','mnplus':'\u2213','models':'\u22A7','mopf':'\uD835\uDD5E','Mopf':'\uD835\uDD44','mp':'\u2213','mscr':'\uD835\uDCC2','Mscr':'\u2133','mstpos':'\u223E','mu':'\u03BC','Mu':'\u039C','multimap':'\u22B8','mumap':'\u22B8','nabla':'\u2207','nacute':'\u0144','Nacute':'\u0143','nang':'\u2220\u20D2','nap':'\u2249','napE':'\u2A70\u0338','napid':'\u224B\u0338','napos':'\u0149','napprox':'\u2249','natur':'\u266E','natural':'\u266E','naturals':'\u2115','nbsp':'\xA0','nbump':'\u224E\u0338','nbumpe':'\u224F\u0338','ncap':'\u2A43','ncaron':'\u0148','Ncaron':'\u0147','ncedil':'\u0146','Ncedil':'\u0145','ncong':'\u2247','ncongdot':'\u2A6D\u0338','ncup':'\u2A42','ncy':'\u043D','Ncy':'\u041D','ndash':'\u2013','ne':'\u2260','nearhk':'\u2924','nearr':'\u2197','neArr':'\u21D7','nearrow':'\u2197','nedot':'\u2250\u0338','NegativeMediumSpace':'\u200B','NegativeThickSpace':'\u200B','NegativeThinSpace':'\u200B','NegativeVeryThinSpace':'\u200B','nequiv':'\u2262','nesear':'\u2928','nesim':'\u2242\u0338','NestedGreaterGreater':'\u226B','NestedLessLess':'\u226A','NewLine':'\n','nexist':'\u2204','nexists':'\u2204','nfr':'\uD835\uDD2B','Nfr':'\uD835\uDD11','nge':'\u2271','ngE':'\u2267\u0338','ngeq':'\u2271','ngeqq':'\u2267\u0338','ngeqslant':'\u2A7E\u0338','nges':'\u2A7E\u0338','nGg':'\u22D9\u0338','ngsim':'\u2275','ngt':'\u226F','nGt':'\u226B\u20D2','ngtr':'\u226F','nGtv':'\u226B\u0338','nharr':'\u21AE','nhArr':'\u21CE','nhpar':'\u2AF2','ni':'\u220B','nis':'\u22FC','nisd':'\u22FA','niv':'\u220B','njcy':'\u045A','NJcy':'\u040A','nlarr':'\u219A','nlArr':'\u21CD','nldr':'\u2025','nle':'\u2270','nlE':'\u2266\u0338','nleftarrow':'\u219A','nLeftarrow':'\u21CD','nleftrightarrow':'\u21AE','nLeftrightarrow':'\u21CE','nleq':'\u2270','nleqq':'\u2266\u0338','nleqslant':'\u2A7D\u0338','nles':'\u2A7D\u0338','nless':'\u226E','nLl':'\u22D8\u0338','nlsim':'\u2274','nlt':'\u226E','nLt':'\u226A\u20D2','nltri':'\u22EA','nltrie':'\u22EC','nLtv':'\u226A\u0338','nmid':'\u2224','NoBreak':'\u2060','NonBreakingSpace':'\xA0','nopf':'\uD835\uDD5F','Nopf':'\u2115','not':'\xAC','Not':'\u2AEC','NotCongruent':'\u2262','NotCupCap':'\u226D','NotDoubleVerticalBar':'\u2226','NotElement':'\u2209','NotEqual':'\u2260','NotEqualTilde':'\u2242\u0338','NotExists':'\u2204','NotGreater':'\u226F','NotGreaterEqual':'\u2271','NotGreaterFullEqual':'\u2267\u0338','NotGreaterGreater':'\u226B\u0338','NotGreaterLess':'\u2279','NotGreaterSlantEqual':'\u2A7E\u0338','NotGreaterTilde':'\u2275','NotHumpDownHump':'\u224E\u0338','NotHumpEqual':'\u224F\u0338','notin':'\u2209','notindot':'\u22F5\u0338','notinE':'\u22F9\u0338','notinva':'\u2209','notinvb':'\u22F7','notinvc':'\u22F6','NotLeftTriangle':'\u22EA','NotLeftTriangleBar':'\u29CF\u0338','NotLeftTriangleEqual':'\u22EC','NotLess':'\u226E','NotLessEqual':'\u2270','NotLessGreater':'\u2278','NotLessLess':'\u226A\u0338','NotLessSlantEqual':'\u2A7D\u0338','NotLessTilde':'\u2274','NotNestedGreaterGreater':'\u2AA2\u0338','NotNestedLessLess':'\u2AA1\u0338','notni':'\u220C','notniva':'\u220C','notnivb':'\u22FE','notnivc':'\u22FD','NotPrecedes':'\u2280','NotPrecedesEqual':'\u2AAF\u0338','NotPrecedesSlantEqual':'\u22E0','NotReverseElement':'\u220C','NotRightTriangle':'\u22EB','NotRightTriangleBar':'\u29D0\u0338','NotRightTriangleEqual':'\u22ED','NotSquareSubset':'\u228F\u0338','NotSquareSubsetEqual':'\u22E2','NotSquareSuperset':'\u2290\u0338','NotSquareSupersetEqual':'\u22E3','NotSubset':'\u2282\u20D2','NotSubsetEqual':'\u2288','NotSucceeds':'\u2281','NotSucceedsEqual':'\u2AB0\u0338','NotSucceedsSlantEqual':'\u22E1','NotSucceedsTilde':'\u227F\u0338','NotSuperset':'\u2283\u20D2','NotSupersetEqual':'\u2289','NotTilde':'\u2241','NotTildeEqual':'\u2244','NotTildeFullEqual':'\u2247','NotTildeTilde':'\u2249','NotVerticalBar':'\u2224','npar':'\u2226','nparallel':'\u2226','nparsl':'\u2AFD\u20E5','npart':'\u2202\u0338','npolint':'\u2A14','npr':'\u2280','nprcue':'\u22E0','npre':'\u2AAF\u0338','nprec':'\u2280','npreceq':'\u2AAF\u0338','nrarr':'\u219B','nrArr':'\u21CF','nrarrc':'\u2933\u0338','nrarrw':'\u219D\u0338','nrightarrow':'\u219B','nRightarrow':'\u21CF','nrtri':'\u22EB','nrtrie':'\u22ED','nsc':'\u2281','nsccue':'\u22E1','nsce':'\u2AB0\u0338','nscr':'\uD835\uDCC3','Nscr':'\uD835\uDCA9','nshortmid':'\u2224','nshortparallel':'\u2226','nsim':'\u2241','nsime':'\u2244','nsimeq':'\u2244','nsmid':'\u2224','nspar':'\u2226','nsqsube':'\u22E2','nsqsupe':'\u22E3','nsub':'\u2284','nsube':'\u2288','nsubE':'\u2AC5\u0338','nsubset':'\u2282\u20D2','nsubseteq':'\u2288','nsubseteqq':'\u2AC5\u0338','nsucc':'\u2281','nsucceq':'\u2AB0\u0338','nsup':'\u2285','nsupe':'\u2289','nsupE':'\u2AC6\u0338','nsupset':'\u2283\u20D2','nsupseteq':'\u2289','nsupseteqq':'\u2AC6\u0338','ntgl':'\u2279','ntilde':'\xF1','Ntilde':'\xD1','ntlg':'\u2278','ntriangleleft':'\u22EA','ntrianglelefteq':'\u22EC','ntriangleright':'\u22EB','ntrianglerighteq':'\u22ED','nu':'\u03BD','Nu':'\u039D','num':'#','numero':'\u2116','numsp':'\u2007','nvap':'\u224D\u20D2','nvdash':'\u22AC','nvDash':'\u22AD','nVdash':'\u22AE','nVDash':'\u22AF','nvge':'\u2265\u20D2','nvgt':'>\u20D2','nvHarr':'\u2904','nvinfin':'\u29DE','nvlArr':'\u2902','nvle':'\u2264\u20D2','nvlt':'<\u20D2','nvltrie':'\u22B4\u20D2','nvrArr':'\u2903','nvrtrie':'\u22B5\u20D2','nvsim':'\u223C\u20D2','nwarhk':'\u2923','nwarr':'\u2196','nwArr':'\u21D6','nwarrow':'\u2196','nwnear':'\u2927','oacute':'\xF3','Oacute':'\xD3','oast':'\u229B','ocir':'\u229A','ocirc':'\xF4','Ocirc':'\xD4','ocy':'\u043E','Ocy':'\u041E','odash':'\u229D','odblac':'\u0151','Odblac':'\u0150','odiv':'\u2A38','odot':'\u2299','odsold':'\u29BC','oelig':'\u0153','OElig':'\u0152','ofcir':'\u29BF','ofr':'\uD835\uDD2C','Ofr':'\uD835\uDD12','ogon':'\u02DB','ograve':'\xF2','Ograve':'\xD2','ogt':'\u29C1','ohbar':'\u29B5','ohm':'\u03A9','oint':'\u222E','olarr':'\u21BA','olcir':'\u29BE','olcross':'\u29BB','oline':'\u203E','olt':'\u29C0','omacr':'\u014D','Omacr':'\u014C','omega':'\u03C9','Omega':'\u03A9','omicron':'\u03BF','Omicron':'\u039F','omid':'\u29B6','ominus':'\u2296','oopf':'\uD835\uDD60','Oopf':'\uD835\uDD46','opar':'\u29B7','OpenCurlyDoubleQuote':'\u201C','OpenCurlyQuote':'\u2018','operp':'\u29B9','oplus':'\u2295','or':'\u2228','Or':'\u2A54','orarr':'\u21BB','ord':'\u2A5D','order':'\u2134','orderof':'\u2134','ordf':'\xAA','ordm':'\xBA','origof':'\u22B6','oror':'\u2A56','orslope':'\u2A57','orv':'\u2A5B','oS':'\u24C8','oscr':'\u2134','Oscr':'\uD835\uDCAA','oslash':'\xF8','Oslash':'\xD8','osol':'\u2298','otilde':'\xF5','Otilde':'\xD5','otimes':'\u2297','Otimes':'\u2A37','otimesas':'\u2A36','ouml':'\xF6','Ouml':'\xD6','ovbar':'\u233D','OverBar':'\u203E','OverBrace':'\u23DE','OverBracket':'\u23B4','OverParenthesis':'\u23DC','par':'\u2225','para':'\xB6','parallel':'\u2225','parsim':'\u2AF3','parsl':'\u2AFD','part':'\u2202','PartialD':'\u2202','pcy':'\u043F','Pcy':'\u041F','percnt':'%','period':'.','permil':'\u2030','perp':'\u22A5','pertenk':'\u2031','pfr':'\uD835\uDD2D','Pfr':'\uD835\uDD13','phi':'\u03C6','Phi':'\u03A6','phiv':'\u03D5','phmmat':'\u2133','phone':'\u260E','pi':'\u03C0','Pi':'\u03A0','pitchfork':'\u22D4','piv':'\u03D6','planck':'\u210F','planckh':'\u210E','plankv':'\u210F','plus':'+','plusacir':'\u2A23','plusb':'\u229E','pluscir':'\u2A22','plusdo':'\u2214','plusdu':'\u2A25','pluse':'\u2A72','PlusMinus':'\xB1','plusmn':'\xB1','plussim':'\u2A26','plustwo':'\u2A27','pm':'\xB1','Poincareplane':'\u210C','pointint':'\u2A15','popf':'\uD835\uDD61','Popf':'\u2119','pound':'\xA3','pr':'\u227A','Pr':'\u2ABB','prap':'\u2AB7','prcue':'\u227C','pre':'\u2AAF','prE':'\u2AB3','prec':'\u227A','precapprox':'\u2AB7','preccurlyeq':'\u227C','Precedes':'\u227A','PrecedesEqual':'\u2AAF','PrecedesSlantEqual':'\u227C','PrecedesTilde':'\u227E','preceq':'\u2AAF','precnapprox':'\u2AB9','precneqq':'\u2AB5','precnsim':'\u22E8','precsim':'\u227E','prime':'\u2032','Prime':'\u2033','primes':'\u2119','prnap':'\u2AB9','prnE':'\u2AB5','prnsim':'\u22E8','prod':'\u220F','Product':'\u220F','profalar':'\u232E','profline':'\u2312','profsurf':'\u2313','prop':'\u221D','Proportion':'\u2237','Proportional':'\u221D','propto':'\u221D','prsim':'\u227E','prurel':'\u22B0','pscr':'\uD835\uDCC5','Pscr':'\uD835\uDCAB','psi':'\u03C8','Psi':'\u03A8','puncsp':'\u2008','qfr':'\uD835\uDD2E','Qfr':'\uD835\uDD14','qint':'\u2A0C','qopf':'\uD835\uDD62','Qopf':'\u211A','qprime':'\u2057','qscr':'\uD835\uDCC6','Qscr':'\uD835\uDCAC','quaternions':'\u210D','quatint':'\u2A16','quest':'?','questeq':'\u225F','quot':'"','QUOT':'"','rAarr':'\u21DB','race':'\u223D\u0331','racute':'\u0155','Racute':'\u0154','radic':'\u221A','raemptyv':'\u29B3','rang':'\u27E9','Rang':'\u27EB','rangd':'\u2992','range':'\u29A5','rangle':'\u27E9','raquo':'\xBB','rarr':'\u2192','rArr':'\u21D2','Rarr':'\u21A0','rarrap':'\u2975','rarrb':'\u21E5','rarrbfs':'\u2920','rarrc':'\u2933','rarrfs':'\u291E','rarrhk':'\u21AA','rarrlp':'\u21AC','rarrpl':'\u2945','rarrsim':'\u2974','rarrtl':'\u21A3','Rarrtl':'\u2916','rarrw':'\u219D','ratail':'\u291A','rAtail':'\u291C','ratio':'\u2236','rationals':'\u211A','rbarr':'\u290D','rBarr':'\u290F','RBarr':'\u2910','rbbrk':'\u2773','rbrace':'}','rbrack':']','rbrke':'\u298C','rbrksld':'\u298E','rbrkslu':'\u2990','rcaron':'\u0159','Rcaron':'\u0158','rcedil':'\u0157','Rcedil':'\u0156','rceil':'\u2309','rcub':'}','rcy':'\u0440','Rcy':'\u0420','rdca':'\u2937','rdldhar':'\u2969','rdquo':'\u201D','rdquor':'\u201D','rdsh':'\u21B3','Re':'\u211C','real':'\u211C','realine':'\u211B','realpart':'\u211C','reals':'\u211D','rect':'\u25AD','reg':'\xAE','REG':'\xAE','ReverseElement':'\u220B','ReverseEquilibrium':'\u21CB','ReverseUpEquilibrium':'\u296F','rfisht':'\u297D','rfloor':'\u230B','rfr':'\uD835\uDD2F','Rfr':'\u211C','rHar':'\u2964','rhard':'\u21C1','rharu':'\u21C0','rharul':'\u296C','rho':'\u03C1','Rho':'\u03A1','rhov':'\u03F1','RightAngleBracket':'\u27E9','rightarrow':'\u2192','Rightarrow':'\u21D2','RightArrow':'\u2192','RightArrowBar':'\u21E5','RightArrowLeftArrow':'\u21C4','rightarrowtail':'\u21A3','RightCeiling':'\u2309','RightDoubleBracket':'\u27E7','RightDownTeeVector':'\u295D','RightDownVector':'\u21C2','RightDownVectorBar':'\u2955','RightFloor':'\u230B','rightharpoondown':'\u21C1','rightharpoonup':'\u21C0','rightleftarrows':'\u21C4','rightleftharpoons':'\u21CC','rightrightarrows':'\u21C9','rightsquigarrow':'\u219D','RightTee':'\u22A2','RightTeeArrow':'\u21A6','RightTeeVector':'\u295B','rightthreetimes':'\u22CC','RightTriangle':'\u22B3','RightTriangleBar':'\u29D0','RightTriangleEqual':'\u22B5','RightUpDownVector':'\u294F','RightUpTeeVector':'\u295C','RightUpVector':'\u21BE','RightUpVectorBar':'\u2954','RightVector':'\u21C0','RightVectorBar':'\u2953','ring':'\u02DA','risingdotseq':'\u2253','rlarr':'\u21C4','rlhar':'\u21CC','rlm':'\u200F','rmoust':'\u23B1','rmoustache':'\u23B1','rnmid':'\u2AEE','roang':'\u27ED','roarr':'\u21FE','robrk':'\u27E7','ropar':'\u2986','ropf':'\uD835\uDD63','Ropf':'\u211D','roplus':'\u2A2E','rotimes':'\u2A35','RoundImplies':'\u2970','rpar':')','rpargt':'\u2994','rppolint':'\u2A12','rrarr':'\u21C9','Rrightarrow':'\u21DB','rsaquo':'\u203A','rscr':'\uD835\uDCC7','Rscr':'\u211B','rsh':'\u21B1','Rsh':'\u21B1','rsqb':']','rsquo':'\u2019','rsquor':'\u2019','rthree':'\u22CC','rtimes':'\u22CA','rtri':'\u25B9','rtrie':'\u22B5','rtrif':'\u25B8','rtriltri':'\u29CE','RuleDelayed':'\u29F4','ruluhar':'\u2968','rx':'\u211E','sacute':'\u015B','Sacute':'\u015A','sbquo':'\u201A','sc':'\u227B','Sc':'\u2ABC','scap':'\u2AB8','scaron':'\u0161','Scaron':'\u0160','sccue':'\u227D','sce':'\u2AB0','scE':'\u2AB4','scedil':'\u015F','Scedil':'\u015E','scirc':'\u015D','Scirc':'\u015C','scnap':'\u2ABA','scnE':'\u2AB6','scnsim':'\u22E9','scpolint':'\u2A13','scsim':'\u227F','scy':'\u0441','Scy':'\u0421','sdot':'\u22C5','sdotb':'\u22A1','sdote':'\u2A66','searhk':'\u2925','searr':'\u2198','seArr':'\u21D8','searrow':'\u2198','sect':'\xA7','semi':';','seswar':'\u2929','setminus':'\u2216','setmn':'\u2216','sext':'\u2736','sfr':'\uD835\uDD30','Sfr':'\uD835\uDD16','sfrown':'\u2322','sharp':'\u266F','shchcy':'\u0449','SHCHcy':'\u0429','shcy':'\u0448','SHcy':'\u0428','ShortDownArrow':'\u2193','ShortLeftArrow':'\u2190','shortmid':'\u2223','shortparallel':'\u2225','ShortRightArrow':'\u2192','ShortUpArrow':'\u2191','shy':'\xAD','sigma':'\u03C3','Sigma':'\u03A3','sigmaf':'\u03C2','sigmav':'\u03C2','sim':'\u223C','simdot':'\u2A6A','sime':'\u2243','simeq':'\u2243','simg':'\u2A9E','simgE':'\u2AA0','siml':'\u2A9D','simlE':'\u2A9F','simne':'\u2246','simplus':'\u2A24','simrarr':'\u2972','slarr':'\u2190','SmallCircle':'\u2218','smallsetminus':'\u2216','smashp':'\u2A33','smeparsl':'\u29E4','smid':'\u2223','smile':'\u2323','smt':'\u2AAA','smte':'\u2AAC','smtes':'\u2AAC\uFE00','softcy':'\u044C','SOFTcy':'\u042C','sol':'/','solb':'\u29C4','solbar':'\u233F','sopf':'\uD835\uDD64','Sopf':'\uD835\uDD4A','spades':'\u2660','spadesuit':'\u2660','spar':'\u2225','sqcap':'\u2293','sqcaps':'\u2293\uFE00','sqcup':'\u2294','sqcups':'\u2294\uFE00','Sqrt':'\u221A','sqsub':'\u228F','sqsube':'\u2291','sqsubset':'\u228F','sqsubseteq':'\u2291','sqsup':'\u2290','sqsupe':'\u2292','sqsupset':'\u2290','sqsupseteq':'\u2292','squ':'\u25A1','square':'\u25A1','Square':'\u25A1','SquareIntersection':'\u2293','SquareSubset':'\u228F','SquareSubsetEqual':'\u2291','SquareSuperset':'\u2290','SquareSupersetEqual':'\u2292','SquareUnion':'\u2294','squarf':'\u25AA','squf':'\u25AA','srarr':'\u2192','sscr':'\uD835\uDCC8','Sscr':'\uD835\uDCAE','ssetmn':'\u2216','ssmile':'\u2323','sstarf':'\u22C6','star':'\u2606','Star':'\u22C6','starf':'\u2605','straightepsilon':'\u03F5','straightphi':'\u03D5','strns':'\xAF','sub':'\u2282','Sub':'\u22D0','subdot':'\u2ABD','sube':'\u2286','subE':'\u2AC5','subedot':'\u2AC3','submult':'\u2AC1','subne':'\u228A','subnE':'\u2ACB','subplus':'\u2ABF','subrarr':'\u2979','subset':'\u2282','Subset':'\u22D0','subseteq':'\u2286','subseteqq':'\u2AC5','SubsetEqual':'\u2286','subsetneq':'\u228A','subsetneqq':'\u2ACB','subsim':'\u2AC7','subsub':'\u2AD5','subsup':'\u2AD3','succ':'\u227B','succapprox':'\u2AB8','succcurlyeq':'\u227D','Succeeds':'\u227B','SucceedsEqual':'\u2AB0','SucceedsSlantEqual':'\u227D','SucceedsTilde':'\u227F','succeq':'\u2AB0','succnapprox':'\u2ABA','succneqq':'\u2AB6','succnsim':'\u22E9','succsim':'\u227F','SuchThat':'\u220B','sum':'\u2211','Sum':'\u2211','sung':'\u266A','sup':'\u2283','Sup':'\u22D1','sup1':'\xB9','sup2':'\xB2','sup3':'\xB3','supdot':'\u2ABE','supdsub':'\u2AD8','supe':'\u2287','supE':'\u2AC6','supedot':'\u2AC4','Superset':'\u2283','SupersetEqual':'\u2287','suphsol':'\u27C9','suphsub':'\u2AD7','suplarr':'\u297B','supmult':'\u2AC2','supne':'\u228B','supnE':'\u2ACC','supplus':'\u2AC0','supset':'\u2283','Supset':'\u22D1','supseteq':'\u2287','supseteqq':'\u2AC6','supsetneq':'\u228B','supsetneqq':'\u2ACC','supsim':'\u2AC8','supsub':'\u2AD4','supsup':'\u2AD6','swarhk':'\u2926','swarr':'\u2199','swArr':'\u21D9','swarrow':'\u2199','swnwar':'\u292A','szlig':'\xDF','Tab':'\t','target':'\u2316','tau':'\u03C4','Tau':'\u03A4','tbrk':'\u23B4','tcaron':'\u0165','Tcaron':'\u0164','tcedil':'\u0163','Tcedil':'\u0162','tcy':'\u0442','Tcy':'\u0422','tdot':'\u20DB','telrec':'\u2315','tfr':'\uD835\uDD31','Tfr':'\uD835\uDD17','there4':'\u2234','therefore':'\u2234','Therefore':'\u2234','theta':'\u03B8','Theta':'\u0398','thetasym':'\u03D1','thetav':'\u03D1','thickapprox':'\u2248','thicksim':'\u223C','ThickSpace':'\u205F\u200A','thinsp':'\u2009','ThinSpace':'\u2009','thkap':'\u2248','thksim':'\u223C','thorn':'\xFE','THORN':'\xDE','tilde':'\u02DC','Tilde':'\u223C','TildeEqual':'\u2243','TildeFullEqual':'\u2245','TildeTilde':'\u2248','times':'\xD7','timesb':'\u22A0','timesbar':'\u2A31','timesd':'\u2A30','tint':'\u222D','toea':'\u2928','top':'\u22A4','topbot':'\u2336','topcir':'\u2AF1','topf':'\uD835\uDD65','Topf':'\uD835\uDD4B','topfork':'\u2ADA','tosa':'\u2929','tprime':'\u2034','trade':'\u2122','TRADE':'\u2122','triangle':'\u25B5','triangledown':'\u25BF','triangleleft':'\u25C3','trianglelefteq':'\u22B4','triangleq':'\u225C','triangleright':'\u25B9','trianglerighteq':'\u22B5','tridot':'\u25EC','trie':'\u225C','triminus':'\u2A3A','TripleDot':'\u20DB','triplus':'\u2A39','trisb':'\u29CD','tritime':'\u2A3B','trpezium':'\u23E2','tscr':'\uD835\uDCC9','Tscr':'\uD835\uDCAF','tscy':'\u0446','TScy':'\u0426','tshcy':'\u045B','TSHcy':'\u040B','tstrok':'\u0167','Tstrok':'\u0166','twixt':'\u226C','twoheadleftarrow':'\u219E','twoheadrightarrow':'\u21A0','uacute':'\xFA','Uacute':'\xDA','uarr':'\u2191','uArr':'\u21D1','Uarr':'\u219F','Uarrocir':'\u2949','ubrcy':'\u045E','Ubrcy':'\u040E','ubreve':'\u016D','Ubreve':'\u016C','ucirc':'\xFB','Ucirc':'\xDB','ucy':'\u0443','Ucy':'\u0423','udarr':'\u21C5','udblac':'\u0171','Udblac':'\u0170','udhar':'\u296E','ufisht':'\u297E','ufr':'\uD835\uDD32','Ufr':'\uD835\uDD18','ugrave':'\xF9','Ugrave':'\xD9','uHar':'\u2963','uharl':'\u21BF','uharr':'\u21BE','uhblk':'\u2580','ulcorn':'\u231C','ulcorner':'\u231C','ulcrop':'\u230F','ultri':'\u25F8','umacr':'\u016B','Umacr':'\u016A','uml':'\xA8','UnderBar':'_','UnderBrace':'\u23DF','UnderBracket':'\u23B5','UnderParenthesis':'\u23DD','Union':'\u22C3','UnionPlus':'\u228E','uogon':'\u0173','Uogon':'\u0172','uopf':'\uD835\uDD66','Uopf':'\uD835\uDD4C','uparrow':'\u2191','Uparrow':'\u21D1','UpArrow':'\u2191','UpArrowBar':'\u2912','UpArrowDownArrow':'\u21C5','updownarrow':'\u2195','Updownarrow':'\u21D5','UpDownArrow':'\u2195','UpEquilibrium':'\u296E','upharpoonleft':'\u21BF','upharpoonright':'\u21BE','uplus':'\u228E','UpperLeftArrow':'\u2196','UpperRightArrow':'\u2197','upsi':'\u03C5','Upsi':'\u03D2','upsih':'\u03D2','upsilon':'\u03C5','Upsilon':'\u03A5','UpTee':'\u22A5','UpTeeArrow':'\u21A5','upuparrows':'\u21C8','urcorn':'\u231D','urcorner':'\u231D','urcrop':'\u230E','uring':'\u016F','Uring':'\u016E','urtri':'\u25F9','uscr':'\uD835\uDCCA','Uscr':'\uD835\uDCB0','utdot':'\u22F0','utilde':'\u0169','Utilde':'\u0168','utri':'\u25B5','utrif':'\u25B4','uuarr':'\u21C8','uuml':'\xFC','Uuml':'\xDC','uwangle':'\u29A7','vangrt':'\u299C','varepsilon':'\u03F5','varkappa':'\u03F0','varnothing':'\u2205','varphi':'\u03D5','varpi':'\u03D6','varpropto':'\u221D','varr':'\u2195','vArr':'\u21D5','varrho':'\u03F1','varsigma':'\u03C2','varsubsetneq':'\u228A\uFE00','varsubsetneqq':'\u2ACB\uFE00','varsupsetneq':'\u228B\uFE00','varsupsetneqq':'\u2ACC\uFE00','vartheta':'\u03D1','vartriangleleft':'\u22B2','vartriangleright':'\u22B3','vBar':'\u2AE8','Vbar':'\u2AEB','vBarv':'\u2AE9','vcy':'\u0432','Vcy':'\u0412','vdash':'\u22A2','vDash':'\u22A8','Vdash':'\u22A9','VDash':'\u22AB','Vdashl':'\u2AE6','vee':'\u2228','Vee':'\u22C1','veebar':'\u22BB','veeeq':'\u225A','vellip':'\u22EE','verbar':'|','Verbar':'\u2016','vert':'|','Vert':'\u2016','VerticalBar':'\u2223','VerticalLine':'|','VerticalSeparator':'\u2758','VerticalTilde':'\u2240','VeryThinSpace':'\u200A','vfr':'\uD835\uDD33','Vfr':'\uD835\uDD19','vltri':'\u22B2','vnsub':'\u2282\u20D2','vnsup':'\u2283\u20D2','vopf':'\uD835\uDD67','Vopf':'\uD835\uDD4D','vprop':'\u221D','vrtri':'\u22B3','vscr':'\uD835\uDCCB','Vscr':'\uD835\uDCB1','vsubne':'\u228A\uFE00','vsubnE':'\u2ACB\uFE00','vsupne':'\u228B\uFE00','vsupnE':'\u2ACC\uFE00','Vvdash':'\u22AA','vzigzag':'\u299A','wcirc':'\u0175','Wcirc':'\u0174','wedbar':'\u2A5F','wedge':'\u2227','Wedge':'\u22C0','wedgeq':'\u2259','weierp':'\u2118','wfr':'\uD835\uDD34','Wfr':'\uD835\uDD1A','wopf':'\uD835\uDD68','Wopf':'\uD835\uDD4E','wp':'\u2118','wr':'\u2240','wreath':'\u2240','wscr':'\uD835\uDCCC','Wscr':'\uD835\uDCB2','xcap':'\u22C2','xcirc':'\u25EF','xcup':'\u22C3','xdtri':'\u25BD','xfr':'\uD835\uDD35','Xfr':'\uD835\uDD1B','xharr':'\u27F7','xhArr':'\u27FA','xi':'\u03BE','Xi':'\u039E','xlarr':'\u27F5','xlArr':'\u27F8','xmap':'\u27FC','xnis':'\u22FB','xodot':'\u2A00','xopf':'\uD835\uDD69','Xopf':'\uD835\uDD4F','xoplus':'\u2A01','xotime':'\u2A02','xrarr':'\u27F6','xrArr':'\u27F9','xscr':'\uD835\uDCCD','Xscr':'\uD835\uDCB3','xsqcup':'\u2A06','xuplus':'\u2A04','xutri':'\u25B3','xvee':'\u22C1','xwedge':'\u22C0','yacute':'\xFD','Yacute':'\xDD','yacy':'\u044F','YAcy':'\u042F','ycirc':'\u0177','Ycirc':'\u0176','ycy':'\u044B','Ycy':'\u042B','yen':'\xA5','yfr':'\uD835\uDD36','Yfr':'\uD835\uDD1C','yicy':'\u0457','YIcy':'\u0407','yopf':'\uD835\uDD6A','Yopf':'\uD835\uDD50','yscr':'\uD835\uDCCE','Yscr':'\uD835\uDCB4','yucy':'\u044E','YUcy':'\u042E','yuml':'\xFF','Yuml':'\u0178','zacute':'\u017A','Zacute':'\u0179','zcaron':'\u017E','Zcaron':'\u017D','zcy':'\u0437','Zcy':'\u0417','zdot':'\u017C','Zdot':'\u017B','zeetrf':'\u2128','ZeroWidthSpace':'\u200B','zeta':'\u03B6','Zeta':'\u0396','zfr':'\uD835\uDD37','Zfr':'\u2128','zhcy':'\u0436','ZHcy':'\u0416','zigrarr':'\u21DD','zopf':'\uD835\uDD6B','Zopf':'\u2124','zscr':'\uD835\uDCCF','Zscr':'\uD835\uDCB5','zwj':'\u200D','zwnj':'\u200C'};
13330 var decodeMapLegacy = {'aacute':'\xE1','Aacute':'\xC1','acirc':'\xE2','Acirc':'\xC2','acute':'\xB4','aelig':'\xE6','AElig':'\xC6','agrave':'\xE0','Agrave':'\xC0','amp':'&','AMP':'&','aring':'\xE5','Aring':'\xC5','atilde':'\xE3','Atilde':'\xC3','auml':'\xE4','Auml':'\xC4','brvbar':'\xA6','ccedil':'\xE7','Ccedil':'\xC7','cedil':'\xB8','cent':'\xA2','copy':'\xA9','COPY':'\xA9','curren':'\xA4','deg':'\xB0','divide':'\xF7','eacute':'\xE9','Eacute':'\xC9','ecirc':'\xEA','Ecirc':'\xCA','egrave':'\xE8','Egrave':'\xC8','eth':'\xF0','ETH':'\xD0','euml':'\xEB','Euml':'\xCB','frac12':'\xBD','frac14':'\xBC','frac34':'\xBE','gt':'>','GT':'>','iacute':'\xED','Iacute':'\xCD','icirc':'\xEE','Icirc':'\xCE','iexcl':'\xA1','igrave':'\xEC','Igrave':'\xCC','iquest':'\xBF','iuml':'\xEF','Iuml':'\xCF','laquo':'\xAB','lt':'<','LT':'<','macr':'\xAF','micro':'\xB5','middot':'\xB7','nbsp':'\xA0','not':'\xAC','ntilde':'\xF1','Ntilde':'\xD1','oacute':'\xF3','Oacute':'\xD3','ocirc':'\xF4','Ocirc':'\xD4','ograve':'\xF2','Ograve':'\xD2','ordf':'\xAA','ordm':'\xBA','oslash':'\xF8','Oslash':'\xD8','otilde':'\xF5','Otilde':'\xD5','ouml':'\xF6','Ouml':'\xD6','para':'\xB6','plusmn':'\xB1','pound':'\xA3','quot':'"','QUOT':'"','raquo':'\xBB','reg':'\xAE','REG':'\xAE','sect':'\xA7','shy':'\xAD','sup1':'\xB9','sup2':'\xB2','sup3':'\xB3','szlig':'\xDF','thorn':'\xFE','THORN':'\xDE','times':'\xD7','uacute':'\xFA','Uacute':'\xDA','ucirc':'\xFB','Ucirc':'\xDB','ugrave':'\xF9','Ugrave':'\xD9','uml':'\xA8','uuml':'\xFC','Uuml':'\xDC','yacute':'\xFD','Yacute':'\xDD','yen':'\xA5','yuml':'\xFF'};
13331 var decodeMapNumeric = {'0':'\uFFFD','128':'\u20AC','130':'\u201A','131':'\u0192','132':'\u201E','133':'\u2026','134':'\u2020','135':'\u2021','136':'\u02C6','137':'\u2030','138':'\u0160','139':'\u2039','140':'\u0152','142':'\u017D','145':'\u2018','146':'\u2019','147':'\u201C','148':'\u201D','149':'\u2022','150':'\u2013','151':'\u2014','152':'\u02DC','153':'\u2122','154':'\u0161','155':'\u203A','156':'\u0153','158':'\u017E','159':'\u0178'};
13332 var invalidReferenceCodePoints = [1,2,3,4,5,6,7,8,11,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,64976,64977,64978,64979,64980,64981,64982,64983,64984,64985,64986,64987,64988,64989,64990,64991,64992,64993,64994,64995,64996,64997,64998,64999,65000,65001,65002,65003,65004,65005,65006,65007,65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111];
13333
13334 /*--------------------------------------------------------------------------*/
13335
13336 var stringFromCharCode = String.fromCharCode;
13337
13338 var object = {};
13339 var hasOwnProperty = object.hasOwnProperty;
13340 var has = function(object, propertyName) {
13341 return hasOwnProperty.call(object, propertyName);
13342 };
13343
13344 var contains = function(array, value) {
13345 var index = -1;
13346 var length = array.length;
13347 while (++index < length) {
13348 if (array[index] == value) {
13349 return true;
13350 }
13351 }
13352 return false;
13353 };
13354
13355 var merge = function(options, defaults) {
13356 if (!options) {
13357 return defaults;
13358 }
13359 var result = {};
13360 var key;
13361 for (key in defaults) {
13362 // A `hasOwnProperty` check is not needed here, since only recognized
13363 // option names are used anyway. Any others are ignored.
13364 result[key] = has(options, key) ? options[key] : defaults[key];
13365 }
13366 return result;
13367 };
13368
13369 // Modified version of `ucs2encode`; see https://mths.be/punycode.
13370 var codePointToSymbol = function(codePoint, strict) {
13371 var output = '';
13372 if ((codePoint >= 0xD800 && codePoint <= 0xDFFF) || codePoint > 0x10FFFF) {
13373 // See issue #4:
13374 // “Otherwise, if the number is in the range 0xD800 to 0xDFFF or is
13375 // greater than 0x10FFFF, then this is a parse error. Return a U+FFFD
13376 // REPLACEMENT CHARACTER.”
13377 if (strict) {
13378 parseError('character reference outside the permissible Unicode range');
13379 }
13380 return '\uFFFD';
13381 }
13382 if (has(decodeMapNumeric, codePoint)) {
13383 if (strict) {
13384 parseError('disallowed character reference');
13385 }
13386 return decodeMapNumeric[codePoint];
13387 }
13388 if (strict && contains(invalidReferenceCodePoints, codePoint)) {
13389 parseError('disallowed character reference');
13390 }
13391 if (codePoint > 0xFFFF) {
13392 codePoint -= 0x10000;
13393 output += stringFromCharCode(codePoint >>> 10 & 0x3FF | 0xD800);
13394 codePoint = 0xDC00 | codePoint & 0x3FF;
13395 }
13396 output += stringFromCharCode(codePoint);
13397 return output;
13398 };
13399
13400 var hexEscape = function(codePoint) {
13401 return '&#x' + codePoint.toString(16).toUpperCase() + ';';
13402 };
13403
13404 var decEscape = function(codePoint) {
13405 return '&#' + codePoint + ';';
13406 };
13407
13408 var parseError = function(message) {
13409 throw Error('Parse error: ' + message);
13410 };
13411
13412 /*--------------------------------------------------------------------------*/
13413
13414 var encode = function(string, options) {
13415 options = merge(options, encode.options);
13416 var strict = options.strict;
13417 if (strict && regexInvalidRawCodePoint.test(string)) {
13418 parseError('forbidden code point');
13419 }
13420 var encodeEverything = options.encodeEverything;
13421 var useNamedReferences = options.useNamedReferences;
13422 var allowUnsafeSymbols = options.allowUnsafeSymbols;
13423 var escapeCodePoint = options.decimal ? decEscape : hexEscape;
13424
13425 var escapeBmpSymbol = function(symbol) {
13426 return escapeCodePoint(symbol.charCodeAt(0));
13427 };
13428
13429 if (encodeEverything) {
13430 // Encode ASCII symbols.
13431 string = string.replace(regexAsciiWhitelist, function(symbol) {
13432 // Use named references if requested & possible.
13433 if (useNamedReferences && has(encodeMap, symbol)) {
13434 return '&' + encodeMap[symbol] + ';';
13435 }
13436 return escapeBmpSymbol(symbol);
13437 });
13438 // Shorten a few escapes that represent two symbols, of which at least one
13439 // is within the ASCII range.
13440 if (useNamedReferences) {
13441 string = string
13442 .replace(/&gt;\u20D2/g, '&nvgt;')
13443 .replace(/&lt;\u20D2/g, '&nvlt;')
13444 .replace(/&#x66;&#x6A;/g, '&fjlig;');
13445 }
13446 // Encode non-ASCII symbols.
13447 if (useNamedReferences) {
13448 // Encode non-ASCII symbols that can be replaced with a named reference.
13449 string = string.replace(regexEncodeNonAscii, function(string) {
13450 // Note: there is no need to check `has(encodeMap, string)` here.
13451 return '&' + encodeMap[string] + ';';
13452 });
13453 }
13454 // Note: any remaining non-ASCII symbols are handled outside of the `if`.
13455 } else if (useNamedReferences) {
13456 // Apply named character references.
13457 // Encode `<>"'&` using named character references.
13458 if (!allowUnsafeSymbols) {
13459 string = string.replace(regexEscape, function(string) {
13460 return '&' + encodeMap[string] + ';'; // no need to check `has()` here
13461 });
13462 }
13463 // Shorten escapes that represent two symbols, of which at least one is
13464 // `<>"'&`.
13465 string = string
13466 .replace(/&gt;\u20D2/g, '&nvgt;')
13467 .replace(/&lt;\u20D2/g, '&nvlt;');
13468 // Encode non-ASCII symbols that can be replaced with a named reference.
13469 string = string.replace(regexEncodeNonAscii, function(string) {
13470 // Note: there is no need to check `has(encodeMap, string)` here.
13471 return '&' + encodeMap[string] + ';';
13472 });
13473 } else if (!allowUnsafeSymbols) {
13474 // Encode `<>"'&` using hexadecimal escapes, now that they’re not handled
13475 // using named character references.
13476 string = string.replace(regexEscape, escapeBmpSymbol);
13477 }
13478 return string
13479 // Encode astral symbols.
13480 .replace(regexAstralSymbols, function($0) {
13481 // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
13482 var high = $0.charCodeAt(0);
13483 var low = $0.charCodeAt(1);
13484 var codePoint = (high - 0xD800) * 0x400 + low - 0xDC00 + 0x10000;
13485 return escapeCodePoint(codePoint);
13486 })
13487 // Encode any remaining BMP symbols that are not printable ASCII symbols
13488 // using a hexadecimal escape.
13489 .replace(regexBmpWhitelist, escapeBmpSymbol);
13490 };
13491 // Expose default options (so they can be overridden globally).
13492 encode.options = {
13493 'allowUnsafeSymbols': false,
13494 'encodeEverything': false,
13495 'strict': false,
13496 'useNamedReferences': false,
13497 'decimal' : false
13498 };
13499
13500 var decode = function(html, options) {
13501 options = merge(options, decode.options);
13502 var strict = options.strict;
13503 if (strict && regexInvalidEntity.test(html)) {
13504 parseError('malformed character reference');
13505 }
13506 return html.replace(regexDecode, function($0, $1, $2, $3, $4, $5, $6, $7, $8) {
13507 var codePoint;
13508 var semicolon;
13509 var decDigits;
13510 var hexDigits;
13511 var reference;
13512 var next;
13513
13514 if ($1) {
13515 reference = $1;
13516 // Note: there is no need to check `has(decodeMap, reference)`.
13517 return decodeMap[reference];
13518 }
13519
13520 if ($2) {
13521 // Decode named character references without trailing `;`, e.g. `&amp`.
13522 // This is only a parse error if it gets converted to `&`, or if it is
13523 // followed by `=` in an attribute context.
13524 reference = $2;
13525 next = $3;
13526 if (next && options.isAttributeValue) {
13527 if (strict && next == '=') {
13528 parseError('`&` did not start a character reference');
13529 }
13530 return $0;
13531 } else {
13532 if (strict) {
13533 parseError(
13534 'named character reference was not terminated by a semicolon'
13535 );
13536 }
13537 // Note: there is no need to check `has(decodeMapLegacy, reference)`.
13538 return decodeMapLegacy[reference] + (next || '');
13539 }
13540 }
13541
13542 if ($4) {
13543 // Decode decimal escapes, e.g. `&#119558;`.
13544 decDigits = $4;
13545 semicolon = $5;
13546 if (strict && !semicolon) {
13547 parseError('character reference was not terminated by a semicolon');
13548 }
13549 codePoint = parseInt(decDigits, 10);
13550 return codePointToSymbol(codePoint, strict);
13551 }
13552
13553 if ($6) {
13554 // Decode hexadecimal escapes, e.g. `&#x1D306;`.
13555 hexDigits = $6;
13556 semicolon = $7;
13557 if (strict && !semicolon) {
13558 parseError('character reference was not terminated by a semicolon');
13559 }
13560 codePoint = parseInt(hexDigits, 16);
13561 return codePointToSymbol(codePoint, strict);
13562 }
13563
13564 // If we’re still here, `if ($7)` is implied; it’s an ambiguous
13565 // ampersand for sure. https://mths.be/notes/ambiguous-ampersands
13566 if (strict) {
13567 parseError(
13568 'named character reference was not terminated by a semicolon'
13569 );
13570 }
13571 return $0;
13572 });
13573 };
13574 // Expose default options (so they can be overridden globally).
13575 decode.options = {
13576 'isAttributeValue': false,
13577 'strict': false
13578 };
13579
13580 var escape = function(string) {
13581 return string.replace(regexEscape, function($0) {
13582 // Note: there is no need to check `has(escapeMap, $0)` here.
13583 return escapeMap[$0];
13584 });
13585 };
13586
13587 /*--------------------------------------------------------------------------*/
13588
13589 var he = {
13590 'version': '1.2.0',
13591 'encode': encode,
13592 'decode': decode,
13593 'escape': escape,
13594 'unescape': decode
13595 };
13596
13597 // Some AMD build optimizers, like r.js, check for specific condition patterns
13598 // like the following:
13599 if (
13600 false
13601 ) {
13602 define(function() {
13603 return he;
13604 });
13605 } else if (freeExports && !freeExports.nodeType) {
13606 if (freeModule) { // in Node.js, io.js, or RingoJS v0.8.0+
13607 freeModule.exports = he;
13608 } else { // in Narwhal or RingoJS v0.7.0-
13609 for (var key in he) {
13610 has(he, key) && (freeExports[key] = he[key]);
13611 }
13612 }
13613 } else { // in Rhino or a web browser
13614 root.he = he;
13615 }
13616
13617}(this));
13618
13619}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
13620},{}],55:[function(require,module,exports){
13621exports.read = function (buffer, offset, isLE, mLen, nBytes) {
13622 var e, m
13623 var eLen = (nBytes * 8) - mLen - 1
13624 var eMax = (1 << eLen) - 1
13625 var eBias = eMax >> 1
13626 var nBits = -7
13627 var i = isLE ? (nBytes - 1) : 0
13628 var d = isLE ? -1 : 1
13629 var s = buffer[offset + i]
13630
13631 i += d
13632
13633 e = s & ((1 << (-nBits)) - 1)
13634 s >>= (-nBits)
13635 nBits += eLen
13636 for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
13637
13638 m = e & ((1 << (-nBits)) - 1)
13639 e >>= (-nBits)
13640 nBits += mLen
13641 for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
13642
13643 if (e === 0) {
13644 e = 1 - eBias
13645 } else if (e === eMax) {
13646 return m ? NaN : ((s ? -1 : 1) * Infinity)
13647 } else {
13648 m = m + Math.pow(2, mLen)
13649 e = e - eBias
13650 }
13651 return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
13652}
13653
13654exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
13655 var e, m, c
13656 var eLen = (nBytes * 8) - mLen - 1
13657 var eMax = (1 << eLen) - 1
13658 var eBias = eMax >> 1
13659 var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
13660 var i = isLE ? 0 : (nBytes - 1)
13661 var d = isLE ? 1 : -1
13662 var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
13663
13664 value = Math.abs(value)
13665
13666 if (isNaN(value) || value === Infinity) {
13667 m = isNaN(value) ? 1 : 0
13668 e = eMax
13669 } else {
13670 e = Math.floor(Math.log(value) / Math.LN2)
13671 if (value * (c = Math.pow(2, -e)) < 1) {
13672 e--
13673 c *= 2
13674 }
13675 if (e + eBias >= 1) {
13676 value += rt / c
13677 } else {
13678 value += rt * Math.pow(2, 1 - eBias)
13679 }
13680 if (value * c >= 2) {
13681 e++
13682 c /= 2
13683 }
13684
13685 if (e + eBias >= eMax) {
13686 m = 0
13687 e = eMax
13688 } else if (e + eBias >= 1) {
13689 m = ((value * c) - 1) * Math.pow(2, mLen)
13690 e = e + eBias
13691 } else {
13692 m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
13693 e = 0
13694 }
13695 }
13696
13697 for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
13698
13699 e = (e << mLen) | m
13700 eLen += mLen
13701 for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
13702
13703 buffer[offset + i - d] |= s * 128
13704}
13705
13706},{}],56:[function(require,module,exports){
13707if (typeof Object.create === 'function') {
13708 // implementation from standard node.js 'util' module
13709 module.exports = function inherits(ctor, superCtor) {
13710 ctor.super_ = superCtor
13711 ctor.prototype = Object.create(superCtor.prototype, {
13712 constructor: {
13713 value: ctor,
13714 enumerable: false,
13715 writable: true,
13716 configurable: true
13717 }
13718 });
13719 };
13720} else {
13721 // old school shim for old browsers
13722 module.exports = function inherits(ctor, superCtor) {
13723 ctor.super_ = superCtor
13724 var TempCtor = function () {}
13725 TempCtor.prototype = superCtor.prototype
13726 ctor.prototype = new TempCtor()
13727 ctor.prototype.constructor = ctor
13728 }
13729}
13730
13731},{}],57:[function(require,module,exports){
13732/*!
13733 * Determine if an object is a Buffer
13734 *
13735 * @author Feross Aboukhadijeh <https://feross.org>
13736 * @license MIT
13737 */
13738
13739// The _isBuffer check is for Safari 5-7 support, because it's missing
13740// Object.prototype.constructor. Remove this eventually
13741module.exports = function (obj) {
13742 return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
13743}
13744
13745function isBuffer (obj) {
13746 return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
13747}
13748
13749// For Node v0.10 support. Remove this eventually.
13750function isSlowBuffer (obj) {
13751 return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
13752}
13753
13754},{}],58:[function(require,module,exports){
13755var toString = {}.toString;
13756
13757module.exports = Array.isArray || function (arr) {
13758 return toString.call(arr) == '[object Array]';
13759};
13760
13761},{}],59:[function(require,module,exports){
13762(function (process){
13763var path = require('path');
13764var fs = require('fs');
13765var _0777 = parseInt('0777', 8);
13766
13767module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP;
13768
13769function mkdirP (p, opts, f, made) {
13770 if (typeof opts === 'function') {
13771 f = opts;
13772 opts = {};
13773 }
13774 else if (!opts || typeof opts !== 'object') {
13775 opts = { mode: opts };
13776 }
13777
13778 var mode = opts.mode;
13779 var xfs = opts.fs || fs;
13780
13781 if (mode === undefined) {
13782 mode = _0777 & (~process.umask());
13783 }
13784 if (!made) made = null;
13785
13786 var cb = f || function () {};
13787 p = path.resolve(p);
13788
13789 xfs.mkdir(p, mode, function (er) {
13790 if (!er) {
13791 made = made || p;
13792 return cb(null, made);
13793 }
13794 switch (er.code) {
13795 case 'ENOENT':
13796 mkdirP(path.dirname(p), opts, function (er, made) {
13797 if (er) cb(er, made);
13798 else mkdirP(p, opts, cb, made);
13799 });
13800 break;
13801
13802 // In the case of any other error, just see if there's a dir
13803 // there already. If so, then hooray! If not, then something
13804 // is borked.
13805 default:
13806 xfs.stat(p, function (er2, stat) {
13807 // if the stat fails, then that's super weird.
13808 // let the original error be the failure reason.
13809 if (er2 || !stat.isDirectory()) cb(er, made)
13810 else cb(null, made);
13811 });
13812 break;
13813 }
13814 });
13815}
13816
13817mkdirP.sync = function sync (p, opts, made) {
13818 if (!opts || typeof opts !== 'object') {
13819 opts = { mode: opts };
13820 }
13821
13822 var mode = opts.mode;
13823 var xfs = opts.fs || fs;
13824
13825 if (mode === undefined) {
13826 mode = _0777 & (~process.umask());
13827 }
13828 if (!made) made = null;
13829
13830 p = path.resolve(p);
13831
13832 try {
13833 xfs.mkdirSync(p, mode);
13834 made = made || p;
13835 }
13836 catch (err0) {
13837 switch (err0.code) {
13838 case 'ENOENT' :
13839 made = sync(path.dirname(p), opts, made);
13840 sync(p, opts, made);
13841 break;
13842
13843 // In the case of any other error, just see if there's a dir
13844 // there already. If so, then hooray! If not, then something
13845 // is borked.
13846 default:
13847 var stat;
13848 try {
13849 stat = xfs.statSync(p);
13850 }
13851 catch (err1) {
13852 throw err0;
13853 }
13854 if (!stat.isDirectory()) throw err0;
13855 break;
13856 }
13857 }
13858
13859 return made;
13860};
13861
13862}).call(this,require('_process'))
13863},{"_process":69,"fs":42,"path":42}],60:[function(require,module,exports){
13864/**
13865 * Helpers.
13866 */
13867
13868var s = 1000;
13869var m = s * 60;
13870var h = m * 60;
13871var d = h * 24;
13872var w = d * 7;
13873var y = d * 365.25;
13874
13875/**
13876 * Parse or format the given `val`.
13877 *
13878 * Options:
13879 *
13880 * - `long` verbose formatting [false]
13881 *
13882 * @param {String|Number} val
13883 * @param {Object} [options]
13884 * @throws {Error} throw an error if val is not a non-empty string or a number
13885 * @return {String|Number}
13886 * @api public
13887 */
13888
13889module.exports = function(val, options) {
13890 options = options || {};
13891 var type = typeof val;
13892 if (type === 'string' && val.length > 0) {
13893 return parse(val);
13894 } else if (type === 'number' && isNaN(val) === false) {
13895 return options.long ? fmtLong(val) : fmtShort(val);
13896 }
13897 throw new Error(
13898 'val is not a non-empty string or a valid number. val=' +
13899 JSON.stringify(val)
13900 );
13901};
13902
13903/**
13904 * Parse the given `str` and return milliseconds.
13905 *
13906 * @param {String} str
13907 * @return {Number}
13908 * @api private
13909 */
13910
13911function parse(str) {
13912 str = String(str);
13913 if (str.length > 100) {
13914 return;
13915 }
13916 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(
13917 str
13918 );
13919 if (!match) {
13920 return;
13921 }
13922 var n = parseFloat(match[1]);
13923 var type = (match[2] || 'ms').toLowerCase();
13924 switch (type) {
13925 case 'years':
13926 case 'year':
13927 case 'yrs':
13928 case 'yr':
13929 case 'y':
13930 return n * y;
13931 case 'weeks':
13932 case 'week':
13933 case 'w':
13934 return n * w;
13935 case 'days':
13936 case 'day':
13937 case 'd':
13938 return n * d;
13939 case 'hours':
13940 case 'hour':
13941 case 'hrs':
13942 case 'hr':
13943 case 'h':
13944 return n * h;
13945 case 'minutes':
13946 case 'minute':
13947 case 'mins':
13948 case 'min':
13949 case 'm':
13950 return n * m;
13951 case 'seconds':
13952 case 'second':
13953 case 'secs':
13954 case 'sec':
13955 case 's':
13956 return n * s;
13957 case 'milliseconds':
13958 case 'millisecond':
13959 case 'msecs':
13960 case 'msec':
13961 case 'ms':
13962 return n;
13963 default:
13964 return undefined;
13965 }
13966}
13967
13968/**
13969 * Short format for `ms`.
13970 *
13971 * @param {Number} ms
13972 * @return {String}
13973 * @api private
13974 */
13975
13976function fmtShort(ms) {
13977 var msAbs = Math.abs(ms);
13978 if (msAbs >= d) {
13979 return Math.round(ms / d) + 'd';
13980 }
13981 if (msAbs >= h) {
13982 return Math.round(ms / h) + 'h';
13983 }
13984 if (msAbs >= m) {
13985 return Math.round(ms / m) + 'm';
13986 }
13987 if (msAbs >= s) {
13988 return Math.round(ms / s) + 's';
13989 }
13990 return ms + 'ms';
13991}
13992
13993/**
13994 * Long format for `ms`.
13995 *
13996 * @param {Number} ms
13997 * @return {String}
13998 * @api private
13999 */
14000
14001function fmtLong(ms) {
14002 var msAbs = Math.abs(ms);
14003 if (msAbs >= d) {
14004 return plural(ms, msAbs, d, 'day');
14005 }
14006 if (msAbs >= h) {
14007 return plural(ms, msAbs, h, 'hour');
14008 }
14009 if (msAbs >= m) {
14010 return plural(ms, msAbs, m, 'minute');
14011 }
14012 if (msAbs >= s) {
14013 return plural(ms, msAbs, s, 'second');
14014 }
14015 return ms + ' ms';
14016}
14017
14018/**
14019 * Pluralization helper.
14020 */
14021
14022function plural(ms, msAbs, n, name) {
14023 var isPlural = msAbs >= n * 1.5;
14024 return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
14025}
14026
14027},{}],61:[function(require,module,exports){
14028'use strict';
14029
14030var keysShim;
14031if (!Object.keys) {
14032 // modified from https://github.com/es-shims/es5-shim
14033 var has = Object.prototype.hasOwnProperty;
14034 var toStr = Object.prototype.toString;
14035 var isArgs = require('./isArguments'); // eslint-disable-line global-require
14036 var isEnumerable = Object.prototype.propertyIsEnumerable;
14037 var hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString');
14038 var hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype');
14039 var dontEnums = [
14040 'toString',
14041 'toLocaleString',
14042 'valueOf',
14043 'hasOwnProperty',
14044 'isPrototypeOf',
14045 'propertyIsEnumerable',
14046 'constructor'
14047 ];
14048 var equalsConstructorPrototype = function (o) {
14049 var ctor = o.constructor;
14050 return ctor && ctor.prototype === o;
14051 };
14052 var excludedKeys = {
14053 $applicationCache: true,
14054 $console: true,
14055 $external: true,
14056 $frame: true,
14057 $frameElement: true,
14058 $frames: true,
14059 $innerHeight: true,
14060 $innerWidth: true,
14061 $outerHeight: true,
14062 $outerWidth: true,
14063 $pageXOffset: true,
14064 $pageYOffset: true,
14065 $parent: true,
14066 $scrollLeft: true,
14067 $scrollTop: true,
14068 $scrollX: true,
14069 $scrollY: true,
14070 $self: true,
14071 $webkitIndexedDB: true,
14072 $webkitStorageInfo: true,
14073 $window: true
14074 };
14075 var hasAutomationEqualityBug = (function () {
14076 /* global window */
14077 if (typeof window === 'undefined') { return false; }
14078 for (var k in window) {
14079 try {
14080 if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') {
14081 try {
14082 equalsConstructorPrototype(window[k]);
14083 } catch (e) {
14084 return true;
14085 }
14086 }
14087 } catch (e) {
14088 return true;
14089 }
14090 }
14091 return false;
14092 }());
14093 var equalsConstructorPrototypeIfNotBuggy = function (o) {
14094 /* global window */
14095 if (typeof window === 'undefined' || !hasAutomationEqualityBug) {
14096 return equalsConstructorPrototype(o);
14097 }
14098 try {
14099 return equalsConstructorPrototype(o);
14100 } catch (e) {
14101 return false;
14102 }
14103 };
14104
14105 keysShim = function keys(object) {
14106 var isObject = object !== null && typeof object === 'object';
14107 var isFunction = toStr.call(object) === '[object Function]';
14108 var isArguments = isArgs(object);
14109 var isString = isObject && toStr.call(object) === '[object String]';
14110 var theKeys = [];
14111
14112 if (!isObject && !isFunction && !isArguments) {
14113 throw new TypeError('Object.keys called on a non-object');
14114 }
14115
14116 var skipProto = hasProtoEnumBug && isFunction;
14117 if (isString && object.length > 0 && !has.call(object, 0)) {
14118 for (var i = 0; i < object.length; ++i) {
14119 theKeys.push(String(i));
14120 }
14121 }
14122
14123 if (isArguments && object.length > 0) {
14124 for (var j = 0; j < object.length; ++j) {
14125 theKeys.push(String(j));
14126 }
14127 } else {
14128 for (var name in object) {
14129 if (!(skipProto && name === 'prototype') && has.call(object, name)) {
14130 theKeys.push(String(name));
14131 }
14132 }
14133 }
14134
14135 if (hasDontEnumBug) {
14136 var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);
14137
14138 for (var k = 0; k < dontEnums.length; ++k) {
14139 if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) {
14140 theKeys.push(dontEnums[k]);
14141 }
14142 }
14143 }
14144 return theKeys;
14145 };
14146}
14147module.exports = keysShim;
14148
14149},{"./isArguments":63}],62:[function(require,module,exports){
14150'use strict';
14151
14152var slice = Array.prototype.slice;
14153var isArgs = require('./isArguments');
14154
14155var origKeys = Object.keys;
14156var keysShim = origKeys ? function keys(o) { return origKeys(o); } : require('./implementation');
14157
14158var originalKeys = Object.keys;
14159
14160keysShim.shim = function shimObjectKeys() {
14161 if (Object.keys) {
14162 var keysWorksWithArguments = (function () {
14163 // Safari 5.0 bug
14164 var args = Object.keys(arguments);
14165 return args && args.length === arguments.length;
14166 }(1, 2));
14167 if (!keysWorksWithArguments) {
14168 Object.keys = function keys(object) { // eslint-disable-line func-name-matching
14169 if (isArgs(object)) {
14170 return originalKeys(slice.call(object));
14171 }
14172 return originalKeys(object);
14173 };
14174 }
14175 } else {
14176 Object.keys = keysShim;
14177 }
14178 return Object.keys || keysShim;
14179};
14180
14181module.exports = keysShim;
14182
14183},{"./implementation":61,"./isArguments":63}],63:[function(require,module,exports){
14184'use strict';
14185
14186var toStr = Object.prototype.toString;
14187
14188module.exports = function isArguments(value) {
14189 var str = toStr.call(value);
14190 var isArgs = str === '[object Arguments]';
14191 if (!isArgs) {
14192 isArgs = str !== '[object Array]' &&
14193 value !== null &&
14194 typeof value === 'object' &&
14195 typeof value.length === 'number' &&
14196 value.length >= 0 &&
14197 toStr.call(value.callee) === '[object Function]';
14198 }
14199 return isArgs;
14200};
14201
14202},{}],64:[function(require,module,exports){
14203'use strict';
14204
14205// modified from https://github.com/es-shims/es6-shim
14206var keys = require('object-keys');
14207var bind = require('function-bind');
14208var canBeObject = function (obj) {
14209 return typeof obj !== 'undefined' && obj !== null;
14210};
14211var hasSymbols = require('has-symbols/shams')();
14212var toObject = Object;
14213var push = bind.call(Function.call, Array.prototype.push);
14214var propIsEnumerable = bind.call(Function.call, Object.prototype.propertyIsEnumerable);
14215var originalGetSymbols = hasSymbols ? Object.getOwnPropertySymbols : null;
14216
14217module.exports = function assign(target, source1) {
14218 if (!canBeObject(target)) { throw new TypeError('target must be an object'); }
14219 var objTarget = toObject(target);
14220 var s, source, i, props, syms, value, key;
14221 for (s = 1; s < arguments.length; ++s) {
14222 source = toObject(arguments[s]);
14223 props = keys(source);
14224 var getSymbols = hasSymbols && (Object.getOwnPropertySymbols || originalGetSymbols);
14225 if (getSymbols) {
14226 syms = getSymbols(source);
14227 for (i = 0; i < syms.length; ++i) {
14228 key = syms[i];
14229 if (propIsEnumerable(source, key)) {
14230 push(props, key);
14231 }
14232 }
14233 }
14234 for (i = 0; i < props.length; ++i) {
14235 key = props[i];
14236 value = source[key];
14237 if (propIsEnumerable(source, key)) {
14238 objTarget[key] = value;
14239 }
14240 }
14241 }
14242 return objTarget;
14243};
14244
14245},{"function-bind":52,"has-symbols/shams":53,"object-keys":62}],65:[function(require,module,exports){
14246'use strict';
14247
14248var defineProperties = require('define-properties');
14249
14250var implementation = require('./implementation');
14251var getPolyfill = require('./polyfill');
14252var shim = require('./shim');
14253
14254var polyfill = getPolyfill();
14255
14256defineProperties(polyfill, {
14257 getPolyfill: getPolyfill,
14258 implementation: implementation,
14259 shim: shim
14260});
14261
14262module.exports = polyfill;
14263
14264},{"./implementation":64,"./polyfill":66,"./shim":67,"define-properties":47}],66:[function(require,module,exports){
14265'use strict';
14266
14267var implementation = require('./implementation');
14268
14269var lacksProperEnumerationOrder = function () {
14270 if (!Object.assign) {
14271 return false;
14272 }
14273 // v8, specifically in node 4.x, has a bug with incorrect property enumeration order
14274 // note: this does not detect the bug unless there's 20 characters
14275 var str = 'abcdefghijklmnopqrst';
14276 var letters = str.split('');
14277 var map = {};
14278 for (var i = 0; i < letters.length; ++i) {
14279 map[letters[i]] = letters[i];
14280 }
14281 var obj = Object.assign({}, map);
14282 var actual = '';
14283 for (var k in obj) {
14284 actual += k;
14285 }
14286 return str !== actual;
14287};
14288
14289var assignHasPendingExceptions = function () {
14290 if (!Object.assign || !Object.preventExtensions) {
14291 return false;
14292 }
14293 // Firefox 37 still has "pending exception" logic in its Object.assign implementation,
14294 // which is 72% slower than our shim, and Firefox 40's native implementation.
14295 var thrower = Object.preventExtensions({ 1: 2 });
14296 try {
14297 Object.assign(thrower, 'xy');
14298 } catch (e) {
14299 return thrower[1] === 'y';
14300 }
14301 return false;
14302};
14303
14304module.exports = function getPolyfill() {
14305 if (!Object.assign) {
14306 return implementation;
14307 }
14308 if (lacksProperEnumerationOrder()) {
14309 return implementation;
14310 }
14311 if (assignHasPendingExceptions()) {
14312 return implementation;
14313 }
14314 return Object.assign;
14315};
14316
14317},{"./implementation":64}],67:[function(require,module,exports){
14318'use strict';
14319
14320var define = require('define-properties');
14321var getPolyfill = require('./polyfill');
14322
14323module.exports = function shimAssign() {
14324 var polyfill = getPolyfill();
14325 define(
14326 Object,
14327 { assign: polyfill },
14328 { assign: function () { return Object.assign !== polyfill; } }
14329 );
14330 return polyfill;
14331};
14332
14333},{"./polyfill":66,"define-properties":47}],68:[function(require,module,exports){
14334(function (process){
14335'use strict';
14336
14337if (!process.version ||
14338 process.version.indexOf('v0.') === 0 ||
14339 process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {
14340 module.exports = { nextTick: nextTick };
14341} else {
14342 module.exports = process
14343}
14344
14345function nextTick(fn, arg1, arg2, arg3) {
14346 if (typeof fn !== 'function') {
14347 throw new TypeError('"callback" argument must be a function');
14348 }
14349 var len = arguments.length;
14350 var args, i;
14351 switch (len) {
14352 case 0:
14353 case 1:
14354 return process.nextTick(fn);
14355 case 2:
14356 return process.nextTick(function afterTickOne() {
14357 fn.call(null, arg1);
14358 });
14359 case 3:
14360 return process.nextTick(function afterTickTwo() {
14361 fn.call(null, arg1, arg2);
14362 });
14363 case 4:
14364 return process.nextTick(function afterTickThree() {
14365 fn.call(null, arg1, arg2, arg3);
14366 });
14367 default:
14368 args = new Array(len - 1);
14369 i = 0;
14370 while (i < args.length) {
14371 args[i++] = arguments[i];
14372 }
14373 return process.nextTick(function afterTick() {
14374 fn.apply(null, args);
14375 });
14376 }
14377}
14378
14379
14380}).call(this,require('_process'))
14381},{"_process":69}],69:[function(require,module,exports){
14382// shim for using process in browser
14383var process = module.exports = {};
14384
14385// cached from whatever global is present so that test runners that stub it
14386// don't break things. But we need to wrap it in a try catch in case it is
14387// wrapped in strict mode code which doesn't define any globals. It's inside a
14388// function because try/catches deoptimize in certain engines.
14389
14390var cachedSetTimeout;
14391var cachedClearTimeout;
14392
14393function defaultSetTimout() {
14394 throw new Error('setTimeout has not been defined');
14395}
14396function defaultClearTimeout () {
14397 throw new Error('clearTimeout has not been defined');
14398}
14399(function () {
14400 try {
14401 if (typeof setTimeout === 'function') {
14402 cachedSetTimeout = setTimeout;
14403 } else {
14404 cachedSetTimeout = defaultSetTimout;
14405 }
14406 } catch (e) {
14407 cachedSetTimeout = defaultSetTimout;
14408 }
14409 try {
14410 if (typeof clearTimeout === 'function') {
14411 cachedClearTimeout = clearTimeout;
14412 } else {
14413 cachedClearTimeout = defaultClearTimeout;
14414 }
14415 } catch (e) {
14416 cachedClearTimeout = defaultClearTimeout;
14417 }
14418} ())
14419function runTimeout(fun) {
14420 if (cachedSetTimeout === setTimeout) {
14421 //normal enviroments in sane situations
14422 return setTimeout(fun, 0);
14423 }
14424 // if setTimeout wasn't available but was latter defined
14425 if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
14426 cachedSetTimeout = setTimeout;
14427 return setTimeout(fun, 0);
14428 }
14429 try {
14430 // when when somebody has screwed with setTimeout but no I.E. maddness
14431 return cachedSetTimeout(fun, 0);
14432 } catch(e){
14433 try {
14434 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
14435 return cachedSetTimeout.call(null, fun, 0);
14436 } catch(e){
14437 // 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
14438 return cachedSetTimeout.call(this, fun, 0);
14439 }
14440 }
14441
14442
14443}
14444function runClearTimeout(marker) {
14445 if (cachedClearTimeout === clearTimeout) {
14446 //normal enviroments in sane situations
14447 return clearTimeout(marker);
14448 }
14449 // if clearTimeout wasn't available but was latter defined
14450 if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
14451 cachedClearTimeout = clearTimeout;
14452 return clearTimeout(marker);
14453 }
14454 try {
14455 // when when somebody has screwed with setTimeout but no I.E. maddness
14456 return cachedClearTimeout(marker);
14457 } catch (e){
14458 try {
14459 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
14460 return cachedClearTimeout.call(null, marker);
14461 } catch (e){
14462 // 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.
14463 // Some versions of I.E. have different rules for clearTimeout vs setTimeout
14464 return cachedClearTimeout.call(this, marker);
14465 }
14466 }
14467
14468
14469
14470}
14471var queue = [];
14472var draining = false;
14473var currentQueue;
14474var queueIndex = -1;
14475
14476function cleanUpNextTick() {
14477 if (!draining || !currentQueue) {
14478 return;
14479 }
14480 draining = false;
14481 if (currentQueue.length) {
14482 queue = currentQueue.concat(queue);
14483 } else {
14484 queueIndex = -1;
14485 }
14486 if (queue.length) {
14487 drainQueue();
14488 }
14489}
14490
14491function drainQueue() {
14492 if (draining) {
14493 return;
14494 }
14495 var timeout = runTimeout(cleanUpNextTick);
14496 draining = true;
14497
14498 var len = queue.length;
14499 while(len) {
14500 currentQueue = queue;
14501 queue = [];
14502 while (++queueIndex < len) {
14503 if (currentQueue) {
14504 currentQueue[queueIndex].run();
14505 }
14506 }
14507 queueIndex = -1;
14508 len = queue.length;
14509 }
14510 currentQueue = null;
14511 draining = false;
14512 runClearTimeout(timeout);
14513}
14514
14515process.nextTick = function (fun) {
14516 var args = new Array(arguments.length - 1);
14517 if (arguments.length > 1) {
14518 for (var i = 1; i < arguments.length; i++) {
14519 args[i - 1] = arguments[i];
14520 }
14521 }
14522 queue.push(new Item(fun, args));
14523 if (queue.length === 1 && !draining) {
14524 runTimeout(drainQueue);
14525 }
14526};
14527
14528// v8 likes predictible objects
14529function Item(fun, array) {
14530 this.fun = fun;
14531 this.array = array;
14532}
14533Item.prototype.run = function () {
14534 this.fun.apply(null, this.array);
14535};
14536process.title = 'browser';
14537process.browser = true;
14538process.env = {};
14539process.argv = [];
14540process.version = ''; // empty string to avoid regexp issues
14541process.versions = {};
14542
14543function noop() {}
14544
14545process.on = noop;
14546process.addListener = noop;
14547process.once = noop;
14548process.off = noop;
14549process.removeListener = noop;
14550process.removeAllListeners = noop;
14551process.emit = noop;
14552process.prependListener = noop;
14553process.prependOnceListener = noop;
14554
14555process.listeners = function (name) { return [] }
14556
14557process.binding = function (name) {
14558 throw new Error('process.binding is not supported');
14559};
14560
14561process.cwd = function () { return '/' };
14562process.chdir = function (dir) {
14563 throw new Error('process.chdir is not supported');
14564};
14565process.umask = function() { return 0; };
14566
14567},{}],70:[function(require,module,exports){
14568module.exports = require('./lib/_stream_duplex.js');
14569
14570},{"./lib/_stream_duplex.js":71}],71:[function(require,module,exports){
14571// Copyright Joyent, Inc. and other Node contributors.
14572//
14573// Permission is hereby granted, free of charge, to any person obtaining a
14574// copy of this software and associated documentation files (the
14575// "Software"), to deal in the Software without restriction, including
14576// without limitation the rights to use, copy, modify, merge, publish,
14577// distribute, sublicense, and/or sell copies of the Software, and to permit
14578// persons to whom the Software is furnished to do so, subject to the
14579// following conditions:
14580//
14581// The above copyright notice and this permission notice shall be included
14582// in all copies or substantial portions of the Software.
14583//
14584// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14585// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14586// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
14587// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
14588// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
14589// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
14590// USE OR OTHER DEALINGS IN THE SOFTWARE.
14591
14592// a duplex stream is just a stream that is both readable and writable.
14593// Since JS doesn't have multiple prototypal inheritance, this class
14594// prototypally inherits from Readable, and then parasitically from
14595// Writable.
14596
14597'use strict';
14598
14599/*<replacement>*/
14600
14601var pna = require('process-nextick-args');
14602/*</replacement>*/
14603
14604/*<replacement>*/
14605var objectKeys = Object.keys || function (obj) {
14606 var keys = [];
14607 for (var key in obj) {
14608 keys.push(key);
14609 }return keys;
14610};
14611/*</replacement>*/
14612
14613module.exports = Duplex;
14614
14615/*<replacement>*/
14616var util = require('core-util-is');
14617util.inherits = require('inherits');
14618/*</replacement>*/
14619
14620var Readable = require('./_stream_readable');
14621var Writable = require('./_stream_writable');
14622
14623util.inherits(Duplex, Readable);
14624
14625{
14626 // avoid scope creep, the keys array can then be collected
14627 var keys = objectKeys(Writable.prototype);
14628 for (var v = 0; v < keys.length; v++) {
14629 var method = keys[v];
14630 if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
14631 }
14632}
14633
14634function Duplex(options) {
14635 if (!(this instanceof Duplex)) return new Duplex(options);
14636
14637 Readable.call(this, options);
14638 Writable.call(this, options);
14639
14640 if (options && options.readable === false) this.readable = false;
14641
14642 if (options && options.writable === false) this.writable = false;
14643
14644 this.allowHalfOpen = true;
14645 if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
14646
14647 this.once('end', onend);
14648}
14649
14650Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
14651 // making it explicit this property is not enumerable
14652 // because otherwise some prototype manipulation in
14653 // userland will fail
14654 enumerable: false,
14655 get: function () {
14656 return this._writableState.highWaterMark;
14657 }
14658});
14659
14660// the no-half-open enforcer
14661function onend() {
14662 // if we allow half-open state, or if the writable side ended,
14663 // then we're ok.
14664 if (this.allowHalfOpen || this._writableState.ended) return;
14665
14666 // no more data can be written.
14667 // But allow more writes to happen in this tick.
14668 pna.nextTick(onEndNT, this);
14669}
14670
14671function onEndNT(self) {
14672 self.end();
14673}
14674
14675Object.defineProperty(Duplex.prototype, 'destroyed', {
14676 get: function () {
14677 if (this._readableState === undefined || this._writableState === undefined) {
14678 return false;
14679 }
14680 return this._readableState.destroyed && this._writableState.destroyed;
14681 },
14682 set: function (value) {
14683 // we ignore the value if the stream
14684 // has not been initialized yet
14685 if (this._readableState === undefined || this._writableState === undefined) {
14686 return;
14687 }
14688
14689 // backward compatibility, the user is explicitly
14690 // managing destroyed
14691 this._readableState.destroyed = value;
14692 this._writableState.destroyed = value;
14693 }
14694});
14695
14696Duplex.prototype._destroy = function (err, cb) {
14697 this.push(null);
14698 this.end();
14699
14700 pna.nextTick(cb, err);
14701};
14702},{"./_stream_readable":73,"./_stream_writable":75,"core-util-is":44,"inherits":56,"process-nextick-args":68}],72:[function(require,module,exports){
14703// Copyright Joyent, Inc. and other Node contributors.
14704//
14705// Permission is hereby granted, free of charge, to any person obtaining a
14706// copy of this software and associated documentation files (the
14707// "Software"), to deal in the Software without restriction, including
14708// without limitation the rights to use, copy, modify, merge, publish,
14709// distribute, sublicense, and/or sell copies of the Software, and to permit
14710// persons to whom the Software is furnished to do so, subject to the
14711// following conditions:
14712//
14713// The above copyright notice and this permission notice shall be included
14714// in all copies or substantial portions of the Software.
14715//
14716// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14717// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14718// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
14719// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
14720// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
14721// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
14722// USE OR OTHER DEALINGS IN THE SOFTWARE.
14723
14724// a passthrough stream.
14725// basically just the most minimal sort of Transform stream.
14726// Every written chunk gets output as-is.
14727
14728'use strict';
14729
14730module.exports = PassThrough;
14731
14732var Transform = require('./_stream_transform');
14733
14734/*<replacement>*/
14735var util = require('core-util-is');
14736util.inherits = require('inherits');
14737/*</replacement>*/
14738
14739util.inherits(PassThrough, Transform);
14740
14741function PassThrough(options) {
14742 if (!(this instanceof PassThrough)) return new PassThrough(options);
14743
14744 Transform.call(this, options);
14745}
14746
14747PassThrough.prototype._transform = function (chunk, encoding, cb) {
14748 cb(null, chunk);
14749};
14750},{"./_stream_transform":74,"core-util-is":44,"inherits":56}],73:[function(require,module,exports){
14751(function (process,global){
14752// Copyright Joyent, Inc. and other Node contributors.
14753//
14754// Permission is hereby granted, free of charge, to any person obtaining a
14755// copy of this software and associated documentation files (the
14756// "Software"), to deal in the Software without restriction, including
14757// without limitation the rights to use, copy, modify, merge, publish,
14758// distribute, sublicense, and/or sell copies of the Software, and to permit
14759// persons to whom the Software is furnished to do so, subject to the
14760// following conditions:
14761//
14762// The above copyright notice and this permission notice shall be included
14763// in all copies or substantial portions of the Software.
14764//
14765// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14766// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14767// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
14768// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
14769// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
14770// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
14771// USE OR OTHER DEALINGS IN THE SOFTWARE.
14772
14773'use strict';
14774
14775/*<replacement>*/
14776
14777var pna = require('process-nextick-args');
14778/*</replacement>*/
14779
14780module.exports = Readable;
14781
14782/*<replacement>*/
14783var isArray = require('isarray');
14784/*</replacement>*/
14785
14786/*<replacement>*/
14787var Duplex;
14788/*</replacement>*/
14789
14790Readable.ReadableState = ReadableState;
14791
14792/*<replacement>*/
14793var EE = require('events').EventEmitter;
14794
14795var EElistenerCount = function (emitter, type) {
14796 return emitter.listeners(type).length;
14797};
14798/*</replacement>*/
14799
14800/*<replacement>*/
14801var Stream = require('./internal/streams/stream');
14802/*</replacement>*/
14803
14804/*<replacement>*/
14805
14806var Buffer = require('safe-buffer').Buffer;
14807var OurUint8Array = global.Uint8Array || function () {};
14808function _uint8ArrayToBuffer(chunk) {
14809 return Buffer.from(chunk);
14810}
14811function _isUint8Array(obj) {
14812 return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
14813}
14814
14815/*</replacement>*/
14816
14817/*<replacement>*/
14818var util = require('core-util-is');
14819util.inherits = require('inherits');
14820/*</replacement>*/
14821
14822/*<replacement>*/
14823var debugUtil = require('util');
14824var debug = void 0;
14825if (debugUtil && debugUtil.debuglog) {
14826 debug = debugUtil.debuglog('stream');
14827} else {
14828 debug = function () {};
14829}
14830/*</replacement>*/
14831
14832var BufferList = require('./internal/streams/BufferList');
14833var destroyImpl = require('./internal/streams/destroy');
14834var StringDecoder;
14835
14836util.inherits(Readable, Stream);
14837
14838var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];
14839
14840function prependListener(emitter, event, fn) {
14841 // Sadly this is not cacheable as some libraries bundle their own
14842 // event emitter implementation with them.
14843 if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn);
14844
14845 // This is a hack to make sure that our error handler is attached before any
14846 // userland ones. NEVER DO THIS. This is here only because this code needs
14847 // to continue to work with older versions of Node.js that do not include
14848 // the prependListener() method. The goal is to eventually remove this hack.
14849 if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];
14850}
14851
14852function ReadableState(options, stream) {
14853 Duplex = Duplex || require('./_stream_duplex');
14854
14855 options = options || {};
14856
14857 // Duplex streams are both readable and writable, but share
14858 // the same options object.
14859 // However, some cases require setting options to different
14860 // values for the readable and the writable sides of the duplex stream.
14861 // These options can be provided separately as readableXXX and writableXXX.
14862 var isDuplex = stream instanceof Duplex;
14863
14864 // object stream flag. Used to make read(n) ignore n and to
14865 // make all the buffer merging and length checks go away
14866 this.objectMode = !!options.objectMode;
14867
14868 if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
14869
14870 // the point at which it stops calling _read() to fill the buffer
14871 // Note: 0 is a valid value, means "don't call _read preemptively ever"
14872 var hwm = options.highWaterMark;
14873 var readableHwm = options.readableHighWaterMark;
14874 var defaultHwm = this.objectMode ? 16 : 16 * 1024;
14875
14876 if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm;
14877
14878 // cast to ints.
14879 this.highWaterMark = Math.floor(this.highWaterMark);
14880
14881 // A linked list is used to store data chunks instead of an array because the
14882 // linked list can remove elements from the beginning faster than
14883 // array.shift()
14884 this.buffer = new BufferList();
14885 this.length = 0;
14886 this.pipes = null;
14887 this.pipesCount = 0;
14888 this.flowing = null;
14889 this.ended = false;
14890 this.endEmitted = false;
14891 this.reading = false;
14892
14893 // a flag to be able to tell if the event 'readable'/'data' is emitted
14894 // immediately, or on a later tick. We set this to true at first, because
14895 // any actions that shouldn't happen until "later" should generally also
14896 // not happen before the first read call.
14897 this.sync = true;
14898
14899 // whenever we return null, then we set a flag to say
14900 // that we're awaiting a 'readable' event emission.
14901 this.needReadable = false;
14902 this.emittedReadable = false;
14903 this.readableListening = false;
14904 this.resumeScheduled = false;
14905
14906 // has it been destroyed
14907 this.destroyed = false;
14908
14909 // Crypto is kind of old and crusty. Historically, its default string
14910 // encoding is 'binary' so we have to make this configurable.
14911 // Everything else in the universe uses 'utf8', though.
14912 this.defaultEncoding = options.defaultEncoding || 'utf8';
14913
14914 // the number of writers that are awaiting a drain event in .pipe()s
14915 this.awaitDrain = 0;
14916
14917 // if true, a maybeReadMore has been scheduled
14918 this.readingMore = false;
14919
14920 this.decoder = null;
14921 this.encoding = null;
14922 if (options.encoding) {
14923 if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
14924 this.decoder = new StringDecoder(options.encoding);
14925 this.encoding = options.encoding;
14926 }
14927}
14928
14929function Readable(options) {
14930 Duplex = Duplex || require('./_stream_duplex');
14931
14932 if (!(this instanceof Readable)) return new Readable(options);
14933
14934 this._readableState = new ReadableState(options, this);
14935
14936 // legacy
14937 this.readable = true;
14938
14939 if (options) {
14940 if (typeof options.read === 'function') this._read = options.read;
14941
14942 if (typeof options.destroy === 'function') this._destroy = options.destroy;
14943 }
14944
14945 Stream.call(this);
14946}
14947
14948Object.defineProperty(Readable.prototype, 'destroyed', {
14949 get: function () {
14950 if (this._readableState === undefined) {
14951 return false;
14952 }
14953 return this._readableState.destroyed;
14954 },
14955 set: function (value) {
14956 // we ignore the value if the stream
14957 // has not been initialized yet
14958 if (!this._readableState) {
14959 return;
14960 }
14961
14962 // backward compatibility, the user is explicitly
14963 // managing destroyed
14964 this._readableState.destroyed = value;
14965 }
14966});
14967
14968Readable.prototype.destroy = destroyImpl.destroy;
14969Readable.prototype._undestroy = destroyImpl.undestroy;
14970Readable.prototype._destroy = function (err, cb) {
14971 this.push(null);
14972 cb(err);
14973};
14974
14975// Manually shove something into the read() buffer.
14976// This returns true if the highWaterMark has not been hit yet,
14977// similar to how Writable.write() returns true if you should
14978// write() some more.
14979Readable.prototype.push = function (chunk, encoding) {
14980 var state = this._readableState;
14981 var skipChunkCheck;
14982
14983 if (!state.objectMode) {
14984 if (typeof chunk === 'string') {
14985 encoding = encoding || state.defaultEncoding;
14986 if (encoding !== state.encoding) {
14987 chunk = Buffer.from(chunk, encoding);
14988 encoding = '';
14989 }
14990 skipChunkCheck = true;
14991 }
14992 } else {
14993 skipChunkCheck = true;
14994 }
14995
14996 return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
14997};
14998
14999// Unshift should *always* be something directly out of read()
15000Readable.prototype.unshift = function (chunk) {
15001 return readableAddChunk(this, chunk, null, true, false);
15002};
15003
15004function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
15005 var state = stream._readableState;
15006 if (chunk === null) {
15007 state.reading = false;
15008 onEofChunk(stream, state);
15009 } else {
15010 var er;
15011 if (!skipChunkCheck) er = chunkInvalid(state, chunk);
15012 if (er) {
15013 stream.emit('error', er);
15014 } else if (state.objectMode || chunk && chunk.length > 0) {
15015 if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {
15016 chunk = _uint8ArrayToBuffer(chunk);
15017 }
15018
15019 if (addToFront) {
15020 if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true);
15021 } else if (state.ended) {
15022 stream.emit('error', new Error('stream.push() after EOF'));
15023 } else {
15024 state.reading = false;
15025 if (state.decoder && !encoding) {
15026 chunk = state.decoder.write(chunk);
15027 if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);
15028 } else {
15029 addChunk(stream, state, chunk, false);
15030 }
15031 }
15032 } else if (!addToFront) {
15033 state.reading = false;
15034 }
15035 }
15036
15037 return needMoreData(state);
15038}
15039
15040function addChunk(stream, state, chunk, addToFront) {
15041 if (state.flowing && state.length === 0 && !state.sync) {
15042 stream.emit('data', chunk);
15043 stream.read(0);
15044 } else {
15045 // update the buffer info.
15046 state.length += state.objectMode ? 1 : chunk.length;
15047 if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);
15048
15049 if (state.needReadable) emitReadable(stream);
15050 }
15051 maybeReadMore(stream, state);
15052}
15053
15054function chunkInvalid(state, chunk) {
15055 var er;
15056 if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
15057 er = new TypeError('Invalid non-string/buffer chunk');
15058 }
15059 return er;
15060}
15061
15062// if it's past the high water mark, we can push in some more.
15063// Also, if we have no data yet, we can stand some
15064// more bytes. This is to work around cases where hwm=0,
15065// such as the repl. Also, if the push() triggered a
15066// readable event, and the user called read(largeNumber) such that
15067// needReadable was set, then we ought to push more, so that another
15068// 'readable' event will be triggered.
15069function needMoreData(state) {
15070 return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
15071}
15072
15073Readable.prototype.isPaused = function () {
15074 return this._readableState.flowing === false;
15075};
15076
15077// backwards compatibility.
15078Readable.prototype.setEncoding = function (enc) {
15079 if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
15080 this._readableState.decoder = new StringDecoder(enc);
15081 this._readableState.encoding = enc;
15082 return this;
15083};
15084
15085// Don't raise the hwm > 8MB
15086var MAX_HWM = 0x800000;
15087function computeNewHighWaterMark(n) {
15088 if (n >= MAX_HWM) {
15089 n = MAX_HWM;
15090 } else {
15091 // Get the next highest power of 2 to prevent increasing hwm excessively in
15092 // tiny amounts
15093 n--;
15094 n |= n >>> 1;
15095 n |= n >>> 2;
15096 n |= n >>> 4;
15097 n |= n >>> 8;
15098 n |= n >>> 16;
15099 n++;
15100 }
15101 return n;
15102}
15103
15104// This function is designed to be inlinable, so please take care when making
15105// changes to the function body.
15106function howMuchToRead(n, state) {
15107 if (n <= 0 || state.length === 0 && state.ended) return 0;
15108 if (state.objectMode) return 1;
15109 if (n !== n) {
15110 // Only flow one buffer at a time
15111 if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
15112 }
15113 // If we're asking for more than the current hwm, then raise the hwm.
15114 if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
15115 if (n <= state.length) return n;
15116 // Don't have enough
15117 if (!state.ended) {
15118 state.needReadable = true;
15119 return 0;
15120 }
15121 return state.length;
15122}
15123
15124// you can override either this method, or the async _read(n) below.
15125Readable.prototype.read = function (n) {
15126 debug('read', n);
15127 n = parseInt(n, 10);
15128 var state = this._readableState;
15129 var nOrig = n;
15130
15131 if (n !== 0) state.emittedReadable = false;
15132
15133 // if we're doing read(0) to trigger a readable event, but we
15134 // already have a bunch of data in the buffer, then just trigger
15135 // the 'readable' event and move on.
15136 if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
15137 debug('read: emitReadable', state.length, state.ended);
15138 if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
15139 return null;
15140 }
15141
15142 n = howMuchToRead(n, state);
15143
15144 // if we've ended, and we're now clear, then finish it up.
15145 if (n === 0 && state.ended) {
15146 if (state.length === 0) endReadable(this);
15147 return null;
15148 }
15149
15150 // All the actual chunk generation logic needs to be
15151 // *below* the call to _read. The reason is that in certain
15152 // synthetic stream cases, such as passthrough streams, _read
15153 // may be a completely synchronous operation which may change
15154 // the state of the read buffer, providing enough data when
15155 // before there was *not* enough.
15156 //
15157 // So, the steps are:
15158 // 1. Figure out what the state of things will be after we do
15159 // a read from the buffer.
15160 //
15161 // 2. If that resulting state will trigger a _read, then call _read.
15162 // Note that this may be asynchronous, or synchronous. Yes, it is
15163 // deeply ugly to write APIs this way, but that still doesn't mean
15164 // that the Readable class should behave improperly, as streams are
15165 // designed to be sync/async agnostic.
15166 // Take note if the _read call is sync or async (ie, if the read call
15167 // has returned yet), so that we know whether or not it's safe to emit
15168 // 'readable' etc.
15169 //
15170 // 3. Actually pull the requested chunks out of the buffer and return.
15171
15172 // if we need a readable event, then we need to do some reading.
15173 var doRead = state.needReadable;
15174 debug('need readable', doRead);
15175
15176 // if we currently have less than the highWaterMark, then also read some
15177 if (state.length === 0 || state.length - n < state.highWaterMark) {
15178 doRead = true;
15179 debug('length less than watermark', doRead);
15180 }
15181
15182 // however, if we've ended, then there's no point, and if we're already
15183 // reading, then it's unnecessary.
15184 if (state.ended || state.reading) {
15185 doRead = false;
15186 debug('reading or ended', doRead);
15187 } else if (doRead) {
15188 debug('do read');
15189 state.reading = true;
15190 state.sync = true;
15191 // if the length is currently zero, then we *need* a readable event.
15192 if (state.length === 0) state.needReadable = true;
15193 // call internal read method
15194 this._read(state.highWaterMark);
15195 state.sync = false;
15196 // If _read pushed data synchronously, then `reading` will be false,
15197 // and we need to re-evaluate how much data we can return to the user.
15198 if (!state.reading) n = howMuchToRead(nOrig, state);
15199 }
15200
15201 var ret;
15202 if (n > 0) ret = fromList(n, state);else ret = null;
15203
15204 if (ret === null) {
15205 state.needReadable = true;
15206 n = 0;
15207 } else {
15208 state.length -= n;
15209 }
15210
15211 if (state.length === 0) {
15212 // If we have nothing in the buffer, then we want to know
15213 // as soon as we *do* get something into the buffer.
15214 if (!state.ended) state.needReadable = true;
15215
15216 // If we tried to read() past the EOF, then emit end on the next tick.
15217 if (nOrig !== n && state.ended) endReadable(this);
15218 }
15219
15220 if (ret !== null) this.emit('data', ret);
15221
15222 return ret;
15223};
15224
15225function onEofChunk(stream, state) {
15226 if (state.ended) return;
15227 if (state.decoder) {
15228 var chunk = state.decoder.end();
15229 if (chunk && chunk.length) {
15230 state.buffer.push(chunk);
15231 state.length += state.objectMode ? 1 : chunk.length;
15232 }
15233 }
15234 state.ended = true;
15235
15236 // emit 'readable' now to make sure it gets picked up.
15237 emitReadable(stream);
15238}
15239
15240// Don't emit readable right away in sync mode, because this can trigger
15241// another read() call => stack overflow. This way, it might trigger
15242// a nextTick recursion warning, but that's not so bad.
15243function emitReadable(stream) {
15244 var state = stream._readableState;
15245 state.needReadable = false;
15246 if (!state.emittedReadable) {
15247 debug('emitReadable', state.flowing);
15248 state.emittedReadable = true;
15249 if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream);
15250 }
15251}
15252
15253function emitReadable_(stream) {
15254 debug('emit readable');
15255 stream.emit('readable');
15256 flow(stream);
15257}
15258
15259// at this point, the user has presumably seen the 'readable' event,
15260// and called read() to consume some data. that may have triggered
15261// in turn another _read(n) call, in which case reading = true if
15262// it's in progress.
15263// However, if we're not ended, or reading, and the length < hwm,
15264// then go ahead and try to read some more preemptively.
15265function maybeReadMore(stream, state) {
15266 if (!state.readingMore) {
15267 state.readingMore = true;
15268 pna.nextTick(maybeReadMore_, stream, state);
15269 }
15270}
15271
15272function maybeReadMore_(stream, state) {
15273 var len = state.length;
15274 while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
15275 debug('maybeReadMore read 0');
15276 stream.read(0);
15277 if (len === state.length)
15278 // didn't get any data, stop spinning.
15279 break;else len = state.length;
15280 }
15281 state.readingMore = false;
15282}
15283
15284// abstract method. to be overridden in specific implementation classes.
15285// call cb(er, data) where data is <= n in length.
15286// for virtual (non-string, non-buffer) streams, "length" is somewhat
15287// arbitrary, and perhaps not very meaningful.
15288Readable.prototype._read = function (n) {
15289 this.emit('error', new Error('_read() is not implemented'));
15290};
15291
15292Readable.prototype.pipe = function (dest, pipeOpts) {
15293 var src = this;
15294 var state = this._readableState;
15295
15296 switch (state.pipesCount) {
15297 case 0:
15298 state.pipes = dest;
15299 break;
15300 case 1:
15301 state.pipes = [state.pipes, dest];
15302 break;
15303 default:
15304 state.pipes.push(dest);
15305 break;
15306 }
15307 state.pipesCount += 1;
15308 debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
15309
15310 var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
15311
15312 var endFn = doEnd ? onend : unpipe;
15313 if (state.endEmitted) pna.nextTick(endFn);else src.once('end', endFn);
15314
15315 dest.on('unpipe', onunpipe);
15316 function onunpipe(readable, unpipeInfo) {
15317 debug('onunpipe');
15318 if (readable === src) {
15319 if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
15320 unpipeInfo.hasUnpiped = true;
15321 cleanup();
15322 }
15323 }
15324 }
15325
15326 function onend() {
15327 debug('onend');
15328 dest.end();
15329 }
15330
15331 // when the dest drains, it reduces the awaitDrain counter
15332 // on the source. This would be more elegant with a .once()
15333 // handler in flow(), but adding and removing repeatedly is
15334 // too slow.
15335 var ondrain = pipeOnDrain(src);
15336 dest.on('drain', ondrain);
15337
15338 var cleanedUp = false;
15339 function cleanup() {
15340 debug('cleanup');
15341 // cleanup event handlers once the pipe is broken
15342 dest.removeListener('close', onclose);
15343 dest.removeListener('finish', onfinish);
15344 dest.removeListener('drain', ondrain);
15345 dest.removeListener('error', onerror);
15346 dest.removeListener('unpipe', onunpipe);
15347 src.removeListener('end', onend);
15348 src.removeListener('end', unpipe);
15349 src.removeListener('data', ondata);
15350
15351 cleanedUp = true;
15352
15353 // if the reader is waiting for a drain event from this
15354 // specific writer, then it would cause it to never start
15355 // flowing again.
15356 // So, if this is awaiting a drain, then we just call it now.
15357 // If we don't know, then assume that we are waiting for one.
15358 if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
15359 }
15360
15361 // If the user pushes more data while we're writing to dest then we'll end up
15362 // in ondata again. However, we only want to increase awaitDrain once because
15363 // dest will only emit one 'drain' event for the multiple writes.
15364 // => Introduce a guard on increasing awaitDrain.
15365 var increasedAwaitDrain = false;
15366 src.on('data', ondata);
15367 function ondata(chunk) {
15368 debug('ondata');
15369 increasedAwaitDrain = false;
15370 var ret = dest.write(chunk);
15371 if (false === ret && !increasedAwaitDrain) {
15372 // If the user unpiped during `dest.write()`, it is possible
15373 // to get stuck in a permanently paused state if that write
15374 // also returned false.
15375 // => Check whether `dest` is still a piping destination.
15376 if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
15377 debug('false write response, pause', src._readableState.awaitDrain);
15378 src._readableState.awaitDrain++;
15379 increasedAwaitDrain = true;
15380 }
15381 src.pause();
15382 }
15383 }
15384
15385 // if the dest has an error, then stop piping into it.
15386 // however, don't suppress the throwing behavior for this.
15387 function onerror(er) {
15388 debug('onerror', er);
15389 unpipe();
15390 dest.removeListener('error', onerror);
15391 if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);
15392 }
15393
15394 // Make sure our error handler is attached before userland ones.
15395 prependListener(dest, 'error', onerror);
15396
15397 // Both close and finish should trigger unpipe, but only once.
15398 function onclose() {
15399 dest.removeListener('finish', onfinish);
15400 unpipe();
15401 }
15402 dest.once('close', onclose);
15403 function onfinish() {
15404 debug('onfinish');
15405 dest.removeListener('close', onclose);
15406 unpipe();
15407 }
15408 dest.once('finish', onfinish);
15409
15410 function unpipe() {
15411 debug('unpipe');
15412 src.unpipe(dest);
15413 }
15414
15415 // tell the dest that it's being piped to
15416 dest.emit('pipe', src);
15417
15418 // start the flow if it hasn't been started already.
15419 if (!state.flowing) {
15420 debug('pipe resume');
15421 src.resume();
15422 }
15423
15424 return dest;
15425};
15426
15427function pipeOnDrain(src) {
15428 return function () {
15429 var state = src._readableState;
15430 debug('pipeOnDrain', state.awaitDrain);
15431 if (state.awaitDrain) state.awaitDrain--;
15432 if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
15433 state.flowing = true;
15434 flow(src);
15435 }
15436 };
15437}
15438
15439Readable.prototype.unpipe = function (dest) {
15440 var state = this._readableState;
15441 var unpipeInfo = { hasUnpiped: false };
15442
15443 // if we're not piping anywhere, then do nothing.
15444 if (state.pipesCount === 0) return this;
15445
15446 // just one destination. most common case.
15447 if (state.pipesCount === 1) {
15448 // passed in one, but it's not the right one.
15449 if (dest && dest !== state.pipes) return this;
15450
15451 if (!dest) dest = state.pipes;
15452
15453 // got a match.
15454 state.pipes = null;
15455 state.pipesCount = 0;
15456 state.flowing = false;
15457 if (dest) dest.emit('unpipe', this, unpipeInfo);
15458 return this;
15459 }
15460
15461 // slow case. multiple pipe destinations.
15462
15463 if (!dest) {
15464 // remove all.
15465 var dests = state.pipes;
15466 var len = state.pipesCount;
15467 state.pipes = null;
15468 state.pipesCount = 0;
15469 state.flowing = false;
15470
15471 for (var i = 0; i < len; i++) {
15472 dests[i].emit('unpipe', this, unpipeInfo);
15473 }return this;
15474 }
15475
15476 // try to find the right one.
15477 var index = indexOf(state.pipes, dest);
15478 if (index === -1) return this;
15479
15480 state.pipes.splice(index, 1);
15481 state.pipesCount -= 1;
15482 if (state.pipesCount === 1) state.pipes = state.pipes[0];
15483
15484 dest.emit('unpipe', this, unpipeInfo);
15485
15486 return this;
15487};
15488
15489// set up data events if they are asked for
15490// Ensure readable listeners eventually get something
15491Readable.prototype.on = function (ev, fn) {
15492 var res = Stream.prototype.on.call(this, ev, fn);
15493
15494 if (ev === 'data') {
15495 // Start flowing on next tick if stream isn't explicitly paused
15496 if (this._readableState.flowing !== false) this.resume();
15497 } else if (ev === 'readable') {
15498 var state = this._readableState;
15499 if (!state.endEmitted && !state.readableListening) {
15500 state.readableListening = state.needReadable = true;
15501 state.emittedReadable = false;
15502 if (!state.reading) {
15503 pna.nextTick(nReadingNextTick, this);
15504 } else if (state.length) {
15505 emitReadable(this);
15506 }
15507 }
15508 }
15509
15510 return res;
15511};
15512Readable.prototype.addListener = Readable.prototype.on;
15513
15514function nReadingNextTick(self) {
15515 debug('readable nexttick read 0');
15516 self.read(0);
15517}
15518
15519// pause() and resume() are remnants of the legacy readable stream API
15520// If the user uses them, then switch into old mode.
15521Readable.prototype.resume = function () {
15522 var state = this._readableState;
15523 if (!state.flowing) {
15524 debug('resume');
15525 state.flowing = true;
15526 resume(this, state);
15527 }
15528 return this;
15529};
15530
15531function resume(stream, state) {
15532 if (!state.resumeScheduled) {
15533 state.resumeScheduled = true;
15534 pna.nextTick(resume_, stream, state);
15535 }
15536}
15537
15538function resume_(stream, state) {
15539 if (!state.reading) {
15540 debug('resume read 0');
15541 stream.read(0);
15542 }
15543
15544 state.resumeScheduled = false;
15545 state.awaitDrain = 0;
15546 stream.emit('resume');
15547 flow(stream);
15548 if (state.flowing && !state.reading) stream.read(0);
15549}
15550
15551Readable.prototype.pause = function () {
15552 debug('call pause flowing=%j', this._readableState.flowing);
15553 if (false !== this._readableState.flowing) {
15554 debug('pause');
15555 this._readableState.flowing = false;
15556 this.emit('pause');
15557 }
15558 return this;
15559};
15560
15561function flow(stream) {
15562 var state = stream._readableState;
15563 debug('flow', state.flowing);
15564 while (state.flowing && stream.read() !== null) {}
15565}
15566
15567// wrap an old-style stream as the async data source.
15568// This is *not* part of the readable stream interface.
15569// It is an ugly unfortunate mess of history.
15570Readable.prototype.wrap = function (stream) {
15571 var _this = this;
15572
15573 var state = this._readableState;
15574 var paused = false;
15575
15576 stream.on('end', function () {
15577 debug('wrapped end');
15578 if (state.decoder && !state.ended) {
15579 var chunk = state.decoder.end();
15580 if (chunk && chunk.length) _this.push(chunk);
15581 }
15582
15583 _this.push(null);
15584 });
15585
15586 stream.on('data', function (chunk) {
15587 debug('wrapped data');
15588 if (state.decoder) chunk = state.decoder.write(chunk);
15589
15590 // don't skip over falsy values in objectMode
15591 if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
15592
15593 var ret = _this.push(chunk);
15594 if (!ret) {
15595 paused = true;
15596 stream.pause();
15597 }
15598 });
15599
15600 // proxy all the other methods.
15601 // important when wrapping filters and duplexes.
15602 for (var i in stream) {
15603 if (this[i] === undefined && typeof stream[i] === 'function') {
15604 this[i] = function (method) {
15605 return function () {
15606 return stream[method].apply(stream, arguments);
15607 };
15608 }(i);
15609 }
15610 }
15611
15612 // proxy certain important events.
15613 for (var n = 0; n < kProxyEvents.length; n++) {
15614 stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
15615 }
15616
15617 // when we try to consume some more bytes, simply unpause the
15618 // underlying stream.
15619 this._read = function (n) {
15620 debug('wrapped _read', n);
15621 if (paused) {
15622 paused = false;
15623 stream.resume();
15624 }
15625 };
15626
15627 return this;
15628};
15629
15630Object.defineProperty(Readable.prototype, 'readableHighWaterMark', {
15631 // making it explicit this property is not enumerable
15632 // because otherwise some prototype manipulation in
15633 // userland will fail
15634 enumerable: false,
15635 get: function () {
15636 return this._readableState.highWaterMark;
15637 }
15638});
15639
15640// exposed for testing purposes only.
15641Readable._fromList = fromList;
15642
15643// Pluck off n bytes from an array of buffers.
15644// Length is the combined lengths of all the buffers in the list.
15645// This function is designed to be inlinable, so please take care when making
15646// changes to the function body.
15647function fromList(n, state) {
15648 // nothing buffered
15649 if (state.length === 0) return null;
15650
15651 var ret;
15652 if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
15653 // read it all, truncate the list
15654 if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length);
15655 state.buffer.clear();
15656 } else {
15657 // read part of list
15658 ret = fromListPartial(n, state.buffer, state.decoder);
15659 }
15660
15661 return ret;
15662}
15663
15664// Extracts only enough buffered data to satisfy the amount requested.
15665// This function is designed to be inlinable, so please take care when making
15666// changes to the function body.
15667function fromListPartial(n, list, hasStrings) {
15668 var ret;
15669 if (n < list.head.data.length) {
15670 // slice is the same for buffers and strings
15671 ret = list.head.data.slice(0, n);
15672 list.head.data = list.head.data.slice(n);
15673 } else if (n === list.head.data.length) {
15674 // first chunk is a perfect match
15675 ret = list.shift();
15676 } else {
15677 // result spans more than one buffer
15678 ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
15679 }
15680 return ret;
15681}
15682
15683// Copies a specified amount of characters from the list of buffered data
15684// chunks.
15685// This function is designed to be inlinable, so please take care when making
15686// changes to the function body.
15687function copyFromBufferString(n, list) {
15688 var p = list.head;
15689 var c = 1;
15690 var ret = p.data;
15691 n -= ret.length;
15692 while (p = p.next) {
15693 var str = p.data;
15694 var nb = n > str.length ? str.length : n;
15695 if (nb === str.length) ret += str;else ret += str.slice(0, n);
15696 n -= nb;
15697 if (n === 0) {
15698 if (nb === str.length) {
15699 ++c;
15700 if (p.next) list.head = p.next;else list.head = list.tail = null;
15701 } else {
15702 list.head = p;
15703 p.data = str.slice(nb);
15704 }
15705 break;
15706 }
15707 ++c;
15708 }
15709 list.length -= c;
15710 return ret;
15711}
15712
15713// Copies a specified amount of bytes from the list of buffered data chunks.
15714// This function is designed to be inlinable, so please take care when making
15715// changes to the function body.
15716function copyFromBuffer(n, list) {
15717 var ret = Buffer.allocUnsafe(n);
15718 var p = list.head;
15719 var c = 1;
15720 p.data.copy(ret);
15721 n -= p.data.length;
15722 while (p = p.next) {
15723 var buf = p.data;
15724 var nb = n > buf.length ? buf.length : n;
15725 buf.copy(ret, ret.length - n, 0, nb);
15726 n -= nb;
15727 if (n === 0) {
15728 if (nb === buf.length) {
15729 ++c;
15730 if (p.next) list.head = p.next;else list.head = list.tail = null;
15731 } else {
15732 list.head = p;
15733 p.data = buf.slice(nb);
15734 }
15735 break;
15736 }
15737 ++c;
15738 }
15739 list.length -= c;
15740 return ret;
15741}
15742
15743function endReadable(stream) {
15744 var state = stream._readableState;
15745
15746 // If we get here before consuming all the bytes, then that is a
15747 // bug in node. Should never happen.
15748 if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream');
15749
15750 if (!state.endEmitted) {
15751 state.ended = true;
15752 pna.nextTick(endReadableNT, state, stream);
15753 }
15754}
15755
15756function endReadableNT(state, stream) {
15757 // Check that we didn't get one last unshift.
15758 if (!state.endEmitted && state.length === 0) {
15759 state.endEmitted = true;
15760 stream.readable = false;
15761 stream.emit('end');
15762 }
15763}
15764
15765function indexOf(xs, x) {
15766 for (var i = 0, l = xs.length; i < l; i++) {
15767 if (xs[i] === x) return i;
15768 }
15769 return -1;
15770}
15771}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
15772},{"./_stream_duplex":71,"./internal/streams/BufferList":76,"./internal/streams/destroy":77,"./internal/streams/stream":78,"_process":69,"core-util-is":44,"events":50,"inherits":56,"isarray":58,"process-nextick-args":68,"safe-buffer":83,"string_decoder/":85,"util":40}],74:[function(require,module,exports){
15773// Copyright Joyent, Inc. and other Node contributors.
15774//
15775// Permission is hereby granted, free of charge, to any person obtaining a
15776// copy of this software and associated documentation files (the
15777// "Software"), to deal in the Software without restriction, including
15778// without limitation the rights to use, copy, modify, merge, publish,
15779// distribute, sublicense, and/or sell copies of the Software, and to permit
15780// persons to whom the Software is furnished to do so, subject to the
15781// following conditions:
15782//
15783// The above copyright notice and this permission notice shall be included
15784// in all copies or substantial portions of the Software.
15785//
15786// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15787// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
15788// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
15789// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
15790// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
15791// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
15792// USE OR OTHER DEALINGS IN THE SOFTWARE.
15793
15794// a transform stream is a readable/writable stream where you do
15795// something with the data. Sometimes it's called a "filter",
15796// but that's not a great name for it, since that implies a thing where
15797// some bits pass through, and others are simply ignored. (That would
15798// be a valid example of a transform, of course.)
15799//
15800// While the output is causally related to the input, it's not a
15801// necessarily symmetric or synchronous transformation. For example,
15802// a zlib stream might take multiple plain-text writes(), and then
15803// emit a single compressed chunk some time in the future.
15804//
15805// Here's how this works:
15806//
15807// The Transform stream has all the aspects of the readable and writable
15808// stream classes. When you write(chunk), that calls _write(chunk,cb)
15809// internally, and returns false if there's a lot of pending writes
15810// buffered up. When you call read(), that calls _read(n) until
15811// there's enough pending readable data buffered up.
15812//
15813// In a transform stream, the written data is placed in a buffer. When
15814// _read(n) is called, it transforms the queued up data, calling the
15815// buffered _write cb's as it consumes chunks. If consuming a single
15816// written chunk would result in multiple output chunks, then the first
15817// outputted bit calls the readcb, and subsequent chunks just go into
15818// the read buffer, and will cause it to emit 'readable' if necessary.
15819//
15820// This way, back-pressure is actually determined by the reading side,
15821// since _read has to be called to start processing a new chunk. However,
15822// a pathological inflate type of transform can cause excessive buffering
15823// here. For example, imagine a stream where every byte of input is
15824// interpreted as an integer from 0-255, and then results in that many
15825// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in
15826// 1kb of data being output. In this case, you could write a very small
15827// amount of input, and end up with a very large amount of output. In
15828// such a pathological inflating mechanism, there'd be no way to tell
15829// the system to stop doing the transform. A single 4MB write could
15830// cause the system to run out of memory.
15831//
15832// However, even in such a pathological case, only a single written chunk
15833// would be consumed, and then the rest would wait (un-transformed) until
15834// the results of the previous transformed chunk were consumed.
15835
15836'use strict';
15837
15838module.exports = Transform;
15839
15840var Duplex = require('./_stream_duplex');
15841
15842/*<replacement>*/
15843var util = require('core-util-is');
15844util.inherits = require('inherits');
15845/*</replacement>*/
15846
15847util.inherits(Transform, Duplex);
15848
15849function afterTransform(er, data) {
15850 var ts = this._transformState;
15851 ts.transforming = false;
15852
15853 var cb = ts.writecb;
15854
15855 if (!cb) {
15856 return this.emit('error', new Error('write callback called multiple times'));
15857 }
15858
15859 ts.writechunk = null;
15860 ts.writecb = null;
15861
15862 if (data != null) // single equals check for both `null` and `undefined`
15863 this.push(data);
15864
15865 cb(er);
15866
15867 var rs = this._readableState;
15868 rs.reading = false;
15869 if (rs.needReadable || rs.length < rs.highWaterMark) {
15870 this._read(rs.highWaterMark);
15871 }
15872}
15873
15874function Transform(options) {
15875 if (!(this instanceof Transform)) return new Transform(options);
15876
15877 Duplex.call(this, options);
15878
15879 this._transformState = {
15880 afterTransform: afterTransform.bind(this),
15881 needTransform: false,
15882 transforming: false,
15883 writecb: null,
15884 writechunk: null,
15885 writeencoding: null
15886 };
15887
15888 // start out asking for a readable event once data is transformed.
15889 this._readableState.needReadable = true;
15890
15891 // we have implemented the _read method, and done the other things
15892 // that Readable wants before the first _read call, so unset the
15893 // sync guard flag.
15894 this._readableState.sync = false;
15895
15896 if (options) {
15897 if (typeof options.transform === 'function') this._transform = options.transform;
15898
15899 if (typeof options.flush === 'function') this._flush = options.flush;
15900 }
15901
15902 // When the writable side finishes, then flush out anything remaining.
15903 this.on('prefinish', prefinish);
15904}
15905
15906function prefinish() {
15907 var _this = this;
15908
15909 if (typeof this._flush === 'function') {
15910 this._flush(function (er, data) {
15911 done(_this, er, data);
15912 });
15913 } else {
15914 done(this, null, null);
15915 }
15916}
15917
15918Transform.prototype.push = function (chunk, encoding) {
15919 this._transformState.needTransform = false;
15920 return Duplex.prototype.push.call(this, chunk, encoding);
15921};
15922
15923// This is the part where you do stuff!
15924// override this function in implementation classes.
15925// 'chunk' is an input chunk.
15926//
15927// Call `push(newChunk)` to pass along transformed output
15928// to the readable side. You may call 'push' zero or more times.
15929//
15930// Call `cb(err)` when you are done with this chunk. If you pass
15931// an error, then that'll put the hurt on the whole operation. If you
15932// never call cb(), then you'll never get another chunk.
15933Transform.prototype._transform = function (chunk, encoding, cb) {
15934 throw new Error('_transform() is not implemented');
15935};
15936
15937Transform.prototype._write = function (chunk, encoding, cb) {
15938 var ts = this._transformState;
15939 ts.writecb = cb;
15940 ts.writechunk = chunk;
15941 ts.writeencoding = encoding;
15942 if (!ts.transforming) {
15943 var rs = this._readableState;
15944 if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
15945 }
15946};
15947
15948// Doesn't matter what the args are here.
15949// _transform does all the work.
15950// That we got here means that the readable side wants more data.
15951Transform.prototype._read = function (n) {
15952 var ts = this._transformState;
15953
15954 if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
15955 ts.transforming = true;
15956 this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
15957 } else {
15958 // mark that we need a transform, so that any data that comes in
15959 // will get processed, now that we've asked for it.
15960 ts.needTransform = true;
15961 }
15962};
15963
15964Transform.prototype._destroy = function (err, cb) {
15965 var _this2 = this;
15966
15967 Duplex.prototype._destroy.call(this, err, function (err2) {
15968 cb(err2);
15969 _this2.emit('close');
15970 });
15971};
15972
15973function done(stream, er, data) {
15974 if (er) return stream.emit('error', er);
15975
15976 if (data != null) // single equals check for both `null` and `undefined`
15977 stream.push(data);
15978
15979 // if there's nothing in the write buffer, then that means
15980 // that nothing more will ever be provided
15981 if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0');
15982
15983 if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming');
15984
15985 return stream.push(null);
15986}
15987},{"./_stream_duplex":71,"core-util-is":44,"inherits":56}],75:[function(require,module,exports){
15988(function (process,global,setImmediate){
15989// Copyright Joyent, Inc. and other Node contributors.
15990//
15991// Permission is hereby granted, free of charge, to any person obtaining a
15992// copy of this software and associated documentation files (the
15993// "Software"), to deal in the Software without restriction, including
15994// without limitation the rights to use, copy, modify, merge, publish,
15995// distribute, sublicense, and/or sell copies of the Software, and to permit
15996// persons to whom the Software is furnished to do so, subject to the
15997// following conditions:
15998//
15999// The above copyright notice and this permission notice shall be included
16000// in all copies or substantial portions of the Software.
16001//
16002// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16003// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16004// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
16005// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
16006// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
16007// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
16008// USE OR OTHER DEALINGS IN THE SOFTWARE.
16009
16010// A bit simpler than readable streams.
16011// Implement an async ._write(chunk, encoding, cb), and it'll handle all
16012// the drain event emission and buffering.
16013
16014'use strict';
16015
16016/*<replacement>*/
16017
16018var pna = require('process-nextick-args');
16019/*</replacement>*/
16020
16021module.exports = Writable;
16022
16023/* <replacement> */
16024function WriteReq(chunk, encoding, cb) {
16025 this.chunk = chunk;
16026 this.encoding = encoding;
16027 this.callback = cb;
16028 this.next = null;
16029}
16030
16031// It seems a linked list but it is not
16032// there will be only 2 of these for each stream
16033function CorkedRequest(state) {
16034 var _this = this;
16035
16036 this.next = null;
16037 this.entry = null;
16038 this.finish = function () {
16039 onCorkedFinish(_this, state);
16040 };
16041}
16042/* </replacement> */
16043
16044/*<replacement>*/
16045var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick;
16046/*</replacement>*/
16047
16048/*<replacement>*/
16049var Duplex;
16050/*</replacement>*/
16051
16052Writable.WritableState = WritableState;
16053
16054/*<replacement>*/
16055var util = require('core-util-is');
16056util.inherits = require('inherits');
16057/*</replacement>*/
16058
16059/*<replacement>*/
16060var internalUtil = {
16061 deprecate: require('util-deprecate')
16062};
16063/*</replacement>*/
16064
16065/*<replacement>*/
16066var Stream = require('./internal/streams/stream');
16067/*</replacement>*/
16068
16069/*<replacement>*/
16070
16071var Buffer = require('safe-buffer').Buffer;
16072var OurUint8Array = global.Uint8Array || function () {};
16073function _uint8ArrayToBuffer(chunk) {
16074 return Buffer.from(chunk);
16075}
16076function _isUint8Array(obj) {
16077 return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
16078}
16079
16080/*</replacement>*/
16081
16082var destroyImpl = require('./internal/streams/destroy');
16083
16084util.inherits(Writable, Stream);
16085
16086function nop() {}
16087
16088function WritableState(options, stream) {
16089 Duplex = Duplex || require('./_stream_duplex');
16090
16091 options = options || {};
16092
16093 // Duplex streams are both readable and writable, but share
16094 // the same options object.
16095 // However, some cases require setting options to different
16096 // values for the readable and the writable sides of the duplex stream.
16097 // These options can be provided separately as readableXXX and writableXXX.
16098 var isDuplex = stream instanceof Duplex;
16099
16100 // object stream flag to indicate whether or not this stream
16101 // contains buffers or objects.
16102 this.objectMode = !!options.objectMode;
16103
16104 if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
16105
16106 // the point at which write() starts returning false
16107 // Note: 0 is a valid value, means that we always return false if
16108 // the entire buffer is not flushed immediately on write()
16109 var hwm = options.highWaterMark;
16110 var writableHwm = options.writableHighWaterMark;
16111 var defaultHwm = this.objectMode ? 16 : 16 * 1024;
16112
16113 if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm;
16114
16115 // cast to ints.
16116 this.highWaterMark = Math.floor(this.highWaterMark);
16117
16118 // if _final has been called
16119 this.finalCalled = false;
16120
16121 // drain event flag.
16122 this.needDrain = false;
16123 // at the start of calling end()
16124 this.ending = false;
16125 // when end() has been called, and returned
16126 this.ended = false;
16127 // when 'finish' is emitted
16128 this.finished = false;
16129
16130 // has it been destroyed
16131 this.destroyed = false;
16132
16133 // should we decode strings into buffers before passing to _write?
16134 // this is here so that some node-core streams can optimize string
16135 // handling at a lower level.
16136 var noDecode = options.decodeStrings === false;
16137 this.decodeStrings = !noDecode;
16138
16139 // Crypto is kind of old and crusty. Historically, its default string
16140 // encoding is 'binary' so we have to make this configurable.
16141 // Everything else in the universe uses 'utf8', though.
16142 this.defaultEncoding = options.defaultEncoding || 'utf8';
16143
16144 // not an actual buffer we keep track of, but a measurement
16145 // of how much we're waiting to get pushed to some underlying
16146 // socket or file.
16147 this.length = 0;
16148
16149 // a flag to see when we're in the middle of a write.
16150 this.writing = false;
16151
16152 // when true all writes will be buffered until .uncork() call
16153 this.corked = 0;
16154
16155 // a flag to be able to tell if the onwrite cb is called immediately,
16156 // or on a later tick. We set this to true at first, because any
16157 // actions that shouldn't happen until "later" should generally also
16158 // not happen before the first write call.
16159 this.sync = true;
16160
16161 // a flag to know if we're processing previously buffered items, which
16162 // may call the _write() callback in the same tick, so that we don't
16163 // end up in an overlapped onwrite situation.
16164 this.bufferProcessing = false;
16165
16166 // the callback that's passed to _write(chunk,cb)
16167 this.onwrite = function (er) {
16168 onwrite(stream, er);
16169 };
16170
16171 // the callback that the user supplies to write(chunk,encoding,cb)
16172 this.writecb = null;
16173
16174 // the amount that is being written when _write is called.
16175 this.writelen = 0;
16176
16177 this.bufferedRequest = null;
16178 this.lastBufferedRequest = null;
16179
16180 // number of pending user-supplied write callbacks
16181 // this must be 0 before 'finish' can be emitted
16182 this.pendingcb = 0;
16183
16184 // emit prefinish if the only thing we're waiting for is _write cbs
16185 // This is relevant for synchronous Transform streams
16186 this.prefinished = false;
16187
16188 // True if the error was already emitted and should not be thrown again
16189 this.errorEmitted = false;
16190
16191 // count buffered requests
16192 this.bufferedRequestCount = 0;
16193
16194 // allocate the first CorkedRequest, there is always
16195 // one allocated and free to use, and we maintain at most two
16196 this.corkedRequestsFree = new CorkedRequest(this);
16197}
16198
16199WritableState.prototype.getBuffer = function getBuffer() {
16200 var current = this.bufferedRequest;
16201 var out = [];
16202 while (current) {
16203 out.push(current);
16204 current = current.next;
16205 }
16206 return out;
16207};
16208
16209(function () {
16210 try {
16211 Object.defineProperty(WritableState.prototype, 'buffer', {
16212 get: internalUtil.deprecate(function () {
16213 return this.getBuffer();
16214 }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')
16215 });
16216 } catch (_) {}
16217})();
16218
16219// Test _writableState for inheritance to account for Duplex streams,
16220// whose prototype chain only points to Readable.
16221var realHasInstance;
16222if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {
16223 realHasInstance = Function.prototype[Symbol.hasInstance];
16224 Object.defineProperty(Writable, Symbol.hasInstance, {
16225 value: function (object) {
16226 if (realHasInstance.call(this, object)) return true;
16227 if (this !== Writable) return false;
16228
16229 return object && object._writableState instanceof WritableState;
16230 }
16231 });
16232} else {
16233 realHasInstance = function (object) {
16234 return object instanceof this;
16235 };
16236}
16237
16238function Writable(options) {
16239 Duplex = Duplex || require('./_stream_duplex');
16240
16241 // Writable ctor is applied to Duplexes, too.
16242 // `realHasInstance` is necessary because using plain `instanceof`
16243 // would return false, as no `_writableState` property is attached.
16244
16245 // Trying to use the custom `instanceof` for Writable here will also break the
16246 // Node.js LazyTransform implementation, which has a non-trivial getter for
16247 // `_writableState` that would lead to infinite recursion.
16248 if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
16249 return new Writable(options);
16250 }
16251
16252 this._writableState = new WritableState(options, this);
16253
16254 // legacy.
16255 this.writable = true;
16256
16257 if (options) {
16258 if (typeof options.write === 'function') this._write = options.write;
16259
16260 if (typeof options.writev === 'function') this._writev = options.writev;
16261
16262 if (typeof options.destroy === 'function') this._destroy = options.destroy;
16263
16264 if (typeof options.final === 'function') this._final = options.final;
16265 }
16266
16267 Stream.call(this);
16268}
16269
16270// Otherwise people can pipe Writable streams, which is just wrong.
16271Writable.prototype.pipe = function () {
16272 this.emit('error', new Error('Cannot pipe, not readable'));
16273};
16274
16275function writeAfterEnd(stream, cb) {
16276 var er = new Error('write after end');
16277 // TODO: defer error events consistently everywhere, not just the cb
16278 stream.emit('error', er);
16279 pna.nextTick(cb, er);
16280}
16281
16282// Checks that a user-supplied chunk is valid, especially for the particular
16283// mode the stream is in. Currently this means that `null` is never accepted
16284// and undefined/non-string values are only allowed in object mode.
16285function validChunk(stream, state, chunk, cb) {
16286 var valid = true;
16287 var er = false;
16288
16289 if (chunk === null) {
16290 er = new TypeError('May not write null values to stream');
16291 } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
16292 er = new TypeError('Invalid non-string/buffer chunk');
16293 }
16294 if (er) {
16295 stream.emit('error', er);
16296 pna.nextTick(cb, er);
16297 valid = false;
16298 }
16299 return valid;
16300}
16301
16302Writable.prototype.write = function (chunk, encoding, cb) {
16303 var state = this._writableState;
16304 var ret = false;
16305 var isBuf = !state.objectMode && _isUint8Array(chunk);
16306
16307 if (isBuf && !Buffer.isBuffer(chunk)) {
16308 chunk = _uint8ArrayToBuffer(chunk);
16309 }
16310
16311 if (typeof encoding === 'function') {
16312 cb = encoding;
16313 encoding = null;
16314 }
16315
16316 if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
16317
16318 if (typeof cb !== 'function') cb = nop;
16319
16320 if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {
16321 state.pendingcb++;
16322 ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
16323 }
16324
16325 return ret;
16326};
16327
16328Writable.prototype.cork = function () {
16329 var state = this._writableState;
16330
16331 state.corked++;
16332};
16333
16334Writable.prototype.uncork = function () {
16335 var state = this._writableState;
16336
16337 if (state.corked) {
16338 state.corked--;
16339
16340 if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
16341 }
16342};
16343
16344Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
16345 // node::ParseEncoding() requires lower case.
16346 if (typeof encoding === 'string') encoding = encoding.toLowerCase();
16347 if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding);
16348 this._writableState.defaultEncoding = encoding;
16349 return this;
16350};
16351
16352function decodeChunk(state, chunk, encoding) {
16353 if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
16354 chunk = Buffer.from(chunk, encoding);
16355 }
16356 return chunk;
16357}
16358
16359Object.defineProperty(Writable.prototype, 'writableHighWaterMark', {
16360 // making it explicit this property is not enumerable
16361 // because otherwise some prototype manipulation in
16362 // userland will fail
16363 enumerable: false,
16364 get: function () {
16365 return this._writableState.highWaterMark;
16366 }
16367});
16368
16369// if we're already writing something, then just put this
16370// in the queue, and wait our turn. Otherwise, call _write
16371// If we return false, then we need a drain event, so set that flag.
16372function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
16373 if (!isBuf) {
16374 var newChunk = decodeChunk(state, chunk, encoding);
16375 if (chunk !== newChunk) {
16376 isBuf = true;
16377 encoding = 'buffer';
16378 chunk = newChunk;
16379 }
16380 }
16381 var len = state.objectMode ? 1 : chunk.length;
16382
16383 state.length += len;
16384
16385 var ret = state.length < state.highWaterMark;
16386 // we must ensure that previous needDrain will not be reset to false.
16387 if (!ret) state.needDrain = true;
16388
16389 if (state.writing || state.corked) {
16390 var last = state.lastBufferedRequest;
16391 state.lastBufferedRequest = {
16392 chunk: chunk,
16393 encoding: encoding,
16394 isBuf: isBuf,
16395 callback: cb,
16396 next: null
16397 };
16398 if (last) {
16399 last.next = state.lastBufferedRequest;
16400 } else {
16401 state.bufferedRequest = state.lastBufferedRequest;
16402 }
16403 state.bufferedRequestCount += 1;
16404 } else {
16405 doWrite(stream, state, false, len, chunk, encoding, cb);
16406 }
16407
16408 return ret;
16409}
16410
16411function doWrite(stream, state, writev, len, chunk, encoding, cb) {
16412 state.writelen = len;
16413 state.writecb = cb;
16414 state.writing = true;
16415 state.sync = true;
16416 if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
16417 state.sync = false;
16418}
16419
16420function onwriteError(stream, state, sync, er, cb) {
16421 --state.pendingcb;
16422
16423 if (sync) {
16424 // defer the callback if we are being called synchronously
16425 // to avoid piling up things on the stack
16426 pna.nextTick(cb, er);
16427 // this can emit finish, and it will always happen
16428 // after error
16429 pna.nextTick(finishMaybe, stream, state);
16430 stream._writableState.errorEmitted = true;
16431 stream.emit('error', er);
16432 } else {
16433 // the caller expect this to happen before if
16434 // it is async
16435 cb(er);
16436 stream._writableState.errorEmitted = true;
16437 stream.emit('error', er);
16438 // this can emit finish, but finish must
16439 // always follow error
16440 finishMaybe(stream, state);
16441 }
16442}
16443
16444function onwriteStateUpdate(state) {
16445 state.writing = false;
16446 state.writecb = null;
16447 state.length -= state.writelen;
16448 state.writelen = 0;
16449}
16450
16451function onwrite(stream, er) {
16452 var state = stream._writableState;
16453 var sync = state.sync;
16454 var cb = state.writecb;
16455
16456 onwriteStateUpdate(state);
16457
16458 if (er) onwriteError(stream, state, sync, er, cb);else {
16459 // Check if we're actually ready to finish, but don't emit yet
16460 var finished = needFinish(state);
16461
16462 if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
16463 clearBuffer(stream, state);
16464 }
16465
16466 if (sync) {
16467 /*<replacement>*/
16468 asyncWrite(afterWrite, stream, state, finished, cb);
16469 /*</replacement>*/
16470 } else {
16471 afterWrite(stream, state, finished, cb);
16472 }
16473 }
16474}
16475
16476function afterWrite(stream, state, finished, cb) {
16477 if (!finished) onwriteDrain(stream, state);
16478 state.pendingcb--;
16479 cb();
16480 finishMaybe(stream, state);
16481}
16482
16483// Must force callback to be called on nextTick, so that we don't
16484// emit 'drain' before the write() consumer gets the 'false' return
16485// value, and has a chance to attach a 'drain' listener.
16486function onwriteDrain(stream, state) {
16487 if (state.length === 0 && state.needDrain) {
16488 state.needDrain = false;
16489 stream.emit('drain');
16490 }
16491}
16492
16493// if there's something in the buffer waiting, then process it
16494function clearBuffer(stream, state) {
16495 state.bufferProcessing = true;
16496 var entry = state.bufferedRequest;
16497
16498 if (stream._writev && entry && entry.next) {
16499 // Fast case, write everything using _writev()
16500 var l = state.bufferedRequestCount;
16501 var buffer = new Array(l);
16502 var holder = state.corkedRequestsFree;
16503 holder.entry = entry;
16504
16505 var count = 0;
16506 var allBuffers = true;
16507 while (entry) {
16508 buffer[count] = entry;
16509 if (!entry.isBuf) allBuffers = false;
16510 entry = entry.next;
16511 count += 1;
16512 }
16513 buffer.allBuffers = allBuffers;
16514
16515 doWrite(stream, state, true, state.length, buffer, '', holder.finish);
16516
16517 // doWrite is almost always async, defer these to save a bit of time
16518 // as the hot path ends with doWrite
16519 state.pendingcb++;
16520 state.lastBufferedRequest = null;
16521 if (holder.next) {
16522 state.corkedRequestsFree = holder.next;
16523 holder.next = null;
16524 } else {
16525 state.corkedRequestsFree = new CorkedRequest(state);
16526 }
16527 state.bufferedRequestCount = 0;
16528 } else {
16529 // Slow case, write chunks one-by-one
16530 while (entry) {
16531 var chunk = entry.chunk;
16532 var encoding = entry.encoding;
16533 var cb = entry.callback;
16534 var len = state.objectMode ? 1 : chunk.length;
16535
16536 doWrite(stream, state, false, len, chunk, encoding, cb);
16537 entry = entry.next;
16538 state.bufferedRequestCount--;
16539 // if we didn't call the onwrite immediately, then
16540 // it means that we need to wait until it does.
16541 // also, that means that the chunk and cb are currently
16542 // being processed, so move the buffer counter past them.
16543 if (state.writing) {
16544 break;
16545 }
16546 }
16547
16548 if (entry === null) state.lastBufferedRequest = null;
16549 }
16550
16551 state.bufferedRequest = entry;
16552 state.bufferProcessing = false;
16553}
16554
16555Writable.prototype._write = function (chunk, encoding, cb) {
16556 cb(new Error('_write() is not implemented'));
16557};
16558
16559Writable.prototype._writev = null;
16560
16561Writable.prototype.end = function (chunk, encoding, cb) {
16562 var state = this._writableState;
16563
16564 if (typeof chunk === 'function') {
16565 cb = chunk;
16566 chunk = null;
16567 encoding = null;
16568 } else if (typeof encoding === 'function') {
16569 cb = encoding;
16570 encoding = null;
16571 }
16572
16573 if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
16574
16575 // .end() fully uncorks
16576 if (state.corked) {
16577 state.corked = 1;
16578 this.uncork();
16579 }
16580
16581 // ignore unnecessary end() calls.
16582 if (!state.ending && !state.finished) endWritable(this, state, cb);
16583};
16584
16585function needFinish(state) {
16586 return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
16587}
16588function callFinal(stream, state) {
16589 stream._final(function (err) {
16590 state.pendingcb--;
16591 if (err) {
16592 stream.emit('error', err);
16593 }
16594 state.prefinished = true;
16595 stream.emit('prefinish');
16596 finishMaybe(stream, state);
16597 });
16598}
16599function prefinish(stream, state) {
16600 if (!state.prefinished && !state.finalCalled) {
16601 if (typeof stream._final === 'function') {
16602 state.pendingcb++;
16603 state.finalCalled = true;
16604 pna.nextTick(callFinal, stream, state);
16605 } else {
16606 state.prefinished = true;
16607 stream.emit('prefinish');
16608 }
16609 }
16610}
16611
16612function finishMaybe(stream, state) {
16613 var need = needFinish(state);
16614 if (need) {
16615 prefinish(stream, state);
16616 if (state.pendingcb === 0) {
16617 state.finished = true;
16618 stream.emit('finish');
16619 }
16620 }
16621 return need;
16622}
16623
16624function endWritable(stream, state, cb) {
16625 state.ending = true;
16626 finishMaybe(stream, state);
16627 if (cb) {
16628 if (state.finished) pna.nextTick(cb);else stream.once('finish', cb);
16629 }
16630 state.ended = true;
16631 stream.writable = false;
16632}
16633
16634function onCorkedFinish(corkReq, state, err) {
16635 var entry = corkReq.entry;
16636 corkReq.entry = null;
16637 while (entry) {
16638 var cb = entry.callback;
16639 state.pendingcb--;
16640 cb(err);
16641 entry = entry.next;
16642 }
16643 if (state.corkedRequestsFree) {
16644 state.corkedRequestsFree.next = corkReq;
16645 } else {
16646 state.corkedRequestsFree = corkReq;
16647 }
16648}
16649
16650Object.defineProperty(Writable.prototype, 'destroyed', {
16651 get: function () {
16652 if (this._writableState === undefined) {
16653 return false;
16654 }
16655 return this._writableState.destroyed;
16656 },
16657 set: function (value) {
16658 // we ignore the value if the stream
16659 // has not been initialized yet
16660 if (!this._writableState) {
16661 return;
16662 }
16663
16664 // backward compatibility, the user is explicitly
16665 // managing destroyed
16666 this._writableState.destroyed = value;
16667 }
16668});
16669
16670Writable.prototype.destroy = destroyImpl.destroy;
16671Writable.prototype._undestroy = destroyImpl.undestroy;
16672Writable.prototype._destroy = function (err, cb) {
16673 this.end();
16674 cb(err);
16675};
16676}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("timers").setImmediate)
16677},{"./_stream_duplex":71,"./internal/streams/destroy":77,"./internal/streams/stream":78,"_process":69,"core-util-is":44,"inherits":56,"process-nextick-args":68,"safe-buffer":83,"timers":86,"util-deprecate":87}],76:[function(require,module,exports){
16678'use strict';
16679
16680function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
16681
16682var Buffer = require('safe-buffer').Buffer;
16683var util = require('util');
16684
16685function copyBuffer(src, target, offset) {
16686 src.copy(target, offset);
16687}
16688
16689module.exports = function () {
16690 function BufferList() {
16691 _classCallCheck(this, BufferList);
16692
16693 this.head = null;
16694 this.tail = null;
16695 this.length = 0;
16696 }
16697
16698 BufferList.prototype.push = function push(v) {
16699 var entry = { data: v, next: null };
16700 if (this.length > 0) this.tail.next = entry;else this.head = entry;
16701 this.tail = entry;
16702 ++this.length;
16703 };
16704
16705 BufferList.prototype.unshift = function unshift(v) {
16706 var entry = { data: v, next: this.head };
16707 if (this.length === 0) this.tail = entry;
16708 this.head = entry;
16709 ++this.length;
16710 };
16711
16712 BufferList.prototype.shift = function shift() {
16713 if (this.length === 0) return;
16714 var ret = this.head.data;
16715 if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
16716 --this.length;
16717 return ret;
16718 };
16719
16720 BufferList.prototype.clear = function clear() {
16721 this.head = this.tail = null;
16722 this.length = 0;
16723 };
16724
16725 BufferList.prototype.join = function join(s) {
16726 if (this.length === 0) return '';
16727 var p = this.head;
16728 var ret = '' + p.data;
16729 while (p = p.next) {
16730 ret += s + p.data;
16731 }return ret;
16732 };
16733
16734 BufferList.prototype.concat = function concat(n) {
16735 if (this.length === 0) return Buffer.alloc(0);
16736 if (this.length === 1) return this.head.data;
16737 var ret = Buffer.allocUnsafe(n >>> 0);
16738 var p = this.head;
16739 var i = 0;
16740 while (p) {
16741 copyBuffer(p.data, ret, i);
16742 i += p.data.length;
16743 p = p.next;
16744 }
16745 return ret;
16746 };
16747
16748 return BufferList;
16749}();
16750
16751if (util && util.inspect && util.inspect.custom) {
16752 module.exports.prototype[util.inspect.custom] = function () {
16753 var obj = util.inspect({ length: this.length });
16754 return this.constructor.name + ' ' + obj;
16755 };
16756}
16757},{"safe-buffer":83,"util":40}],77:[function(require,module,exports){
16758'use strict';
16759
16760/*<replacement>*/
16761
16762var pna = require('process-nextick-args');
16763/*</replacement>*/
16764
16765// undocumented cb() API, needed for core, not for public API
16766function destroy(err, cb) {
16767 var _this = this;
16768
16769 var readableDestroyed = this._readableState && this._readableState.destroyed;
16770 var writableDestroyed = this._writableState && this._writableState.destroyed;
16771
16772 if (readableDestroyed || writableDestroyed) {
16773 if (cb) {
16774 cb(err);
16775 } else if (err && (!this._writableState || !this._writableState.errorEmitted)) {
16776 pna.nextTick(emitErrorNT, this, err);
16777 }
16778 return this;
16779 }
16780
16781 // we set destroyed to true before firing error callbacks in order
16782 // to make it re-entrance safe in case destroy() is called within callbacks
16783
16784 if (this._readableState) {
16785 this._readableState.destroyed = true;
16786 }
16787
16788 // if this is a duplex stream mark the writable part as destroyed as well
16789 if (this._writableState) {
16790 this._writableState.destroyed = true;
16791 }
16792
16793 this._destroy(err || null, function (err) {
16794 if (!cb && err) {
16795 pna.nextTick(emitErrorNT, _this, err);
16796 if (_this._writableState) {
16797 _this._writableState.errorEmitted = true;
16798 }
16799 } else if (cb) {
16800 cb(err);
16801 }
16802 });
16803
16804 return this;
16805}
16806
16807function undestroy() {
16808 if (this._readableState) {
16809 this._readableState.destroyed = false;
16810 this._readableState.reading = false;
16811 this._readableState.ended = false;
16812 this._readableState.endEmitted = false;
16813 }
16814
16815 if (this._writableState) {
16816 this._writableState.destroyed = false;
16817 this._writableState.ended = false;
16818 this._writableState.ending = false;
16819 this._writableState.finished = false;
16820 this._writableState.errorEmitted = false;
16821 }
16822}
16823
16824function emitErrorNT(self, err) {
16825 self.emit('error', err);
16826}
16827
16828module.exports = {
16829 destroy: destroy,
16830 undestroy: undestroy
16831};
16832},{"process-nextick-args":68}],78:[function(require,module,exports){
16833module.exports = require('events').EventEmitter;
16834
16835},{"events":50}],79:[function(require,module,exports){
16836module.exports = require('./readable').PassThrough
16837
16838},{"./readable":80}],80:[function(require,module,exports){
16839exports = module.exports = require('./lib/_stream_readable.js');
16840exports.Stream = exports;
16841exports.Readable = exports;
16842exports.Writable = require('./lib/_stream_writable.js');
16843exports.Duplex = require('./lib/_stream_duplex.js');
16844exports.Transform = require('./lib/_stream_transform.js');
16845exports.PassThrough = require('./lib/_stream_passthrough.js');
16846
16847},{"./lib/_stream_duplex.js":71,"./lib/_stream_passthrough.js":72,"./lib/_stream_readable.js":73,"./lib/_stream_transform.js":74,"./lib/_stream_writable.js":75}],81:[function(require,module,exports){
16848module.exports = require('./readable').Transform
16849
16850},{"./readable":80}],82:[function(require,module,exports){
16851module.exports = require('./lib/_stream_writable.js');
16852
16853},{"./lib/_stream_writable.js":75}],83:[function(require,module,exports){
16854/* eslint-disable node/no-deprecated-api */
16855var buffer = require('buffer')
16856var Buffer = buffer.Buffer
16857
16858// alternative to using Object.keys for old browsers
16859function copyProps (src, dst) {
16860 for (var key in src) {
16861 dst[key] = src[key]
16862 }
16863}
16864if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
16865 module.exports = buffer
16866} else {
16867 // Copy properties from require('buffer')
16868 copyProps(buffer, exports)
16869 exports.Buffer = SafeBuffer
16870}
16871
16872function SafeBuffer (arg, encodingOrOffset, length) {
16873 return Buffer(arg, encodingOrOffset, length)
16874}
16875
16876// Copy static methods from Buffer
16877copyProps(Buffer, SafeBuffer)
16878
16879SafeBuffer.from = function (arg, encodingOrOffset, length) {
16880 if (typeof arg === 'number') {
16881 throw new TypeError('Argument must not be a number')
16882 }
16883 return Buffer(arg, encodingOrOffset, length)
16884}
16885
16886SafeBuffer.alloc = function (size, fill, encoding) {
16887 if (typeof size !== 'number') {
16888 throw new TypeError('Argument must be a number')
16889 }
16890 var buf = Buffer(size)
16891 if (fill !== undefined) {
16892 if (typeof encoding === 'string') {
16893 buf.fill(fill, encoding)
16894 } else {
16895 buf.fill(fill)
16896 }
16897 } else {
16898 buf.fill(0)
16899 }
16900 return buf
16901}
16902
16903SafeBuffer.allocUnsafe = function (size) {
16904 if (typeof size !== 'number') {
16905 throw new TypeError('Argument must be a number')
16906 }
16907 return Buffer(size)
16908}
16909
16910SafeBuffer.allocUnsafeSlow = function (size) {
16911 if (typeof size !== 'number') {
16912 throw new TypeError('Argument must be a number')
16913 }
16914 return buffer.SlowBuffer(size)
16915}
16916
16917},{"buffer":43}],84:[function(require,module,exports){
16918// Copyright Joyent, Inc. and other Node contributors.
16919//
16920// Permission is hereby granted, free of charge, to any person obtaining a
16921// copy of this software and associated documentation files (the
16922// "Software"), to deal in the Software without restriction, including
16923// without limitation the rights to use, copy, modify, merge, publish,
16924// distribute, sublicense, and/or sell copies of the Software, and to permit
16925// persons to whom the Software is furnished to do so, subject to the
16926// following conditions:
16927//
16928// The above copyright notice and this permission notice shall be included
16929// in all copies or substantial portions of the Software.
16930//
16931// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16932// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16933// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
16934// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
16935// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
16936// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
16937// USE OR OTHER DEALINGS IN THE SOFTWARE.
16938
16939module.exports = Stream;
16940
16941var EE = require('events').EventEmitter;
16942var inherits = require('inherits');
16943
16944inherits(Stream, EE);
16945Stream.Readable = require('readable-stream/readable.js');
16946Stream.Writable = require('readable-stream/writable.js');
16947Stream.Duplex = require('readable-stream/duplex.js');
16948Stream.Transform = require('readable-stream/transform.js');
16949Stream.PassThrough = require('readable-stream/passthrough.js');
16950
16951// Backwards-compat with node 0.4.x
16952Stream.Stream = Stream;
16953
16954
16955
16956// old-style streams. Note that the pipe method (the only relevant
16957// part of this class) is overridden in the Readable class.
16958
16959function Stream() {
16960 EE.call(this);
16961}
16962
16963Stream.prototype.pipe = function(dest, options) {
16964 var source = this;
16965
16966 function ondata(chunk) {
16967 if (dest.writable) {
16968 if (false === dest.write(chunk) && source.pause) {
16969 source.pause();
16970 }
16971 }
16972 }
16973
16974 source.on('data', ondata);
16975
16976 function ondrain() {
16977 if (source.readable && source.resume) {
16978 source.resume();
16979 }
16980 }
16981
16982 dest.on('drain', ondrain);
16983
16984 // If the 'end' option is not supplied, dest.end() will be called when
16985 // source gets the 'end' or 'close' events. Only dest.end() once.
16986 if (!dest._isStdio && (!options || options.end !== false)) {
16987 source.on('end', onend);
16988 source.on('close', onclose);
16989 }
16990
16991 var didOnEnd = false;
16992 function onend() {
16993 if (didOnEnd) return;
16994 didOnEnd = true;
16995
16996 dest.end();
16997 }
16998
16999
17000 function onclose() {
17001 if (didOnEnd) return;
17002 didOnEnd = true;
17003
17004 if (typeof dest.destroy === 'function') dest.destroy();
17005 }
17006
17007 // don't leave dangling pipes when there are errors.
17008 function onerror(er) {
17009 cleanup();
17010 if (EE.listenerCount(this, 'error') === 0) {
17011 throw er; // Unhandled stream error in pipe.
17012 }
17013 }
17014
17015 source.on('error', onerror);
17016 dest.on('error', onerror);
17017
17018 // remove all the event listeners that were added.
17019 function cleanup() {
17020 source.removeListener('data', ondata);
17021 dest.removeListener('drain', ondrain);
17022
17023 source.removeListener('end', onend);
17024 source.removeListener('close', onclose);
17025
17026 source.removeListener('error', onerror);
17027 dest.removeListener('error', onerror);
17028
17029 source.removeListener('end', cleanup);
17030 source.removeListener('close', cleanup);
17031
17032 dest.removeListener('close', cleanup);
17033 }
17034
17035 source.on('end', cleanup);
17036 source.on('close', cleanup);
17037
17038 dest.on('close', cleanup);
17039
17040 dest.emit('pipe', source);
17041
17042 // Allow for unix-like usage: A.pipe(B).pipe(C)
17043 return dest;
17044};
17045
17046},{"events":50,"inherits":56,"readable-stream/duplex.js":70,"readable-stream/passthrough.js":79,"readable-stream/readable.js":80,"readable-stream/transform.js":81,"readable-stream/writable.js":82}],85:[function(require,module,exports){
17047// Copyright Joyent, Inc. and other Node contributors.
17048//
17049// Permission is hereby granted, free of charge, to any person obtaining a
17050// copy of this software and associated documentation files (the
17051// "Software"), to deal in the Software without restriction, including
17052// without limitation the rights to use, copy, modify, merge, publish,
17053// distribute, sublicense, and/or sell copies of the Software, and to permit
17054// persons to whom the Software is furnished to do so, subject to the
17055// following conditions:
17056//
17057// The above copyright notice and this permission notice shall be included
17058// in all copies or substantial portions of the Software.
17059//
17060// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17061// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17062// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17063// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
17064// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
17065// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
17066// USE OR OTHER DEALINGS IN THE SOFTWARE.
17067
17068'use strict';
17069
17070/*<replacement>*/
17071
17072var Buffer = require('safe-buffer').Buffer;
17073/*</replacement>*/
17074
17075var isEncoding = Buffer.isEncoding || function (encoding) {
17076 encoding = '' + encoding;
17077 switch (encoding && encoding.toLowerCase()) {
17078 case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw':
17079 return true;
17080 default:
17081 return false;
17082 }
17083};
17084
17085function _normalizeEncoding(enc) {
17086 if (!enc) return 'utf8';
17087 var retried;
17088 while (true) {
17089 switch (enc) {
17090 case 'utf8':
17091 case 'utf-8':
17092 return 'utf8';
17093 case 'ucs2':
17094 case 'ucs-2':
17095 case 'utf16le':
17096 case 'utf-16le':
17097 return 'utf16le';
17098 case 'latin1':
17099 case 'binary':
17100 return 'latin1';
17101 case 'base64':
17102 case 'ascii':
17103 case 'hex':
17104 return enc;
17105 default:
17106 if (retried) return; // undefined
17107 enc = ('' + enc).toLowerCase();
17108 retried = true;
17109 }
17110 }
17111};
17112
17113// Do not cache `Buffer.isEncoding` when checking encoding names as some
17114// modules monkey-patch it to support additional encodings
17115function normalizeEncoding(enc) {
17116 var nenc = _normalizeEncoding(enc);
17117 if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);
17118 return nenc || enc;
17119}
17120
17121// StringDecoder provides an interface for efficiently splitting a series of
17122// buffers into a series of JS strings without breaking apart multi-byte
17123// characters.
17124exports.StringDecoder = StringDecoder;
17125function StringDecoder(encoding) {
17126 this.encoding = normalizeEncoding(encoding);
17127 var nb;
17128 switch (this.encoding) {
17129 case 'utf16le':
17130 this.text = utf16Text;
17131 this.end = utf16End;
17132 nb = 4;
17133 break;
17134 case 'utf8':
17135 this.fillLast = utf8FillLast;
17136 nb = 4;
17137 break;
17138 case 'base64':
17139 this.text = base64Text;
17140 this.end = base64End;
17141 nb = 3;
17142 break;
17143 default:
17144 this.write = simpleWrite;
17145 this.end = simpleEnd;
17146 return;
17147 }
17148 this.lastNeed = 0;
17149 this.lastTotal = 0;
17150 this.lastChar = Buffer.allocUnsafe(nb);
17151}
17152
17153StringDecoder.prototype.write = function (buf) {
17154 if (buf.length === 0) return '';
17155 var r;
17156 var i;
17157 if (this.lastNeed) {
17158 r = this.fillLast(buf);
17159 if (r === undefined) return '';
17160 i = this.lastNeed;
17161 this.lastNeed = 0;
17162 } else {
17163 i = 0;
17164 }
17165 if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);
17166 return r || '';
17167};
17168
17169StringDecoder.prototype.end = utf8End;
17170
17171// Returns only complete characters in a Buffer
17172StringDecoder.prototype.text = utf8Text;
17173
17174// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer
17175StringDecoder.prototype.fillLast = function (buf) {
17176 if (this.lastNeed <= buf.length) {
17177 buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
17178 return this.lastChar.toString(this.encoding, 0, this.lastTotal);
17179 }
17180 buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
17181 this.lastNeed -= buf.length;
17182};
17183
17184// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a
17185// continuation byte. If an invalid byte is detected, -2 is returned.
17186function utf8CheckByte(byte) {
17187 if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;
17188 return byte >> 6 === 0x02 ? -1 : -2;
17189}
17190
17191// Checks at most 3 bytes at the end of a Buffer in order to detect an
17192// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)
17193// needed to complete the UTF-8 character (if applicable) are returned.
17194function utf8CheckIncomplete(self, buf, i) {
17195 var j = buf.length - 1;
17196 if (j < i) return 0;
17197 var nb = utf8CheckByte(buf[j]);
17198 if (nb >= 0) {
17199 if (nb > 0) self.lastNeed = nb - 1;
17200 return nb;
17201 }
17202 if (--j < i || nb === -2) return 0;
17203 nb = utf8CheckByte(buf[j]);
17204 if (nb >= 0) {
17205 if (nb > 0) self.lastNeed = nb - 2;
17206 return nb;
17207 }
17208 if (--j < i || nb === -2) return 0;
17209 nb = utf8CheckByte(buf[j]);
17210 if (nb >= 0) {
17211 if (nb > 0) {
17212 if (nb === 2) nb = 0;else self.lastNeed = nb - 3;
17213 }
17214 return nb;
17215 }
17216 return 0;
17217}
17218
17219// Validates as many continuation bytes for a multi-byte UTF-8 character as
17220// needed or are available. If we see a non-continuation byte where we expect
17221// one, we "replace" the validated continuation bytes we've seen so far with
17222// a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding
17223// behavior. The continuation byte check is included three times in the case
17224// where all of the continuation bytes for a character exist in the same buffer.
17225// It is also done this way as a slight performance increase instead of using a
17226// loop.
17227function utf8CheckExtraBytes(self, buf, p) {
17228 if ((buf[0] & 0xC0) !== 0x80) {
17229 self.lastNeed = 0;
17230 return '\ufffd';
17231 }
17232 if (self.lastNeed > 1 && buf.length > 1) {
17233 if ((buf[1] & 0xC0) !== 0x80) {
17234 self.lastNeed = 1;
17235 return '\ufffd';
17236 }
17237 if (self.lastNeed > 2 && buf.length > 2) {
17238 if ((buf[2] & 0xC0) !== 0x80) {
17239 self.lastNeed = 2;
17240 return '\ufffd';
17241 }
17242 }
17243 }
17244}
17245
17246// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.
17247function utf8FillLast(buf) {
17248 var p = this.lastTotal - this.lastNeed;
17249 var r = utf8CheckExtraBytes(this, buf, p);
17250 if (r !== undefined) return r;
17251 if (this.lastNeed <= buf.length) {
17252 buf.copy(this.lastChar, p, 0, this.lastNeed);
17253 return this.lastChar.toString(this.encoding, 0, this.lastTotal);
17254 }
17255 buf.copy(this.lastChar, p, 0, buf.length);
17256 this.lastNeed -= buf.length;
17257}
17258
17259// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a
17260// partial character, the character's bytes are buffered until the required
17261// number of bytes are available.
17262function utf8Text(buf, i) {
17263 var total = utf8CheckIncomplete(this, buf, i);
17264 if (!this.lastNeed) return buf.toString('utf8', i);
17265 this.lastTotal = total;
17266 var end = buf.length - (total - this.lastNeed);
17267 buf.copy(this.lastChar, 0, end);
17268 return buf.toString('utf8', i, end);
17269}
17270
17271// For UTF-8, a replacement character is added when ending on a partial
17272// character.
17273function utf8End(buf) {
17274 var r = buf && buf.length ? this.write(buf) : '';
17275 if (this.lastNeed) return r + '\ufffd';
17276 return r;
17277}
17278
17279// UTF-16LE typically needs two bytes per character, but even if we have an even
17280// number of bytes available, we need to check if we end on a leading/high
17281// surrogate. In that case, we need to wait for the next two bytes in order to
17282// decode the last character properly.
17283function utf16Text(buf, i) {
17284 if ((buf.length - i) % 2 === 0) {
17285 var r = buf.toString('utf16le', i);
17286 if (r) {
17287 var c = r.charCodeAt(r.length - 1);
17288 if (c >= 0xD800 && c <= 0xDBFF) {
17289 this.lastNeed = 2;
17290 this.lastTotal = 4;
17291 this.lastChar[0] = buf[buf.length - 2];
17292 this.lastChar[1] = buf[buf.length - 1];
17293 return r.slice(0, -1);
17294 }
17295 }
17296 return r;
17297 }
17298 this.lastNeed = 1;
17299 this.lastTotal = 2;
17300 this.lastChar[0] = buf[buf.length - 1];
17301 return buf.toString('utf16le', i, buf.length - 1);
17302}
17303
17304// For UTF-16LE we do not explicitly append special replacement characters if we
17305// end on a partial character, we simply let v8 handle that.
17306function utf16End(buf) {
17307 var r = buf && buf.length ? this.write(buf) : '';
17308 if (this.lastNeed) {
17309 var end = this.lastTotal - this.lastNeed;
17310 return r + this.lastChar.toString('utf16le', 0, end);
17311 }
17312 return r;
17313}
17314
17315function base64Text(buf, i) {
17316 var n = (buf.length - i) % 3;
17317 if (n === 0) return buf.toString('base64', i);
17318 this.lastNeed = 3 - n;
17319 this.lastTotal = 3;
17320 if (n === 1) {
17321 this.lastChar[0] = buf[buf.length - 1];
17322 } else {
17323 this.lastChar[0] = buf[buf.length - 2];
17324 this.lastChar[1] = buf[buf.length - 1];
17325 }
17326 return buf.toString('base64', i, buf.length - n);
17327}
17328
17329function base64End(buf) {
17330 var r = buf && buf.length ? this.write(buf) : '';
17331 if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);
17332 return r;
17333}
17334
17335// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)
17336function simpleWrite(buf) {
17337 return buf.toString(this.encoding);
17338}
17339
17340function simpleEnd(buf) {
17341 return buf && buf.length ? this.write(buf) : '';
17342}
17343},{"safe-buffer":83}],86:[function(require,module,exports){
17344(function (setImmediate,clearImmediate){
17345var nextTick = require('process/browser.js').nextTick;
17346var apply = Function.prototype.apply;
17347var slice = Array.prototype.slice;
17348var immediateIds = {};
17349var nextImmediateId = 0;
17350
17351// DOM APIs, for completeness
17352
17353exports.setTimeout = function() {
17354 return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);
17355};
17356exports.setInterval = function() {
17357 return new Timeout(apply.call(setInterval, window, arguments), clearInterval);
17358};
17359exports.clearTimeout =
17360exports.clearInterval = function(timeout) { timeout.close(); };
17361
17362function Timeout(id, clearFn) {
17363 this._id = id;
17364 this._clearFn = clearFn;
17365}
17366Timeout.prototype.unref = Timeout.prototype.ref = function() {};
17367Timeout.prototype.close = function() {
17368 this._clearFn.call(window, this._id);
17369};
17370
17371// Does not start the time, just sets up the members needed.
17372exports.enroll = function(item, msecs) {
17373 clearTimeout(item._idleTimeoutId);
17374 item._idleTimeout = msecs;
17375};
17376
17377exports.unenroll = function(item) {
17378 clearTimeout(item._idleTimeoutId);
17379 item._idleTimeout = -1;
17380};
17381
17382exports._unrefActive = exports.active = function(item) {
17383 clearTimeout(item._idleTimeoutId);
17384
17385 var msecs = item._idleTimeout;
17386 if (msecs >= 0) {
17387 item._idleTimeoutId = setTimeout(function onTimeout() {
17388 if (item._onTimeout)
17389 item._onTimeout();
17390 }, msecs);
17391 }
17392};
17393
17394// That's not how node.js implements it but the exposed api is the same.
17395exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function(fn) {
17396 var id = nextImmediateId++;
17397 var args = arguments.length < 2 ? false : slice.call(arguments, 1);
17398
17399 immediateIds[id] = true;
17400
17401 nextTick(function onNextTick() {
17402 if (immediateIds[id]) {
17403 // fn.call() is faster so we optimize for the common use-case
17404 // @see http://jsperf.com/call-apply-segu
17405 if (args) {
17406 fn.apply(null, args);
17407 } else {
17408 fn.call(null);
17409 }
17410 // Prevent ids from leaking
17411 exports.clearImmediate(id);
17412 }
17413 });
17414
17415 return id;
17416};
17417
17418exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function(id) {
17419 delete immediateIds[id];
17420};
17421}).call(this,require("timers").setImmediate,require("timers").clearImmediate)
17422},{"process/browser.js":69,"timers":86}],87:[function(require,module,exports){
17423(function (global){
17424
17425/**
17426 * Module exports.
17427 */
17428
17429module.exports = deprecate;
17430
17431/**
17432 * Mark that a method should not be used.
17433 * Returns a modified function which warns once by default.
17434 *
17435 * If `localStorage.noDeprecation = true` is set, then it is a no-op.
17436 *
17437 * If `localStorage.throwDeprecation = true` is set, then deprecated functions
17438 * will throw an Error when invoked.
17439 *
17440 * If `localStorage.traceDeprecation = true` is set, then deprecated functions
17441 * will invoke `console.trace()` instead of `console.error()`.
17442 *
17443 * @param {Function} fn - the function to deprecate
17444 * @param {String} msg - the string to print to the console when `fn` is invoked
17445 * @returns {Function} a new "deprecated" version of `fn`
17446 * @api public
17447 */
17448
17449function deprecate (fn, msg) {
17450 if (config('noDeprecation')) {
17451 return fn;
17452 }
17453
17454 var warned = false;
17455 function deprecated() {
17456 if (!warned) {
17457 if (config('throwDeprecation')) {
17458 throw new Error(msg);
17459 } else if (config('traceDeprecation')) {
17460 console.trace(msg);
17461 } else {
17462 console.warn(msg);
17463 }
17464 warned = true;
17465 }
17466 return fn.apply(this, arguments);
17467 }
17468
17469 return deprecated;
17470}
17471
17472/**
17473 * Checks `localStorage` for boolean values for the given `name`.
17474 *
17475 * @param {String} name
17476 * @returns {Boolean}
17477 * @api private
17478 */
17479
17480function config (name) {
17481 // accessing global.localStorage can trigger a DOMException in sandboxed iframes
17482 try {
17483 if (!global.localStorage) return false;
17484 } catch (_) {
17485 return false;
17486 }
17487 var val = global.localStorage[name];
17488 if (null == val) return false;
17489 return String(val).toLowerCase() === 'true';
17490}
17491
17492}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
17493},{}],88:[function(require,module,exports){
17494module.exports = function isBuffer(arg) {
17495 return arg && typeof arg === 'object'
17496 && typeof arg.copy === 'function'
17497 && typeof arg.fill === 'function'
17498 && typeof arg.readUInt8 === 'function';
17499}
17500},{}],89:[function(require,module,exports){
17501(function (process,global){
17502// Copyright Joyent, Inc. and other Node contributors.
17503//
17504// Permission is hereby granted, free of charge, to any person obtaining a
17505// copy of this software and associated documentation files (the
17506// "Software"), to deal in the Software without restriction, including
17507// without limitation the rights to use, copy, modify, merge, publish,
17508// distribute, sublicense, and/or sell copies of the Software, and to permit
17509// persons to whom the Software is furnished to do so, subject to the
17510// following conditions:
17511//
17512// The above copyright notice and this permission notice shall be included
17513// in all copies or substantial portions of the Software.
17514//
17515// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17516// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17517// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17518// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
17519// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
17520// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
17521// USE OR OTHER DEALINGS IN THE SOFTWARE.
17522
17523var formatRegExp = /%[sdj%]/g;
17524exports.format = function(f) {
17525 if (!isString(f)) {
17526 var objects = [];
17527 for (var i = 0; i < arguments.length; i++) {
17528 objects.push(inspect(arguments[i]));
17529 }
17530 return objects.join(' ');
17531 }
17532
17533 var i = 1;
17534 var args = arguments;
17535 var len = args.length;
17536 var str = String(f).replace(formatRegExp, function(x) {
17537 if (x === '%%') return '%';
17538 if (i >= len) return x;
17539 switch (x) {
17540 case '%s': return String(args[i++]);
17541 case '%d': return Number(args[i++]);
17542 case '%j':
17543 try {
17544 return JSON.stringify(args[i++]);
17545 } catch (_) {
17546 return '[Circular]';
17547 }
17548 default:
17549 return x;
17550 }
17551 });
17552 for (var x = args[i]; i < len; x = args[++i]) {
17553 if (isNull(x) || !isObject(x)) {
17554 str += ' ' + x;
17555 } else {
17556 str += ' ' + inspect(x);
17557 }
17558 }
17559 return str;
17560};
17561
17562
17563// Mark that a method should not be used.
17564// Returns a modified function which warns once by default.
17565// If --no-deprecation is set, then it is a no-op.
17566exports.deprecate = function(fn, msg) {
17567 // Allow for deprecating things in the process of starting up.
17568 if (isUndefined(global.process)) {
17569 return function() {
17570 return exports.deprecate(fn, msg).apply(this, arguments);
17571 };
17572 }
17573
17574 if (process.noDeprecation === true) {
17575 return fn;
17576 }
17577
17578 var warned = false;
17579 function deprecated() {
17580 if (!warned) {
17581 if (process.throwDeprecation) {
17582 throw new Error(msg);
17583 } else if (process.traceDeprecation) {
17584 console.trace(msg);
17585 } else {
17586 console.error(msg);
17587 }
17588 warned = true;
17589 }
17590 return fn.apply(this, arguments);
17591 }
17592
17593 return deprecated;
17594};
17595
17596
17597var debugs = {};
17598var debugEnviron;
17599exports.debuglog = function(set) {
17600 if (isUndefined(debugEnviron))
17601 debugEnviron = process.env.NODE_DEBUG || '';
17602 set = set.toUpperCase();
17603 if (!debugs[set]) {
17604 if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
17605 var pid = process.pid;
17606 debugs[set] = function() {
17607 var msg = exports.format.apply(exports, arguments);
17608 console.error('%s %d: %s', set, pid, msg);
17609 };
17610 } else {
17611 debugs[set] = function() {};
17612 }
17613 }
17614 return debugs[set];
17615};
17616
17617
17618/**
17619 * Echos the value of a value. Trys to print the value out
17620 * in the best way possible given the different types.
17621 *
17622 * @param {Object} obj The object to print out.
17623 * @param {Object} opts Optional options object that alters the output.
17624 */
17625/* legacy: obj, showHidden, depth, colors*/
17626function inspect(obj, opts) {
17627 // default options
17628 var ctx = {
17629 seen: [],
17630 stylize: stylizeNoColor
17631 };
17632 // legacy...
17633 if (arguments.length >= 3) ctx.depth = arguments[2];
17634 if (arguments.length >= 4) ctx.colors = arguments[3];
17635 if (isBoolean(opts)) {
17636 // legacy...
17637 ctx.showHidden = opts;
17638 } else if (opts) {
17639 // got an "options" object
17640 exports._extend(ctx, opts);
17641 }
17642 // set default options
17643 if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
17644 if (isUndefined(ctx.depth)) ctx.depth = 2;
17645 if (isUndefined(ctx.colors)) ctx.colors = false;
17646 if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
17647 if (ctx.colors) ctx.stylize = stylizeWithColor;
17648 return formatValue(ctx, obj, ctx.depth);
17649}
17650exports.inspect = inspect;
17651
17652
17653// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
17654inspect.colors = {
17655 'bold' : [1, 22],
17656 'italic' : [3, 23],
17657 'underline' : [4, 24],
17658 'inverse' : [7, 27],
17659 'white' : [37, 39],
17660 'grey' : [90, 39],
17661 'black' : [30, 39],
17662 'blue' : [34, 39],
17663 'cyan' : [36, 39],
17664 'green' : [32, 39],
17665 'magenta' : [35, 39],
17666 'red' : [31, 39],
17667 'yellow' : [33, 39]
17668};
17669
17670// Don't use 'blue' not visible on cmd.exe
17671inspect.styles = {
17672 'special': 'cyan',
17673 'number': 'yellow',
17674 'boolean': 'yellow',
17675 'undefined': 'grey',
17676 'null': 'bold',
17677 'string': 'green',
17678 'date': 'magenta',
17679 // "name": intentionally not styling
17680 'regexp': 'red'
17681};
17682
17683
17684function stylizeWithColor(str, styleType) {
17685 var style = inspect.styles[styleType];
17686
17687 if (style) {
17688 return '\u001b[' + inspect.colors[style][0] + 'm' + str +
17689 '\u001b[' + inspect.colors[style][1] + 'm';
17690 } else {
17691 return str;
17692 }
17693}
17694
17695
17696function stylizeNoColor(str, styleType) {
17697 return str;
17698}
17699
17700
17701function arrayToHash(array) {
17702 var hash = {};
17703
17704 array.forEach(function(val, idx) {
17705 hash[val] = true;
17706 });
17707
17708 return hash;
17709}
17710
17711
17712function formatValue(ctx, value, recurseTimes) {
17713 // Provide a hook for user-specified inspect functions.
17714 // Check that value is an object with an inspect function on it
17715 if (ctx.customInspect &&
17716 value &&
17717 isFunction(value.inspect) &&
17718 // Filter out the util module, it's inspect function is special
17719 value.inspect !== exports.inspect &&
17720 // Also filter out any prototype objects using the circular check.
17721 !(value.constructor && value.constructor.prototype === value)) {
17722 var ret = value.inspect(recurseTimes, ctx);
17723 if (!isString(ret)) {
17724 ret = formatValue(ctx, ret, recurseTimes);
17725 }
17726 return ret;
17727 }
17728
17729 // Primitive types cannot have properties
17730 var primitive = formatPrimitive(ctx, value);
17731 if (primitive) {
17732 return primitive;
17733 }
17734
17735 // Look up the keys of the object.
17736 var keys = Object.keys(value);
17737 var visibleKeys = arrayToHash(keys);
17738
17739 if (ctx.showHidden) {
17740 keys = Object.getOwnPropertyNames(value);
17741 }
17742
17743 // IE doesn't make error fields non-enumerable
17744 // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
17745 if (isError(value)
17746 && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
17747 return formatError(value);
17748 }
17749
17750 // Some type of object without properties can be shortcutted.
17751 if (keys.length === 0) {
17752 if (isFunction(value)) {
17753 var name = value.name ? ': ' + value.name : '';
17754 return ctx.stylize('[Function' + name + ']', 'special');
17755 }
17756 if (isRegExp(value)) {
17757 return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
17758 }
17759 if (isDate(value)) {
17760 return ctx.stylize(Date.prototype.toString.call(value), 'date');
17761 }
17762 if (isError(value)) {
17763 return formatError(value);
17764 }
17765 }
17766
17767 var base = '', array = false, braces = ['{', '}'];
17768
17769 // Make Array say that they are Array
17770 if (isArray(value)) {
17771 array = true;
17772 braces = ['[', ']'];
17773 }
17774
17775 // Make functions say that they are functions
17776 if (isFunction(value)) {
17777 var n = value.name ? ': ' + value.name : '';
17778 base = ' [Function' + n + ']';
17779 }
17780
17781 // Make RegExps say that they are RegExps
17782 if (isRegExp(value)) {
17783 base = ' ' + RegExp.prototype.toString.call(value);
17784 }
17785
17786 // Make dates with properties first say the date
17787 if (isDate(value)) {
17788 base = ' ' + Date.prototype.toUTCString.call(value);
17789 }
17790
17791 // Make error with message first say the error
17792 if (isError(value)) {
17793 base = ' ' + formatError(value);
17794 }
17795
17796 if (keys.length === 0 && (!array || value.length == 0)) {
17797 return braces[0] + base + braces[1];
17798 }
17799
17800 if (recurseTimes < 0) {
17801 if (isRegExp(value)) {
17802 return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
17803 } else {
17804 return ctx.stylize('[Object]', 'special');
17805 }
17806 }
17807
17808 ctx.seen.push(value);
17809
17810 var output;
17811 if (array) {
17812 output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
17813 } else {
17814 output = keys.map(function(key) {
17815 return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
17816 });
17817 }
17818
17819 ctx.seen.pop();
17820
17821 return reduceToSingleString(output, base, braces);
17822}
17823
17824
17825function formatPrimitive(ctx, value) {
17826 if (isUndefined(value))
17827 return ctx.stylize('undefined', 'undefined');
17828 if (isString(value)) {
17829 var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
17830 .replace(/'/g, "\\'")
17831 .replace(/\\"/g, '"') + '\'';
17832 return ctx.stylize(simple, 'string');
17833 }
17834 if (isNumber(value))
17835 return ctx.stylize('' + value, 'number');
17836 if (isBoolean(value))
17837 return ctx.stylize('' + value, 'boolean');
17838 // For some reason typeof null is "object", so special case here.
17839 if (isNull(value))
17840 return ctx.stylize('null', 'null');
17841}
17842
17843
17844function formatError(value) {
17845 return '[' + Error.prototype.toString.call(value) + ']';
17846}
17847
17848
17849function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
17850 var output = [];
17851 for (var i = 0, l = value.length; i < l; ++i) {
17852 if (hasOwnProperty(value, String(i))) {
17853 output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
17854 String(i), true));
17855 } else {
17856 output.push('');
17857 }
17858 }
17859 keys.forEach(function(key) {
17860 if (!key.match(/^\d+$/)) {
17861 output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
17862 key, true));
17863 }
17864 });
17865 return output;
17866}
17867
17868
17869function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
17870 var name, str, desc;
17871 desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
17872 if (desc.get) {
17873 if (desc.set) {
17874 str = ctx.stylize('[Getter/Setter]', 'special');
17875 } else {
17876 str = ctx.stylize('[Getter]', 'special');
17877 }
17878 } else {
17879 if (desc.set) {
17880 str = ctx.stylize('[Setter]', 'special');
17881 }
17882 }
17883 if (!hasOwnProperty(visibleKeys, key)) {
17884 name = '[' + key + ']';
17885 }
17886 if (!str) {
17887 if (ctx.seen.indexOf(desc.value) < 0) {
17888 if (isNull(recurseTimes)) {
17889 str = formatValue(ctx, desc.value, null);
17890 } else {
17891 str = formatValue(ctx, desc.value, recurseTimes - 1);
17892 }
17893 if (str.indexOf('\n') > -1) {
17894 if (array) {
17895 str = str.split('\n').map(function(line) {
17896 return ' ' + line;
17897 }).join('\n').substr(2);
17898 } else {
17899 str = '\n' + str.split('\n').map(function(line) {
17900 return ' ' + line;
17901 }).join('\n');
17902 }
17903 }
17904 } else {
17905 str = ctx.stylize('[Circular]', 'special');
17906 }
17907 }
17908 if (isUndefined(name)) {
17909 if (array && key.match(/^\d+$/)) {
17910 return str;
17911 }
17912 name = JSON.stringify('' + key);
17913 if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
17914 name = name.substr(1, name.length - 2);
17915 name = ctx.stylize(name, 'name');
17916 } else {
17917 name = name.replace(/'/g, "\\'")
17918 .replace(/\\"/g, '"')
17919 .replace(/(^"|"$)/g, "'");
17920 name = ctx.stylize(name, 'string');
17921 }
17922 }
17923
17924 return name + ': ' + str;
17925}
17926
17927
17928function reduceToSingleString(output, base, braces) {
17929 var numLinesEst = 0;
17930 var length = output.reduce(function(prev, cur) {
17931 numLinesEst++;
17932 if (cur.indexOf('\n') >= 0) numLinesEst++;
17933 return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
17934 }, 0);
17935
17936 if (length > 60) {
17937 return braces[0] +
17938 (base === '' ? '' : base + '\n ') +
17939 ' ' +
17940 output.join(',\n ') +
17941 ' ' +
17942 braces[1];
17943 }
17944
17945 return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
17946}
17947
17948
17949// NOTE: These type checking functions intentionally don't use `instanceof`
17950// because it is fragile and can be easily faked with `Object.create()`.
17951function isArray(ar) {
17952 return Array.isArray(ar);
17953}
17954exports.isArray = isArray;
17955
17956function isBoolean(arg) {
17957 return typeof arg === 'boolean';
17958}
17959exports.isBoolean = isBoolean;
17960
17961function isNull(arg) {
17962 return arg === null;
17963}
17964exports.isNull = isNull;
17965
17966function isNullOrUndefined(arg) {
17967 return arg == null;
17968}
17969exports.isNullOrUndefined = isNullOrUndefined;
17970
17971function isNumber(arg) {
17972 return typeof arg === 'number';
17973}
17974exports.isNumber = isNumber;
17975
17976function isString(arg) {
17977 return typeof arg === 'string';
17978}
17979exports.isString = isString;
17980
17981function isSymbol(arg) {
17982 return typeof arg === 'symbol';
17983}
17984exports.isSymbol = isSymbol;
17985
17986function isUndefined(arg) {
17987 return arg === void 0;
17988}
17989exports.isUndefined = isUndefined;
17990
17991function isRegExp(re) {
17992 return isObject(re) && objectToString(re) === '[object RegExp]';
17993}
17994exports.isRegExp = isRegExp;
17995
17996function isObject(arg) {
17997 return typeof arg === 'object' && arg !== null;
17998}
17999exports.isObject = isObject;
18000
18001function isDate(d) {
18002 return isObject(d) && objectToString(d) === '[object Date]';
18003}
18004exports.isDate = isDate;
18005
18006function isError(e) {
18007 return isObject(e) &&
18008 (objectToString(e) === '[object Error]' || e instanceof Error);
18009}
18010exports.isError = isError;
18011
18012function isFunction(arg) {
18013 return typeof arg === 'function';
18014}
18015exports.isFunction = isFunction;
18016
18017function isPrimitive(arg) {
18018 return arg === null ||
18019 typeof arg === 'boolean' ||
18020 typeof arg === 'number' ||
18021 typeof arg === 'string' ||
18022 typeof arg === 'symbol' || // ES6 symbol
18023 typeof arg === 'undefined';
18024}
18025exports.isPrimitive = isPrimitive;
18026
18027exports.isBuffer = require('./support/isBuffer');
18028
18029function objectToString(o) {
18030 return Object.prototype.toString.call(o);
18031}
18032
18033
18034function pad(n) {
18035 return n < 10 ? '0' + n.toString(10) : n.toString(10);
18036}
18037
18038
18039var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
18040 'Oct', 'Nov', 'Dec'];
18041
18042// 26 Feb 16:19:34
18043function timestamp() {
18044 var d = new Date();
18045 var time = [pad(d.getHours()),
18046 pad(d.getMinutes()),
18047 pad(d.getSeconds())].join(':');
18048 return [d.getDate(), months[d.getMonth()], time].join(' ');
18049}
18050
18051
18052// log is just a thin wrapper to console.log that prepends a timestamp
18053exports.log = function() {
18054 console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
18055};
18056
18057
18058/**
18059 * Inherit the prototype methods from one constructor into another.
18060 *
18061 * The Function.prototype.inherits from lang.js rewritten as a standalone
18062 * function (not on Function.prototype). NOTE: If this file is to be loaded
18063 * during bootstrapping this function needs to be rewritten using some native
18064 * functions as prototype setup using normal JavaScript does not work as
18065 * expected during bootstrapping (see mirror.js in r114903).
18066 *
18067 * @param {function} ctor Constructor function which needs to inherit the
18068 * prototype.
18069 * @param {function} superCtor Constructor function to inherit prototype from.
18070 */
18071exports.inherits = require('inherits');
18072
18073exports._extend = function(origin, add) {
18074 // Don't do anything if add isn't an object
18075 if (!add || !isObject(add)) return origin;
18076
18077 var keys = Object.keys(add);
18078 var i = keys.length;
18079 while (i--) {
18080 origin[keys[i]] = add[keys[i]];
18081 }
18082 return origin;
18083};
18084
18085function hasOwnProperty(obj, prop) {
18086 return Object.prototype.hasOwnProperty.call(obj, prop);
18087}
18088
18089}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
18090},{"./support/isBuffer":88,"_process":69,"inherits":56}],90:[function(require,module,exports){
18091module.exports={
18092 "name": "mocha",
18093 "version": "7.0.0",
18094 "homepage": "https://mochajs.org/",
18095 "notifyLogo": "https://ibin.co/4QuRuGjXvl36.png"
18096}
18097},{}]},{},[1]);