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){
5 /* eslint no-unused-vars: off */
6 /* eslint-env commonjs */
12 process.stdout = require('browser-stdout')({label: false});
14 var Mocha = require('./lib/mocha');
17 * Create a Mocha instance.
22 var mocha = new Mocha({reporter: 'html'});
25 * Save timer references to avoid Sinon interfering (see GH-237).
28 var Date = global.Date;
29 var setTimeout = global.setTimeout;
30 var setInterval = global.setInterval;
31 var clearTimeout = global.clearTimeout;
32 var clearInterval = global.clearInterval;
34 var uncaughtExceptionHandlers = [];
36 var originalOnerrorHandler = global.onerror;
39 * Remove uncaughtException listener.
40 * Revert to original onerror handler if previously defined.
43 process.removeListener = function(e, fn) {
44 if (e === 'uncaughtException') {
45 if (originalOnerrorHandler) {
46 global.onerror = originalOnerrorHandler;
48 global.onerror = function() {};
50 var i = uncaughtExceptionHandlers.indexOf(fn);
52 uncaughtExceptionHandlers.splice(i, 1);
58 * Implements uncaughtException listener.
61 process.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.options.allowUncaught;
67 uncaughtExceptionHandlers.push(fn);
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.
74 mocha.suite.removeAllListeners('pre-require');
76 var immediateQueue = [];
79 function timeslice() {
80 var immediateStart = new Date().getTime();
81 while (immediateQueue.length && new Date().getTime() - immediateStart < 100) {
82 immediateQueue.shift()();
84 if (immediateQueue.length) {
85 immediateTimeout = setTimeout(timeslice, 0);
87 immediateTimeout = null;
92 * High-performance override of Runner.immediately.
95 Mocha.Runner.immediately = function(callback) {
96 immediateQueue.push(callback);
97 if (!immediateTimeout) {
98 immediateTimeout = setTimeout(timeslice, 0);
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.
107 mocha.throwError = function(err) {
108 uncaughtExceptionHandlers.forEach(function(fn) {
115 * Override ui to ensure that the ui functions are initialized.
116 * Normally this would happen in Mocha.prototype.loadFiles.
119 mocha.ui = function(ui) {
120 Mocha.prototype.ui.call(this, ui);
121 this.suite.emit('pre-require', global, null, this);
126 * Setup mocha with the given setting options.
129 mocha.setup = function(opts) {
130 if (typeof opts === 'string') {
133 for (var opt in opts) {
134 if (Object.prototype.hasOwnProperty.call(opts, opt)) {
135 this[opt](opts[opt]);
142 * Run mocha, returning the Runner.
145 mocha.run = function(fn) {
146 var options = mocha.options;
147 mocha.globals('location');
149 var query = Mocha.utils.parseQuery(global.location.search || '');
151 mocha.grep(query.grep);
154 mocha.fgrep(query.fgrep);
160 return Mocha.prototype.run.call(mocha, function(err) {
161 // The DOM Document is not available in Web Workers.
162 var document = global.document;
165 document.getElementById('mocha') &&
166 options.noHighlighting !== true
168 Mocha.utils.highlightTags('code');
177 * Expose the process shim.
178 * https://github.com/mochajs/mocha/pull/916
181 Mocha.process = process;
187 global.Mocha = Mocha;
188 global.mocha = mocha;
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
193 module.exports = global;
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){
201 * Web Notifications module.
206 * Save timer references to avoid Sinon interfering (see GH-237).
208 var Date = global.Date;
209 var setTimeout = global.setTimeout;
210 var EVENT_RUN_END = require('../runner').constants.EVENT_RUN_END;
213 * Checks if browser notification support exists.
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
222 exports.isCapable = function() {
223 var hasNotificationSupport = 'Notification' in window;
224 var hasPromiseSupport = typeof Promise === 'function';
225 return process.browser && hasNotificationSupport && hasPromiseSupport;
229 * Implements browser notifications as a pseudo-reporter.
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.
238 exports.notify = function(runner) {
239 var promise = isPermitted();
242 * Attempt notification.
244 var sendNotification = function() {
245 // If user hasn't responded yet... "No notification for you!" (Seinfeld)
246 Promise.race([promise, Promise.resolve(undefined)])
251 .catch(notPermitted);
254 runner.once(EVENT_RUN_END, sendNotification);
258 * Checks if browser notification is permitted by user.
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.
267 function isPermitted() {
269 granted: function allow() {
270 return Promise.resolve(true);
272 denied: function deny() {
273 return Promise.resolve(false);
275 default: function ask() {
276 return Notification.requestPermission().then(function(permission) {
277 return permission === 'granted';
282 return permitted[Notification.permission]();
287 * Determines if notification should proceed.
290 * Notification shall <strong>not</strong> proceed unless `value` is true.
292 * `value` will equal one of:
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>
300 * @param {boolean|undefined} value - Determines if notification permissible.
301 * @returns {Promise<undefined>} Notification can proceed
303 function canNotify(value) {
305 var why = value === false ? 'blocked' : 'unacknowledged';
306 var reason = 'not permitted by user (' + why + ')';
307 return Promise.reject(new Error(reason));
309 return Promise.resolve();
313 * Displays the notification.
316 * @param {Runner} runner - Runner instance.
318 function display(runner) {
319 var stats = runner.stats;
324 var logo = require('../../package').notifyLogo;
329 if (stats.failures) {
330 _message = stats.failures + ' of ' + stats.tests + ' tests failed';
331 message = symbol.cross + ' ' + _message;
334 _message = stats.passes + ' tests passed in ' + stats.duration + 'ms';
335 message = symbol.tick + ' ' + _message;
347 requireInteraction: false,
348 timestamp: Date.now()
350 var notification = new Notification(title, options);
352 // Autoclose after brief delay (makes various browsers act same)
353 var FORCE_DURATION = 4000;
354 setTimeout(notification.close.bind(notification), FORCE_DURATION);
358 * As notifications are tangential to our purpose, just log the error.
361 * @param {Error} err - Why notification didn't happen.
363 function notPermitted(err) {
364 console.error('notification error:', err.message);
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){
375 module.exports = Progress;
378 * Initialize a new `Progress` indicator.
380 function Progress() {
384 this.font('helvetica, arial, sans-serif');
388 * Set progress size to `size`.
391 * @param {number} size
392 * @return {Progress} Progress instance.
394 Progress.prototype.size = function(size) {
400 * Set text to `text`.
403 * @param {string} text
404 * @return {Progress} Progress instance.
406 Progress.prototype.text = function(text) {
412 * Set font size to `size`.
415 * @param {number} size
416 * @return {Progress} Progress instance.
418 Progress.prototype.fontSize = function(size) {
419 this._fontSize = size;
424 * Set font to `family`.
426 * @param {string} family
427 * @return {Progress} Progress instance.
429 Progress.prototype.font = function(family) {
435 * Update percentage to `n`.
438 * @return {Progress} Progress instance.
440 Progress.prototype.update = function(n) {
448 * @param {CanvasRenderingContext2d} ctx
449 * @return {Progress} Progress instance.
451 Progress.prototype.draw = function(ctx) {
453 var percent = Math.min(this.percent, 100);
454 var size = this._size;
459 var fontSize = this._fontSize;
461 ctx.font = fontSize + 'px ' + this._font;
463 var angle = Math.PI * 2 * (percent / 100);
464 ctx.clearRect(0, 0, size, size);
467 ctx.strokeStyle = '#9f9f9f';
469 ctx.arc(x, y, rad, 0, angle, false);
473 ctx.strokeStyle = '#eee';
475 ctx.arc(x, y, rad - 1, 0, angle, true);
479 var text = this._text || (percent | 0) + '%';
480 var w = ctx.measureText(text).width;
482 ctx.fillText(text, x - w / 2 + 1, y + fontSize / 2 - 1);
484 // don't fail if we can't render progress
489 },{}],4:[function(require,module,exports){
493 exports.isatty = function isatty() {
497 exports.getWindowSize = function getWindowSize() {
498 if ('innerHeight' in global) {
499 return [global.innerHeight, global.innerWidth];
501 // In a Web Worker, the DOM Window is not available.
505 }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
506 },{}],5:[function(require,module,exports){
515 module.exports = Context;
518 * Initialize a new `Context`.
522 function Context() {}
525 * Set or get the context `Runnable` to `runnable`.
528 * @param {Runnable} runnable
529 * @return {Context} context
531 Context.prototype.runnable = function(runnable) {
532 if (!arguments.length) {
533 return this._runnable;
535 this.test = this._runnable = runnable;
540 * Set or get test timeout `ms`.
544 * @return {Context} self
546 Context.prototype.timeout = function(ms) {
547 if (!arguments.length) {
548 return this.runnable().timeout();
550 this.runnable().timeout(ms);
555 * Set test timeout `enabled`.
558 * @param {boolean} enabled
559 * @return {Context} self
561 Context.prototype.enableTimeouts = function(enabled) {
562 if (!arguments.length) {
563 return this.runnable().enableTimeouts();
565 this.runnable().enableTimeouts(enabled);
570 * Set or get test slowness threshold `ms`.
574 * @return {Context} self
576 Context.prototype.slow = function(ms) {
577 if (!arguments.length) {
578 return this.runnable().slow();
580 this.runnable().slow(ms);
585 * Mark a test as skipped.
590 Context.prototype.skip = function() {
591 this.runnable().skip();
595 * Set or get a number of allowed retries on failed tests
599 * @return {Context} self
601 Context.prototype.retries = function(n) {
602 if (!arguments.length) {
603 return this.runnable().retries();
605 this.runnable().retries(n);
609 },{}],6:[function(require,module,exports){
615 * Factory functions to create throwable error objects
619 * Creates an error object to be thrown when no files to be tested could be found using specified pattern.
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
626 function createNoFilesMatchPatternError(message, pattern) {
627 var err = new Error(message);
628 err.code = 'ERR_MOCHA_NO_FILES_MATCH_PATTERN';
629 err.pattern = pattern;
634 * Creates an error object to be thrown when the reporter specified in the options was not found.
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
641 function createInvalidReporterError(message, reporter) {
642 var err = new TypeError(message);
643 err.code = 'ERR_MOCHA_INVALID_REPORTER';
644 err.reporter = reporter;
649 * Creates an error object to be thrown when the interface specified in the options was not found.
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
656 function createInvalidInterfaceError(message, ui) {
657 var err = new Error(message);
658 err.code = 'ERR_MOCHA_INVALID_INTERFACE';
664 * Creates an error object to be thrown when a behavior, option, or parameter is unsupported.
667 * @param {string} message - Error message to be displayed.
668 * @returns {Error} instance detailing the error condition
670 function createUnsupportedError(message) {
671 var err = new Error(message);
672 err.code = 'ERR_MOCHA_UNSUPPORTED';
677 * Creates an error object to be thrown when an argument is missing.
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
685 function createMissingArgumentError(message, argument, expected) {
686 return createInvalidArgumentTypeError(message, argument, expected);
690 * Creates an error object to be thrown when an argument did not use the supported type
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
698 function 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;
708 * Creates an error object to be thrown when an argument did not use the supported value
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
717 function createInvalidArgumentValueError(message, argument, value, reason) {
718 var err = new TypeError(message);
719 err.code = 'ERR_MOCHA_INVALID_ARG_VALUE';
720 err.argument = argument;
722 err.reason = typeof reason !== 'undefined' ? reason : 'is invalid';
727 * Creates an error object to be thrown when an exception was caught, but the `Error` is falsy or undefined.
730 * @param {string} message - Error message to be displayed.
731 * @returns {Error} instance detailing the error condition
733 function createInvalidExceptionError(message, value) {
734 var err = new Error(message);
735 err.code = 'ERR_MOCHA_INVALID_EXCEPTION';
736 err.valueType = typeof value;
742 createInvalidArgumentTypeError: createInvalidArgumentTypeError,
743 createInvalidArgumentValueError: createInvalidArgumentValueError,
744 createInvalidExceptionError: createInvalidExceptionError,
745 createInvalidInterfaceError: createInvalidInterfaceError,
746 createInvalidReporterError: createInvalidReporterError,
747 createMissingArgumentError: createMissingArgumentError,
748 createNoFilesMatchPatternError: createNoFilesMatchPatternError,
749 createUnsupportedError: createUnsupportedError
752 },{}],7:[function(require,module,exports){
755 var Runnable = require('./runnable');
756 var inherits = require('./utils').inherits;
762 module.exports = Hook;
765 * Initialize a new `Hook` with the given `title` and callback `fn`
769 * @param {String} title
770 * @param {Function} fn
772 function Hook(title, fn) {
773 Runnable.call(this, title, fn);
778 * Inherit from `Runnable.prototype`.
780 inherits(Hook, Runnable);
783 * Get or set the test `err`.
790 Hook.prototype.error = function(err) {
791 if (!arguments.length) {
800 },{"./runnable":33,"./utils":38}],8:[function(require,module,exports){
803 var Test = require('../test');
804 var EVENT_FILE_PRE_REQUIRE = require('../suite').constants
805 .EVENT_FILE_PRE_REQUIRE;
808 * BDD-style interface:
810 * describe('Array', function() {
811 * describe('#indexOf()', function() {
812 * it('should return -1 when not present', function() {
816 * it('should return the index when present', function() {
822 * @param {Suite} suite Root suite.
824 module.exports = function bddInterface(suite) {
825 var suites = [suite];
827 suite.on(EVENT_FILE_PRE_REQUIRE, function(context, file, mocha) {
828 var common = require('./common')(suites, context, mocha);
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);
836 * Describe a "suite" with the given `title`
837 * and callback `fn` containing nested suites
841 context.describe = context.context = function(title, fn) {
842 return common.suite.create({
853 context.xdescribe = context.xcontext = context.describe.skip = function(
857 return common.suite.skip({
868 context.describe.only = function(title, fn) {
869 return common.suite.only({
877 * Describe a specification or test-case
878 * with the given `title` and callback `fn`
882 context.it = context.specify = function(title, fn) {
883 var suite = suites[0];
884 if (suite.isPending()) {
887 var test = new Test(title, fn);
894 * Exclusive test-case.
897 context.it.only = function(title, fn) {
898 return common.test.only(mocha, context.it(title, fn));
905 context.xit = context.xspecify = context.it.skip = function(title) {
906 return context.it(title);
910 * Number of attempts to retry.
912 context.it.retries = function(n) {
918 module.exports.description = 'BDD or RSpec style [default]';
920 },{"../suite":36,"../test":37,"./common":9}],9:[function(require,module,exports){
923 var Suite = require('../suite');
924 var errors = require('../errors');
925 var createMissingArgumentError = errors.createMissingArgumentError;
928 * Functions common to more than one interface.
930 * @param {Suite[]} suites
931 * @param {Context} context
932 * @param {Mocha} mocha
933 * @return {Object} An object containing common functions.
935 module.exports = function(suites, context, mocha) {
937 * Check if the suite should be tested.
940 * @param {Suite} suite - suite to check
943 function shouldBeTested(suite) {
945 !mocha.options.grep ||
946 (mocha.options.grep &&
947 mocha.options.grep.test(suite.fullTitle()) &&
948 !mocha.options.invert)
954 * This is only present if flag --delay is passed into Mocha. It triggers
955 * root suite execution.
957 * @param {Suite} suite The root suite.
958 * @return {Function} A function which runs the root suite
960 runWithSuite: function runWithSuite(suite) {
961 return function run() {
967 * Execute before running tests.
969 * @param {string} name
970 * @param {Function} fn
972 before: function(name, fn) {
973 suites[0].beforeAll(name, fn);
977 * Execute after running tests.
979 * @param {string} name
980 * @param {Function} fn
982 after: function(name, fn) {
983 suites[0].afterAll(name, fn);
987 * Execute before each test case.
989 * @param {string} name
990 * @param {Function} fn
992 beforeEach: function(name, fn) {
993 suites[0].beforeEach(name, fn);
997 * Execute after each test case.
999 * @param {string} name
1000 * @param {Function} fn
1002 afterEach: function(name, fn) {
1003 suites[0].afterEach(name, fn);
1008 * Create an exclusive Suite; convenience function
1009 * See docstring for create() below.
1011 * @param {Object} opts
1014 only: function only(opts) {
1016 return this.create(opts);
1020 * Create a Suite, but skip it; convenience function
1021 * See docstring for create() below.
1023 * @param {Object} opts
1026 skip: function skip(opts) {
1027 opts.pending = true;
1028 return this.create(opts);
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?
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);
1048 if (mocha.options.forbidOnly && shouldBeTested(suite)) {
1049 throw new Error('`.only` forbidden');
1052 suite.parent.appendOnlySuite(suite);
1054 if (suite.pending) {
1055 if (mocha.options.forbidPending && shouldBeTested(suite)) {
1056 throw new Error('Pending test forbidden');
1059 if (typeof opts.fn === 'function') {
1060 opts.fn.call(suite);
1062 } else if (typeof opts.fn === 'undefined' && !suite.pending) {
1063 throw createMissingArgumentError(
1066 '" was defined but no callback was supplied. ' +
1067 'Supply a callback or explicitly skip the suite.',
1071 } else if (!opts.fn && suite.pending) {
1081 * Exclusive test-case.
1083 * @param {Object} mocha
1084 * @param {Function} test
1087 only: function(mocha, test) {
1088 test.parent.appendOnlyTest(test);
1093 * Pending test case.
1095 * @param {string} title
1097 skip: function(title) {
1098 context.test(title);
1102 * Number of retry attempts
1106 retries: function(n) {
1113 },{"../errors":6,"../suite":36}],10:[function(require,module,exports){
1115 var Suite = require('../suite');
1116 var Test = require('../test');
1119 * Exports-style (as Node.js module) interface:
1123 * 'should return -1 when the value is not present': function() {
1127 * 'should return the correct index when the value is present': function() {
1133 * @param {Suite} suite Root suite.
1135 module.exports = function(suite) {
1136 var suites = [suite];
1138 suite.on(Suite.constants.EVENT_FILE_REQUIRE, visit);
1140 function visit(obj, file) {
1142 for (var key in obj) {
1143 if (typeof obj[key] === 'function') {
1147 suites[0].beforeAll(fn);
1150 suites[0].afterAll(fn);
1153 suites[0].beforeEach(fn);
1156 suites[0].afterEach(fn);
1159 var test = new Test(key, fn);
1161 suites[0].addTest(test);
1164 suite = Suite.create(suites[0], key);
1165 suites.unshift(suite);
1166 visit(obj[key], file);
1173 module.exports.description = 'Node.js module ("exports") style';
1175 },{"../suite":36,"../test":37}],11:[function(require,module,exports){
1178 exports.bdd = require('./bdd');
1179 exports.tdd = require('./tdd');
1180 exports.qunit = require('./qunit');
1181 exports.exports = require('./exports');
1183 },{"./bdd":8,"./exports":10,"./qunit":12,"./tdd":13}],12:[function(require,module,exports){
1186 var Test = require('../test');
1187 var EVENT_FILE_PRE_REQUIRE = require('../suite').constants
1188 .EVENT_FILE_PRE_REQUIRE;
1191 * QUnit-style interface:
1195 * test('#length', function() {
1196 * var arr = [1,2,3];
1197 * ok(arr.length == 3);
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);
1209 * test('#length', function() {
1210 * ok('foo'.length == 3);
1213 * @param {Suite} suite Root suite.
1215 module.exports = function qUnitInterface(suite) {
1216 var suites = [suite];
1218 suite.on(EVENT_FILE_PRE_REQUIRE, function(context, file, mocha) {
1219 var common = require('./common')(suites, context, mocha);
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);
1227 * Describe a "suite" with the given `title`.
1230 context.suite = function(title) {
1231 if (suites.length > 1) {
1234 return common.suite.create({
1245 context.suite.only = function(title) {
1246 if (suites.length > 1) {
1249 return common.suite.only({
1257 * Describe a specification or test-case
1258 * with the given `title` and callback `fn`
1259 * acting as a thunk.
1262 context.test = function(title, fn) {
1263 var test = new Test(title, fn);
1265 suites[0].addTest(test);
1270 * Exclusive test-case.
1273 context.test.only = function(title, fn) {
1274 return common.test.only(mocha, context.test(title, fn));
1277 context.test.skip = common.test.skip;
1278 context.test.retries = common.test.retries;
1282 module.exports.description = 'QUnit style';
1284 },{"../suite":36,"../test":37,"./common":9}],13:[function(require,module,exports){
1287 var Test = require('../test');
1288 var EVENT_FILE_PRE_REQUIRE = require('../suite').constants
1289 .EVENT_FILE_PRE_REQUIRE;
1292 * TDD-style interface:
1294 * suite('Array', function() {
1295 * suite('#indexOf()', function() {
1296 * suiteSetup(function() {
1300 * test('should return -1 when not present', function() {
1304 * test('should return the index when present', function() {
1308 * suiteTeardown(function() {
1314 * @param {Suite} suite Root suite.
1316 module.exports = function(suite) {
1317 var suites = [suite];
1319 suite.on(EVENT_FILE_PRE_REQUIRE, function(context, file, mocha) {
1320 var common = require('./common')(suites, context, mocha);
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);
1329 * Describe a "suite" with the given `title` and callback `fn` containing
1330 * nested suites and/or tests.
1332 context.suite = function(title, fn) {
1333 return common.suite.create({
1343 context.suite.skip = function(title, fn) {
1344 return common.suite.skip({
1352 * Exclusive test-case.
1354 context.suite.only = function(title, fn) {
1355 return common.suite.only({
1363 * Describe a specification or test-case with the given `title` and
1364 * callback `fn` acting as a thunk.
1366 context.test = function(title, fn) {
1367 var suite = suites[0];
1368 if (suite.isPending()) {
1371 var test = new Test(title, fn);
1373 suite.addTest(test);
1378 * Exclusive test-case.
1381 context.test.only = function(title, fn) {
1382 return common.test.only(mocha, context.test(title, fn));
1385 context.test.skip = common.test.skip;
1386 context.test.retries = common.test.retries;
1390 module.exports.description =
1391 'traditional "suite"/"test" instead of BDD\'s "describe"/"it"';
1393 },{"../suite":36,"../test":37,"./common":9}],14:[function(require,module,exports){
1394 (function (process,global){
1399 * Copyright(c) 2011 TJ Holowaychuk <tj@vision-media.ca>
1403 var escapeRe = require('escape-string-regexp');
1404 var path = require('path');
1405 var builtinReporters = require('./reporters');
1406 var growl = require('./growl');
1407 var utils = require('./utils');
1408 var mocharc = require('./mocharc.json');
1409 var errors = require('./errors');
1410 var Suite = require('./suite');
1411 var esmUtils = utils.supportsEsModules() ? require('./esm-utils') : undefined;
1412 var createStatsCollector = require('./stats-collector');
1413 var createInvalidReporterError = errors.createInvalidReporterError;
1414 var createInvalidInterfaceError = errors.createInvalidInterfaceError;
1415 var EVENT_FILE_PRE_REQUIRE = Suite.constants.EVENT_FILE_PRE_REQUIRE;
1416 var EVENT_FILE_POST_REQUIRE = Suite.constants.EVENT_FILE_POST_REQUIRE;
1417 var EVENT_FILE_REQUIRE = Suite.constants.EVENT_FILE_REQUIRE;
1418 var sQuote = utils.sQuote;
1420 exports = module.exports = Mocha;
1423 * To require local UIs and reporters when running in node.
1426 if (!process.browser) {
1427 var cwd = process.cwd();
1428 module.paths.push(cwd, path.join(cwd, 'node_modules'));
1440 exports.utils = utils;
1441 exports.interfaces = require('./interfaces');
1446 exports.reporters = builtinReporters;
1447 exports.Runnable = require('./runnable');
1448 exports.Context = require('./context');
1453 exports.Runner = require('./runner');
1454 exports.Suite = Suite;
1455 exports.Hook = require('./hook');
1456 exports.Test = require('./test');
1459 * Constructs a new Mocha instance with `options`.
1463 * @param {Object} [options] - Settings object.
1464 * @param {boolean} [options.allowUncaught] - Propagate uncaught errors?
1465 * @param {boolean} [options.asyncOnly] - Force `done` callback or promise?
1466 * @param {boolean} [options.bail] - Bail after first test failure?
1467 * @param {boolean} [options.checkLeaks] - Check for global variable leaks?
1468 * @param {boolean} [options.color] - Color TTY output from reporter?
1469 * @param {boolean} [options.delay] - Delay root suite execution?
1470 * @param {boolean} [options.diff] - Show diff on failure?
1471 * @param {string} [options.fgrep] - Test filter given string.
1472 * @param {boolean} [options.forbidOnly] - Tests marked `only` fail the suite?
1473 * @param {boolean} [options.forbidPending] - Pending tests fail the suite?
1474 * @param {boolean} [options.fullTrace] - Full stacktrace upon failure?
1475 * @param {string[]} [options.global] - Variables expected in global scope.
1476 * @param {RegExp|string} [options.grep] - Test filter given regular expression.
1477 * @param {boolean} [options.growl] - Enable desktop notifications?
1478 * @param {boolean} [options.inlineDiffs] - Display inline diffs?
1479 * @param {boolean} [options.invert] - Invert test filter matches?
1480 * @param {boolean} [options.noHighlighting] - Disable syntax highlighting?
1481 * @param {string|constructor} [options.reporter] - Reporter name or constructor.
1482 * @param {Object} [options.reporterOption] - Reporter settings object.
1483 * @param {number} [options.retries] - Number of times to retry failed tests.
1484 * @param {number} [options.slow] - Slow threshold value.
1485 * @param {number|string} [options.timeout] - Timeout threshold value.
1486 * @param {string} [options.ui] - Interface name.
1488 function Mocha(options) {
1489 options = utils.assign({}, mocharc, options || {});
1491 this.options = options;
1493 this.suite = new exports.Suite('', new exports.Context(), true);
1495 this.grep(options.grep)
1496 .fgrep(options.fgrep)
1500 options.reporterOption || options.reporterOptions // reporterOptions was previously the only way to specify options to reporter
1503 .global(options.global);
1505 // this guard exists because Suite#timeout does not consider `undefined` to be valid input
1506 if (typeof options.timeout !== 'undefined') {
1507 this.timeout(options.timeout === false ? 0 : options.timeout);
1510 if ('retries' in options) {
1511 this.retries(options.retries);
1528 ].forEach(function(opt) {
1536 * Enables or disables bailing on the first failure.
1539 * @see [CLI option](../#-bail-b)
1540 * @param {boolean} [bail=true] - Whether to bail on first error.
1541 * @returns {Mocha} this
1544 Mocha.prototype.bail = function(bail) {
1545 this.suite.bail(bail !== false);
1551 * Adds `file` to be loaded for execution.
1554 * Useful for generic setup code that must be included within test suite.
1557 * @see [CLI option](../#-file-filedirectoryglob)
1558 * @param {string} file - Pathname of file to be loaded.
1559 * @returns {Mocha} this
1562 Mocha.prototype.addFile = function(file) {
1563 this.files.push(file);
1568 * Sets reporter to `reporter`, defaults to "spec".
1571 * @see [CLI option](../#-reporter-name-r-name)
1572 * @see [Reporters](../#reporters)
1573 * @param {String|Function} reporter - Reporter name or constructor.
1574 * @param {Object} [reporterOptions] - Options used to configure the reporter.
1575 * @returns {Mocha} this
1577 * @throws {Error} if requested reporter cannot be loaded
1580 * // Use XUnit reporter and direct its output to file
1581 * mocha.reporter('xunit', { output: '/path/to/testspec.xunit.xml' });
1583 Mocha.prototype.reporter = function(reporter, reporterOptions) {
1584 if (typeof reporter === 'function') {
1585 this._reporter = reporter;
1587 reporter = reporter || 'spec';
1589 // Try to load a built-in reporter.
1590 if (builtinReporters[reporter]) {
1591 _reporter = builtinReporters[reporter];
1593 // Try to load reporters from process.cwd() and node_modules
1596 _reporter = require(reporter);
1599 err.code !== 'MODULE_NOT_FOUND' ||
1600 err.message.indexOf('Cannot find module') !== -1
1602 // Try to load reporters from a path (absolute or relative)
1604 _reporter = require(path.resolve(process.cwd(), reporter));
1606 _err.code !== 'MODULE_NOT_FOUND' ||
1607 _err.message.indexOf('Cannot find module') !== -1
1608 ? console.warn(sQuote(reporter) + ' reporter not found')
1611 ' reporter blew up with error:\n' +
1617 sQuote(reporter) + ' reporter blew up with error:\n' + err.stack
1623 throw createInvalidReporterError(
1624 'invalid reporter ' + sQuote(reporter),
1628 this._reporter = _reporter;
1630 this.options.reporterOption = reporterOptions;
1631 // alias option name is used in public reporters xunit/tap/progress
1632 this.options.reporterOptions = reporterOptions;
1637 * Sets test UI `name`, defaults to "bdd".
1640 * @see [CLI option](../#-ui-name-u-name)
1641 * @see [Interface DSLs](../#interfaces)
1642 * @param {string|Function} [ui=bdd] - Interface name or class.
1643 * @returns {Mocha} this
1645 * @throws {Error} if requested interface cannot be loaded
1647 Mocha.prototype.ui = function(ui) {
1649 if (typeof ui === 'function') {
1653 bindInterface = exports.interfaces[ui];
1654 if (!bindInterface) {
1656 bindInterface = require(ui);
1658 throw createInvalidInterfaceError(
1659 'invalid interface ' + sQuote(ui),
1665 bindInterface(this.suite);
1667 this.suite.on(EVENT_FILE_PRE_REQUIRE, function(context) {
1668 exports.afterEach = context.afterEach || context.teardown;
1669 exports.after = context.after || context.suiteTeardown;
1670 exports.beforeEach = context.beforeEach || context.setup;
1671 exports.before = context.before || context.suiteSetup;
1672 exports.describe = context.describe || context.suite;
1673 exports.it = context.it || context.test;
1674 exports.xit = context.xit || (context.test && context.test.skip);
1675 exports.setup = context.setup || context.beforeEach;
1676 exports.suiteSetup = context.suiteSetup || context.before;
1677 exports.suiteTeardown = context.suiteTeardown || context.after;
1678 exports.suite = context.suite || context.describe;
1679 exports.teardown = context.teardown || context.afterEach;
1680 exports.test = context.test || context.it;
1681 exports.run = context.run;
1688 * Loads `files` prior to execution. Does not support ES Modules.
1691 * The implementation relies on Node's `require` to execute
1692 * the test interface functions and will be subject to its cache.
1693 * Supports only CommonJS modules. To load ES modules, use Mocha#loadFilesAsync.
1696 * @see {@link Mocha#addFile}
1697 * @see {@link Mocha#run}
1698 * @see {@link Mocha#unloadFiles}
1699 * @see {@link Mocha#loadFilesAsync}
1700 * @param {Function} [fn] - Callback invoked upon completion.
1702 Mocha.prototype.loadFiles = function(fn) {
1704 var suite = this.suite;
1705 this.files.forEach(function(file) {
1706 file = path.resolve(file);
1707 suite.emit(EVENT_FILE_PRE_REQUIRE, global, file, self);
1708 suite.emit(EVENT_FILE_REQUIRE, require(file), file, self);
1709 suite.emit(EVENT_FILE_POST_REQUIRE, global, file, self);
1715 * Loads `files` prior to execution. Supports Node ES Modules.
1718 * The implementation relies on Node's `require` and `import` to execute
1719 * the test interface functions and will be subject to its cache.
1720 * Supports both CJS and ESM modules.
1723 * @see {@link Mocha#addFile}
1724 * @see {@link Mocha#run}
1725 * @see {@link Mocha#unloadFiles}
1726 * @returns {Promise}
1729 * // loads ESM (and CJS) test files asynchronously, then runs root suite
1730 * mocha.loadFilesAsync()
1731 * .then(() => mocha.run(failures => process.exitCode = failures ? 1 : 0))
1732 * .catch(() => process.exitCode = 1);
1734 Mocha.prototype.loadFilesAsync = function() {
1736 var suite = this.suite;
1737 this.loadAsync = true;
1740 return new Promise(function(resolve) {
1741 self.loadFiles(resolve);
1745 return esmUtils.loadFilesAsync(
1748 suite.emit(EVENT_FILE_PRE_REQUIRE, global, file, self);
1750 function(file, resultModule) {
1751 suite.emit(EVENT_FILE_REQUIRE, resultModule, file, self);
1752 suite.emit(EVENT_FILE_POST_REQUIRE, global, file, self);
1758 * Removes a previously loaded file from Node's `require` cache.
1762 * @see {@link Mocha#unloadFiles}
1763 * @param {string} file - Pathname of file to be unloaded.
1765 Mocha.unloadFile = function(file) {
1766 delete require.cache[require.resolve(file)];
1770 * Unloads `files` from Node's `require` cache.
1773 * This allows required files to be "freshly" reloaded, providing the ability
1774 * to reuse a Mocha instance programmatically.
1775 * Note: does not clear ESM module files from the cache
1777 * <strong>Intended for consumers — not used internally</strong>
1780 * @see {@link Mocha#run}
1781 * @returns {Mocha} this
1784 Mocha.prototype.unloadFiles = function() {
1785 this.files.forEach(Mocha.unloadFile);
1790 * Sets `grep` filter after escaping RegExp special characters.
1793 * @see {@link Mocha#grep}
1794 * @param {string} str - Value to be converted to a regexp.
1795 * @returns {Mocha} this
1799 * // Select tests whose full title begins with `"foo"` followed by a period
1800 * mocha.fgrep('foo.');
1802 Mocha.prototype.fgrep = function(str) {
1806 return this.grep(new RegExp(escapeRe(str)));
1811 * Sets `grep` filter used to select specific tests for execution.
1814 * If `re` is a regexp-like string, it will be converted to regexp.
1815 * The regexp is tested against the full title of each test (i.e., the
1816 * name of the test preceded by titles of each its ancestral suites).
1817 * As such, using an <em>exact-match</em> fixed pattern against the
1818 * test name itself will not yield any matches.
1820 * <strong>Previous filter value will be overwritten on each call!</strong>
1823 * @see [CLI option](../#-grep-regexp-g-regexp)
1824 * @see {@link Mocha#fgrep}
1825 * @see {@link Mocha#invert}
1826 * @param {RegExp|String} re - Regular expression used to select tests.
1827 * @return {Mocha} this
1831 * // Select tests whose full title contains `"match"`, ignoring case
1832 * mocha.grep(/match/i);
1835 * // Same as above but with regexp-like string argument
1836 * mocha.grep('/match/i');
1839 * // ## Anti-example
1840 * // Given embedded test `it('only-this-test')`...
1841 * mocha.grep('/^only-this-test$/'); // NO! Use `.only()` to do this!
1843 Mocha.prototype.grep = function(re) {
1844 if (utils.isString(re)) {
1845 // extract args if it's regex-like, i.e: [string, pattern, flag]
1846 var arg = re.match(/^\/(.*)\/(g|i|)$|.*/);
1847 this.options.grep = new RegExp(arg[1] || arg[0], arg[2]);
1849 this.options.grep = re;
1855 * Inverts `grep` matches.
1858 * @see {@link Mocha#grep}
1859 * @return {Mocha} this
1863 * // Select tests whose full title does *not* contain `"match"`, ignoring case
1864 * mocha.grep(/match/i).invert();
1866 Mocha.prototype.invert = function() {
1867 this.options.invert = true;
1872 * Enables or disables ignoring global leaks.
1874 * @deprecated since v7.0.0
1876 * @see {@link Mocha#checkLeaks}
1877 * @param {boolean} [ignoreLeaks=false] - Whether to ignore global leaks.
1878 * @return {Mocha} this
1881 Mocha.prototype.ignoreLeaks = function(ignoreLeaks) {
1883 '"ignoreLeaks()" is DEPRECATED, please use "checkLeaks()" instead.'
1885 this.options.checkLeaks = !ignoreLeaks;
1890 * Enables or disables checking for global variables leaked while running tests.
1893 * @see [CLI option](../#-check-leaks)
1894 * @param {boolean} [checkLeaks=true] - Whether to check for global variable leaks.
1895 * @return {Mocha} this
1898 Mocha.prototype.checkLeaks = function(checkLeaks) {
1899 this.options.checkLeaks = checkLeaks !== false;
1904 * Displays full stack trace upon test failure.
1907 * @see [CLI option](../#-full-trace)
1908 * @param {boolean} [fullTrace=true] - Whether to print full stacktrace upon failure.
1909 * @return {Mocha} this
1912 Mocha.prototype.fullTrace = function(fullTrace) {
1913 this.options.fullTrace = fullTrace !== false;
1918 * Enables desktop notification support if prerequisite software installed.
1921 * @see [CLI option](../#-growl-g)
1922 * @return {Mocha} this
1925 Mocha.prototype.growl = function() {
1926 this.options.growl = this.isGrowlCapable();
1927 if (!this.options.growl) {
1928 var detail = process.browser
1929 ? 'notification support not available in this browser...'
1930 : 'notification support prerequisites not installed...';
1931 console.error(detail + ' cannot enable!');
1938 * Determines if Growl support seems likely.
1941 * <strong>Not available when run in browser.</strong>
1944 * @see {@link Growl#isCapable}
1945 * @see {@link Mocha#growl}
1946 * @return {boolean} whether Growl support can be expected
1948 Mocha.prototype.isGrowlCapable = growl.isCapable;
1951 * Implements desktop notifications using a pseudo-reporter.
1954 * @see {@link Mocha#growl}
1955 * @see {@link Growl#notify}
1956 * @param {Runner} runner - Runner instance.
1958 Mocha.prototype._growl = growl.notify;
1961 * Specifies whitelist of variable names to be expected in global scope.
1964 * @see [CLI option](../#-global-variable-name)
1965 * @see {@link Mocha#checkLeaks}
1966 * @param {String[]|String} global - Accepted global variable name(s).
1967 * @return {Mocha} this
1971 * // Specify variables to be expected in global scope
1972 * mocha.global(['jQuery', 'MyLib']);
1974 Mocha.prototype.global = function(global) {
1975 this.options.global = (this.options.global || [])
1978 .filter(function(elt, idx, arr) {
1979 return arr.indexOf(elt) === idx;
1983 // for backwards compatibility, 'globals' is an alias of 'global'
1984 Mocha.prototype.globals = Mocha.prototype.global;
1987 * Enables or disables TTY color output by screen-oriented reporters.
1989 * @deprecated since v7.0.0
1991 * @see {@link Mocha#color}
1992 * @param {boolean} colors - Whether to enable color output.
1993 * @return {Mocha} this
1996 Mocha.prototype.useColors = function(colors) {
1997 utils.deprecate('"useColors()" is DEPRECATED, please use "color()" instead.');
1998 if (colors !== undefined) {
1999 this.options.color = colors;
2005 * Enables or disables TTY color output by screen-oriented reporters.
2008 * @see [CLI option](../#-color-c-colors)
2009 * @param {boolean} [color=true] - Whether to enable color output.
2010 * @return {Mocha} this
2013 Mocha.prototype.color = function(color) {
2014 this.options.color = color !== false;
2019 * Determines if reporter should use inline diffs (rather than +/-)
2020 * in test failure output.
2022 * @deprecated since v7.0.0
2024 * @see {@link Mocha#inlineDiffs}
2025 * @param {boolean} [inlineDiffs=false] - Whether to use inline diffs.
2026 * @return {Mocha} this
2029 Mocha.prototype.useInlineDiffs = function(inlineDiffs) {
2031 '"useInlineDiffs()" is DEPRECATED, please use "inlineDiffs()" instead.'
2033 this.options.inlineDiffs = inlineDiffs !== undefined && inlineDiffs;
2038 * Enables or disables reporter to use inline diffs (rather than +/-)
2039 * in test failure output.
2042 * @see [CLI option](../#-inline-diffs)
2043 * @param {boolean} [inlineDiffs=true] - Whether to use inline diffs.
2044 * @return {Mocha} this
2047 Mocha.prototype.inlineDiffs = function(inlineDiffs) {
2048 this.options.inlineDiffs = inlineDiffs !== false;
2053 * Determines if reporter should include diffs in test failure output.
2055 * @deprecated since v7.0.0
2057 * @see {@link Mocha#diff}
2058 * @param {boolean} [hideDiff=false] - Whether to hide diffs.
2059 * @return {Mocha} this
2062 Mocha.prototype.hideDiff = function(hideDiff) {
2063 utils.deprecate('"hideDiff()" is DEPRECATED, please use "diff()" instead.');
2064 this.options.diff = !(hideDiff === true);
2069 * Enables or disables reporter to include diff in test failure output.
2072 * @see [CLI option](../#-diff)
2073 * @param {boolean} [diff=true] - Whether to show diff on failure.
2074 * @return {Mocha} this
2077 Mocha.prototype.diff = function(diff) {
2078 this.options.diff = diff !== false;
2084 * Sets timeout threshold value.
2087 * A string argument can use shorthand (such as "2s") and will be converted.
2088 * If the value is `0`, timeouts will be disabled.
2091 * @see [CLI option](../#-timeout-ms-t-ms)
2092 * @see [Timeouts](../#timeouts)
2093 * @see {@link Mocha#enableTimeouts}
2094 * @param {number|string} msecs - Timeout threshold value.
2095 * @return {Mocha} this
2099 * // Sets timeout to one second
2100 * mocha.timeout(1000);
2103 * // Same as above but using string argument
2104 * mocha.timeout('1s');
2106 Mocha.prototype.timeout = function(msecs) {
2107 this.suite.timeout(msecs);
2112 * Sets the number of times to retry failed tests.
2115 * @see [CLI option](../#-retries-n)
2116 * @see [Retry Tests](../#retry-tests)
2117 * @param {number} retry - Number of times to retry failed tests.
2118 * @return {Mocha} this
2122 * // Allow any failed test to retry one more time
2125 Mocha.prototype.retries = function(n) {
2126 this.suite.retries(n);
2131 * Sets slowness threshold value.
2134 * @see [CLI option](../#-slow-ms-s-ms)
2135 * @param {number} msecs - Slowness threshold value.
2136 * @return {Mocha} this
2140 * // Sets "slow" threshold to half a second
2144 * // Same as above but using string argument
2145 * mocha.slow('0.5s');
2147 Mocha.prototype.slow = function(msecs) {
2148 this.suite.slow(msecs);
2153 * Enables or disables timeouts.
2156 * @see [CLI option](../#-timeout-ms-t-ms)
2157 * @param {boolean} enableTimeouts - Whether to enable timeouts.
2158 * @return {Mocha} this
2161 Mocha.prototype.enableTimeouts = function(enableTimeouts) {
2162 this.suite.enableTimeouts(
2163 arguments.length && enableTimeouts !== undefined ? enableTimeouts : true
2169 * Forces all tests to either accept a `done` callback or return a promise.
2172 * @see [CLI option](../#-async-only-a)
2173 * @param {boolean} [asyncOnly=true] - Whether to force `done` callback or promise.
2174 * @return {Mocha} this
2177 Mocha.prototype.asyncOnly = function(asyncOnly) {
2178 this.options.asyncOnly = asyncOnly !== false;
2183 * Disables syntax highlighting (in browser).
2186 * @return {Mocha} this
2189 Mocha.prototype.noHighlighting = function() {
2190 this.options.noHighlighting = true;
2195 * Enables or disables uncaught errors to propagate.
2198 * @see [CLI option](../#-allow-uncaught)
2199 * @param {boolean} [allowUncaught=true] - Whether to propagate uncaught errors.
2200 * @return {Mocha} this
2203 Mocha.prototype.allowUncaught = function(allowUncaught) {
2204 this.options.allowUncaught = allowUncaught !== false;
2210 * Delays root suite execution.
2213 * Used to perform asynch operations before any suites are run.
2216 * @see [delayed root suite](../#delayed-root-suite)
2217 * @returns {Mocha} this
2220 Mocha.prototype.delay = function delay() {
2221 this.options.delay = true;
2226 * Causes tests marked `only` to fail the suite.
2229 * @see [CLI option](../#-forbid-only)
2230 * @param {boolean} [forbidOnly=true] - Whether tests marked `only` fail the suite.
2231 * @returns {Mocha} this
2234 Mocha.prototype.forbidOnly = function(forbidOnly) {
2235 this.options.forbidOnly = forbidOnly !== false;
2240 * Causes pending tests and tests marked `skip` to fail the suite.
2243 * @see [CLI option](../#-forbid-pending)
2244 * @param {boolean} [forbidPending=true] - Whether pending tests fail the suite.
2245 * @returns {Mocha} this
2248 Mocha.prototype.forbidPending = function(forbidPending) {
2249 this.options.forbidPending = forbidPending !== false;
2254 * Mocha version as specified by "package.json".
2256 * @name Mocha#version
2260 Object.defineProperty(Mocha.prototype, 'version', {
2261 value: require('../package.json').version,
2262 configurable: false,
2268 * Callback to be invoked when test execution is complete.
2271 * @param {number} failures - Number of failures that occurred.
2275 * Runs root suite and invokes `fn()` when complete.
2278 * To run tests multiple times (or to run tests in files that are
2279 * already in the `require` cache), make sure to clear them from
2283 * @see {@link Mocha#unloadFiles}
2284 * @see {@link Runner#run}
2285 * @param {DoneCB} [fn] - Callback invoked when test execution completed.
2286 * @returns {Runner} runner instance
2289 * // exit with non-zero status if there were test failures
2290 * mocha.run(failures => process.exitCode = failures ? 1 : 0);
2292 Mocha.prototype.run = function(fn) {
2293 if (this.files.length && !this.loadAsync) {
2296 var suite = this.suite;
2297 var options = this.options;
2298 options.files = this.files;
2299 var runner = new exports.Runner(suite, options.delay);
2300 createStatsCollector(runner);
2301 var reporter = new this._reporter(runner, options);
2302 runner.checkLeaks = options.checkLeaks === true;
2303 runner.fullStackTrace = options.fullTrace;
2304 runner.asyncOnly = options.asyncOnly;
2305 runner.allowUncaught = options.allowUncaught;
2306 runner.forbidOnly = options.forbidOnly;
2307 runner.forbidPending = options.forbidPending;
2309 runner.grep(options.grep, options.invert);
2311 if (options.global) {
2312 runner.globals(options.global);
2314 if (options.growl) {
2315 this._growl(runner);
2317 if (options.color !== undefined) {
2318 exports.reporters.Base.useColors = options.color;
2320 exports.reporters.Base.inlineDiffs = options.inlineDiffs;
2321 exports.reporters.Base.hideDiff = !options.diff;
2323 function done(failures) {
2324 fn = fn || utils.noop;
2325 if (reporter.done) {
2326 reporter.done(failures, fn);
2332 return runner.run(done);
2335 }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
2336 },{"../package.json":90,"./context":5,"./errors":6,"./esm-utils":42,"./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){
2339 "extension": ["js", "cjs", "mjs"],
2340 "opts": "./test/mocha.opts",
2341 "package": "./package.json",
2346 "watch-ignore": ["node_modules", ".git"]
2349 },{}],16:[function(require,module,exports){
2352 module.exports = Pending;
2355 * Initialize a new `Pending` error with the given message.
2357 * @param {string} message
2359 function Pending(message) {
2360 this.message = message;
2363 },{}],17:[function(require,module,exports){
2364 (function (process){
2370 * Module dependencies.
2373 var tty = require('tty');
2374 var diff = require('diff');
2375 var milliseconds = require('ms');
2376 var utils = require('../utils');
2377 var supportsColor = process.browser ? null : require('supports-color');
2378 var constants = require('../runner').constants;
2379 var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
2380 var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
2386 exports = module.exports = Base;
2389 * Check if both stdio streams are associated with a tty.
2392 var isatty = process.stdout.isTTY && process.stderr.isTTY;
2395 * Save log references to avoid tests interfering (see GH-3604).
2397 var consoleLog = console.log;
2400 * Enable coloring by default, except in the browser interface.
2405 (supportsColor.stdout || process.env.MOCHA_COLORS !== undefined);
2408 * Inline diffs instead of +/-
2411 exports.inlineDiffs = false;
2414 * Default color map.
2422 'bright yellow': 93,
2426 'error message': 31,
2440 * Default symbol map.
2451 // With node.js on Windows: use symbols available in terminal default fonts
2452 if (process.platform === 'win32') {
2453 exports.symbols.ok = '\u221A';
2454 exports.symbols.err = '\u00D7';
2455 exports.symbols.dot = '.';
2459 * Color `str` with the given `type`,
2460 * allowing colors to be disabled,
2461 * as well as user-defined color
2465 * @param {string} type
2466 * @param {string} str
2469 var color = (exports.color = function(type, str) {
2470 if (!exports.useColors) {
2473 return '\u001b[' + exports.colors[type] + 'm' + str + '\u001b[0m';
2477 * Expose term window size, with some defaults for when stderr is not a tty.
2485 exports.window.width = process.stdout.getWindowSize
2486 ? process.stdout.getWindowSize(1)[0]
2487 : tty.getWindowSize()[1];
2491 * Expose some basic cursor interactions that are common among reporters.
2496 isatty && process.stdout.write('\u001b[?25l');
2500 isatty && process.stdout.write('\u001b[?25h');
2503 deleteLine: function() {
2504 isatty && process.stdout.write('\u001b[2K');
2507 beginningOfLine: function() {
2508 isatty && process.stdout.write('\u001b[0G');
2513 exports.cursor.deleteLine();
2514 exports.cursor.beginningOfLine();
2516 process.stdout.write('\r');
2521 var showDiff = (exports.showDiff = function(err) {
2524 err.showDiff !== false &&
2525 sameType(err.actual, err.expected) &&
2526 err.expected !== undefined
2530 function stringifyDiffObjs(err) {
2531 if (!utils.isString(err.actual) || !utils.isString(err.expected)) {
2532 err.actual = utils.stringify(err.actual);
2533 err.expected = utils.stringify(err.expected);
2538 * Returns a diff between 2 strings with coloured ANSI output.
2541 * The diff will be either inline or unified dependent on the value
2542 * of `Base.inlineDiff`.
2544 * @param {string} actual
2545 * @param {string} expected
2546 * @return {string} Diff
2548 var generateDiff = (exports.generateDiff = function(actual, expected) {
2550 return exports.inlineDiffs
2551 ? inlineDiff(actual, expected)
2552 : unifiedDiff(actual, expected);
2556 color('diff added', '+ expected') +
2558 color('diff removed', '- actual: failed to generate Mocha diff') +
2565 * Outputs the given `failures` as a list.
2568 * @memberof Mocha.reporters.Base
2570 * @param {Object[]} failures - Each is Test instance with corresponding
2573 exports.list = function(failures) {
2574 var multipleErr, multipleTest;
2576 failures.forEach(function(test, i) {
2579 color('error title', ' %s) %s:\n') +
2580 color('error message', ' %s') +
2581 color('error stack', '\n%s\n');
2586 if (test.err && test.err.multiple) {
2587 if (multipleTest !== test) {
2588 multipleTest = test;
2589 multipleErr = [test.err].concat(test.err.multiple);
2591 err = multipleErr.shift();
2596 if (err.message && typeof err.message.toString === 'function') {
2597 message = err.message + '';
2598 } else if (typeof err.inspect === 'function') {
2599 message = err.inspect() + '';
2603 var stack = err.stack || message;
2604 var index = message ? stack.indexOf(message) : -1;
2609 index += message.length;
2610 msg = stack.slice(0, index);
2611 // remove msg from stack
2612 stack = stack.slice(index + 1);
2617 msg = 'Uncaught ' + msg;
2619 // explicitly show diff
2620 if (!exports.hideDiff && showDiff(err)) {
2621 stringifyDiffObjs(err);
2623 color('error title', ' %s) %s:\n%s') + color('error stack', '\n%s\n');
2624 var match = message.match(/^([^:]+): expected/);
2625 msg = '\n ' + color('error message', match ? match[1] : msg);
2627 msg += generateDiff(err.actual, err.expected);
2630 // indent stack trace
2631 stack = stack.replace(/^/gm, ' ');
2633 // indented test title
2635 test.titlePath().forEach(function(str, index) {
2639 for (var i = 0; i < index; i++) {
2645 Base.consoleLog(fmt, i + 1, testTitle, msg, stack);
2650 * Constructs a new `Base` reporter instance.
2653 * All other reporters generally inherit from this reporter.
2657 * @memberof Mocha.reporters
2658 * @param {Runner} runner - Instance triggers reporter actions.
2659 * @param {Object} [options] - runner options
2661 function Base(runner, options) {
2662 var failures = (this.failures = []);
2665 throw new TypeError('Missing runner argument');
2667 this.options = options || {};
2668 this.runner = runner;
2669 this.stats = runner.stats; // assigned so Reporters keep a closer reference
2671 runner.on(EVENT_TEST_PASS, function(test) {
2672 if (test.duration > test.slow()) {
2673 test.speed = 'slow';
2674 } else if (test.duration > test.slow() / 2) {
2675 test.speed = 'medium';
2677 test.speed = 'fast';
2681 runner.on(EVENT_TEST_FAIL, function(test, err) {
2682 if (showDiff(err)) {
2683 stringifyDiffObjs(err);
2685 // more than one error per test
2686 if (test.err && err instanceof Error) {
2687 test.err.multiple = (test.err.multiple || []).concat(err);
2691 failures.push(test);
2696 * Outputs common epilogue used by many of the bundled reporters.
2699 * @memberof Mocha.reporters
2701 Base.prototype.epilogue = function() {
2702 var stats = this.stats;
2709 color('bright pass', ' ') +
2710 color('green', ' %d passing') +
2711 color('light', ' (%s)');
2713 Base.consoleLog(fmt, stats.passes || 0, milliseconds(stats.duration));
2716 if (stats.pending) {
2717 fmt = color('pending', ' ') + color('pending', ' %d pending');
2719 Base.consoleLog(fmt, stats.pending);
2723 if (stats.failures) {
2724 fmt = color('fail', ' %d failing');
2726 Base.consoleLog(fmt, stats.failures);
2728 Base.list(this.failures);
2736 * Pads the given `str` to `len`.
2739 * @param {string} str
2740 * @param {string} len
2743 function pad(str, len) {
2745 return Array(len - str.length + 1).join(' ') + str;
2749 * Returns inline diff between 2 strings with coloured ANSI output.
2752 * @param {String} actual
2753 * @param {String} expected
2754 * @return {string} Diff
2756 function inlineDiff(actual, expected) {
2757 var msg = errorDiff(actual, expected);
2760 var lines = msg.split('\n');
2761 if (lines.length > 4) {
2762 var width = String(lines.length).length;
2764 .map(function(str, i) {
2765 return pad(++i, width) + ' |' + ' ' + str;
2773 color('diff removed', 'actual') +
2775 color('diff added', 'expected') +
2781 msg = msg.replace(/^/gm, ' ');
2786 * Returns unified diff between two strings with coloured ANSI output.
2789 * @param {String} actual
2790 * @param {String} expected
2791 * @return {string} The diff.
2793 function unifiedDiff(actual, expected) {
2795 function cleanUp(line) {
2796 if (line[0] === '+') {
2797 return indent + colorLines('diff added', line);
2799 if (line[0] === '-') {
2800 return indent + colorLines('diff removed', line);
2802 if (line.match(/@@/)) {
2805 if (line.match(/\\ No newline/)) {
2808 return indent + line;
2810 function notBlank(line) {
2811 return typeof line !== 'undefined' && line !== null;
2813 var msg = diff.createPatch('string', actual, expected);
2814 var lines = msg.split('\n').splice(5);
2817 colorLines('diff added', '+ expected') +
2819 colorLines('diff removed', '- actual') +
2829 * Returns character diff for `err`.
2832 * @param {String} actual
2833 * @param {String} expected
2834 * @return {string} the diff
2836 function errorDiff(actual, expected) {
2838 .diffWordsWithSpace(actual, expected)
2839 .map(function(str) {
2841 return colorLines('diff added', str.value);
2844 return colorLines('diff removed', str.value);
2852 * Colors lines for `str`, using the color `name`.
2855 * @param {string} name
2856 * @param {string} str
2859 function colorLines(name, str) {
2862 .map(function(str) {
2863 return color(name, str);
2869 * Object#toString reference.
2871 var objToString = Object.prototype.toString;
2874 * Checks that a / b have the same type.
2881 function sameType(a, b) {
2882 return objToString.call(a) === objToString.call(b);
2885 Base.consoleLog = consoleLog;
2887 Base.abstract = true;
2889 }).call(this,require('_process'))
2890 },{"../runner":34,"../utils":38,"_process":69,"diff":48,"ms":60,"supports-color":42,"tty":4}],18:[function(require,module,exports){
2896 * Module dependencies.
2899 var Base = require('./base');
2900 var utils = require('../utils');
2901 var constants = require('../runner').constants;
2902 var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
2903 var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
2904 var EVENT_SUITE_BEGIN = constants.EVENT_SUITE_BEGIN;
2905 var EVENT_SUITE_END = constants.EVENT_SUITE_END;
2911 exports = module.exports = Doc;
2914 * Constructs a new `Doc` reporter instance.
2918 * @memberof Mocha.reporters
2919 * @extends Mocha.reporters.Base
2920 * @param {Runner} runner - Instance triggers reporter actions.
2921 * @param {Object} [options] - runner options
2923 function Doc(runner, options) {
2924 Base.call(this, runner, options);
2929 return Array(indents).join(' ');
2932 runner.on(EVENT_SUITE_BEGIN, function(suite) {
2937 Base.consoleLog('%s<section class="suite">', indent());
2939 Base.consoleLog('%s<h1>%s</h1>', indent(), utils.escape(suite.title));
2940 Base.consoleLog('%s<dl>', indent());
2943 runner.on(EVENT_SUITE_END, function(suite) {
2947 Base.consoleLog('%s</dl>', indent());
2949 Base.consoleLog('%s</section>', indent());
2953 runner.on(EVENT_TEST_PASS, function(test) {
2954 Base.consoleLog('%s <dt>%s</dt>', indent(), utils.escape(test.title));
2955 var code = utils.escape(utils.clean(test.body));
2956 Base.consoleLog('%s <dd><pre><code>%s</code></pre></dd>', indent(), code);
2959 runner.on(EVENT_TEST_FAIL, function(test, err) {
2961 '%s <dt class="error">%s</dt>',
2963 utils.escape(test.title)
2965 var code = utils.escape(utils.clean(test.body));
2967 '%s <dd class="error"><pre><code>%s</code></pre></dd>',
2972 '%s <dd class="error">%s</dd>',
2979 Doc.description = 'HTML documentation';
2981 },{"../runner":34,"../utils":38,"./base":17}],19:[function(require,module,exports){
2982 (function (process){
2988 * Module dependencies.
2991 var Base = require('./base');
2992 var inherits = require('../utils').inherits;
2993 var constants = require('../runner').constants;
2994 var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
2995 var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
2996 var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
2997 var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
2998 var EVENT_RUN_END = constants.EVENT_RUN_END;
3004 exports = module.exports = Dot;
3007 * Constructs a new `Dot` reporter instance.
3011 * @memberof Mocha.reporters
3012 * @extends Mocha.reporters.Base
3013 * @param {Runner} runner - Instance triggers reporter actions.
3014 * @param {Object} [options] - runner options
3016 function Dot(runner, options) {
3017 Base.call(this, runner, options);
3020 var width = (Base.window.width * 0.75) | 0;
3023 runner.on(EVENT_RUN_BEGIN, function() {
3024 process.stdout.write('\n');
3027 runner.on(EVENT_TEST_PENDING, function() {
3028 if (++n % width === 0) {
3029 process.stdout.write('\n ');
3031 process.stdout.write(Base.color('pending', Base.symbols.comma));
3034 runner.on(EVENT_TEST_PASS, function(test) {
3035 if (++n % width === 0) {
3036 process.stdout.write('\n ');
3038 if (test.speed === 'slow') {
3039 process.stdout.write(Base.color('bright yellow', Base.symbols.dot));
3041 process.stdout.write(Base.color(test.speed, Base.symbols.dot));
3045 runner.on(EVENT_TEST_FAIL, function() {
3046 if (++n % width === 0) {
3047 process.stdout.write('\n ');
3049 process.stdout.write(Base.color('fail', Base.symbols.bang));
3052 runner.once(EVENT_RUN_END, function() {
3053 process.stdout.write('\n');
3059 * Inherit from `Base.prototype`.
3061 inherits(Dot, Base);
3063 Dot.description = 'dot matrix representation';
3065 }).call(this,require('_process'))
3066 },{"../runner":34,"../utils":38,"./base":17,"_process":69}],20:[function(require,module,exports){
3070 /* eslint-env browser */
3075 * Module dependencies.
3078 var Base = require('./base');
3079 var utils = require('../utils');
3080 var Progress = require('../browser/progress');
3081 var escapeRe = require('escape-string-regexp');
3082 var constants = require('../runner').constants;
3083 var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
3084 var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
3085 var EVENT_SUITE_BEGIN = constants.EVENT_SUITE_BEGIN;
3086 var EVENT_SUITE_END = constants.EVENT_SUITE_END;
3087 var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
3088 var escape = utils.escape;
3091 * Save timer references to avoid Sinon interfering (see GH-237).
3094 var Date = global.Date;
3100 exports = module.exports = HTML;
3107 '<ul id="mocha-stats">' +
3108 '<li class="progress"><canvas width="40" height="40"></canvas></li>' +
3109 '<li class="passes"><a href="javascript:void(0);">passes:</a> <em>0</em></li>' +
3110 '<li class="failures"><a href="javascript:void(0);">failures:</a> <em>0</em></li>' +
3111 '<li class="duration">duration: <em>0</em>s</li>' +
3114 var playIcon = '‣';
3117 * Constructs a new `HTML` reporter instance.
3121 * @memberof Mocha.reporters
3122 * @extends Mocha.reporters.Base
3123 * @param {Runner} runner - Instance triggers reporter actions.
3124 * @param {Object} [options] - runner options
3126 function HTML(runner, options) {
3127 Base.call(this, runner, options);
3130 var stats = this.stats;
3131 var stat = fragment(statsTemplate);
3132 var items = stat.getElementsByTagName('li');
3133 var passes = items[1].getElementsByTagName('em')[0];
3134 var passesLink = items[1].getElementsByTagName('a')[0];
3135 var failures = items[2].getElementsByTagName('em')[0];
3136 var failuresLink = items[2].getElementsByTagName('a')[0];
3137 var duration = items[3].getElementsByTagName('em')[0];
3138 var canvas = stat.getElementsByTagName('canvas')[0];
3139 var report = fragment('<ul id="mocha-report"></ul>');
3140 var stack = [report];
3143 var root = document.getElementById('mocha');
3145 if (canvas.getContext) {
3146 var ratio = window.devicePixelRatio || 1;
3147 canvas.style.width = canvas.width;
3148 canvas.style.height = canvas.height;
3149 canvas.width *= ratio;
3150 canvas.height *= ratio;
3151 ctx = canvas.getContext('2d');
3152 ctx.scale(ratio, ratio);
3153 progress = new Progress();
3157 return error('#mocha div missing, add it to your document');
3161 on(passesLink, 'click', function(evt) {
3162 evt.preventDefault();
3164 var name = /pass/.test(report.className) ? '' : ' pass';
3165 report.className = report.className.replace(/fail|pass/g, '') + name;
3166 if (report.className.trim()) {
3167 hideSuitesWithout('test pass');
3172 on(failuresLink, 'click', function(evt) {
3173 evt.preventDefault();
3175 var name = /fail/.test(report.className) ? '' : ' fail';
3176 report.className = report.className.replace(/fail|pass/g, '') + name;
3177 if (report.className.trim()) {
3178 hideSuitesWithout('test fail');
3182 root.appendChild(stat);
3183 root.appendChild(report);
3189 runner.on(EVENT_SUITE_BEGIN, function(suite) {
3195 var url = self.suiteURL(suite);
3197 '<li class="suite"><h1><a href="%s">%s</a></h1></li>',
3203 stack[0].appendChild(el);
3204 stack.unshift(document.createElement('ul'));
3205 el.appendChild(stack[0]);
3208 runner.on(EVENT_SUITE_END, function(suite) {
3216 runner.on(EVENT_TEST_PASS, function(test) {
3217 var url = self.testURL(test);
3219 '<li class="test pass %e"><h2>%e<span class="duration">%ems</span> ' +
3220 '<a href="%s" class="replay">' +
3223 var el = fragment(markup, test.speed, test.title, test.duration, url);
3224 self.addCodeToggle(el, test.body);
3229 runner.on(EVENT_TEST_FAIL, function(test) {
3231 '<li class="test fail"><h2>%e <a href="%e" class="replay">' +
3237 var stackString; // Note: Includes leading newline
3238 var message = test.err.toString();
3240 // <=IE7 stringifies to [Object Error]. Since it can be overloaded, we
3241 // check for the result of the stringifying.
3242 if (message === '[object Error]') {
3243 message = test.err.message;
3246 if (test.err.stack) {
3247 var indexOfMessage = test.err.stack.indexOf(test.err.message);
3248 if (indexOfMessage === -1) {
3249 stackString = test.err.stack;
3251 stackString = test.err.stack.substr(
3252 test.err.message.length + indexOfMessage
3255 } else if (test.err.sourceURL && test.err.line !== undefined) {
3256 // Safari doesn't give you a stack. Let's at least provide a source line.
3257 stackString = '\n(' + test.err.sourceURL + ':' + test.err.line + ')';
3260 stackString = stackString || '';
3262 if (test.err.htmlMessage && stackString) {
3265 '<div class="html-error">%s\n<pre class="error">%e</pre></div>',
3266 test.err.htmlMessage,
3270 } else if (test.err.htmlMessage) {
3272 fragment('<div class="html-error">%s</div>', test.err.htmlMessage)
3276 fragment('<pre class="error">%e%e</pre>', message, stackString)
3280 self.addCodeToggle(el, test.body);
3285 runner.on(EVENT_TEST_PENDING, function(test) {
3287 '<li class="test pass pending"><h2>%e</h2></li>',
3294 function appendToStack(el) {
3295 // Don't call .appendChild if #mocha-report was already .shift()'ed off the stack.
3297 stack[0].appendChild(el);
3301 function updateStats() {
3302 // TODO: add to stats
3303 var percent = ((stats.tests / runner.total) * 100) | 0;
3305 progress.update(percent).draw(ctx);
3309 var ms = new Date() - stats.start;
3310 text(passes, stats.passes);
3311 text(failures, stats.failures);
3312 text(duration, (ms / 1000).toFixed(2));
3317 * Makes a URL, preserving querystring ("search") parameters.
3320 * @return {string} A new URL.
3322 function makeUrl(s) {
3323 var search = window.location.search;
3325 // Remove previous grep query parameter if present
3327 search = search.replace(/[?&]grep=[^&\s]*/g, '').replace(/^&/, '?');
3331 window.location.pathname +
3332 (search ? search + '&' : '?') +
3334 encodeURIComponent(escapeRe(s))
3339 * Provide suite URL.
3341 * @param {Object} [suite]
3343 HTML.prototype.suiteURL = function(suite) {
3344 return makeUrl(suite.fullTitle());
3350 * @param {Object} [test]
3352 HTML.prototype.testURL = function(test) {
3353 return makeUrl(test.fullTitle());
3357 * Adds code toggle functionality for the provided test's list element.
3359 * @param {HTMLLIElement} el
3360 * @param {string} contents
3362 HTML.prototype.addCodeToggle = function(el, contents) {
3363 var h2 = el.getElementsByTagName('h2')[0];
3365 on(h2, 'click', function() {
3366 pre.style.display = pre.style.display === 'none' ? 'block' : 'none';
3369 var pre = fragment('<pre><code>%e</code></pre>', utils.clean(contents));
3370 el.appendChild(pre);
3371 pre.style.display = 'none';
3375 * Display error `msg`.
3377 * @param {string} msg
3379 function error(msg) {
3380 document.body.appendChild(fragment('<div id="mocha-error">%s</div>', msg));
3384 * Return a DOM fragment from `html`.
3386 * @param {string} html
3388 function fragment(html) {
3389 var args = arguments;
3390 var div = document.createElement('div');
3393 div.innerHTML = html.replace(/%([se])/g, function(_, type) {
3396 return String(args[i++]);
3398 return escape(args[i++]);
3403 return div.firstChild;
3407 * Check for suites that do not have elements
3408 * with `classname`, and hide them.
3410 * @param {text} classname
3412 function hideSuitesWithout(classname) {
3413 var suites = document.getElementsByClassName('suite');
3414 for (var i = 0; i < suites.length; i++) {
3415 var els = suites[i].getElementsByClassName(classname);
3417 suites[i].className += ' hidden';
3423 * Unhide .hidden suites.
3426 var els = document.getElementsByClassName('suite hidden');
3427 while (els.length > 0) {
3428 els[0].className = els[0].className.replace('suite hidden', 'suite');
3433 * Set an element's text contents.
3435 * @param {HTMLElement} el
3436 * @param {string} contents
3438 function text(el, contents) {
3439 if (el.textContent) {
3440 el.textContent = contents;
3442 el.innerText = contents;
3447 * Listen on `event` with callback `fn`.
3449 function on(el, event, fn) {
3450 if (el.addEventListener) {
3451 el.addEventListener(event, fn, false);
3453 el.attachEvent('on' + event, fn);
3457 HTML.browserOnly = true;
3459 }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
3460 },{"../browser/progress":3,"../runner":34,"../utils":38,"./base":17,"escape-string-regexp":49}],21:[function(require,module,exports){
3463 // Alias exports to a their normalized format Mocha#reporter to prevent a need
3464 // for dynamic (try/catch) requires, which Browserify doesn't handle.
3465 exports.Base = exports.base = require('./base');
3466 exports.Dot = exports.dot = require('./dot');
3467 exports.Doc = exports.doc = require('./doc');
3468 exports.TAP = exports.tap = require('./tap');
3469 exports.JSON = exports.json = require('./json');
3470 exports.HTML = exports.html = require('./html');
3471 exports.List = exports.list = require('./list');
3472 exports.Min = exports.min = require('./min');
3473 exports.Spec = exports.spec = require('./spec');
3474 exports.Nyan = exports.nyan = require('./nyan');
3475 exports.XUnit = exports.xunit = require('./xunit');
3476 exports.Markdown = exports.markdown = require('./markdown');
3477 exports.Progress = exports.progress = require('./progress');
3478 exports.Landing = exports.landing = require('./landing');
3479 exports.JSONStream = exports['json-stream'] = require('./json-stream');
3481 },{"./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){
3482 (function (process){
3485 * @module JSONStream
3488 * Module dependencies.
3491 var Base = require('./base');
3492 var constants = require('../runner').constants;
3493 var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
3494 var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
3495 var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
3496 var EVENT_RUN_END = constants.EVENT_RUN_END;
3499 * Expose `JSONStream`.
3502 exports = module.exports = JSONStream;
3505 * Constructs a new `JSONStream` reporter instance.
3509 * @memberof Mocha.reporters
3510 * @extends Mocha.reporters.Base
3511 * @param {Runner} runner - Instance triggers reporter actions.
3512 * @param {Object} [options] - runner options
3514 function JSONStream(runner, options) {
3515 Base.call(this, runner, options);
3518 var total = runner.total;
3520 runner.once(EVENT_RUN_BEGIN, function() {
3521 writeEvent(['start', {total: total}]);
3524 runner.on(EVENT_TEST_PASS, function(test) {
3525 writeEvent(['pass', clean(test)]);
3528 runner.on(EVENT_TEST_FAIL, function(test, err) {
3530 test.err = err.message;
3531 test.stack = err.stack || null;
3532 writeEvent(['fail', test]);
3535 runner.once(EVENT_RUN_END, function() {
3536 writeEvent(['end', self.stats]);
3541 * Mocha event to be written to the output stream.
3542 * @typedef {Array} JSONStream~MochaEvent
3546 * Writes Mocha event to reporter output stream.
3549 * @param {JSONStream~MochaEvent} event - Mocha event to be output.
3551 function writeEvent(event) {
3552 process.stdout.write(JSON.stringify(event) + '\n');
3556 * Returns an object literal representation of `test`
3557 * free of cyclic properties, etc.
3560 * @param {Test} test - Instance used as data source.
3561 * @return {Object} object containing pared-down test instance data
3563 function clean(test) {
3566 fullTitle: test.fullTitle(),
3567 duration: test.duration,
3568 currentRetry: test.currentRetry()
3572 JSONStream.description = 'newline delimited JSON events';
3574 }).call(this,require('_process'))
3575 },{"../runner":34,"./base":17,"_process":69}],23:[function(require,module,exports){
3576 (function (process){
3582 * Module dependencies.
3585 var Base = require('./base');
3586 var constants = require('../runner').constants;
3587 var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
3588 var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
3589 var EVENT_TEST_END = constants.EVENT_TEST_END;
3590 var EVENT_RUN_END = constants.EVENT_RUN_END;
3591 var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
3597 exports = module.exports = JSONReporter;
3600 * Constructs a new `JSON` reporter instance.
3604 * @memberof Mocha.reporters
3605 * @extends Mocha.reporters.Base
3606 * @param {Runner} runner - Instance triggers reporter actions.
3607 * @param {Object} [options] - runner options
3609 function JSONReporter(runner, options) {
3610 Base.call(this, runner, options);
3618 runner.on(EVENT_TEST_END, function(test) {
3622 runner.on(EVENT_TEST_PASS, function(test) {
3626 runner.on(EVENT_TEST_FAIL, function(test) {
3627 failures.push(test);
3630 runner.on(EVENT_TEST_PENDING, function(test) {
3634 runner.once(EVENT_RUN_END, function() {
3637 tests: tests.map(clean),
3638 pending: pending.map(clean),
3639 failures: failures.map(clean),
3640 passes: passes.map(clean)
3643 runner.testResults = obj;
3645 process.stdout.write(JSON.stringify(obj, null, 2));
3650 * Return a plain-object representation of `test`
3651 * free of cyclic properties etc.
3654 * @param {Object} test
3657 function clean(test) {
3658 var err = test.err || {};
3659 if (err instanceof Error) {
3660 err = errorJSON(err);
3665 fullTitle: test.fullTitle(),
3666 duration: test.duration,
3667 currentRetry: test.currentRetry(),
3668 err: cleanCycles(err)
3673 * Replaces any circular references inside `obj` with '[object Object]'
3676 * @param {Object} obj
3679 function cleanCycles(obj) {
3682 JSON.stringify(obj, function(key, value) {
3683 if (typeof value === 'object' && value !== null) {
3684 if (cache.indexOf(value) !== -1) {
3685 // Instead of going in a circle, we'll print [object Object]
3697 * Transform an Error object into a JSON object.
3700 * @param {Error} err
3703 function errorJSON(err) {
3705 Object.getOwnPropertyNames(err).forEach(function(key) {
3706 res[key] = err[key];
3711 JSONReporter.description = 'single JSON object';
3713 }).call(this,require('_process'))
3714 },{"../runner":34,"./base":17,"_process":69}],24:[function(require,module,exports){
3715 (function (process){
3721 * Module dependencies.
3724 var Base = require('./base');
3725 var inherits = require('../utils').inherits;
3726 var constants = require('../runner').constants;
3727 var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
3728 var EVENT_RUN_END = constants.EVENT_RUN_END;
3729 var EVENT_TEST_END = constants.EVENT_TEST_END;
3730 var STATE_FAILED = require('../runnable').constants.STATE_FAILED;
3732 var cursor = Base.cursor;
3733 var color = Base.color;
3739 exports = module.exports = Landing;
3745 Base.colors.plane = 0;
3748 * Airplane crash color.
3751 Base.colors['plane crash'] = 31;
3757 Base.colors.runway = 90;
3760 * Constructs a new `Landing` reporter instance.
3764 * @memberof Mocha.reporters
3765 * @extends Mocha.reporters.Base
3766 * @param {Runner} runner - Instance triggers reporter actions.
3767 * @param {Object} [options] - runner options
3769 function Landing(runner, options) {
3770 Base.call(this, runner, options);
3773 var width = (Base.window.width * 0.75) | 0;
3774 var total = runner.total;
3775 var stream = process.stdout;
3776 var plane = color('plane', '✈');
3781 var buf = Array(width).join('-');
3782 return ' ' + color('runway', buf);
3785 runner.on(EVENT_RUN_BEGIN, function() {
3786 stream.write('\n\n\n ');
3790 runner.on(EVENT_TEST_END, function(test) {
3791 // check if the plane crashed
3792 var col = crashed === -1 ? ((width * ++n) / total) | 0 : crashed;
3795 if (test.state === STATE_FAILED) {
3796 plane = color('plane crash', '✈');
3800 // render landing strip
3801 stream.write('\u001b[' + (width + 1) + 'D\u001b[2A');
3802 stream.write(runway());
3803 stream.write('\n ');
3804 stream.write(color('runway', Array(col).join('⋅')));
3805 stream.write(plane);
3806 stream.write(color('runway', Array(width - col).join('⋅') + '\n'));
3807 stream.write(runway());
3808 stream.write('\u001b[0m');
3811 runner.once(EVENT_RUN_END, function() {
3813 process.stdout.write('\n');
3819 * Inherit from `Base.prototype`.
3821 inherits(Landing, Base);
3823 Landing.description = 'Unicode landing strip';
3825 }).call(this,require('_process'))
3826 },{"../runnable":33,"../runner":34,"../utils":38,"./base":17,"_process":69}],25:[function(require,module,exports){
3827 (function (process){
3833 * Module dependencies.
3836 var Base = require('./base');
3837 var inherits = require('../utils').inherits;
3838 var constants = require('../runner').constants;
3839 var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
3840 var EVENT_RUN_END = constants.EVENT_RUN_END;
3841 var EVENT_TEST_BEGIN = constants.EVENT_TEST_BEGIN;
3842 var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
3843 var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
3844 var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
3845 var color = Base.color;
3846 var cursor = Base.cursor;
3852 exports = module.exports = List;
3855 * Constructs a new `List` reporter instance.
3859 * @memberof Mocha.reporters
3860 * @extends Mocha.reporters.Base
3861 * @param {Runner} runner - Instance triggers reporter actions.
3862 * @param {Object} [options] - runner options
3864 function List(runner, options) {
3865 Base.call(this, runner, options);
3870 runner.on(EVENT_RUN_BEGIN, function() {
3874 runner.on(EVENT_TEST_BEGIN, function(test) {
3875 process.stdout.write(color('pass', ' ' + test.fullTitle() + ': '));
3878 runner.on(EVENT_TEST_PENDING, function(test) {
3879 var fmt = color('checkmark', ' -') + color('pending', ' %s');
3880 Base.consoleLog(fmt, test.fullTitle());
3883 runner.on(EVENT_TEST_PASS, function(test) {
3885 color('checkmark', ' ' + Base.symbols.ok) +
3886 color('pass', ' %s: ') +
3887 color(test.speed, '%dms');
3889 Base.consoleLog(fmt, test.fullTitle(), test.duration);
3892 runner.on(EVENT_TEST_FAIL, function(test) {
3894 Base.consoleLog(color('fail', ' %d) %s'), ++n, test.fullTitle());
3897 runner.once(EVENT_RUN_END, self.epilogue.bind(self));
3901 * Inherit from `Base.prototype`.
3903 inherits(List, Base);
3905 List.description = 'like "spec" reporter but flat';
3907 }).call(this,require('_process'))
3908 },{"../runner":34,"../utils":38,"./base":17,"_process":69}],26:[function(require,module,exports){
3909 (function (process){
3915 * Module dependencies.
3918 var Base = require('./base');
3919 var utils = require('../utils');
3920 var constants = require('../runner').constants;
3921 var EVENT_RUN_END = constants.EVENT_RUN_END;
3922 var EVENT_SUITE_BEGIN = constants.EVENT_SUITE_BEGIN;
3923 var EVENT_SUITE_END = constants.EVENT_SUITE_END;
3924 var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
3930 var SUITE_PREFIX = '$';
3933 * Expose `Markdown`.
3936 exports = module.exports = Markdown;
3939 * Constructs a new `Markdown` reporter instance.
3943 * @memberof Mocha.reporters
3944 * @extends Mocha.reporters.Base
3945 * @param {Runner} runner - Instance triggers reporter actions.
3946 * @param {Object} [options] - runner options
3948 function Markdown(runner, options) {
3949 Base.call(this, runner, options);
3954 function title(str) {
3955 return Array(level).join('#') + ' ' + str;
3958 function mapTOC(suite, obj) {
3960 var key = SUITE_PREFIX + suite.title;
3962 obj = obj[key] = obj[key] || {suite: suite};
3963 suite.suites.forEach(function(suite) {
3970 function stringifyTOC(obj, level) {
3974 for (var key in obj) {
3975 if (key === 'suite') {
3978 if (key !== SUITE_PREFIX) {
3979 link = ' - [' + key.substring(1) + ']';
3980 link += '(#' + utils.slug(obj[key].suite.fullTitle()) + ')\n';
3981 buf += Array(level).join(' ') + link;
3983 buf += stringifyTOC(obj[key], level);
3988 function generateTOC(suite) {
3989 var obj = mapTOC(suite, {});
3990 return stringifyTOC(obj, 0);
3993 generateTOC(runner.suite);
3995 runner.on(EVENT_SUITE_BEGIN, function(suite) {
3997 var slug = utils.slug(suite.fullTitle());
3998 buf += '<a name="' + slug + '"></a>' + '\n';
3999 buf += title(suite.title) + '\n';
4002 runner.on(EVENT_SUITE_END, function() {
4006 runner.on(EVENT_TEST_PASS, function(test) {
4007 var code = utils.clean(test.body);
4008 buf += test.title + '.\n';
4014 runner.once(EVENT_RUN_END, function() {
4015 process.stdout.write('# TOC\n');
4016 process.stdout.write(generateTOC(runner.suite));
4017 process.stdout.write(buf);
4021 Markdown.description = 'GitHub Flavored Markdown';
4023 }).call(this,require('_process'))
4024 },{"../runner":34,"../utils":38,"./base":17,"_process":69}],27:[function(require,module,exports){
4025 (function (process){
4031 * Module dependencies.
4034 var Base = require('./base');
4035 var inherits = require('../utils').inherits;
4036 var constants = require('../runner').constants;
4037 var EVENT_RUN_END = constants.EVENT_RUN_END;
4038 var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
4044 exports = module.exports = Min;
4047 * Constructs a new `Min` reporter instance.
4050 * This minimal test reporter is best used with '--watch'.
4054 * @memberof Mocha.reporters
4055 * @extends Mocha.reporters.Base
4056 * @param {Runner} runner - Instance triggers reporter actions.
4057 * @param {Object} [options] - runner options
4059 function Min(runner, options) {
4060 Base.call(this, runner, options);
4062 runner.on(EVENT_RUN_BEGIN, function() {
4064 process.stdout.write('\u001b[2J');
4065 // set cursor position
4066 process.stdout.write('\u001b[1;3H');
4069 runner.once(EVENT_RUN_END, this.epilogue.bind(this));
4073 * Inherit from `Base.prototype`.
4075 inherits(Min, Base);
4077 Min.description = 'essentially just a summary';
4079 }).call(this,require('_process'))
4080 },{"../runner":34,"../utils":38,"./base":17,"_process":69}],28:[function(require,module,exports){
4081 (function (process){
4087 * Module dependencies.
4090 var Base = require('./base');
4091 var constants = require('../runner').constants;
4092 var inherits = require('../utils').inherits;
4093 var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
4094 var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
4095 var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
4096 var EVENT_RUN_END = constants.EVENT_RUN_END;
4097 var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
4103 exports = module.exports = NyanCat;
4106 * Constructs a new `Nyan` reporter instance.
4110 * @memberof Mocha.reporters
4111 * @extends Mocha.reporters.Base
4112 * @param {Runner} runner - Instance triggers reporter actions.
4113 * @param {Object} [options] - runner options
4115 function NyanCat(runner, options) {
4116 Base.call(this, runner, options);
4119 var width = (Base.window.width * 0.75) | 0;
4120 var nyanCatWidth = (this.nyanCatWidth = 11);
4122 this.colorIndex = 0;
4123 this.numberOfLines = 4;
4124 this.rainbowColors = self.generateColors();
4125 this.scoreboardWidth = 5;
4127 this.trajectories = [[], [], [], []];
4128 this.trajectoryWidthMax = width - nyanCatWidth;
4130 runner.on(EVENT_RUN_BEGIN, function() {
4135 runner.on(EVENT_TEST_PENDING, function() {
4139 runner.on(EVENT_TEST_PASS, function() {
4143 runner.on(EVENT_TEST_FAIL, function() {
4147 runner.once(EVENT_RUN_END, function() {
4149 for (var i = 0; i < self.numberOfLines; i++) {
4157 * Inherit from `Base.prototype`.
4159 inherits(NyanCat, Base);
4167 NyanCat.prototype.draw = function() {
4168 this.appendRainbow();
4169 this.drawScoreboard();
4172 this.tick = !this.tick;
4176 * Draw the "scoreboard" showing the number
4177 * of passes, failures and pending tests.
4182 NyanCat.prototype.drawScoreboard = function() {
4183 var stats = this.stats;
4185 function draw(type, n) {
4187 write(Base.color(type, n));
4191 draw('green', stats.passes);
4192 draw('fail', stats.failures);
4193 draw('pending', stats.pending);
4196 this.cursorUp(this.numberOfLines);
4200 * Append the rainbow.
4205 NyanCat.prototype.appendRainbow = function() {
4206 var segment = this.tick ? '_' : '-';
4207 var rainbowified = this.rainbowify(segment);
4209 for (var index = 0; index < this.numberOfLines; index++) {
4210 var trajectory = this.trajectories[index];
4211 if (trajectory.length >= this.trajectoryWidthMax) {
4214 trajectory.push(rainbowified);
4224 NyanCat.prototype.drawRainbow = function() {
4227 this.trajectories.forEach(function(line) {
4228 write('\u001b[' + self.scoreboardWidth + 'C');
4229 write(line.join(''));
4233 this.cursorUp(this.numberOfLines);
4241 NyanCat.prototype.drawNyanCat = function() {
4243 var startWidth = this.scoreboardWidth + this.trajectories[0].length;
4244 var dist = '\u001b[' + startWidth + 'C';
4252 padding = self.tick ? ' ' : ' ';
4253 write('_|' + padding + '/\\_/\\ ');
4257 padding = self.tick ? '_' : '__';
4258 var tail = self.tick ? '~' : '^';
4259 write(tail + '|' + padding + this.face() + ' ');
4263 padding = self.tick ? ' ' : ' ';
4264 write(padding + '"" "" ');
4267 this.cursorUp(this.numberOfLines);
4271 * Draw nyan cat face.
4277 NyanCat.prototype.face = function() {
4278 var stats = this.stats;
4279 if (stats.failures) {
4281 } else if (stats.pending) {
4283 } else if (stats.passes) {
4290 * Move cursor up `n`.
4296 NyanCat.prototype.cursorUp = function(n) {
4297 write('\u001b[' + n + 'A');
4301 * Move cursor down `n`.
4307 NyanCat.prototype.cursorDown = function(n) {
4308 write('\u001b[' + n + 'B');
4312 * Generate rainbow colors.
4317 NyanCat.prototype.generateColors = function() {
4320 for (var i = 0; i < 6 * 7; i++) {
4321 var pi3 = Math.floor(Math.PI / 3);
4322 var n = i * (1.0 / 6);
4323 var r = Math.floor(3 * Math.sin(n) + 3);
4324 var g = Math.floor(3 * Math.sin(n + 2 * pi3) + 3);
4325 var b = Math.floor(3 * Math.sin(n + 4 * pi3) + 3);
4326 colors.push(36 * r + 6 * g + b + 16);
4333 * Apply rainbow to the given `str`.
4336 * @param {string} str
4339 NyanCat.prototype.rainbowify = function(str) {
4340 if (!Base.useColors) {
4343 var color = this.rainbowColors[this.colorIndex % this.rainbowColors.length];
4344 this.colorIndex += 1;
4345 return '\u001b[38;5;' + color + 'm' + str + '\u001b[0m';
4351 * @param {string} string A message to write to stdout.
4353 function write(string) {
4354 process.stdout.write(string);
4357 NyanCat.description = '"nyan cat"';
4359 }).call(this,require('_process'))
4360 },{"../runner":34,"../utils":38,"./base":17,"_process":69}],29:[function(require,module,exports){
4361 (function (process){
4367 * Module dependencies.
4370 var Base = require('./base');
4371 var constants = require('../runner').constants;
4372 var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
4373 var EVENT_TEST_END = constants.EVENT_TEST_END;
4374 var EVENT_RUN_END = constants.EVENT_RUN_END;
4375 var inherits = require('../utils').inherits;
4376 var color = Base.color;
4377 var cursor = Base.cursor;
4380 * Expose `Progress`.
4383 exports = module.exports = Progress;
4386 * General progress bar color.
4389 Base.colors.progress = 90;
4392 * Constructs a new `Progress` reporter instance.
4396 * @memberof Mocha.reporters
4397 * @extends Mocha.reporters.Base
4398 * @param {Runner} runner - Instance triggers reporter actions.
4399 * @param {Object} [options] - runner options
4401 function Progress(runner, options) {
4402 Base.call(this, runner, options);
4405 var width = (Base.window.width * 0.5) | 0;
4406 var total = runner.total;
4411 options = options || {};
4412 var reporterOptions = options.reporterOptions || {};
4414 options.open = reporterOptions.open || '[';
4415 options.complete = reporterOptions.complete || '▬';
4416 options.incomplete = reporterOptions.incomplete || Base.symbols.dot;
4417 options.close = reporterOptions.close || ']';
4418 options.verbose = reporterOptions.verbose || false;
4421 runner.on(EVENT_RUN_BEGIN, function() {
4422 process.stdout.write('\n');
4427 runner.on(EVENT_TEST_END, function() {
4430 var percent = complete / total;
4431 var n = (width * percent) | 0;
4434 if (n === lastN && !options.verbose) {
4435 // Don't re-render the line if it hasn't changed
4441 process.stdout.write('\u001b[J');
4442 process.stdout.write(color('progress', ' ' + options.open));
4443 process.stdout.write(Array(n).join(options.complete));
4444 process.stdout.write(Array(i).join(options.incomplete));
4445 process.stdout.write(color('progress', options.close));
4446 if (options.verbose) {
4447 process.stdout.write(color('progress', ' ' + complete + ' of ' + total));
4451 // tests are complete, output some stats
4452 // and the failures if any
4453 runner.once(EVENT_RUN_END, function() {
4455 process.stdout.write('\n');
4461 * Inherit from `Base.prototype`.
4463 inherits(Progress, Base);
4465 Progress.description = 'a progress bar';
4467 }).call(this,require('_process'))
4468 },{"../runner":34,"../utils":38,"./base":17,"_process":69}],30:[function(require,module,exports){
4474 * Module dependencies.
4477 var Base = require('./base');
4478 var constants = require('../runner').constants;
4479 var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
4480 var EVENT_RUN_END = constants.EVENT_RUN_END;
4481 var EVENT_SUITE_BEGIN = constants.EVENT_SUITE_BEGIN;
4482 var EVENT_SUITE_END = constants.EVENT_SUITE_END;
4483 var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
4484 var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
4485 var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
4486 var inherits = require('../utils').inherits;
4487 var color = Base.color;
4493 exports = module.exports = Spec;
4496 * Constructs a new `Spec` reporter instance.
4500 * @memberof Mocha.reporters
4501 * @extends Mocha.reporters.Base
4502 * @param {Runner} runner - Instance triggers reporter actions.
4503 * @param {Object} [options] - runner options
4505 function Spec(runner, options) {
4506 Base.call(this, runner, options);
4513 return Array(indents).join(' ');
4516 runner.on(EVENT_RUN_BEGIN, function() {
4520 runner.on(EVENT_SUITE_BEGIN, function(suite) {
4522 Base.consoleLog(color('suite', '%s%s'), indent(), suite.title);
4525 runner.on(EVENT_SUITE_END, function() {
4527 if (indents === 1) {
4532 runner.on(EVENT_TEST_PENDING, function(test) {
4533 var fmt = indent() + color('pending', ' - %s');
4534 Base.consoleLog(fmt, test.title);
4537 runner.on(EVENT_TEST_PASS, function(test) {
4539 if (test.speed === 'fast') {
4542 color('checkmark', ' ' + Base.symbols.ok) +
4543 color('pass', ' %s');
4544 Base.consoleLog(fmt, test.title);
4548 color('checkmark', ' ' + Base.symbols.ok) +
4549 color('pass', ' %s') +
4550 color(test.speed, ' (%dms)');
4551 Base.consoleLog(fmt, test.title, test.duration);
4555 runner.on(EVENT_TEST_FAIL, function(test) {
4556 Base.consoleLog(indent() + color('fail', ' %d) %s'), ++n, test.title);
4559 runner.once(EVENT_RUN_END, self.epilogue.bind(self));
4563 * Inherit from `Base.prototype`.
4565 inherits(Spec, Base);
4567 Spec.description = 'hierarchical & verbose [default]';
4569 },{"../runner":34,"../utils":38,"./base":17}],31:[function(require,module,exports){
4570 (function (process){
4576 * Module dependencies.
4579 var util = require('util');
4580 var Base = require('./base');
4581 var constants = require('../runner').constants;
4582 var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
4583 var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
4584 var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
4585 var EVENT_RUN_END = constants.EVENT_RUN_END;
4586 var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
4587 var EVENT_TEST_END = constants.EVENT_TEST_END;
4588 var inherits = require('../utils').inherits;
4589 var sprintf = util.format;
4595 exports = module.exports = TAP;
4598 * Constructs a new `TAP` reporter instance.
4602 * @memberof Mocha.reporters
4603 * @extends Mocha.reporters.Base
4604 * @param {Runner} runner - Instance triggers reporter actions.
4605 * @param {Object} [options] - runner options
4607 function TAP(runner, options) {
4608 Base.call(this, runner, options);
4613 var tapVersion = '12';
4614 if (options && options.reporterOptions) {
4615 if (options.reporterOptions.tapVersion) {
4616 tapVersion = options.reporterOptions.tapVersion.toString();
4620 this._producer = createProducer(tapVersion);
4622 runner.once(EVENT_RUN_BEGIN, function() {
4623 var ntests = runner.grepTotal(runner.suite);
4624 self._producer.writeVersion();
4625 self._producer.writePlan(ntests);
4628 runner.on(EVENT_TEST_END, function() {
4632 runner.on(EVENT_TEST_PENDING, function(test) {
4633 self._producer.writePending(n, test);
4636 runner.on(EVENT_TEST_PASS, function(test) {
4637 self._producer.writePass(n, test);
4640 runner.on(EVENT_TEST_FAIL, function(test, err) {
4641 self._producer.writeFail(n, test, err);
4644 runner.once(EVENT_RUN_END, function() {
4645 self._producer.writeEpilogue(runner.stats);
4650 * Inherit from `Base.prototype`.
4652 inherits(TAP, Base);
4655 * Returns a TAP-safe title of `test`.
4658 * @param {Test} test - Test instance.
4659 * @return {String} title with any hash character removed
4661 function title(test) {
4662 return test.fullTitle().replace(/#/g, '');
4666 * Writes newline-terminated formatted string to reporter output stream.
4669 * @param {string} format - `printf`-like format string
4670 * @param {...*} [varArgs] - Format string arguments
4672 function println(format, varArgs) {
4673 var vargs = Array.from(arguments);
4675 process.stdout.write(sprintf.apply(null, vargs));
4679 * Returns a `tapVersion`-appropriate TAP producer instance, if possible.
4682 * @param {string} tapVersion - Version of TAP specification to produce.
4683 * @returns {TAPProducer} specification-appropriate instance
4684 * @throws {Error} if specification version has no associated producer.
4686 function createProducer(tapVersion) {
4688 '12': new TAP12Producer(),
4689 '13': new TAP13Producer()
4691 var producer = producers[tapVersion];
4695 'invalid or unsupported TAP version: ' + JSON.stringify(tapVersion)
4704 * Constructs a new TAPProducer.
4707 * <em>Only</em> to be used as an abstract base class.
4712 function TAPProducer() {}
4715 * Writes the TAP version to reporter output stream.
4719 TAPProducer.prototype.writeVersion = function() {};
4722 * Writes the plan to reporter output stream.
4725 * @param {number} ntests - Number of tests that are planned to run.
4727 TAPProducer.prototype.writePlan = function(ntests) {
4728 println('%d..%d', 1, ntests);
4732 * Writes that test passed to reporter output stream.
4735 * @param {number} n - Index of test that passed.
4736 * @param {Test} test - Instance containing test information.
4738 TAPProducer.prototype.writePass = function(n, test) {
4739 println('ok %d %s', n, title(test));
4743 * Writes that test was skipped to reporter output stream.
4746 * @param {number} n - Index of test that was skipped.
4747 * @param {Test} test - Instance containing test information.
4749 TAPProducer.prototype.writePending = function(n, test) {
4750 println('ok %d %s # SKIP -', n, title(test));
4754 * Writes that test failed to reporter output stream.
4757 * @param {number} n - Index of test that failed.
4758 * @param {Test} test - Instance containing test information.
4759 * @param {Error} err - Reason the test failed.
4761 TAPProducer.prototype.writeFail = function(n, test, err) {
4762 println('not ok %d %s', n, title(test));
4766 * Writes the summary epilogue to reporter output stream.
4769 * @param {Object} stats - Object containing run statistics.
4771 TAPProducer.prototype.writeEpilogue = function(stats) {
4772 // :TBD: Why is this not counting pending tests?
4773 println('# tests ' + (stats.passes + stats.failures));
4774 println('# pass ' + stats.passes);
4775 // :TBD: Why are we not showing pending results?
4776 println('# fail ' + stats.failures);
4781 * Constructs a new TAP12Producer.
4784 * Produces output conforming to the TAP12 specification.
4788 * @extends TAPProducer
4789 * @see {@link https://testanything.org/tap-specification.html|Specification}
4791 function TAP12Producer() {
4793 * Writes that test failed to reporter output stream, with error formatting.
4796 this.writeFail = function(n, test, err) {
4797 TAPProducer.prototype.writeFail.call(this, n, test, err);
4799 println(err.message.replace(/^/gm, ' '));
4802 println(err.stack.replace(/^/gm, ' '));
4808 * Inherit from `TAPProducer.prototype`.
4810 inherits(TAP12Producer, TAPProducer);
4814 * Constructs a new TAP13Producer.
4817 * Produces output conforming to the TAP13 specification.
4821 * @extends TAPProducer
4822 * @see {@link https://testanything.org/tap-version-13-specification.html|Specification}
4824 function TAP13Producer() {
4826 * Writes the TAP version to reporter output stream.
4829 this.writeVersion = function() {
4830 println('TAP version 13');
4834 * Writes that test failed to reporter output stream, with error formatting.
4837 this.writeFail = function(n, test, err) {
4838 TAPProducer.prototype.writeFail.call(this, n, test, err);
4839 var emitYamlBlock = err.message != null || err.stack != null;
4840 if (emitYamlBlock) {
4841 println(indent(1) + '---');
4843 println(indent(2) + 'message: |-');
4844 println(err.message.replace(/^/gm, indent(3)));
4847 println(indent(2) + 'stack: |-');
4848 println(err.stack.replace(/^/gm, indent(3)));
4850 println(indent(1) + '...');
4854 function indent(level) {
4855 return Array(level + 1).join(' ');
4860 * Inherit from `TAPProducer.prototype`.
4862 inherits(TAP13Producer, TAPProducer);
4864 TAP.description = 'TAP-compatible output';
4866 }).call(this,require('_process'))
4867 },{"../runner":34,"../utils":38,"./base":17,"_process":69,"util":89}],32:[function(require,module,exports){
4868 (function (process,global){
4874 * Module dependencies.
4877 var Base = require('./base');
4878 var utils = require('../utils');
4879 var fs = require('fs');
4880 var mkdirp = require('mkdirp');
4881 var path = require('path');
4882 var errors = require('../errors');
4883 var createUnsupportedError = errors.createUnsupportedError;
4884 var constants = require('../runner').constants;
4885 var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
4886 var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
4887 var EVENT_RUN_END = constants.EVENT_RUN_END;
4888 var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
4889 var STATE_FAILED = require('../runnable').constants.STATE_FAILED;
4890 var inherits = utils.inherits;
4891 var escape = utils.escape;
4894 * Save timer references to avoid Sinon interfering (see GH-237).
4896 var Date = global.Date;
4902 exports = module.exports = XUnit;
4905 * Constructs a new `XUnit` reporter instance.
4909 * @memberof Mocha.reporters
4910 * @extends Mocha.reporters.Base
4911 * @param {Runner} runner - Instance triggers reporter actions.
4912 * @param {Object} [options] - runner options
4914 function XUnit(runner, options) {
4915 Base.call(this, runner, options);
4917 var stats = this.stats;
4921 // the name of the test suite, as it will appear in the resulting XML file
4924 // the default name of the test suite if none is provided
4925 var DEFAULT_SUITE_NAME = 'Mocha Tests';
4927 if (options && options.reporterOptions) {
4928 if (options.reporterOptions.output) {
4929 if (!fs.createWriteStream) {
4930 throw createUnsupportedError('file output not supported in browser');
4933 mkdirp.sync(path.dirname(options.reporterOptions.output));
4934 self.fileStream = fs.createWriteStream(options.reporterOptions.output);
4937 // get the suite name from the reporter options (if provided)
4938 suiteName = options.reporterOptions.suiteName;
4941 // fall back to the default suite name
4942 suiteName = suiteName || DEFAULT_SUITE_NAME;
4944 runner.on(EVENT_TEST_PENDING, function(test) {
4948 runner.on(EVENT_TEST_PASS, function(test) {
4952 runner.on(EVENT_TEST_FAIL, function(test) {
4956 runner.once(EVENT_RUN_END, function() {
4964 errors: stats.failures,
4965 skipped: stats.tests - stats.failures - stats.passes,
4966 timestamp: new Date().toUTCString(),
4967 time: stats.duration / 1000 || 0
4973 tests.forEach(function(t) {
4977 self.write('</testsuite>');
4982 * Inherit from `Base.prototype`.
4984 inherits(XUnit, Base);
4987 * Override done to close the stream (if it's a file).
4990 * @param {Function} fn
4992 XUnit.prototype.done = function(failures, fn) {
4993 if (this.fileStream) {
4994 this.fileStream.end(function() {
5003 * Write out the given line.
5005 * @param {string} line
5007 XUnit.prototype.write = function(line) {
5008 if (this.fileStream) {
5009 this.fileStream.write(line + '\n');
5010 } else if (typeof process === 'object' && process.stdout) {
5011 process.stdout.write(line + '\n');
5013 Base.consoleLog(line);
5018 * Output tag for the given `test.`
5020 * @param {Test} test
5022 XUnit.prototype.test = function(test) {
5023 Base.useColors = false;
5026 classname: test.parent.fullTitle(),
5028 time: test.duration / 1000 || 0
5031 if (test.state === STATE_FAILED) {
5034 !Base.hideDiff && Base.showDiff(err)
5035 ? '\n' + Base.generateDiff(err.actual, err.expected)
5046 escape(err.message) + escape(diff) + '\n' + escape(err.stack)
5050 } else if (test.isPending()) {
5051 this.write(tag('testcase', attrs, false, tag('skipped', {}, true)));
5053 this.write(tag('testcase', attrs, true));
5066 function tag(name, attrs, close, content) {
5067 var end = close ? '/>' : '>';
5071 for (var key in attrs) {
5072 if (Object.prototype.hasOwnProperty.call(attrs, key)) {
5073 pairs.push(key + '="' + escape(attrs[key]) + '"');
5077 tag = '<' + name + (pairs.length ? ' ' + pairs.join(' ') : '') + end;
5079 tag += content + '</' + name + end;
5084 XUnit.description = 'XUnit-compatible XML output';
5086 }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
5087 },{"../errors":6,"../runnable":33,"../runner":34,"../utils":38,"./base":17,"_process":69,"fs":42,"mkdirp":59,"path":42}],33:[function(require,module,exports){
5091 var EventEmitter = require('events').EventEmitter;
5092 var Pending = require('./pending');
5093 var debug = require('debug')('mocha:runnable');
5094 var milliseconds = require('ms');
5095 var utils = require('./utils');
5096 var createInvalidExceptionError = require('./errors')
5097 .createInvalidExceptionError;
5100 * Save timer references to avoid Sinon interfering (see GH-237).
5102 var Date = global.Date;
5103 var setTimeout = global.setTimeout;
5104 var clearTimeout = global.clearTimeout;
5105 var toString = Object.prototype.toString;
5107 module.exports = Runnable;
5110 * Initialize a new `Runnable` with the given `title` and callback `fn`.
5113 * @extends external:EventEmitter
5115 * @param {String} title
5116 * @param {Function} fn
5118 function Runnable(title, fn) {
5121 this.body = (fn || '').toString();
5122 this.async = fn && fn.length;
5123 this.sync = !this.async;
5124 this._timeout = 2000;
5126 this._enableTimeouts = true;
5127 this.timedOut = false;
5129 this._currentRetry = 0;
5130 this.pending = false;
5134 * Inherit from `EventEmitter.prototype`.
5136 utils.inherits(Runnable, EventEmitter);
5139 * Get current timeout value in msecs.
5142 * @returns {number} current timeout threshold value
5146 * Set timeout threshold value (msecs).
5149 * A string argument can use shorthand (e.g., "2s") and will be converted.
5150 * The value will be clamped to range [<code>0</code>, <code>2^<sup>31</sup>-1</code>].
5151 * If clamped value matches either range endpoint, timeouts will be disabled.
5154 * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout#Maximum_delay_value}
5155 * @param {number|string} ms - Timeout threshold value.
5156 * @returns {Runnable} this
5159 Runnable.prototype.timeout = function(ms) {
5160 if (!arguments.length) {
5161 return this._timeout;
5163 if (typeof ms === 'string') {
5164 ms = milliseconds(ms);
5168 var INT_MAX = Math.pow(2, 31) - 1;
5169 var range = [0, INT_MAX];
5170 ms = utils.clamp(ms, range);
5172 // see #1652 for reasoning
5173 if (ms === range[0] || ms === range[1]) {
5174 this._enableTimeouts = false;
5176 debug('timeout %d', ms);
5179 this.resetTimeout();
5185 * Set or get slow `ms`.
5188 * @param {number|string} ms
5189 * @return {Runnable|number} ms or Runnable instance.
5191 Runnable.prototype.slow = function(ms) {
5192 if (!arguments.length || typeof ms === 'undefined') {
5195 if (typeof ms === 'string') {
5196 ms = milliseconds(ms);
5198 debug('slow %d', ms);
5204 * Set and get whether timeout is `enabled`.
5207 * @param {boolean} enabled
5208 * @return {Runnable|boolean} enabled or Runnable instance.
5210 Runnable.prototype.enableTimeouts = function(enabled) {
5211 if (!arguments.length) {
5212 return this._enableTimeouts;
5214 debug('enableTimeouts %s', enabled);
5215 this._enableTimeouts = enabled;
5220 * Halt and mark as pending.
5222 * @memberof Mocha.Runnable
5225 Runnable.prototype.skip = function() {
5226 this.pending = true;
5227 throw new Pending('sync skip; aborting execution');
5231 * Check if this runnable or its parent suite is marked as pending.
5235 Runnable.prototype.isPending = function() {
5236 return this.pending || (this.parent && this.parent.isPending());
5240 * Return `true` if this Runnable has failed.
5244 Runnable.prototype.isFailed = function() {
5245 return !this.isPending() && this.state === constants.STATE_FAILED;
5249 * Return `true` if this Runnable has passed.
5253 Runnable.prototype.isPassed = function() {
5254 return !this.isPending() && this.state === constants.STATE_PASSED;
5258 * Set or get number of retries.
5262 Runnable.prototype.retries = function(n) {
5263 if (!arguments.length) {
5264 return this._retries;
5270 * Set or get current retry
5274 Runnable.prototype.currentRetry = function(n) {
5275 if (!arguments.length) {
5276 return this._currentRetry;
5278 this._currentRetry = n;
5282 * Return the full title generated by recursively concatenating the parent's
5285 * @memberof Mocha.Runnable
5289 Runnable.prototype.fullTitle = function() {
5290 return this.titlePath().join(' ');
5294 * Return the title path generated by concatenating the parent's title path with the title.
5296 * @memberof Mocha.Runnable
5300 Runnable.prototype.titlePath = function() {
5301 return this.parent.titlePath().concat([this.title]);
5305 * Clear the timeout.
5309 Runnable.prototype.clearTimeout = function() {
5310 clearTimeout(this.timer);
5314 * Inspect the runnable void of private properties.
5319 Runnable.prototype.inspect = function() {
5320 return JSON.stringify(
5322 function(key, val) {
5323 if (key[0] === '_') {
5326 if (key === 'parent') {
5329 if (key === 'ctx') {
5330 return '#<Context>';
5339 * Reset the timeout.
5343 Runnable.prototype.resetTimeout = function() {
5345 var ms = this.timeout() || 1e9;
5347 if (!this._enableTimeouts) {
5350 this.clearTimeout();
5351 this.timer = setTimeout(function() {
5352 if (!self._enableTimeouts) {
5355 self.callback(self._timeoutError(ms));
5356 self.timedOut = true;
5361 * Set or get a list of whitelisted globals for this test run.
5364 * @param {string[]} globals
5366 Runnable.prototype.globals = function(globals) {
5367 if (!arguments.length) {
5368 return this._allowedGlobals;
5370 this._allowedGlobals = globals;
5374 * Run the test and invoke `fn(err)`.
5376 * @param {Function} fn
5379 Runnable.prototype.run = function(fn) {
5381 var start = new Date();
5386 // Sometimes the ctx exists, but it is not runnable
5387 if (ctx && ctx.runnable) {
5391 // called multiple times
5392 function multiple(err) {
5397 var msg = 'done() called multiple times';
5398 if (err && err.message) {
5399 err.message += " (and Mocha's " + msg + ')';
5400 self.emit('error', err);
5402 self.emit('error', new Error(msg));
5407 function done(err) {
5408 var ms = self.timeout();
5409 if (self.timedOut) {
5414 return multiple(err);
5417 self.clearTimeout();
5418 self.duration = new Date() - start;
5420 if (!err && self.duration > ms && self._enableTimeouts) {
5421 err = self._timeoutError(ms);
5426 // for .resetTimeout() and Runner#uncaught()
5427 this.callback = done;
5429 if (this.fn && typeof this.fn.call !== 'function') {
5432 'A runnable must be passed a function as its second argument.'
5438 // explicit async with `done` argument
5440 this.resetTimeout();
5442 // allows skip() to be used in an explicit async context
5443 this.skip = function asyncSkip() {
5444 this.pending = true;
5446 // halt execution, the uncaught handler will ignore the failure.
5447 throw new Pending('async skip; aborting execution');
5451 callFnAsync(this.fn);
5453 // handles async runnables which actually run synchronously
5455 if (err instanceof Pending) {
5456 return; // done() is already called in this.skip()
5457 } else if (this.allowUncaught) {
5460 done(Runnable.toValueOrError(err));
5465 // sync or promise-returning
5467 if (this.isPending()) {
5474 if (err instanceof Pending) {
5476 } else if (this.allowUncaught) {
5479 done(Runnable.toValueOrError(err));
5482 function callFn(fn) {
5483 var result = fn.call(ctx);
5484 if (result && typeof result.then === 'function') {
5485 self.resetTimeout();
5489 // Return null so libraries like bluebird do not warn about
5490 // subsequently constructed Promises.
5494 done(reason || new Error('Promise rejected with no or falsy reason'));
5498 if (self.asyncOnly) {
5501 '--async-only option in use without declaring `done()` or returning a promise'
5510 function callFnAsync(fn) {
5511 var result = fn.call(ctx, function(err) {
5512 if (err instanceof Error || toString.call(err) === '[object Error]') {
5516 if (Object.prototype.toString.call(err) === '[object Object]') {
5518 new Error('done() invoked with non-Error: ' + JSON.stringify(err))
5521 return done(new Error('done() invoked with non-Error: ' + err));
5523 if (result && utils.isPromise(result)) {
5526 'Resolution method is overspecified. Specify a callback *or* return a Promise; not both.'
5537 * Instantiates a "timeout" error
5539 * @param {number} ms - Timeout (in milliseconds)
5540 * @returns {Error} a "timeout" error
5543 Runnable.prototype._timeoutError = function(ms) {
5547 'ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.';
5549 msg += ' (' + this.file + ')';
5551 return new Error(msg);
5554 var constants = utils.defineConstants(
5556 * {@link Runnable}-related constants.
5558 * @memberof Runnable
5566 * Value of `state` prop when a `Runnable` has failed
5568 STATE_FAILED: 'failed',
5570 * Value of `state` prop when a `Runnable` has passed
5572 STATE_PASSED: 'passed'
5577 * Given `value`, return identity if truthy, otherwise create an "invalid exception" error and return that.
5578 * @param {*} [value] - Value to return, if present
5579 * @returns {*|Error} `value`, otherwise an `Error`
5582 Runnable.toValueOrError = function(value) {
5585 createInvalidExceptionError(
5586 'Runnable failed with falsy or undefined exception. Please throw an Error instead.',
5592 Runnable.constants = constants;
5594 }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
5595 },{"./errors":6,"./pending":16,"./utils":38,"debug":45,"events":50,"ms":60}],34:[function(require,module,exports){
5596 (function (process,global){
5600 * Module dependencies.
5602 var util = require('util');
5603 var EventEmitter = require('events').EventEmitter;
5604 var Pending = require('./pending');
5605 var utils = require('./utils');
5606 var inherits = utils.inherits;
5607 var debug = require('debug')('mocha:runner');
5608 var Runnable = require('./runnable');
5609 var Suite = require('./suite');
5610 var HOOK_TYPE_BEFORE_EACH = Suite.constants.HOOK_TYPE_BEFORE_EACH;
5611 var HOOK_TYPE_AFTER_EACH = Suite.constants.HOOK_TYPE_AFTER_EACH;
5612 var HOOK_TYPE_AFTER_ALL = Suite.constants.HOOK_TYPE_AFTER_ALL;
5613 var HOOK_TYPE_BEFORE_ALL = Suite.constants.HOOK_TYPE_BEFORE_ALL;
5614 var EVENT_ROOT_SUITE_RUN = Suite.constants.EVENT_ROOT_SUITE_RUN;
5615 var STATE_FAILED = Runnable.constants.STATE_FAILED;
5616 var STATE_PASSED = Runnable.constants.STATE_PASSED;
5617 var dQuote = utils.dQuote;
5618 var ngettext = utils.ngettext;
5619 var sQuote = utils.sQuote;
5620 var stackFilter = utils.stackTraceFilter();
5621 var stringify = utils.stringify;
5622 var type = utils.type;
5623 var errors = require('./errors');
5624 var createInvalidExceptionError = errors.createInvalidExceptionError;
5625 var createUnsupportedError = errors.createUnsupportedError;
5628 * Non-enumerable globals.
5642 var constants = utils.defineConstants(
5644 * {@link Runner}-related constants.
5654 * Emitted when {@link Hook} execution begins
5656 EVENT_HOOK_BEGIN: 'hook',
5658 * Emitted when {@link Hook} execution ends
5660 EVENT_HOOK_END: 'hook end',
5662 * Emitted when Root {@link Suite} execution begins (all files have been parsed and hooks/tests are ready for execution)
5664 EVENT_RUN_BEGIN: 'start',
5666 * Emitted when Root {@link Suite} execution has been delayed via `delay` option
5668 EVENT_DELAY_BEGIN: 'waiting',
5670 * Emitted when delayed Root {@link Suite} execution is triggered by user via `global.run()`
5672 EVENT_DELAY_END: 'ready',
5674 * Emitted when Root {@link Suite} execution ends
5676 EVENT_RUN_END: 'end',
5678 * Emitted when {@link Suite} execution begins
5680 EVENT_SUITE_BEGIN: 'suite',
5682 * Emitted when {@link Suite} execution ends
5684 EVENT_SUITE_END: 'suite end',
5686 * Emitted when {@link Test} execution begins
5688 EVENT_TEST_BEGIN: 'test',
5690 * Emitted when {@link Test} execution ends
5692 EVENT_TEST_END: 'test end',
5694 * Emitted when {@link Test} execution fails
5696 EVENT_TEST_FAIL: 'fail',
5698 * Emitted when {@link Test} execution succeeds
5700 EVENT_TEST_PASS: 'pass',
5702 * Emitted when {@link Test} becomes pending
5704 EVENT_TEST_PENDING: 'pending',
5706 * Emitted when {@link Test} execution has failed, but will retry
5708 EVENT_TEST_RETRY: 'retry'
5712 module.exports = Runner;
5715 * Initialize a `Runner` at the Root {@link Suite}, which represents a hierarchy of {@link Suite|Suites} and {@link Test|Tests}.
5717 * @extends external:EventEmitter
5720 * @param {Suite} suite Root suite
5721 * @param {boolean} [delay] Whether or not to delay execution of root suite
5724 function Runner(suite, delay) {
5727 this._abort = false;
5728 this._delay = delay;
5730 this.started = false;
5731 this.total = suite.total();
5733 this.on(constants.EVENT_TEST_END, function(test) {
5734 if (test.retriedTest() && test.parent) {
5736 test.parent.tests && test.parent.tests.indexOf(test.retriedTest());
5737 if (idx > -1) test.parent.tests[idx] = test;
5739 self.checkGlobals(test);
5741 this.on(constants.EVENT_HOOK_END, function(hook) {
5742 self.checkGlobals(hook);
5744 this._defaultGrep = /.*/;
5745 this.grep(this._defaultGrep);
5746 this.globals(this.globalProps());
5750 * Wrapper for setImmediate, process.nextTick, or browser polyfill.
5752 * @param {Function} fn
5755 Runner.immediately = global.setImmediate || process.nextTick;
5758 * Inherit from `EventEmitter.prototype`.
5760 inherits(Runner, EventEmitter);
5763 * Run tests with full titles matching `re`. Updates runner.total
5764 * with number of tests matched.
5768 * @param {RegExp} re
5769 * @param {boolean} invert
5770 * @return {Runner} Runner instance.
5772 Runner.prototype.grep = function(re, invert) {
5773 debug('grep %s', re);
5775 this._invert = invert;
5776 this.total = this.grepTotal(this.suite);
5781 * Returns the number of tests matching the grep search for the
5786 * @param {Suite} suite
5789 Runner.prototype.grepTotal = function(suite) {
5793 suite.eachTest(function(test) {
5794 var match = self._grep.test(test.fullTitle());
5807 * Return a list of global properties.
5812 Runner.prototype.globalProps = function() {
5813 var props = Object.keys(global);
5816 for (var i = 0; i < globals.length; ++i) {
5817 if (~props.indexOf(globals[i])) {
5820 props.push(globals[i]);
5827 * Allow the given `arr` of globals.
5831 * @param {Array} arr
5832 * @return {Runner} Runner instance.
5834 Runner.prototype.globals = function(arr) {
5835 if (!arguments.length) {
5836 return this._globals;
5838 debug('globals %j', arr);
5839 this._globals = this._globals.concat(arr);
5844 * Check for global variable leaks.
5848 Runner.prototype.checkGlobals = function(test) {
5849 if (!this.checkLeaks) {
5852 var ok = this._globals;
5854 var globals = this.globalProps();
5858 ok = ok.concat(test._allowedGlobals || []);
5861 if (this.prevGlobalsLength === globals.length) {
5864 this.prevGlobalsLength = globals.length;
5866 leaks = filterLeaks(ok, globals);
5867 this._globals = this._globals.concat(leaks);
5870 var format = ngettext(
5872 'global leak detected: %s',
5873 'global leaks detected: %s'
5875 var error = new Error(util.format(format, leaks.map(sQuote).join(', ')));
5876 this.fail(test, error);
5881 * Fail the given `test`.
5884 * @param {Test} test
5885 * @param {Error} err
5887 Runner.prototype.fail = function(test, err) {
5888 if (test.isPending()) {
5893 test.state = STATE_FAILED;
5895 if (!isError(err)) {
5896 err = thrown2Error(err);
5901 this.fullStackTrace || !err.stack ? err.stack : stackFilter(err.stack);
5903 // some environments do not take kindly to monkeying with the stack
5906 this.emit(constants.EVENT_TEST_FAIL, test, err);
5910 * Fail the given `hook` with `err`.
5912 * Hook failures work in the following pattern:
5913 * - If bail, run corresponding `after each` and `after` hooks,
5915 * - Failed `before` hook skips all tests in a suite and subsuites,
5916 * but jumps to corresponding `after` hook
5917 * - Failed `before each` hook skips remaining tests in a
5918 * suite and jumps to corresponding `after each` hook,
5919 * which is run only once
5920 * - Failed `after` hook does not alter execution order
5921 * - Failed `after each` hook skips remaining tests in a
5922 * suite and subsuites, but executes other `after each`
5926 * @param {Hook} hook
5927 * @param {Error} err
5929 Runner.prototype.failHook = function(hook, err) {
5930 hook.originalTitle = hook.originalTitle || hook.title;
5931 if (hook.ctx && hook.ctx.currentTest) {
5933 hook.originalTitle + ' for ' + dQuote(hook.ctx.currentTest.title);
5936 if (hook.parent.title) {
5937 parentTitle = hook.parent.title;
5939 parentTitle = hook.parent.root ? '{root}' : '';
5941 hook.title = hook.originalTitle + ' in ' + dQuote(parentTitle);
5944 this.fail(hook, err);
5948 * Run hook `name` callbacks and then invoke `fn()`.
5951 * @param {string} name
5952 * @param {Function} fn
5955 Runner.prototype.hook = function(name, fn) {
5956 var suite = this.suite;
5957 var hooks = suite.getHooks(name);
5961 var hook = hooks[i];
5965 self.currentRunnable = hook;
5967 if (name === HOOK_TYPE_BEFORE_ALL) {
5968 hook.ctx.currentTest = hook.parent.tests[0];
5969 } else if (name === HOOK_TYPE_AFTER_ALL) {
5970 hook.ctx.currentTest = hook.parent.tests[hook.parent.tests.length - 1];
5972 hook.ctx.currentTest = self.test;
5975 hook.allowUncaught = self.allowUncaught;
5977 self.emit(constants.EVENT_HOOK_BEGIN, hook);
5979 if (!hook.listeners('error').length) {
5980 hook.on('error', function(err) {
5981 self.failHook(hook, err);
5985 hook.run(function(err) {
5986 var testError = hook.error();
5988 self.fail(self.test, testError);
5992 if (name === HOOK_TYPE_AFTER_EACH) {
5993 // TODO define and implement use case
5995 self.test.pending = true;
5997 } else if (name === HOOK_TYPE_BEFORE_EACH) {
5999 self.test.pending = true;
6001 self.emit(constants.EVENT_HOOK_END, hook);
6002 hook.pending = false; // activates hook for next test
6003 return fn(new Error('abort hookDown'));
6004 } else if (name === HOOK_TYPE_BEFORE_ALL) {
6005 suite.tests.forEach(function(test) {
6006 test.pending = true;
6008 suite.suites.forEach(function(suite) {
6009 suite.pending = true;
6012 hook.pending = false;
6013 var errForbid = createUnsupportedError('`this.skip` forbidden');
6014 self.failHook(hook, errForbid);
6015 return fn(errForbid);
6018 self.failHook(hook, err);
6019 // stop executing hooks, notify callee of hook err
6022 self.emit(constants.EVENT_HOOK_END, hook);
6023 delete hook.ctx.currentTest;
6028 Runner.immediately(function() {
6034 * Run hook `name` for the given array of `suites`
6035 * in order, and callback `fn(err, errSuite)`.
6038 * @param {string} name
6039 * @param {Array} suites
6040 * @param {Function} fn
6042 Runner.prototype.hooks = function(name, suites, fn) {
6044 var orig = this.suite;
6046 function next(suite) {
6054 self.hook(name, function(err) {
6056 var errSuite = self.suite;
6058 return fn(err, errSuite);
6069 * Run hooks from the top level down.
6071 * @param {String} name
6072 * @param {Function} fn
6075 Runner.prototype.hookUp = function(name, fn) {
6076 var suites = [this.suite].concat(this.parents()).reverse();
6077 this.hooks(name, suites, fn);
6081 * Run hooks from the bottom up.
6083 * @param {String} name
6084 * @param {Function} fn
6087 Runner.prototype.hookDown = function(name, fn) {
6088 var suites = [this.suite].concat(this.parents());
6089 this.hooks(name, suites, fn);
6093 * Return an array of parent Suites from
6094 * closest to furthest.
6099 Runner.prototype.parents = function() {
6100 var suite = this.suite;
6102 while (suite.parent) {
6103 suite = suite.parent;
6110 * Run the current test and callback `fn(err)`.
6112 * @param {Function} fn
6115 Runner.prototype.runTest = function(fn) {
6117 var test = this.test;
6123 var suite = this.parents().reverse()[0] || this.suite;
6124 if (this.forbidOnly && suite.hasOnly()) {
6125 fn(new Error('`.only` forbidden'));
6128 if (this.asyncOnly) {
6129 test.asyncOnly = true;
6131 test.on('error', function(err) {
6132 if (err instanceof Pending) {
6135 self.fail(test, err);
6137 if (this.allowUncaught) {
6138 test.allowUncaught = true;
6139 return test.run(fn);
6149 * Run tests in the given `suite` and invoke the callback `fn()` when complete.
6152 * @param {Suite} suite
6153 * @param {Function} fn
6155 Runner.prototype.runTests = function(suite, fn) {
6157 var tests = suite.tests.slice();
6160 function hookErr(_, errSuite, after) {
6161 // before/after Each hook for errSuite failed:
6162 var orig = self.suite;
6164 // for failed 'after each' hook start from errSuite parent,
6165 // otherwise start from errSuite itself
6166 self.suite = after ? errSuite.parent : errSuite;
6169 // call hookUp afterEach
6170 self.hookUp(HOOK_TYPE_AFTER_EACH, function(err2, errSuite2) {
6172 // some hooks may fail even now
6174 return hookErr(err2, errSuite2, true);
6176 // report error suite
6180 // there is no need calling other 'after each' hooks
6186 function next(err, errSuite) {
6187 // if we bail after first err
6188 if (self.failures && suite._bail) {
6197 return hookErr(err, errSuite, true);
6201 test = tests.shift();
6209 var match = self._grep.test(test.fullTitle());
6214 // Run immediately only if we have defined a grep. When we
6215 // define a grep — It can cause maximum callstack error if
6216 // the grep is doing a large recursive loop by neglecting
6217 // all tests. The run immediately function also comes with
6218 // a performance cost. So we don't want to run immediately
6219 // if we run the whole test suite, because running the whole
6220 // test suite don't do any immediate recursive loops. Thus,
6221 // allowing a JS runtime to breathe.
6222 if (self._grep !== self._defaultGrep) {
6223 Runner.immediately(next);
6230 // static skip, no hooks are executed
6231 if (test.isPending()) {
6232 if (self.forbidPending) {
6233 test.isPending = alwaysFalse;
6234 self.fail(test, new Error('Pending test forbidden'));
6235 delete test.isPending;
6237 self.emit(constants.EVENT_TEST_PENDING, test);
6239 self.emit(constants.EVENT_TEST_END, test);
6243 // execute test and hook(s)
6244 self.emit(constants.EVENT_TEST_BEGIN, (self.test = test));
6245 self.hookDown(HOOK_TYPE_BEFORE_EACH, function(err, errSuite) {
6246 // conditional skip within beforeEach
6247 if (test.isPending()) {
6248 if (self.forbidPending) {
6249 test.isPending = alwaysFalse;
6250 self.fail(test, new Error('Pending test forbidden'));
6251 delete test.isPending;
6253 self.emit(constants.EVENT_TEST_PENDING, test);
6255 self.emit(constants.EVENT_TEST_END, test);
6256 // skip inner afterEach hooks below errSuite level
6257 var origSuite = self.suite;
6258 self.suite = errSuite || self.suite;
6259 return self.hookUp(HOOK_TYPE_AFTER_EACH, function(e, eSuite) {
6260 self.suite = origSuite;
6265 return hookErr(err, errSuite, false);
6267 self.currentRunnable = self.test;
6268 self.runTest(function(err) {
6270 // conditional skip within it
6272 if (self.forbidPending) {
6273 test.isPending = alwaysFalse;
6274 self.fail(test, new Error('Pending test forbidden'));
6275 delete test.isPending;
6277 self.emit(constants.EVENT_TEST_PENDING, test);
6279 self.emit(constants.EVENT_TEST_END, test);
6280 return self.hookUp(HOOK_TYPE_AFTER_EACH, next);
6282 var retry = test.currentRetry();
6283 if (retry < test.retries()) {
6284 var clonedTest = test.clone();
6285 clonedTest.currentRetry(retry + 1);
6286 tests.unshift(clonedTest);
6288 self.emit(constants.EVENT_TEST_RETRY, test, err);
6290 // Early return + hook trigger so that it doesn't
6291 // increment the count wrong
6292 return self.hookUp(HOOK_TYPE_AFTER_EACH, next);
6294 self.fail(test, err);
6296 self.emit(constants.EVENT_TEST_END, test);
6297 return self.hookUp(HOOK_TYPE_AFTER_EACH, next);
6300 test.state = STATE_PASSED;
6301 self.emit(constants.EVENT_TEST_PASS, test);
6302 self.emit(constants.EVENT_TEST_END, test);
6303 self.hookUp(HOOK_TYPE_AFTER_EACH, next);
6309 this.hookErr = hookErr;
6313 function alwaysFalse() {
6318 * Run the given `suite` and invoke the callback `fn()` when complete.
6321 * @param {Suite} suite
6322 * @param {Function} fn
6324 Runner.prototype.runSuite = function(suite, fn) {
6327 var total = this.grepTotal(suite);
6329 debug('run suite %s', suite.fullTitle());
6331 if (!total || (self.failures && suite._bail)) {
6335 this.emit(constants.EVENT_SUITE_BEGIN, (this.suite = suite));
6337 function next(errSuite) {
6339 // current suite failed on a hook from errSuite
6340 if (errSuite === suite) {
6341 // if errSuite is current suite
6342 // continue to the next sibling suite
6345 // errSuite is among the parents of current suite
6346 // stop execution of errSuite and all sub-suites
6347 return done(errSuite);
6354 var curr = suite.suites[i++];
6359 // Avoid grep neglecting large number of tests causing a
6360 // huge recursive loop and thus a maximum call stack error.
6361 // See comment in `this.runTests()` for more information.
6362 if (self._grep !== self._defaultGrep) {
6363 Runner.immediately(function() {
6364 self.runSuite(curr, next);
6367 self.runSuite(curr, next);
6371 function done(errSuite) {
6373 self.nextSuite = next;
6375 // remove reference to test
6378 self.hook(HOOK_TYPE_AFTER_ALL, function() {
6379 self.emit(constants.EVENT_SUITE_END, suite);
6384 this.nextSuite = next;
6386 this.hook(HOOK_TYPE_BEFORE_ALL, function(err) {
6390 self.runTests(suite, next);
6395 * Handle uncaught exceptions within runner.
6397 * @param {Error} err
6400 Runner.prototype.uncaught = function(err) {
6401 if (err instanceof Pending) {
6404 // browser does not exit script when throwing in global.onerror()
6405 if (this.allowUncaught && !process.browser) {
6410 debug('uncaught exception %O', err);
6412 debug('uncaught undefined/falsy exception');
6413 err = createInvalidExceptionError(
6414 'Caught falsy/undefined exception which would otherwise be uncaught. No stack trace found; try a debugger',
6419 if (!isError(err)) {
6420 err = thrown2Error(err);
6422 err.uncaught = true;
6424 var runnable = this.currentRunnable;
6427 runnable = new Runnable('Uncaught error outside test suite');
6428 runnable.parent = this.suite;
6431 this.fail(runnable, err);
6433 // Can't recover from this failure
6434 this.emit(constants.EVENT_RUN_BEGIN);
6435 this.fail(runnable, err);
6436 this.emit(constants.EVENT_RUN_END);
6442 runnable.clearTimeout();
6444 if (runnable.isFailed()) {
6445 // Ignore error if already failed
6447 } else if (runnable.isPending()) {
6448 // report 'pending test' retrospectively as failed
6449 runnable.isPending = alwaysFalse;
6450 this.fail(runnable, err);
6451 delete runnable.isPending;
6455 // we cannot recover gracefully if a Runnable has already passed
6456 // then fails asynchronously
6457 if (runnable.isPassed()) {
6458 this.fail(runnable, err);
6462 return runnable.callback(err);
6467 * Handle uncaught exceptions after runner's end event.
6469 * @param {Error} err
6472 Runner.prototype.uncaughtEnd = function uncaughtEnd(err) {
6473 if (err instanceof Pending) return;
6478 * Run the root suite and invoke `fn(failures)`
6483 * @param {Function} fn
6484 * @return {Runner} Runner instance.
6486 Runner.prototype.run = function(fn) {
6488 var rootSuite = this.suite;
6490 fn = fn || function() {};
6492 function uncaught(err) {
6497 // If there is an `only` filter
6498 if (rootSuite.hasOnly()) {
6499 rootSuite.filterOnly();
6501 self.started = true;
6503 self.emit(constants.EVENT_DELAY_END);
6505 self.emit(constants.EVENT_RUN_BEGIN);
6507 self.runSuite(rootSuite, function() {
6508 debug('finished running');
6509 self.emit(constants.EVENT_RUN_END);
6513 debug(constants.EVENT_RUN_BEGIN);
6515 // references cleanup to avoid memory leaks
6516 this.on(constants.EVENT_SUITE_END, function(suite) {
6517 suite.cleanReferences();
6521 this.on(constants.EVENT_RUN_END, function() {
6522 debug(constants.EVENT_RUN_END);
6523 process.removeListener('uncaughtException', uncaught);
6524 process.on('uncaughtException', self.uncaughtEnd);
6528 // uncaught exception
6529 process.removeListener('uncaughtException', self.uncaughtEnd);
6530 process.on('uncaughtException', uncaught);
6533 // for reporters, I guess.
6534 // might be nice to debounce some dots while we wait.
6535 this.emit(constants.EVENT_DELAY_BEGIN, rootSuite);
6536 rootSuite.once(EVENT_ROOT_SUITE_RUN, start);
6538 Runner.immediately(function() {
6547 * Cleanly abort execution.
6551 * @return {Runner} Runner instance.
6553 Runner.prototype.abort = function() {
6561 * Filter leaks with the given globals flagged as `ok`.
6565 * @param {Array} globals
6568 function filterLeaks(ok, globals) {
6569 return globals.filter(function(key) {
6570 // Firefox and Chrome exposes iframes as index inside the window object
6571 if (/^\d+/.test(key)) {
6576 // if runner runs in an iframe, this iframe's window.getInterface method
6577 // not init at first it is assigned in some seconds
6578 if (global.navigator && /^getInterface/.test(key)) {
6582 // an iframe could be approached by window[iframeIndex]
6583 // in ie6,7,8 and opera, iframeIndex is enumerable, this could cause leak
6584 if (global.navigator && /^\d+/.test(key)) {
6588 // Opera and IE expose global variables for HTML element IDs (issue #243)
6589 if (/^mocha-/.test(key)) {
6593 var matched = ok.filter(function(ok) {
6594 if (~ok.indexOf('*')) {
6595 return key.indexOf(ok.split('*')[0]) === 0;
6599 return !matched.length && (!global.navigator || key !== 'onerror');
6604 * Check if argument is an instance of Error object or a duck-typed equivalent.
6607 * @param {Object} err - object to check
6608 * @param {string} err.message - error message
6609 * @returns {boolean}
6611 function isError(err) {
6612 return err instanceof Error || (err && typeof err.message === 'string');
6617 * Converts thrown non-extensible type into proper Error.
6620 * @param {*} thrown - Non-extensible type thrown by code
6623 function thrown2Error(err) {
6625 'the ' + type(err) + ' ' + stringify(err) + ' was thrown, throw an Error :)'
6629 Runner.constants = constants;
6632 * Node.js' `EventEmitter`
6633 * @external EventEmitter
6634 * @see {@link https://nodejs.org/api/events.html#events_class_eventemitter}
6637 }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
6638 },{"./errors":6,"./pending":16,"./runnable":33,"./suite":36,"./utils":38,"_process":69,"debug":45,"events":50,"util":89}],35:[function(require,module,exports){
6643 * Provides a factory function for a {@link StatsCollector} object.
6647 var constants = require('./runner').constants;
6648 var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
6649 var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
6650 var EVENT_SUITE_BEGIN = constants.EVENT_SUITE_BEGIN;
6651 var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
6652 var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
6653 var EVENT_RUN_END = constants.EVENT_RUN_END;
6654 var EVENT_TEST_END = constants.EVENT_TEST_END;
6657 * Test statistics collector.
6660 * @typedef {Object} StatsCollector
6661 * @property {number} suites - integer count of suites run.
6662 * @property {number} tests - integer count of tests run.
6663 * @property {number} passes - integer count of passing tests.
6664 * @property {number} pending - integer count of pending tests.
6665 * @property {number} failures - integer count of failed tests.
6666 * @property {Date} start - time when testing began.
6667 * @property {Date} end - time when testing concluded.
6668 * @property {number} duration - number of msecs that testing took.
6671 var Date = global.Date;
6674 * Provides stats such as test duration, number of tests passed / failed etc., by listening for events emitted by `runner`.
6677 * @param {Runner} runner - Runner instance
6678 * @throws {TypeError} If falsy `runner`
6680 function createStatsCollector(runner) {
6682 * @type StatsCollector
6693 throw new TypeError('Missing runner argument');
6696 runner.stats = stats;
6698 runner.once(EVENT_RUN_BEGIN, function() {
6699 stats.start = new Date();
6701 runner.on(EVENT_SUITE_BEGIN, function(suite) {
6702 suite.root || stats.suites++;
6704 runner.on(EVENT_TEST_PASS, function() {
6707 runner.on(EVENT_TEST_FAIL, function() {
6710 runner.on(EVENT_TEST_PENDING, function() {
6713 runner.on(EVENT_TEST_END, function() {
6716 runner.once(EVENT_RUN_END, function() {
6717 stats.end = new Date();
6718 stats.duration = stats.end - stats.start;
6722 module.exports = createStatsCollector;
6724 }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
6725 },{"./runner":34}],36:[function(require,module,exports){
6729 * Module dependencies.
6731 var EventEmitter = require('events').EventEmitter;
6732 var Hook = require('./hook');
6733 var utils = require('./utils');
6734 var inherits = utils.inherits;
6735 var debug = require('debug')('mocha:suite');
6736 var milliseconds = require('ms');
6737 var errors = require('./errors');
6738 var createInvalidArgumentTypeError = errors.createInvalidArgumentTypeError;
6744 exports = module.exports = Suite;
6747 * Create a new `Suite` with the given `title` and parent `Suite`.
6750 * @param {Suite} parent - Parent suite (required!)
6751 * @param {string} title - Title
6754 Suite.create = function(parent, title) {
6755 var suite = new Suite(title, parent.ctx);
6756 suite.parent = parent;
6757 title = suite.fullTitle();
6758 parent.addSuite(suite);
6763 * Constructs a new `Suite` instance with the given `title`, `ctx`, and `isRoot`.
6767 * @extends EventEmitter
6768 * @see {@link https://nodejs.org/api/events.html#events_class_eventemitter|EventEmitter}
6769 * @param {string} title - Suite title.
6770 * @param {Context} parentContext - Parent context instance.
6771 * @param {boolean} [isRoot=false] - Whether this is the root suite.
6773 function Suite(title, parentContext, isRoot) {
6774 if (!utils.isString(title)) {
6775 throw createInvalidArgumentTypeError(
6776 'Suite argument "title" must be a string. Received type "' +
6784 function Context() {}
6785 Context.prototype = parentContext;
6786 this.ctx = new Context();
6789 this.pending = false;
6790 this._beforeEach = [];
6791 this._beforeAll = [];
6792 this._afterEach = [];
6793 this._afterAll = [];
6794 this.root = isRoot === true;
6795 this._timeout = 2000;
6796 this._enableTimeouts = true;
6800 this._onlyTests = [];
6801 this._onlySuites = [];
6802 this.delayed = false;
6804 this.on('newListener', function(event) {
6805 if (deprecatedEvents[event]) {
6809 '" is deprecated. Please let the Mocha team know about your use case: https://git.io/v6Lwm'
6816 * Inherit from `EventEmitter.prototype`.
6818 inherits(Suite, EventEmitter);
6821 * Return a clone of this `Suite`.
6826 Suite.prototype.clone = function() {
6827 var suite = new Suite(this.title);
6829 suite.ctx = this.ctx;
6830 suite.root = this.root;
6831 suite.timeout(this.timeout());
6832 suite.retries(this.retries());
6833 suite.enableTimeouts(this.enableTimeouts());
6834 suite.slow(this.slow());
6835 suite.bail(this.bail());
6840 * Set or get timeout `ms` or short-hand such as "2s".
6843 * @todo Do not attempt to set value if `ms` is undefined
6844 * @param {number|string} ms
6845 * @return {Suite|number} for chaining
6847 Suite.prototype.timeout = function(ms) {
6848 if (!arguments.length) {
6849 return this._timeout;
6851 if (ms.toString() === '0') {
6852 this._enableTimeouts = false;
6854 if (typeof ms === 'string') {
6855 ms = milliseconds(ms);
6857 debug('timeout %d', ms);
6858 this._timeout = parseInt(ms, 10);
6863 * Set or get number of times to retry a failed test.
6866 * @param {number|string} n
6867 * @return {Suite|number} for chaining
6869 Suite.prototype.retries = function(n) {
6870 if (!arguments.length) {
6871 return this._retries;
6873 debug('retries %d', n);
6874 this._retries = parseInt(n, 10) || 0;
6879 * Set or get timeout to `enabled`.
6882 * @param {boolean} enabled
6883 * @return {Suite|boolean} self or enabled
6885 Suite.prototype.enableTimeouts = function(enabled) {
6886 if (!arguments.length) {
6887 return this._enableTimeouts;
6889 debug('enableTimeouts %s', enabled);
6890 this._enableTimeouts = enabled;
6895 * Set or get slow `ms` or short-hand such as "2s".
6898 * @param {number|string} ms
6899 * @return {Suite|number} for chaining
6901 Suite.prototype.slow = function(ms) {
6902 if (!arguments.length) {
6905 if (typeof ms === 'string') {
6906 ms = milliseconds(ms);
6908 debug('slow %d', ms);
6914 * Set or get whether to bail after first error.
6917 * @param {boolean} bail
6918 * @return {Suite|number} for chaining
6920 Suite.prototype.bail = function(bail) {
6921 if (!arguments.length) {
6924 debug('bail %s', bail);
6930 * Check if this suite or its parent suite is marked as pending.
6934 Suite.prototype.isPending = function() {
6935 return this.pending || (this.parent && this.parent.isPending());
6939 * Generic hook-creator.
6941 * @param {string} title - Title of hook
6942 * @param {Function} fn - Hook callback
6943 * @returns {Hook} A new hook
6945 Suite.prototype._createHook = function(title, fn) {
6946 var hook = new Hook(title, fn);
6948 hook.timeout(this.timeout());
6949 hook.retries(this.retries());
6950 hook.enableTimeouts(this.enableTimeouts());
6951 hook.slow(this.slow());
6952 hook.ctx = this.ctx;
6953 hook.file = this.file;
6958 * Run `fn(test[, done])` before running tests.
6961 * @param {string} title
6962 * @param {Function} fn
6963 * @return {Suite} for chaining
6965 Suite.prototype.beforeAll = function(title, fn) {
6966 if (this.isPending()) {
6969 if (typeof title === 'function') {
6973 title = '"before all" hook' + (title ? ': ' + title : '');
6975 var hook = this._createHook(title, fn);
6976 this._beforeAll.push(hook);
6977 this.emit(constants.EVENT_SUITE_ADD_HOOK_BEFORE_ALL, hook);
6982 * Run `fn(test[, done])` after running tests.
6985 * @param {string} title
6986 * @param {Function} fn
6987 * @return {Suite} for chaining
6989 Suite.prototype.afterAll = function(title, fn) {
6990 if (this.isPending()) {
6993 if (typeof title === 'function') {
6997 title = '"after all" hook' + (title ? ': ' + title : '');
6999 var hook = this._createHook(title, fn);
7000 this._afterAll.push(hook);
7001 this.emit(constants.EVENT_SUITE_ADD_HOOK_AFTER_ALL, hook);
7006 * Run `fn(test[, done])` before each test case.
7009 * @param {string} title
7010 * @param {Function} fn
7011 * @return {Suite} for chaining
7013 Suite.prototype.beforeEach = function(title, fn) {
7014 if (this.isPending()) {
7017 if (typeof title === 'function') {
7021 title = '"before each" hook' + (title ? ': ' + title : '');
7023 var hook = this._createHook(title, fn);
7024 this._beforeEach.push(hook);
7025 this.emit(constants.EVENT_SUITE_ADD_HOOK_BEFORE_EACH, hook);
7030 * Run `fn(test[, done])` after each test case.
7033 * @param {string} title
7034 * @param {Function} fn
7035 * @return {Suite} for chaining
7037 Suite.prototype.afterEach = function(title, fn) {
7038 if (this.isPending()) {
7041 if (typeof title === 'function') {
7045 title = '"after each" hook' + (title ? ': ' + title : '');
7047 var hook = this._createHook(title, fn);
7048 this._afterEach.push(hook);
7049 this.emit(constants.EVENT_SUITE_ADD_HOOK_AFTER_EACH, hook);
7054 * Add a test `suite`.
7057 * @param {Suite} suite
7058 * @return {Suite} for chaining
7060 Suite.prototype.addSuite = function(suite) {
7061 suite.parent = this;
7063 suite.timeout(this.timeout());
7064 suite.retries(this.retries());
7065 suite.enableTimeouts(this.enableTimeouts());
7066 suite.slow(this.slow());
7067 suite.bail(this.bail());
7068 this.suites.push(suite);
7069 this.emit(constants.EVENT_SUITE_ADD_SUITE, suite);
7074 * Add a `test` to this suite.
7077 * @param {Test} test
7078 * @return {Suite} for chaining
7080 Suite.prototype.addTest = function(test) {
7082 test.timeout(this.timeout());
7083 test.retries(this.retries());
7084 test.enableTimeouts(this.enableTimeouts());
7085 test.slow(this.slow());
7086 test.ctx = this.ctx;
7087 this.tests.push(test);
7088 this.emit(constants.EVENT_SUITE_ADD_TEST, test);
7093 * Return the full title generated by recursively concatenating the parent's
7100 Suite.prototype.fullTitle = function() {
7101 return this.titlePath().join(' ');
7105 * Return the title path generated by recursively concatenating the parent's
7112 Suite.prototype.titlePath = function() {
7115 result = result.concat(this.parent.titlePath());
7118 result.push(this.title);
7124 * Return the total number of tests.
7130 Suite.prototype.total = function() {
7132 this.suites.reduce(function(sum, suite) {
7133 return sum + suite.total();
7134 }, 0) + this.tests.length
7139 * Iterates through each suite recursively to find all tests. Applies a
7140 * function in the format `fn(test)`.
7143 * @param {Function} fn
7146 Suite.prototype.eachTest = function(fn) {
7147 this.tests.forEach(fn);
7148 this.suites.forEach(function(suite) {
7155 * This will run the root suite if we happen to be running in delayed mode.
7158 Suite.prototype.run = function run() {
7160 this.emit(constants.EVENT_ROOT_SUITE_RUN);
7165 * Determines whether a suite has an `only` test or suite as a descendant.
7168 * @returns {Boolean}
7170 Suite.prototype.hasOnly = function hasOnly() {
7172 this._onlyTests.length > 0 ||
7173 this._onlySuites.length > 0 ||
7174 this.suites.some(function(suite) {
7175 return suite.hasOnly();
7181 * Filter suites based on `isOnly` logic.
7184 * @returns {Boolean}
7186 Suite.prototype.filterOnly = function filterOnly() {
7187 if (this._onlyTests.length) {
7188 // If the suite contains `only` tests, run those and ignore any nested suites.
7189 this.tests = this._onlyTests;
7192 // Otherwise, do not run any of the tests in this suite.
7194 this._onlySuites.forEach(function(onlySuite) {
7195 // If there are other `only` tests/suites nested in the current `only` suite, then filter that `only` suite.
7196 // Otherwise, all of the tests on this `only` suite should be run, so don't filter it.
7197 if (onlySuite.hasOnly()) {
7198 onlySuite.filterOnly();
7201 // Run the `only` suites, as well as any other suites that have `only` tests/suites as descendants.
7202 var onlySuites = this._onlySuites;
7203 this.suites = this.suites.filter(function(childSuite) {
7204 return onlySuites.indexOf(childSuite) !== -1 || childSuite.filterOnly();
7207 // Keep the suite only if there is something to run
7208 return this.tests.length > 0 || this.suites.length > 0;
7212 * Adds a suite to the list of subsuites marked `only`.
7215 * @param {Suite} suite
7217 Suite.prototype.appendOnlySuite = function(suite) {
7218 this._onlySuites.push(suite);
7222 * Adds a test to the list of tests marked `only`.
7225 * @param {Test} test
7227 Suite.prototype.appendOnlyTest = function(test) {
7228 this._onlyTests.push(test);
7232 * Returns the array of hooks by hook name; see `HOOK_TYPE_*` constants.
7235 Suite.prototype.getHooks = function getHooks(name) {
7236 return this['_' + name];
7240 * Cleans up the references to all the deferred functions
7241 * (before/after/beforeEach/afterEach) and tests of a Suite.
7242 * These must be deleted otherwise a memory leak can happen,
7243 * as those functions may reference variables from closures,
7244 * thus those variables can never be garbage collected as long
7245 * as the deferred functions exist.
7249 Suite.prototype.cleanReferences = function cleanReferences() {
7250 function cleanArrReferences(arr) {
7251 for (var i = 0; i < arr.length; i++) {
7256 if (Array.isArray(this._beforeAll)) {
7257 cleanArrReferences(this._beforeAll);
7260 if (Array.isArray(this._beforeEach)) {
7261 cleanArrReferences(this._beforeEach);
7264 if (Array.isArray(this._afterAll)) {
7265 cleanArrReferences(this._afterAll);
7268 if (Array.isArray(this._afterEach)) {
7269 cleanArrReferences(this._afterEach);
7272 for (var i = 0; i < this.tests.length; i++) {
7273 delete this.tests[i].fn;
7277 var constants = utils.defineConstants(
7279 * {@link Suite}-related constants.
7289 * Event emitted after a test file has been loaded Not emitted in browser.
7291 EVENT_FILE_POST_REQUIRE: 'post-require',
7293 * Event emitted before a test file has been loaded. In browser, this is emitted once an interface has been selected.
7295 EVENT_FILE_PRE_REQUIRE: 'pre-require',
7297 * Event emitted immediately after a test file has been loaded. Not emitted in browser.
7299 EVENT_FILE_REQUIRE: 'require',
7301 * Event emitted when `global.run()` is called (use with `delay` option)
7303 EVENT_ROOT_SUITE_RUN: 'run',
7306 * Namespace for collection of a `Suite`'s "after all" hooks
7308 HOOK_TYPE_AFTER_ALL: 'afterAll',
7310 * Namespace for collection of a `Suite`'s "after each" hooks
7312 HOOK_TYPE_AFTER_EACH: 'afterEach',
7314 * Namespace for collection of a `Suite`'s "before all" hooks
7316 HOOK_TYPE_BEFORE_ALL: 'beforeAll',
7318 * Namespace for collection of a `Suite`'s "before all" hooks
7320 HOOK_TYPE_BEFORE_EACH: 'beforeEach',
7322 // the following events are all deprecated
7325 * Emitted after an "after all" `Hook` has been added to a `Suite`. Deprecated
7327 EVENT_SUITE_ADD_HOOK_AFTER_ALL: 'afterAll',
7329 * Emitted after an "after each" `Hook` has been added to a `Suite` Deprecated
7331 EVENT_SUITE_ADD_HOOK_AFTER_EACH: 'afterEach',
7333 * Emitted after an "before all" `Hook` has been added to a `Suite` Deprecated
7335 EVENT_SUITE_ADD_HOOK_BEFORE_ALL: 'beforeAll',
7337 * Emitted after an "before each" `Hook` has been added to a `Suite` Deprecated
7339 EVENT_SUITE_ADD_HOOK_BEFORE_EACH: 'beforeEach',
7341 * Emitted after a child `Suite` has been added to a `Suite`. Deprecated
7343 EVENT_SUITE_ADD_SUITE: 'suite',
7345 * Emitted after a `Test` has been added to a `Suite`. Deprecated
7347 EVENT_SUITE_ADD_TEST: 'test'
7352 * @summary There are no known use cases for these events.
7353 * @desc This is a `Set`-like object having all keys being the constant's string value and the value being `true`.
7354 * @todo Remove eventually
7355 * @type {Object<string,boolean>}
7358 var deprecatedEvents = Object.keys(constants)
7359 .filter(function(constant) {
7360 return constant.substring(0, 15) === 'EVENT_SUITE_ADD';
7362 .reduce(function(acc, constant) {
7363 acc[constants[constant]] = true;
7365 }, utils.createMap());
7367 Suite.constants = constants;
7369 },{"./errors":6,"./hook":7,"./utils":38,"debug":45,"events":50,"ms":60}],37:[function(require,module,exports){
7371 var Runnable = require('./runnable');
7372 var utils = require('./utils');
7373 var errors = require('./errors');
7374 var createInvalidArgumentTypeError = errors.createInvalidArgumentTypeError;
7375 var isString = utils.isString;
7377 module.exports = Test;
7380 * Initialize a new `Test` with the given `title` and callback `fn`.
7385 * @param {String} title - Test title (required)
7386 * @param {Function} [fn] - Test callback. If omitted, the Test is considered "pending"
7388 function Test(title, fn) {
7389 if (!isString(title)) {
7390 throw createInvalidArgumentTypeError(
7391 'Test argument "title" should be a string. Received type "' +
7398 Runnable.call(this, title, fn);
7404 * Inherit from `Runnable.prototype`.
7406 utils.inherits(Test, Runnable);
7409 * Set or get retried test
7413 Test.prototype.retriedTest = function(n) {
7414 if (!arguments.length) {
7415 return this._retriedTest;
7417 this._retriedTest = n;
7420 Test.prototype.clone = function() {
7421 var test = new Test(this.title, this.fn);
7422 test.timeout(this.timeout());
7423 test.slow(this.slow());
7424 test.enableTimeouts(this.enableTimeouts());
7425 test.retries(this.retries());
7426 test.currentRetry(this.currentRetry());
7427 test.retriedTest(this.retriedTest() || this);
7428 test.globals(this.globals());
7429 test.parent = this.parent;
7430 test.file = this.file;
7431 test.ctx = this.ctx;
7435 },{"./errors":6,"./runnable":33,"./utils":38}],38:[function(require,module,exports){
7436 (function (process,Buffer){
7440 * Various utility functions used throughout Mocha's codebase.
7445 * Module dependencies.
7448 var fs = require('fs');
7449 var path = require('path');
7450 var util = require('util');
7451 var glob = require('glob');
7452 var he = require('he');
7453 var errors = require('./errors');
7454 var createNoFilesMatchPatternError = errors.createNoFilesMatchPatternError;
7455 var createMissingArgumentError = errors.createMissingArgumentError;
7457 var assign = (exports.assign = require('object.assign').getPolyfill());
7460 * Inherit the prototype methods from one constructor into another.
7462 * @param {function} ctor - Constructor function which needs to inherit the
7464 * @param {function} superCtor - Constructor function to inherit prototype from.
7465 * @throws {TypeError} if either constructor is null, or if super constructor
7466 * lacks a prototype.
7468 exports.inherits = util.inherits;
7471 * Escape special characters in the given string of html.
7474 * @param {string} html
7477 exports.escape = function(html) {
7478 return he.encode(String(html), {useNamedReferences: false});
7482 * Test if the given obj is type of string.
7485 * @param {Object} obj
7488 exports.isString = function(obj) {
7489 return typeof obj === 'string';
7493 * Compute a slug from the given `str`.
7496 * @param {string} str
7499 exports.slug = function(str) {
7502 .replace(/ +/g, '-')
7503 .replace(/[^-\w]/g, '');
7507 * Strip the function definition from `str`, and re-indent for pre whitespace.
7509 * @param {string} str
7512 exports.clean = function(str) {
7514 .replace(/\r\n?|[\n\u2028\u2029]/g, '\n')
7515 .replace(/^\uFEFF/, '')
7516 // (traditional)-> space/name parameters body (lambda)-> parameters body multi-statement/single keep body content
7518 /^function(?:\s*|\s+[^(]*)\([^)]*\)\s*\{((?:.|\n)*?)\s*\}$|^\([^)]*\)\s*=>\s*(?:\{((?:.|\n)*?)\s*\}|((?:.|\n)*))$/,
7522 var spaces = str.match(/^\n?( *)/)[1].length;
7523 var tabs = str.match(/^\n?(\t*)/)[1].length;
7524 var re = new RegExp(
7525 '^\n?' + (tabs ? '\t' : ' ') + '{' + (tabs || spaces) + '}',
7529 str = str.replace(re, '');
7535 * Parse the given `qs`.
7538 * @param {string} qs
7541 exports.parseQuery = function(qs) {
7545 .reduce(function(obj, pair) {
7546 var i = pair.indexOf('=');
7547 var key = pair.slice(0, i);
7548 var val = pair.slice(++i);
7550 // Due to how the URLSearchParams API treats spaces
7551 obj[key] = decodeURIComponent(val.replace(/\+/g, '%20'));
7558 * Highlight the given string of `js`.
7561 * @param {string} js
7564 function highlight(js) {
7566 .replace(/</g, '<')
7567 .replace(/>/g, '>')
7568 .replace(/\/\/(.*)/gm, '<span class="comment">//$1</span>')
7569 .replace(/('.*?')/gm, '<span class="string">$1</span>')
7570 .replace(/(\d+\.\d+)/gm, '<span class="number">$1</span>')
7571 .replace(/(\d+)/gm, '<span class="number">$1</span>')
7573 /\bnew[ \t]+(\w+)/gm,
7574 '<span class="keyword">new</span> <span class="init">$1</span>'
7577 /\b(function|new|throw|return|var|if|else)\b/gm,
7578 '<span class="keyword">$1</span>'
7583 * Highlight the contents of tag `name`.
7586 * @param {string} name
7588 exports.highlightTags = function(name) {
7589 var code = document.getElementById('mocha').getElementsByTagName(name);
7590 for (var i = 0, len = code.length; i < len; ++i) {
7591 code[i].innerHTML = highlight(code[i].innerHTML);
7596 * If a value could have properties, and has none, this function is called,
7597 * which returns a string representation of the empty value.
7599 * Functions w/ no properties return `'[Function]'`
7600 * Arrays w/ length === 0 return `'[]'`
7601 * Objects w/ no properties return `'{}'`
7602 * All else: return result of `value.toString()`
7605 * @param {*} value The value to inspect.
7606 * @param {string} typeHint The type of the value
7609 function emptyRepresentation(value, typeHint) {
7612 return '[Function]';
7618 return value.toString();
7623 * Takes some variable and asks `Object.prototype.toString()` what it thinks it
7627 * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString
7628 * @param {*} value The value to test.
7629 * @returns {string} Computed type
7631 * type({}) // 'object'
7632 * type([]) // 'array'
7633 * type(1) // 'number'
7634 * type(false) // 'boolean'
7635 * type(Infinity) // 'number'
7636 * type(null) // 'null'
7637 * type(new Date()) // 'date'
7638 * type(/foo/) // 'regexp'
7639 * type('type') // 'string'
7640 * type(global) // 'global'
7641 * type(new String('foo') // 'object'
7643 var type = (exports.type = function type(value) {
7644 if (value === undefined) {
7646 } else if (value === null) {
7648 } else if (Buffer.isBuffer(value)) {
7651 return Object.prototype.toString
7653 .replace(/^\[.+\s(.+?)]$/, '$1')
7658 * Stringify `value`. Different behavior depending on type of value:
7660 * - If `value` is undefined or null, return `'[undefined]'` or `'[null]'`, respectively.
7661 * - If `value` is not an object, function or array, return result of `value.toString()` wrapped in double-quotes.
7662 * - If `value` is an *empty* object, function, or array, return result of function
7663 * {@link emptyRepresentation}.
7664 * - If `value` has properties, call {@link exports.canonicalize} on it, then return result of
7672 exports.stringify = function(value) {
7673 var typeHint = type(value);
7675 if (!~['object', 'array', 'function'].indexOf(typeHint)) {
7676 if (typeHint === 'buffer') {
7677 var json = Buffer.prototype.toJSON.call(value);
7678 // Based on the toJSON result
7679 return jsonStringify(
7680 json.data && json.type ? json.data : json,
7682 ).replace(/,(\n|$)/g, '$1');
7685 // IE7/IE8 has a bizarre String constructor; needs to be coerced
7686 // into an array and back to obj.
7687 if (typeHint === 'string' && typeof value === 'object') {
7688 value = value.split('').reduce(function(acc, char, idx) {
7692 typeHint = 'object';
7694 return jsonStringify(value);
7698 for (var prop in value) {
7699 if (Object.prototype.hasOwnProperty.call(value, prop)) {
7700 return jsonStringify(
7701 exports.canonicalize(value, null, typeHint),
7703 ).replace(/,(\n|$)/g, '$1');
7707 return emptyRepresentation(value, typeHint);
7711 * like JSON.stringify but more sense.
7714 * @param {Object} object
7715 * @param {number=} spaces
7716 * @param {number=} depth
7719 function jsonStringify(object, spaces, depth) {
7720 if (typeof spaces === 'undefined') {
7722 return _stringify(object);
7726 var space = spaces * depth;
7727 var str = Array.isArray(object) ? '[' : '{';
7728 var end = Array.isArray(object) ? ']' : '}';
7730 typeof object.length === 'number'
7732 : Object.keys(object).length;
7733 // `.repeat()` polyfill
7734 function repeat(s, n) {
7735 return new Array(n).join(s);
7738 function _stringify(val) {
7739 switch (type(val)) {
7742 val = '[' + val + ']';
7746 val = jsonStringify(val, spaces, depth + 1);
7753 val === 0 && 1 / val === -Infinity // `-0`
7758 var sDate = isNaN(val.getTime()) ? val.toString() : val.toISOString();
7759 val = '[Date: ' + sDate + ']';
7762 var json = val.toJSON();
7763 // Based on the toJSON result
7764 json = json.data && json.type ? json.data : json;
7765 val = '[Buffer: ' + jsonStringify(json, 2, depth + 1) + ']';
7769 val === '[Function]' || val === '[Circular]'
7771 : JSON.stringify(val); // string
7776 for (var i in object) {
7777 if (!Object.prototype.hasOwnProperty.call(object, i)) {
7778 continue; // not my business
7783 repeat(' ', space) +
7784 (Array.isArray(object) ? '' : '"' + i + '": ') + // key
7785 _stringify(object[i]) + // value
7786 (length ? ',' : ''); // comma
7792 (str.length !== 1 ? '\n' + repeat(' ', --space) + end : end)
7797 * Return a new Thing that has the keys in sorted order. Recursive.
7800 * - has already been seen, return string `'[Circular]'`
7801 * - is `undefined`, return string `'[undefined]'`
7802 * - is `null`, return value `null`
7803 * - is some other primitive, return the value
7804 * - is not a primitive or an `Array`, `Object`, or `Function`, return the value of the Thing's `toString()` method
7805 * - is a non-empty `Array`, `Object`, or `Function`, return the result of calling this function again.
7806 * - is an empty `Array`, `Object`, or `Function`, return the result of calling `emptyRepresentation()`
7809 * @see {@link exports.stringify}
7810 * @param {*} value Thing to inspect. May or may not have properties.
7811 * @param {Array} [stack=[]] Stack of seen values
7812 * @param {string} [typeHint] Type hint
7813 * @return {(Object|Array|Function|string|undefined)}
7815 exports.canonicalize = function canonicalize(value, stack, typeHint) {
7816 var canonicalizedObj;
7817 /* eslint-disable no-unused-vars */
7819 /* eslint-enable no-unused-vars */
7820 typeHint = typeHint || type(value);
7821 function withStack(value, fn) {
7827 stack = stack || [];
7829 if (stack.indexOf(value) !== -1) {
7830 return '[Circular]';
7837 canonicalizedObj = value;
7840 withStack(value, function() {
7841 canonicalizedObj = value.map(function(item) {
7842 return exports.canonicalize(item, stack);
7847 /* eslint-disable guard-for-in */
7848 for (prop in value) {
7849 canonicalizedObj = {};
7852 /* eslint-enable guard-for-in */
7853 if (!canonicalizedObj) {
7854 canonicalizedObj = emptyRepresentation(value, typeHint);
7859 canonicalizedObj = canonicalizedObj || {};
7860 withStack(value, function() {
7863 .forEach(function(key) {
7864 canonicalizedObj[key] = exports.canonicalize(value[key], stack);
7873 canonicalizedObj = value;
7876 canonicalizedObj = value + '';
7879 return canonicalizedObj;
7883 * Determines if pathname has a matching file extension.
7886 * @param {string} pathname - Pathname to check for match.
7887 * @param {string[]} exts - List of file extensions (sans period).
7888 * @return {boolean} whether file extension matches.
7890 * hasMatchingExtname('foo.html', ['js', 'css']); // => false
7892 function hasMatchingExtname(pathname, exts) {
7893 var suffix = path.extname(pathname).slice(1);
7894 return exts.some(function(element) {
7895 return suffix === element;
7900 * Determines if pathname would be a "hidden" file (or directory) on UN*X.
7903 * On UN*X, pathnames beginning with a full stop (aka dot) are hidden during
7904 * typical usage. Dotfiles, plain-text configuration files, are prime examples.
7906 * @see {@link http://xahlee.info/UnixResource_dir/writ/unix_origin_of_dot_filename.html|Origin of Dot File Names}
7909 * @param {string} pathname - Pathname to check for match.
7910 * @return {boolean} whether pathname would be considered a hidden file.
7912 * isHiddenOnUnix('.profile'); // => true
7914 function isHiddenOnUnix(pathname) {
7915 return path.basename(pathname)[0] === '.';
7919 * Lookup file names at the given `path`.
7922 * Filenames are returned in _traversal_ order by the OS/filesystem.
7923 * **Make no assumption that the names will be sorted in any fashion.**
7926 * @memberof Mocha.utils
7927 * @param {string} filepath - Base path to start searching from.
7928 * @param {string[]} [extensions=[]] - File extensions to look for.
7929 * @param {boolean} [recursive=false] - Whether to recurse into subdirectories.
7930 * @return {string[]} An array of paths.
7931 * @throws {Error} if no files match pattern.
7932 * @throws {TypeError} if `filepath` is directory and `extensions` not provided.
7934 exports.lookupFiles = function lookupFiles(filepath, extensions, recursive) {
7935 extensions = extensions || [];
7936 recursive = recursive || false;
7940 if (!fs.existsSync(filepath)) {
7942 if (glob.hasMagic(filepath)) {
7943 // Handle glob as is without extensions
7946 // glob pattern e.g. 'filepath+(.js|.ts)'
7947 var strExtensions = extensions
7952 pattern = filepath + '+(' + strExtensions + ')';
7954 files = glob.sync(pattern, {nodir: true});
7955 if (!files.length) {
7956 throw createNoFilesMatchPatternError(
7957 'Cannot find any files matching pattern ' + exports.dQuote(filepath),
7966 stat = fs.statSync(filepath);
7967 if (stat.isFile()) {
7976 fs.readdirSync(filepath).forEach(function(dirent) {
7977 var pathname = path.join(filepath, dirent);
7981 stat = fs.statSync(pathname);
7982 if (stat.isDirectory()) {
7984 files = files.concat(lookupFiles(pathname, extensions, recursive));
7992 if (!extensions.length) {
7993 throw createMissingArgumentError(
7995 'Argument %s required when argument %s is a directory',
7996 exports.sQuote('extensions'),
7997 exports.sQuote('filepath')
8006 !hasMatchingExtname(pathname, extensions) ||
8007 isHiddenOnUnix(pathname)
8011 files.push(pathname);
8018 * process.emitWarning or a polyfill
8019 * @see https://nodejs.org/api/process.html#process_process_emitwarning_warning_options
8022 function emitWarning(msg, type) {
8023 if (process.emitWarning) {
8024 process.emitWarning(msg, type);
8026 process.nextTick(function() {
8027 console.warn(type + ': ' + msg);
8033 * Show a deprecation warning. Each distinct message is only displayed once.
8034 * Ignores empty messages.
8036 * @param {string} [msg] - Warning to print
8039 exports.deprecate = function deprecate(msg) {
8041 if (msg && !deprecate.cache[msg]) {
8042 deprecate.cache[msg] = true;
8043 emitWarning(msg, 'DeprecationWarning');
8046 exports.deprecate.cache = {};
8049 * Show a generic warning.
8050 * Ignores empty messages.
8052 * @param {string} [msg] - Warning to print
8055 exports.warn = function warn(msg) {
8063 * This Filter based on `mocha-clean` module.(see: `github.com/rstacruz/mocha-clean`)
8065 * When invoking this function you get a filter function that get the Error.stack as an input,
8066 * and return a prettify output.
8067 * (i.e: strip Mocha and internal node functions from stack trace).
8068 * @returns {Function}
8070 exports.stackTraceFilter = function() {
8071 // TODO: Replace with `process.browser`
8072 var is = typeof document === 'undefined' ? {node: true} : {browser: true};
8073 var slash = path.sep;
8076 cwd = process.cwd() + slash;
8078 cwd = (typeof location === 'undefined'
8081 ).href.replace(/\/[^/]*$/, '/');
8085 function isMochaInternal(line) {
8087 ~line.indexOf('node_modules' + slash + 'mocha' + slash) ||
8088 ~line.indexOf(slash + 'mocha.js') ||
8089 ~line.indexOf(slash + 'mocha.min.js')
8093 function isNodeInternal(line) {
8095 ~line.indexOf('(timers.js:') ||
8096 ~line.indexOf('(events.js:') ||
8097 ~line.indexOf('(node.js:') ||
8098 ~line.indexOf('(module.js:') ||
8099 ~line.indexOf('GeneratorFunctionPrototype.next (native)') ||
8104 return function(stack) {
8105 stack = stack.split('\n');
8107 stack = stack.reduce(function(list, line) {
8108 if (isMochaInternal(line)) {
8112 if (is.node && isNodeInternal(line)) {
8116 // Clean up cwd(absolute)
8117 if (/:\d+:\d+\)?$/.test(line)) {
8118 line = line.replace('(' + cwd, '(');
8125 return stack.join('\n');
8130 * Crude, but effective.
8133 * @returns {boolean} Whether or not `value` is a Promise
8135 exports.isPromise = function isPromise(value) {
8137 typeof value === 'object' &&
8139 typeof value.then === 'function'
8144 * Clamps a numeric value to an inclusive range.
8146 * @param {number} value - Value to be clamped.
8147 * @param {number[]} range - Two element array specifying [min, max] range.
8148 * @returns {number} clamped value
8150 exports.clamp = function clamp(value, range) {
8151 return Math.min(Math.max(value, range[0]), range[1]);
8155 * Single quote text by combining with undirectional ASCII quotation marks.
8158 * Provides a simple means of markup for quoting text to be used in output.
8159 * Use this to quote names of variables, methods, and packages.
8161 * <samp>package 'foo' cannot be found</samp>
8164 * @param {string} str - Value to be quoted.
8165 * @returns {string} quoted value
8167 * sQuote('n') // => 'n'
8169 exports.sQuote = function(str) {
8170 return "'" + str + "'";
8174 * Double quote text by combining with undirectional ASCII quotation marks.
8177 * Provides a simple means of markup for quoting text to be used in output.
8178 * Use this to quote names of datatypes, classes, pathnames, and strings.
8180 * <samp>argument 'value' must be "string" or "number"</samp>
8183 * @param {string} str - Value to be quoted.
8184 * @returns {string} quoted value
8186 * dQuote('number') // => "number"
8188 exports.dQuote = function(str) {
8189 return '"' + str + '"';
8193 * Provides simplistic message translation for dealing with plurality.
8196 * Use this to create messages which need to be singular or plural.
8197 * Some languages have several plural forms, so _complete_ message clauses
8198 * are preferable to generating the message on the fly.
8201 * @param {number} n - Non-negative integer
8202 * @param {string} msg1 - Message to be used in English for `n = 1`
8203 * @param {string} msg2 - Message to be used in English for `n = 0, 2, 3, ...`
8204 * @returns {string} message corresponding to value of `n`
8206 * var sprintf = require('util').format;
8207 * var pkgs = ['one', 'two'];
8208 * var msg = sprintf(
8211 * 'cannot load package: %s',
8212 * 'cannot load packages: %s'
8214 * pkgs.map(sQuote).join(', ')
8216 * console.log(msg); // => cannot load packages: 'one', 'two'
8218 exports.ngettext = function(n, msg1, msg2) {
8219 if (typeof n === 'number' && n >= 0) {
8220 return n === 1 ? msg1 : msg2;
8228 exports.noop = function() {};
8231 * Creates a map-like object.
8234 * A "map" is an object with no prototype, for our purposes. In some cases
8235 * this would be more appropriate than a `Map`, especially if your environment
8236 * doesn't support it. Recommended for use in Mocha's public APIs.
8239 * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map|MDN:Map}
8240 * @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}
8241 * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign|MDN:Object.assign}
8242 * @param {...*} [obj] - Arguments to `Object.assign()`.
8243 * @returns {Object} An object with no prototype, having `...obj` properties
8245 exports.createMap = function(obj) {
8246 return assign.apply(
8248 [Object.create(null)].concat(Array.prototype.slice.call(arguments))
8253 * Creates a read-only map-like object.
8256 * This differs from {@link module:utils.createMap createMap} only in that
8257 * the argument must be non-empty, because the result is frozen.
8259 * @see {@link module:utils.createMap createMap}
8260 * @param {...*} [obj] - Arguments to `Object.assign()`.
8261 * @returns {Object} A frozen object with no prototype, having `...obj` properties
8262 * @throws {TypeError} if argument is not a non-empty object.
8264 exports.defineConstants = function(obj) {
8265 if (type(obj) !== 'object' || !Object.keys(obj).length) {
8266 throw new TypeError('Invalid argument; expected a non-empty object');
8268 return Object.freeze(exports.createMap(obj));
8272 * Whether current version of Node support ES modules
8275 * Versions prior to 10 did not support ES Modules, and version 10 has an old incompatibile version of ESM.
8276 * This function returns whether Node.JS has ES Module supports that is compatible with Mocha's needs,
8277 * which is version >=12.11.
8279 * @returns {Boolean} whether the current version of Node.JS supports ES Modules in a way that is compatible with Mocha
8281 exports.supportsEsModules = function() {
8282 if (!process.browser && process.versions && process.versions.node) {
8283 var versionFields = process.versions.node.split('.');
8284 var major = +versionFields[0];
8285 var minor = +versionFields[1];
8287 if (major >= 13 || (major === 12 && minor >= 11)) {
8293 }).call(this,require('_process'),require("buffer").Buffer)
8294 },{"./errors":6,"_process":69,"buffer":43,"fs":42,"glob":42,"he":54,"object.assign":65,"path":42,"util":89}],39:[function(require,module,exports){
8297 exports.byteLength = byteLength
8298 exports.toByteArray = toByteArray
8299 exports.fromByteArray = fromByteArray
8303 var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
8305 var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
8306 for (var i = 0, len = code.length; i < len; ++i) {
8308 revLookup[code.charCodeAt(i)] = i
8311 // Support decoding URL-safe base64 strings, as Node.js does.
8312 // See: https://en.wikipedia.org/wiki/Base64#URL_applications
8313 revLookup['-'.charCodeAt(0)] = 62
8314 revLookup['_'.charCodeAt(0)] = 63
8316 function getLens (b64) {
8317 var len = b64.length
8320 throw new Error('Invalid string. Length must be a multiple of 4')
8323 // Trim off extra bytes after placeholder bytes are found
8324 // See: https://github.com/beatgammit/base64-js/issues/42
8325 var validLen = b64.indexOf('=')
8326 if (validLen === -1) validLen = len
8328 var placeHoldersLen = validLen === len
8330 : 4 - (validLen % 4)
8332 return [validLen, placeHoldersLen]
8335 // base64 is 4/3 + up to two characters of the original data
8336 function byteLength (b64) {
8337 var lens = getLens(b64)
8338 var validLen = lens[0]
8339 var placeHoldersLen = lens[1]
8340 return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
8343 function _byteLength (b64, validLen, placeHoldersLen) {
8344 return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
8347 function toByteArray (b64) {
8349 var lens = getLens(b64)
8350 var validLen = lens[0]
8351 var placeHoldersLen = lens[1]
8353 var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
8357 // if there are placeholders, only get up to the last complete 4 chars
8358 var len = placeHoldersLen > 0
8362 for (var i = 0; i < len; i += 4) {
8364 (revLookup[b64.charCodeAt(i)] << 18) |
8365 (revLookup[b64.charCodeAt(i + 1)] << 12) |
8366 (revLookup[b64.charCodeAt(i + 2)] << 6) |
8367 revLookup[b64.charCodeAt(i + 3)]
8368 arr[curByte++] = (tmp >> 16) & 0xFF
8369 arr[curByte++] = (tmp >> 8) & 0xFF
8370 arr[curByte++] = tmp & 0xFF
8373 if (placeHoldersLen === 2) {
8375 (revLookup[b64.charCodeAt(i)] << 2) |
8376 (revLookup[b64.charCodeAt(i + 1)] >> 4)
8377 arr[curByte++] = tmp & 0xFF
8380 if (placeHoldersLen === 1) {
8382 (revLookup[b64.charCodeAt(i)] << 10) |
8383 (revLookup[b64.charCodeAt(i + 1)] << 4) |
8384 (revLookup[b64.charCodeAt(i + 2)] >> 2)
8385 arr[curByte++] = (tmp >> 8) & 0xFF
8386 arr[curByte++] = tmp & 0xFF
8392 function tripletToBase64 (num) {
8393 return lookup[num >> 18 & 0x3F] +
8394 lookup[num >> 12 & 0x3F] +
8395 lookup[num >> 6 & 0x3F] +
8399 function encodeChunk (uint8, start, end) {
8402 for (var i = start; i < end; i += 3) {
8404 ((uint8[i] << 16) & 0xFF0000) +
8405 ((uint8[i + 1] << 8) & 0xFF00) +
8406 (uint8[i + 2] & 0xFF)
8407 output.push(tripletToBase64(tmp))
8409 return output.join('')
8412 function fromByteArray (uint8) {
8414 var len = uint8.length
8415 var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
8417 var maxChunkLength = 16383 // must be multiple of 3
8419 // go through the array every three bytes, we'll deal with trailing stuff later
8420 for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
8421 parts.push(encodeChunk(
8422 uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
8426 // pad the end with zeros, but make sure to not forget the extra bytes
8427 if (extraBytes === 1) {
8428 tmp = uint8[len - 1]
8431 lookup[(tmp << 4) & 0x3F] +
8434 } else if (extraBytes === 2) {
8435 tmp = (uint8[len - 2] << 8) + uint8[len - 1]
8438 lookup[(tmp >> 4) & 0x3F] +
8439 lookup[(tmp << 2) & 0x3F] +
8444 return parts.join('')
8447 },{}],40:[function(require,module,exports){
8449 },{}],41:[function(require,module,exports){
8450 (function (process){
8451 var WritableStream = require('stream').Writable
8452 var inherits = require('util').inherits
8454 module.exports = BrowserStdout
8457 inherits(BrowserStdout, WritableStream)
8459 function BrowserStdout(opts) {
8460 if (!(this instanceof BrowserStdout)) return new BrowserStdout(opts)
8463 WritableStream.call(this, opts)
8464 this.label = (opts.label !== undefined) ? opts.label : 'stdout'
8467 BrowserStdout.prototype._write = function(chunks, encoding, cb) {
8468 var output = chunks.toString ? chunks.toString() : chunks
8469 if (this.label === false) {
8472 console.log(this.label+':', output)
8474 process.nextTick(cb)
8477 }).call(this,require('_process'))
8478 },{"_process":69,"stream":84,"util":89}],42:[function(require,module,exports){
8479 arguments[4][40][0].apply(exports,arguments)
8480 },{"dup":40}],43:[function(require,module,exports){
8483 * The buffer module from node.js, for the browser.
8485 * @author Feross Aboukhadijeh <https://feross.org>
8488 /* eslint-disable no-proto */
8492 var base64 = require('base64-js')
8493 var ieee754 = require('ieee754')
8495 exports.Buffer = Buffer
8496 exports.SlowBuffer = SlowBuffer
8497 exports.INSPECT_MAX_BYTES = 50
8499 var K_MAX_LENGTH = 0x7fffffff
8500 exports.kMaxLength = K_MAX_LENGTH
8503 * If `Buffer.TYPED_ARRAY_SUPPORT`:
8504 * === true Use Uint8Array implementation (fastest)
8505 * === false Print warning and recommend using `buffer` v4.x which has an Object
8506 * implementation (most compatible, even IE6)
8508 * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
8509 * Opera 11.6+, iOS 4.2+.
8511 * We report that the browser does not support typed arrays if the are not subclassable
8512 * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`
8513 * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support
8514 * for __proto__ and has a buggy typed array implementation.
8516 Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport()
8518 if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&
8519 typeof console.error === 'function') {
8521 'This browser lacks typed array (Uint8Array) support which is required by ' +
8522 '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'
8526 function typedArraySupport () {
8527 // Can typed array instances can be augmented?
8529 var arr = new Uint8Array(1)
8530 arr.__proto__ = { __proto__: Uint8Array.prototype, foo: function () { return 42 } }
8531 return arr.foo() === 42
8537 Object.defineProperty(Buffer.prototype, 'parent', {
8540 if (!Buffer.isBuffer(this)) return undefined
8545 Object.defineProperty(Buffer.prototype, 'offset', {
8548 if (!Buffer.isBuffer(this)) return undefined
8549 return this.byteOffset
8553 function createBuffer (length) {
8554 if (length > K_MAX_LENGTH) {
8555 throw new RangeError('The value "' + length + '" is invalid for option "size"')
8557 // Return an augmented `Uint8Array` instance
8558 var buf = new Uint8Array(length)
8559 buf.__proto__ = Buffer.prototype
8564 * The Buffer constructor returns instances of `Uint8Array` that have their
8565 * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
8566 * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
8567 * and the `Uint8Array` methods. Square bracket notation works as expected -- it
8568 * returns a single octet.
8570 * The `Uint8Array` prototype remains unmodified.
8573 function Buffer (arg, encodingOrOffset, length) {
8575 if (typeof arg === 'number') {
8576 if (typeof encodingOrOffset === 'string') {
8577 throw new TypeError(
8578 'The "string" argument must be of type string. Received type number'
8581 return allocUnsafe(arg)
8583 return from(arg, encodingOrOffset, length)
8586 // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
8587 if (typeof Symbol !== 'undefined' && Symbol.species != null &&
8588 Buffer[Symbol.species] === Buffer) {
8589 Object.defineProperty(Buffer, Symbol.species, {
8597 Buffer.poolSize = 8192 // not used by this implementation
8599 function from (value, encodingOrOffset, length) {
8600 if (typeof value === 'string') {
8601 return fromString(value, encodingOrOffset)
8604 if (ArrayBuffer.isView(value)) {
8605 return fromArrayLike(value)
8608 if (value == null) {
8610 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
8611 'or Array-like Object. Received type ' + (typeof value)
8615 if (isInstance(value, ArrayBuffer) ||
8616 (value && isInstance(value.buffer, ArrayBuffer))) {
8617 return fromArrayBuffer(value, encodingOrOffset, length)
8620 if (typeof value === 'number') {
8621 throw new TypeError(
8622 'The "value" argument must not be of type number. Received type number'
8626 var valueOf = value.valueOf && value.valueOf()
8627 if (valueOf != null && valueOf !== value) {
8628 return Buffer.from(valueOf, encodingOrOffset, length)
8631 var b = fromObject(value)
8634 if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&
8635 typeof value[Symbol.toPrimitive] === 'function') {
8637 value[Symbol.toPrimitive]('string'), encodingOrOffset, length
8641 throw new TypeError(
8642 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
8643 'or Array-like Object. Received type ' + (typeof value)
8648 * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
8649 * if value is a number.
8650 * Buffer.from(str[, encoding])
8651 * Buffer.from(array)
8652 * Buffer.from(buffer)
8653 * Buffer.from(arrayBuffer[, byteOffset[, length]])
8655 Buffer.from = function (value, encodingOrOffset, length) {
8656 return from(value, encodingOrOffset, length)
8659 // Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:
8660 // https://github.com/feross/buffer/pull/148
8661 Buffer.prototype.__proto__ = Uint8Array.prototype
8662 Buffer.__proto__ = Uint8Array
8664 function assertSize (size) {
8665 if (typeof size !== 'number') {
8666 throw new TypeError('"size" argument must be of type number')
8667 } else if (size < 0) {
8668 throw new RangeError('The value "' + size + '" is invalid for option "size"')
8672 function alloc (size, fill, encoding) {
8675 return createBuffer(size)
8677 if (fill !== undefined) {
8678 // Only pay attention to encoding if it's a string. This
8679 // prevents accidentally sending in a number that would
8680 // be interpreted as a start offset.
8681 return typeof encoding === 'string'
8682 ? createBuffer(size).fill(fill, encoding)
8683 : createBuffer(size).fill(fill)
8685 return createBuffer(size)
8689 * Creates a new filled Buffer instance.
8690 * alloc(size[, fill[, encoding]])
8692 Buffer.alloc = function (size, fill, encoding) {
8693 return alloc(size, fill, encoding)
8696 function allocUnsafe (size) {
8698 return createBuffer(size < 0 ? 0 : checked(size) | 0)
8702 * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
8704 Buffer.allocUnsafe = function (size) {
8705 return allocUnsafe(size)
8708 * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
8710 Buffer.allocUnsafeSlow = function (size) {
8711 return allocUnsafe(size)
8714 function fromString (string, encoding) {
8715 if (typeof encoding !== 'string' || encoding === '') {
8719 if (!Buffer.isEncoding(encoding)) {
8720 throw new TypeError('Unknown encoding: ' + encoding)
8723 var length = byteLength(string, encoding) | 0
8724 var buf = createBuffer(length)
8726 var actual = buf.write(string, encoding)
8728 if (actual !== length) {
8729 // Writing a hex string, for example, that contains invalid characters will
8730 // cause everything after the first invalid character to be ignored. (e.g.
8731 // 'abxxcd' will be treated as 'ab')
8732 buf = buf.slice(0, actual)
8738 function fromArrayLike (array) {
8739 var length = array.length < 0 ? 0 : checked(array.length) | 0
8740 var buf = createBuffer(length)
8741 for (var i = 0; i < length; i += 1) {
8742 buf[i] = array[i] & 255
8747 function fromArrayBuffer (array, byteOffset, length) {
8748 if (byteOffset < 0 || array.byteLength < byteOffset) {
8749 throw new RangeError('"offset" is outside of buffer bounds')
8752 if (array.byteLength < byteOffset + (length || 0)) {
8753 throw new RangeError('"length" is outside of buffer bounds')
8757 if (byteOffset === undefined && length === undefined) {
8758 buf = new Uint8Array(array)
8759 } else if (length === undefined) {
8760 buf = new Uint8Array(array, byteOffset)
8762 buf = new Uint8Array(array, byteOffset, length)
8765 // Return an augmented `Uint8Array` instance
8766 buf.__proto__ = Buffer.prototype
8770 function fromObject (obj) {
8771 if (Buffer.isBuffer(obj)) {
8772 var len = checked(obj.length) | 0
8773 var buf = createBuffer(len)
8775 if (buf.length === 0) {
8779 obj.copy(buf, 0, 0, len)
8783 if (obj.length !== undefined) {
8784 if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {
8785 return createBuffer(0)
8787 return fromArrayLike(obj)
8790 if (obj.type === 'Buffer' && Array.isArray(obj.data)) {
8791 return fromArrayLike(obj.data)
8795 function checked (length) {
8796 // Note: cannot use `length < K_MAX_LENGTH` here because that fails when
8797 // length is NaN (which is otherwise coerced to zero.)
8798 if (length >= K_MAX_LENGTH) {
8799 throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
8800 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')
8805 function SlowBuffer (length) {
8806 if (+length != length) { // eslint-disable-line eqeqeq
8809 return Buffer.alloc(+length)
8812 Buffer.isBuffer = function isBuffer (b) {
8813 return b != null && b._isBuffer === true &&
8814 b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false
8817 Buffer.compare = function compare (a, b) {
8818 if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength)
8819 if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength)
8820 if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
8821 throw new TypeError(
8822 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
8826 if (a === b) return 0
8831 for (var i = 0, len = Math.min(x, y); i < len; ++i) {
8832 if (a[i] !== b[i]) {
8839 if (x < y) return -1
8844 Buffer.isEncoding = function isEncoding (encoding) {
8845 switch (String(encoding).toLowerCase()) {
8863 Buffer.concat = function concat (list, length) {
8864 if (!Array.isArray(list)) {
8865 throw new TypeError('"list" argument must be an Array of Buffers')
8868 if (list.length === 0) {
8869 return Buffer.alloc(0)
8873 if (length === undefined) {
8875 for (i = 0; i < list.length; ++i) {
8876 length += list[i].length
8880 var buffer = Buffer.allocUnsafe(length)
8882 for (i = 0; i < list.length; ++i) {
8884 if (isInstance(buf, Uint8Array)) {
8885 buf = Buffer.from(buf)
8887 if (!Buffer.isBuffer(buf)) {
8888 throw new TypeError('"list" argument must be an Array of Buffers')
8890 buf.copy(buffer, pos)
8896 function byteLength (string, encoding) {
8897 if (Buffer.isBuffer(string)) {
8898 return string.length
8900 if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {
8901 return string.byteLength
8903 if (typeof string !== 'string') {
8904 throw new TypeError(
8905 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' +
8906 'Received type ' + typeof string
8910 var len = string.length
8911 var mustMatch = (arguments.length > 2 && arguments[2] === true)
8912 if (!mustMatch && len === 0) return 0
8914 // Use a for loop to avoid recursion
8915 var loweredCase = false
8924 return utf8ToBytes(string).length
8933 return base64ToBytes(string).length
8936 return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8
8938 encoding = ('' + encoding).toLowerCase()
8943 Buffer.byteLength = byteLength
8945 function slowToString (encoding, start, end) {
8946 var loweredCase = false
8948 // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
8949 // property of a typed array.
8951 // This behaves neither like String nor Uint8Array in that we set start/end
8952 // to their upper/lower bounds if the value passed is out of range.
8953 // undefined is handled specially as per ECMA-262 6th Edition,
8954 // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
8955 if (start === undefined || start < 0) {
8958 // Return early if start > this.length. Done here to prevent potential uint32
8959 // coercion fail below.
8960 if (start > this.length) {
8964 if (end === undefined || end > this.length) {
8972 // Force coercion to uint32. This will also coerce falsey/NaN values to 0.
8980 if (!encoding) encoding = 'utf8'
8985 return hexSlice(this, start, end)
8989 return utf8Slice(this, start, end)
8992 return asciiSlice(this, start, end)
8996 return latin1Slice(this, start, end)
8999 return base64Slice(this, start, end)
9005 return utf16leSlice(this, start, end)
9008 if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
9009 encoding = (encoding + '').toLowerCase()
9015 // This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)
9016 // to detect a Buffer instance. It's not possible to use `instanceof Buffer`
9017 // reliably in a browserify context because there could be multiple different
9018 // copies of the 'buffer' package in use. This method works even for Buffer
9019 // instances that were created from another copy of the `buffer` package.
9020 // See: https://github.com/feross/buffer/issues/154
9021 Buffer.prototype._isBuffer = true
9023 function swap (b, n, m) {
9029 Buffer.prototype.swap16 = function swap16 () {
9030 var len = this.length
9031 if (len % 2 !== 0) {
9032 throw new RangeError('Buffer size must be a multiple of 16-bits')
9034 for (var i = 0; i < len; i += 2) {
9035 swap(this, i, i + 1)
9040 Buffer.prototype.swap32 = function swap32 () {
9041 var len = this.length
9042 if (len % 4 !== 0) {
9043 throw new RangeError('Buffer size must be a multiple of 32-bits')
9045 for (var i = 0; i < len; i += 4) {
9046 swap(this, i, i + 3)
9047 swap(this, i + 1, i + 2)
9052 Buffer.prototype.swap64 = function swap64 () {
9053 var len = this.length
9054 if (len % 8 !== 0) {
9055 throw new RangeError('Buffer size must be a multiple of 64-bits')
9057 for (var i = 0; i < len; i += 8) {
9058 swap(this, i, i + 7)
9059 swap(this, i + 1, i + 6)
9060 swap(this, i + 2, i + 5)
9061 swap(this, i + 3, i + 4)
9066 Buffer.prototype.toString = function toString () {
9067 var length = this.length
9068 if (length === 0) return ''
9069 if (arguments.length === 0) return utf8Slice(this, 0, length)
9070 return slowToString.apply(this, arguments)
9073 Buffer.prototype.toLocaleString = Buffer.prototype.toString
9075 Buffer.prototype.equals = function equals (b) {
9076 if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
9077 if (this === b) return true
9078 return Buffer.compare(this, b) === 0
9081 Buffer.prototype.inspect = function inspect () {
9083 var max = exports.INSPECT_MAX_BYTES
9084 str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()
9085 if (this.length > max) str += ' ... '
9086 return '<Buffer ' + str + '>'
9089 Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
9090 if (isInstance(target, Uint8Array)) {
9091 target = Buffer.from(target, target.offset, target.byteLength)
9093 if (!Buffer.isBuffer(target)) {
9094 throw new TypeError(
9095 'The "target" argument must be one of type Buffer or Uint8Array. ' +
9096 'Received type ' + (typeof target)
9100 if (start === undefined) {
9103 if (end === undefined) {
9104 end = target ? target.length : 0
9106 if (thisStart === undefined) {
9109 if (thisEnd === undefined) {
9110 thisEnd = this.length
9113 if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
9114 throw new RangeError('out of range index')
9117 if (thisStart >= thisEnd && start >= end) {
9120 if (thisStart >= thisEnd) {
9132 if (this === target) return 0
9134 var x = thisEnd - thisStart
9136 var len = Math.min(x, y)
9138 var thisCopy = this.slice(thisStart, thisEnd)
9139 var targetCopy = target.slice(start, end)
9141 for (var i = 0; i < len; ++i) {
9142 if (thisCopy[i] !== targetCopy[i]) {
9149 if (x < y) return -1
9154 // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
9155 // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
9158 // - buffer - a Buffer to search
9159 // - val - a string, Buffer, or number
9160 // - byteOffset - an index into `buffer`; will be clamped to an int32
9161 // - encoding - an optional encoding, relevant is val is a string
9162 // - dir - true for indexOf, false for lastIndexOf
9163 function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
9164 // Empty buffer means no match
9165 if (buffer.length === 0) return -1
9167 // Normalize byteOffset
9168 if (typeof byteOffset === 'string') {
9169 encoding = byteOffset
9171 } else if (byteOffset > 0x7fffffff) {
9172 byteOffset = 0x7fffffff
9173 } else if (byteOffset < -0x80000000) {
9174 byteOffset = -0x80000000
9176 byteOffset = +byteOffset // Coerce to Number.
9177 if (numberIsNaN(byteOffset)) {
9178 // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
9179 byteOffset = dir ? 0 : (buffer.length - 1)
9182 // Normalize byteOffset: negative offsets start from the end of the buffer
9183 if (byteOffset < 0) byteOffset = buffer.length + byteOffset
9184 if (byteOffset >= buffer.length) {
9186 else byteOffset = buffer.length - 1
9187 } else if (byteOffset < 0) {
9188 if (dir) byteOffset = 0
9193 if (typeof val === 'string') {
9194 val = Buffer.from(val, encoding)
9197 // Finally, search either indexOf (if dir is true) or lastIndexOf
9198 if (Buffer.isBuffer(val)) {
9199 // Special case: looking for empty string/buffer always fails
9200 if (val.length === 0) {
9203 return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
9204 } else if (typeof val === 'number') {
9205 val = val & 0xFF // Search for a byte value [0-255]
9206 if (typeof Uint8Array.prototype.indexOf === 'function') {
9208 return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
9210 return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
9213 return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
9216 throw new TypeError('val must be string, number or Buffer')
9219 function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
9221 var arrLength = arr.length
9222 var valLength = val.length
9224 if (encoding !== undefined) {
9225 encoding = String(encoding).toLowerCase()
9226 if (encoding === 'ucs2' || encoding === 'ucs-2' ||
9227 encoding === 'utf16le' || encoding === 'utf-16le') {
9228 if (arr.length < 2 || val.length < 2) {
9238 function read (buf, i) {
9239 if (indexSize === 1) {
9242 return buf.readUInt16BE(i * indexSize)
9249 for (i = byteOffset; i < arrLength; i++) {
9250 if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
9251 if (foundIndex === -1) foundIndex = i
9252 if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
9254 if (foundIndex !== -1) i -= i - foundIndex
9259 if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
9260 for (i = byteOffset; i >= 0; i--) {
9262 for (var j = 0; j < valLength; j++) {
9263 if (read(arr, i + j) !== read(val, j)) {
9275 Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
9276 return this.indexOf(val, byteOffset, encoding) !== -1
9279 Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
9280 return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
9283 Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
9284 return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
9287 function hexWrite (buf, string, offset, length) {
9288 offset = Number(offset) || 0
9289 var remaining = buf.length - offset
9293 length = Number(length)
9294 if (length > remaining) {
9299 var strLen = string.length
9301 if (length > strLen / 2) {
9304 for (var i = 0; i < length; ++i) {
9305 var parsed = parseInt(string.substr(i * 2, 2), 16)
9306 if (numberIsNaN(parsed)) return i
9307 buf[offset + i] = parsed
9312 function utf8Write (buf, string, offset, length) {
9313 return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
9316 function asciiWrite (buf, string, offset, length) {
9317 return blitBuffer(asciiToBytes(string), buf, offset, length)
9320 function latin1Write (buf, string, offset, length) {
9321 return asciiWrite(buf, string, offset, length)
9324 function base64Write (buf, string, offset, length) {
9325 return blitBuffer(base64ToBytes(string), buf, offset, length)
9328 function ucs2Write (buf, string, offset, length) {
9329 return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
9332 Buffer.prototype.write = function write (string, offset, length, encoding) {
9333 // Buffer#write(string)
9334 if (offset === undefined) {
9336 length = this.length
9338 // Buffer#write(string, encoding)
9339 } else if (length === undefined && typeof offset === 'string') {
9341 length = this.length
9343 // Buffer#write(string, offset[, length][, encoding])
9344 } else if (isFinite(offset)) {
9345 offset = offset >>> 0
9346 if (isFinite(length)) {
9347 length = length >>> 0
9348 if (encoding === undefined) encoding = 'utf8'
9355 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
9359 var remaining = this.length - offset
9360 if (length === undefined || length > remaining) length = remaining
9362 if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
9363 throw new RangeError('Attempt to write outside buffer bounds')
9366 if (!encoding) encoding = 'utf8'
9368 var loweredCase = false
9372 return hexWrite(this, string, offset, length)
9376 return utf8Write(this, string, offset, length)
9379 return asciiWrite(this, string, offset, length)
9383 return latin1Write(this, string, offset, length)
9386 // Warning: maxLength not taken into account in base64Write
9387 return base64Write(this, string, offset, length)
9393 return ucs2Write(this, string, offset, length)
9396 if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
9397 encoding = ('' + encoding).toLowerCase()
9403 Buffer.prototype.toJSON = function toJSON () {
9406 data: Array.prototype.slice.call(this._arr || this, 0)
9410 function base64Slice (buf, start, end) {
9411 if (start === 0 && end === buf.length) {
9412 return base64.fromByteArray(buf)
9414 return base64.fromByteArray(buf.slice(start, end))
9418 function utf8Slice (buf, start, end) {
9419 end = Math.min(buf.length, end)
9424 var firstByte = buf[i]
9425 var codePoint = null
9426 var bytesPerSequence = (firstByte > 0xEF) ? 4
9427 : (firstByte > 0xDF) ? 3
9428 : (firstByte > 0xBF) ? 2
9431 if (i + bytesPerSequence <= end) {
9432 var secondByte, thirdByte, fourthByte, tempCodePoint
9434 switch (bytesPerSequence) {
9436 if (firstByte < 0x80) {
9437 codePoint = firstByte
9441 secondByte = buf[i + 1]
9442 if ((secondByte & 0xC0) === 0x80) {
9443 tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
9444 if (tempCodePoint > 0x7F) {
9445 codePoint = tempCodePoint
9450 secondByte = buf[i + 1]
9451 thirdByte = buf[i + 2]
9452 if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
9453 tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
9454 if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
9455 codePoint = tempCodePoint
9460 secondByte = buf[i + 1]
9461 thirdByte = buf[i + 2]
9462 fourthByte = buf[i + 3]
9463 if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
9464 tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
9465 if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
9466 codePoint = tempCodePoint
9472 if (codePoint === null) {
9473 // we did not generate a valid codePoint so insert a
9474 // replacement char (U+FFFD) and advance only 1 byte
9476 bytesPerSequence = 1
9477 } else if (codePoint > 0xFFFF) {
9478 // encode to utf16 (surrogate pair dance)
9479 codePoint -= 0x10000
9480 res.push(codePoint >>> 10 & 0x3FF | 0xD800)
9481 codePoint = 0xDC00 | codePoint & 0x3FF
9485 i += bytesPerSequence
9488 return decodeCodePointsArray(res)
9491 // Based on http://stackoverflow.com/a/22747272/680742, the browser with
9492 // the lowest limit is Chrome, with 0x10000 args.
9493 // We go 1 magnitude less, for safety
9494 var MAX_ARGUMENTS_LENGTH = 0x1000
9496 function decodeCodePointsArray (codePoints) {
9497 var len = codePoints.length
9498 if (len <= MAX_ARGUMENTS_LENGTH) {
9499 return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
9502 // Decode in chunks to avoid "call stack size exceeded".
9506 res += String.fromCharCode.apply(
9508 codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
9514 function asciiSlice (buf, start, end) {
9516 end = Math.min(buf.length, end)
9518 for (var i = start; i < end; ++i) {
9519 ret += String.fromCharCode(buf[i] & 0x7F)
9524 function latin1Slice (buf, start, end) {
9526 end = Math.min(buf.length, end)
9528 for (var i = start; i < end; ++i) {
9529 ret += String.fromCharCode(buf[i])
9534 function hexSlice (buf, start, end) {
9535 var len = buf.length
9537 if (!start || start < 0) start = 0
9538 if (!end || end < 0 || end > len) end = len
9541 for (var i = start; i < end; ++i) {
9542 out += toHex(buf[i])
9547 function utf16leSlice (buf, start, end) {
9548 var bytes = buf.slice(start, end)
9550 for (var i = 0; i < bytes.length; i += 2) {
9551 res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))
9556 Buffer.prototype.slice = function slice (start, end) {
9557 var len = this.length
9559 end = end === undefined ? len : ~~end
9563 if (start < 0) start = 0
9564 } else if (start > len) {
9570 if (end < 0) end = 0
9571 } else if (end > len) {
9575 if (end < start) end = start
9577 var newBuf = this.subarray(start, end)
9578 // Return an augmented `Uint8Array` instance
9579 newBuf.__proto__ = Buffer.prototype
9584 * Need to make sure that buffer isn't trying to write out of bounds.
9586 function checkOffset (offset, ext, length) {
9587 if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
9588 if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
9591 Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
9592 offset = offset >>> 0
9593 byteLength = byteLength >>> 0
9594 if (!noAssert) checkOffset(offset, byteLength, this.length)
9596 var val = this[offset]
9599 while (++i < byteLength && (mul *= 0x100)) {
9600 val += this[offset + i] * mul
9606 Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
9607 offset = offset >>> 0
9608 byteLength = byteLength >>> 0
9610 checkOffset(offset, byteLength, this.length)
9613 var val = this[offset + --byteLength]
9615 while (byteLength > 0 && (mul *= 0x100)) {
9616 val += this[offset + --byteLength] * mul
9622 Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
9623 offset = offset >>> 0
9624 if (!noAssert) checkOffset(offset, 1, this.length)
9628 Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
9629 offset = offset >>> 0
9630 if (!noAssert) checkOffset(offset, 2, this.length)
9631 return this[offset] | (this[offset + 1] << 8)
9634 Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
9635 offset = offset >>> 0
9636 if (!noAssert) checkOffset(offset, 2, this.length)
9637 return (this[offset] << 8) | this[offset + 1]
9640 Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
9641 offset = offset >>> 0
9642 if (!noAssert) checkOffset(offset, 4, this.length)
9644 return ((this[offset]) |
9645 (this[offset + 1] << 8) |
9646 (this[offset + 2] << 16)) +
9647 (this[offset + 3] * 0x1000000)
9650 Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
9651 offset = offset >>> 0
9652 if (!noAssert) checkOffset(offset, 4, this.length)
9654 return (this[offset] * 0x1000000) +
9655 ((this[offset + 1] << 16) |
9656 (this[offset + 2] << 8) |
9660 Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
9661 offset = offset >>> 0
9662 byteLength = byteLength >>> 0
9663 if (!noAssert) checkOffset(offset, byteLength, this.length)
9665 var val = this[offset]
9668 while (++i < byteLength && (mul *= 0x100)) {
9669 val += this[offset + i] * mul
9673 if (val >= mul) val -= Math.pow(2, 8 * byteLength)
9678 Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
9679 offset = offset >>> 0
9680 byteLength = byteLength >>> 0
9681 if (!noAssert) checkOffset(offset, byteLength, this.length)
9685 var val = this[offset + --i]
9686 while (i > 0 && (mul *= 0x100)) {
9687 val += this[offset + --i] * mul
9691 if (val >= mul) val -= Math.pow(2, 8 * byteLength)
9696 Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
9697 offset = offset >>> 0
9698 if (!noAssert) checkOffset(offset, 1, this.length)
9699 if (!(this[offset] & 0x80)) return (this[offset])
9700 return ((0xff - this[offset] + 1) * -1)
9703 Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
9704 offset = offset >>> 0
9705 if (!noAssert) checkOffset(offset, 2, this.length)
9706 var val = this[offset] | (this[offset + 1] << 8)
9707 return (val & 0x8000) ? val | 0xFFFF0000 : val
9710 Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
9711 offset = offset >>> 0
9712 if (!noAssert) checkOffset(offset, 2, this.length)
9713 var val = this[offset + 1] | (this[offset] << 8)
9714 return (val & 0x8000) ? val | 0xFFFF0000 : val
9717 Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
9718 offset = offset >>> 0
9719 if (!noAssert) checkOffset(offset, 4, this.length)
9721 return (this[offset]) |
9722 (this[offset + 1] << 8) |
9723 (this[offset + 2] << 16) |
9724 (this[offset + 3] << 24)
9727 Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
9728 offset = offset >>> 0
9729 if (!noAssert) checkOffset(offset, 4, this.length)
9731 return (this[offset] << 24) |
9732 (this[offset + 1] << 16) |
9733 (this[offset + 2] << 8) |
9737 Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
9738 offset = offset >>> 0
9739 if (!noAssert) checkOffset(offset, 4, this.length)
9740 return ieee754.read(this, offset, true, 23, 4)
9743 Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
9744 offset = offset >>> 0
9745 if (!noAssert) checkOffset(offset, 4, this.length)
9746 return ieee754.read(this, offset, false, 23, 4)
9749 Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
9750 offset = offset >>> 0
9751 if (!noAssert) checkOffset(offset, 8, this.length)
9752 return ieee754.read(this, offset, true, 52, 8)
9755 Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
9756 offset = offset >>> 0
9757 if (!noAssert) checkOffset(offset, 8, this.length)
9758 return ieee754.read(this, offset, false, 52, 8)
9761 function checkInt (buf, value, offset, ext, max, min) {
9762 if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
9763 if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
9764 if (offset + ext > buf.length) throw new RangeError('Index out of range')
9767 Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
9769 offset = offset >>> 0
9770 byteLength = byteLength >>> 0
9772 var maxBytes = Math.pow(2, 8 * byteLength) - 1
9773 checkInt(this, value, offset, byteLength, maxBytes, 0)
9778 this[offset] = value & 0xFF
9779 while (++i < byteLength && (mul *= 0x100)) {
9780 this[offset + i] = (value / mul) & 0xFF
9783 return offset + byteLength
9786 Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
9788 offset = offset >>> 0
9789 byteLength = byteLength >>> 0
9791 var maxBytes = Math.pow(2, 8 * byteLength) - 1
9792 checkInt(this, value, offset, byteLength, maxBytes, 0)
9795 var i = byteLength - 1
9797 this[offset + i] = value & 0xFF
9798 while (--i >= 0 && (mul *= 0x100)) {
9799 this[offset + i] = (value / mul) & 0xFF
9802 return offset + byteLength
9805 Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
9807 offset = offset >>> 0
9808 if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
9809 this[offset] = (value & 0xff)
9813 Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
9815 offset = offset >>> 0
9816 if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
9817 this[offset] = (value & 0xff)
9818 this[offset + 1] = (value >>> 8)
9822 Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
9824 offset = offset >>> 0
9825 if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
9826 this[offset] = (value >>> 8)
9827 this[offset + 1] = (value & 0xff)
9831 Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
9833 offset = offset >>> 0
9834 if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
9835 this[offset + 3] = (value >>> 24)
9836 this[offset + 2] = (value >>> 16)
9837 this[offset + 1] = (value >>> 8)
9838 this[offset] = (value & 0xff)
9842 Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
9844 offset = offset >>> 0
9845 if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
9846 this[offset] = (value >>> 24)
9847 this[offset + 1] = (value >>> 16)
9848 this[offset + 2] = (value >>> 8)
9849 this[offset + 3] = (value & 0xff)
9853 Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
9855 offset = offset >>> 0
9857 var limit = Math.pow(2, (8 * byteLength) - 1)
9859 checkInt(this, value, offset, byteLength, limit - 1, -limit)
9865 this[offset] = value & 0xFF
9866 while (++i < byteLength && (mul *= 0x100)) {
9867 if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
9870 this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
9873 return offset + byteLength
9876 Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
9878 offset = offset >>> 0
9880 var limit = Math.pow(2, (8 * byteLength) - 1)
9882 checkInt(this, value, offset, byteLength, limit - 1, -limit)
9885 var i = byteLength - 1
9888 this[offset + i] = value & 0xFF
9889 while (--i >= 0 && (mul *= 0x100)) {
9890 if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
9893 this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
9896 return offset + byteLength
9899 Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
9901 offset = offset >>> 0
9902 if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
9903 if (value < 0) value = 0xff + value + 1
9904 this[offset] = (value & 0xff)
9908 Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
9910 offset = offset >>> 0
9911 if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
9912 this[offset] = (value & 0xff)
9913 this[offset + 1] = (value >>> 8)
9917 Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
9919 offset = offset >>> 0
9920 if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
9921 this[offset] = (value >>> 8)
9922 this[offset + 1] = (value & 0xff)
9926 Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
9928 offset = offset >>> 0
9929 if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
9930 this[offset] = (value & 0xff)
9931 this[offset + 1] = (value >>> 8)
9932 this[offset + 2] = (value >>> 16)
9933 this[offset + 3] = (value >>> 24)
9937 Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
9939 offset = offset >>> 0
9940 if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
9941 if (value < 0) value = 0xffffffff + value + 1
9942 this[offset] = (value >>> 24)
9943 this[offset + 1] = (value >>> 16)
9944 this[offset + 2] = (value >>> 8)
9945 this[offset + 3] = (value & 0xff)
9949 function checkIEEE754 (buf, value, offset, ext, max, min) {
9950 if (offset + ext > buf.length) throw new RangeError('Index out of range')
9951 if (offset < 0) throw new RangeError('Index out of range')
9954 function writeFloat (buf, value, offset, littleEndian, noAssert) {
9956 offset = offset >>> 0
9958 checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
9960 ieee754.write(buf, value, offset, littleEndian, 23, 4)
9964 Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
9965 return writeFloat(this, value, offset, true, noAssert)
9968 Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
9969 return writeFloat(this, value, offset, false, noAssert)
9972 function writeDouble (buf, value, offset, littleEndian, noAssert) {
9974 offset = offset >>> 0
9976 checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
9978 ieee754.write(buf, value, offset, littleEndian, 52, 8)
9982 Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
9983 return writeDouble(this, value, offset, true, noAssert)
9986 Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
9987 return writeDouble(this, value, offset, false, noAssert)
9990 // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
9991 Buffer.prototype.copy = function copy (target, targetStart, start, end) {
9992 if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')
9993 if (!start) start = 0
9994 if (!end && end !== 0) end = this.length
9995 if (targetStart >= target.length) targetStart = target.length
9996 if (!targetStart) targetStart = 0
9997 if (end > 0 && end < start) end = start
9999 // Copy 0 bytes; we're done
10000 if (end === start) return 0
10001 if (target.length === 0 || this.length === 0) return 0
10003 // Fatal error conditions
10004 if (targetStart < 0) {
10005 throw new RangeError('targetStart out of bounds')
10007 if (start < 0 || start >= this.length) throw new RangeError('Index out of range')
10008 if (end < 0) throw new RangeError('sourceEnd out of bounds')
10011 if (end > this.length) end = this.length
10012 if (target.length - targetStart < end - start) {
10013 end = target.length - targetStart + start
10016 var len = end - start
10018 if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {
10019 // Use built-in when available, missing from IE11
10020 this.copyWithin(targetStart, start, end)
10021 } else if (this === target && start < targetStart && targetStart < end) {
10022 // descending copy from end
10023 for (var i = len - 1; i >= 0; --i) {
10024 target[i + targetStart] = this[i + start]
10027 Uint8Array.prototype.set.call(
10029 this.subarray(start, end),
10038 // buffer.fill(number[, offset[, end]])
10039 // buffer.fill(buffer[, offset[, end]])
10040 // buffer.fill(string[, offset[, end]][, encoding])
10041 Buffer.prototype.fill = function fill (val, start, end, encoding) {
10042 // Handle string cases:
10043 if (typeof val === 'string') {
10044 if (typeof start === 'string') {
10048 } else if (typeof end === 'string') {
10052 if (encoding !== undefined && typeof encoding !== 'string') {
10053 throw new TypeError('encoding must be a string')
10055 if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
10056 throw new TypeError('Unknown encoding: ' + encoding)
10058 if (val.length === 1) {
10059 var code = val.charCodeAt(0)
10060 if ((encoding === 'utf8' && code < 128) ||
10061 encoding === 'latin1') {
10062 // Fast path: If `val` fits into a single byte, use that numeric value.
10066 } else if (typeof val === 'number') {
10070 // Invalid ranges are not set to a default, so can range check early.
10071 if (start < 0 || this.length < start || this.length < end) {
10072 throw new RangeError('Out of range index')
10075 if (end <= start) {
10079 start = start >>> 0
10080 end = end === undefined ? this.length : end >>> 0
10085 if (typeof val === 'number') {
10086 for (i = start; i < end; ++i) {
10090 var bytes = Buffer.isBuffer(val)
10092 : Buffer.from(val, encoding)
10093 var len = bytes.length
10095 throw new TypeError('The value "' + val +
10096 '" is invalid for argument "value"')
10098 for (i = 0; i < end - start; ++i) {
10099 this[i + start] = bytes[i % len]
10106 // HELPER FUNCTIONS
10107 // ================
10109 var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g
10111 function base64clean (str) {
10112 // Node takes equal signs as end of the Base64 encoding
10113 str = str.split('=')[0]
10114 // Node strips out invalid characters like \n and \t from the string, base64-js does not
10115 str = str.trim().replace(INVALID_BASE64_RE, '')
10116 // Node converts strings with length < 2 to ''
10117 if (str.length < 2) return ''
10118 // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
10119 while (str.length % 4 !== 0) {
10125 function toHex (n) {
10126 if (n < 16) return '0' + n.toString(16)
10127 return n.toString(16)
10130 function utf8ToBytes (string, units) {
10131 units = units || Infinity
10133 var length = string.length
10134 var leadSurrogate = null
10137 for (var i = 0; i < length; ++i) {
10138 codePoint = string.charCodeAt(i)
10140 // is surrogate component
10141 if (codePoint > 0xD7FF && codePoint < 0xE000) {
10142 // last char was a lead
10143 if (!leadSurrogate) {
10145 if (codePoint > 0xDBFF) {
10146 // unexpected trail
10147 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
10149 } else if (i + 1 === length) {
10151 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
10156 leadSurrogate = codePoint
10161 // 2 leads in a row
10162 if (codePoint < 0xDC00) {
10163 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
10164 leadSurrogate = codePoint
10168 // valid surrogate pair
10169 codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
10170 } else if (leadSurrogate) {
10171 // valid bmp char, but last char was a lead
10172 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
10175 leadSurrogate = null
10178 if (codePoint < 0x80) {
10179 if ((units -= 1) < 0) break
10180 bytes.push(codePoint)
10181 } else if (codePoint < 0x800) {
10182 if ((units -= 2) < 0) break
10184 codePoint >> 0x6 | 0xC0,
10185 codePoint & 0x3F | 0x80
10187 } else if (codePoint < 0x10000) {
10188 if ((units -= 3) < 0) break
10190 codePoint >> 0xC | 0xE0,
10191 codePoint >> 0x6 & 0x3F | 0x80,
10192 codePoint & 0x3F | 0x80
10194 } else if (codePoint < 0x110000) {
10195 if ((units -= 4) < 0) break
10197 codePoint >> 0x12 | 0xF0,
10198 codePoint >> 0xC & 0x3F | 0x80,
10199 codePoint >> 0x6 & 0x3F | 0x80,
10200 codePoint & 0x3F | 0x80
10203 throw new Error('Invalid code point')
10210 function asciiToBytes (str) {
10212 for (var i = 0; i < str.length; ++i) {
10213 // Node's code seems to be doing this and not & 0x7F..
10214 byteArray.push(str.charCodeAt(i) & 0xFF)
10219 function utf16leToBytes (str, units) {
10222 for (var i = 0; i < str.length; ++i) {
10223 if ((units -= 2) < 0) break
10225 c = str.charCodeAt(i)
10235 function base64ToBytes (str) {
10236 return base64.toByteArray(base64clean(str))
10239 function blitBuffer (src, dst, offset, length) {
10240 for (var i = 0; i < length; ++i) {
10241 if ((i + offset >= dst.length) || (i >= src.length)) break
10242 dst[i + offset] = src[i]
10247 // ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass
10248 // the `instanceof` check but they should be treated as of that type.
10249 // See: https://github.com/feross/buffer/issues/166
10250 function isInstance (obj, type) {
10251 return obj instanceof type ||
10252 (obj != null && obj.constructor != null && obj.constructor.name != null &&
10253 obj.constructor.name === type.name)
10255 function numberIsNaN (obj) {
10256 // For IE11 support
10257 return obj !== obj // eslint-disable-line no-self-compare
10260 }).call(this,require("buffer").Buffer)
10261 },{"base64-js":39,"buffer":43,"ieee754":55}],44:[function(require,module,exports){
10262 (function (Buffer){
10263 // Copyright Joyent, Inc. and other Node contributors.
10265 // Permission is hereby granted, free of charge, to any person obtaining a
10266 // copy of this software and associated documentation files (the
10267 // "Software"), to deal in the Software without restriction, including
10268 // without limitation the rights to use, copy, modify, merge, publish,
10269 // distribute, sublicense, and/or sell copies of the Software, and to permit
10270 // persons to whom the Software is furnished to do so, subject to the
10271 // following conditions:
10273 // The above copyright notice and this permission notice shall be included
10274 // in all copies or substantial portions of the Software.
10276 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
10277 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
10278 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
10279 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
10280 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
10281 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
10282 // USE OR OTHER DEALINGS IN THE SOFTWARE.
10284 // NOTE: These type checking functions intentionally don't use `instanceof`
10285 // because it is fragile and can be easily faked with `Object.create()`.
10287 function isArray(arg) {
10288 if (Array.isArray) {
10289 return Array.isArray(arg);
10291 return objectToString(arg) === '[object Array]';
10293 exports.isArray = isArray;
10295 function isBoolean(arg) {
10296 return typeof arg === 'boolean';
10298 exports.isBoolean = isBoolean;
10300 function isNull(arg) {
10301 return arg === null;
10303 exports.isNull = isNull;
10305 function isNullOrUndefined(arg) {
10306 return arg == null;
10308 exports.isNullOrUndefined = isNullOrUndefined;
10310 function isNumber(arg) {
10311 return typeof arg === 'number';
10313 exports.isNumber = isNumber;
10315 function isString(arg) {
10316 return typeof arg === 'string';
10318 exports.isString = isString;
10320 function isSymbol(arg) {
10321 return typeof arg === 'symbol';
10323 exports.isSymbol = isSymbol;
10325 function isUndefined(arg) {
10326 return arg === void 0;
10328 exports.isUndefined = isUndefined;
10330 function isRegExp(re) {
10331 return objectToString(re) === '[object RegExp]';
10333 exports.isRegExp = isRegExp;
10335 function isObject(arg) {
10336 return typeof arg === 'object' && arg !== null;
10338 exports.isObject = isObject;
10340 function isDate(d) {
10341 return objectToString(d) === '[object Date]';
10343 exports.isDate = isDate;
10345 function isError(e) {
10346 return (objectToString(e) === '[object Error]' || e instanceof Error);
10348 exports.isError = isError;
10350 function isFunction(arg) {
10351 return typeof arg === 'function';
10353 exports.isFunction = isFunction;
10355 function isPrimitive(arg) {
10356 return arg === null ||
10357 typeof arg === 'boolean' ||
10358 typeof arg === 'number' ||
10359 typeof arg === 'string' ||
10360 typeof arg === 'symbol' || // ES6 symbol
10361 typeof arg === 'undefined';
10363 exports.isPrimitive = isPrimitive;
10365 exports.isBuffer = Buffer.isBuffer;
10367 function objectToString(o) {
10368 return Object.prototype.toString.call(o);
10371 }).call(this,{"isBuffer":require("../../is-buffer/index.js")})
10372 },{"../../is-buffer/index.js":57}],45:[function(require,module,exports){
10373 (function (process){
10376 function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
10378 /* eslint-env browser */
10381 * This is the web browser implementation of `debug()`.
10384 exports.formatArgs = formatArgs;
10385 exports.save = save;
10386 exports.load = load;
10387 exports.useColors = useColors;
10388 exports.storage = localstorage();
10393 exports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33'];
10395 * Currently only WebKit-based Web Inspectors, Firefox >= v31,
10396 * and the Firebug extension (any Firefox version) are known
10397 * to support "%c" CSS customizations.
10399 * TODO: add a `localStorage` variable to explicitly enable/disable colors
10401 // eslint-disable-next-line complexity
10403 function useColors() {
10404 // NB: In an Electron preload script, document will be defined but not fully
10405 // initialized. Since we know we're in Chrome, we'll just detect this case
10407 if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
10409 } // Internet Explorer and Edge do not support colors.
10412 if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
10414 } // Is webkit? http://stackoverflow.com/a/16459606/376773
10415 // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
10418 return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
10419 typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
10420 // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
10421 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
10422 typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
10425 * Colorize log arguments if enabled.
10431 function formatArgs(args) {
10432 args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);
10434 if (!this.useColors) {
10438 var c = 'color: ' + this.color;
10439 args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other
10440 // arguments passed either before or after the %c, so we need to
10441 // figure out the correct index to insert the CSS into
10445 args[0].replace(/%[a-zA-Z%]/g, function (match) {
10446 if (match === '%%') {
10452 if (match === '%c') {
10453 // We only are interested in the *last* %c
10454 // (the user may have provided their own)
10458 args.splice(lastC, 0, c);
10461 * Invokes `console.log()` when available.
10462 * No-op when `console.log` is not a "function".
10471 // This hackery is required for IE8/9, where
10472 // the `console.log` function doesn't have 'apply'
10473 return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments);
10476 * Save `namespaces`.
10478 * @param {String} namespaces
10483 function save(namespaces) {
10486 exports.storage.setItem('debug', namespaces);
10488 exports.storage.removeItem('debug');
10490 } catch (error) {// Swallow
10491 // XXX (@Qix-) should we be logging these?
10495 * Load `namespaces`.
10497 * @return {String} returns the previously persisted debug modes
10506 r = exports.storage.getItem('debug');
10507 } catch (error) {} // Swallow
10508 // XXX (@Qix-) should we be logging these?
10509 // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
10512 if (!r && typeof process !== 'undefined' && 'env' in process) {
10513 r = process.env.DEBUG;
10519 * Localstorage attempts to return the localstorage.
10521 * This is necessary because safari throws
10522 * when a user disables cookies/localstorage
10523 * and you attempt to access it.
10525 * @return {LocalStorage}
10530 function localstorage() {
10532 // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
10533 // The Browser also has localStorage in the global context.
10534 return localStorage;
10535 } catch (error) {// Swallow
10536 // XXX (@Qix-) should we be logging these?
10540 module.exports = require('./common')(exports);
10541 var formatters = module.exports.formatters;
10543 * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
10546 formatters.j = function (v) {
10548 return JSON.stringify(v);
10550 return '[UnexpectedJSONParseError]: ' + error.message;
10555 }).call(this,require('_process'))
10556 },{"./common":46,"_process":69}],46:[function(require,module,exports){
10560 * This is the common logic for both the Node.js and web browser
10561 * implementations of `debug()`.
10563 function setup(env) {
10564 createDebug.debug = createDebug;
10565 createDebug.default = createDebug;
10566 createDebug.coerce = coerce;
10567 createDebug.disable = disable;
10568 createDebug.enable = enable;
10569 createDebug.enabled = enabled;
10570 createDebug.humanize = require('ms');
10571 Object.keys(env).forEach(function (key) {
10572 createDebug[key] = env[key];
10575 * Active `debug` instances.
10578 createDebug.instances = [];
10580 * The currently active debug mode names, and names to skip.
10583 createDebug.names = [];
10584 createDebug.skips = [];
10586 * Map of special "%n" handling functions, for the debug "format" argument.
10588 * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
10591 createDebug.formatters = {};
10593 * Selects a color for a debug namespace
10594 * @param {String} namespace The namespace string for the for the debug instance to be colored
10595 * @return {Number|String} An ANSI color code for the given namespace
10599 function selectColor(namespace) {
10602 for (var i = 0; i < namespace.length; i++) {
10603 hash = (hash << 5) - hash + namespace.charCodeAt(i);
10604 hash |= 0; // Convert to 32bit integer
10607 return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
10610 createDebug.selectColor = selectColor;
10612 * Create a debugger with the given `namespace`.
10614 * @param {String} namespace
10615 * @return {Function}
10619 function createDebug(namespace) {
10624 if (!debug.enabled) {
10628 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
10629 args[_key] = arguments[_key];
10632 var self = debug; // Set `diff` timestamp
10634 var curr = Number(new Date());
10635 var ms = curr - (prevTime || curr);
10637 self.prev = prevTime;
10640 args[0] = createDebug.coerce(args[0]);
10642 if (typeof args[0] !== 'string') {
10643 // Anything else let's inspect with %O
10644 args.unshift('%O');
10645 } // Apply any `formatters` transformations
10649 args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {
10650 // If we encounter an escaped % then don't increase the array index
10651 if (match === '%%') {
10656 var formatter = createDebug.formatters[format];
10658 if (typeof formatter === 'function') {
10659 var val = args[index];
10660 match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format`
10662 args.splice(index, 1);
10667 }); // Apply env-specific formatting (colors, etc.)
10669 createDebug.formatArgs.call(self, args);
10670 var logFn = self.log || createDebug.log;
10671 logFn.apply(self, args);
10674 debug.namespace = namespace;
10675 debug.enabled = createDebug.enabled(namespace);
10676 debug.useColors = createDebug.useColors();
10677 debug.color = selectColor(namespace);
10678 debug.destroy = destroy;
10679 debug.extend = extend; // Debug.formatArgs = formatArgs;
10680 // debug.rawLog = rawLog;
10681 // env-specific initialization logic for debug instances
10683 if (typeof createDebug.init === 'function') {
10684 createDebug.init(debug);
10687 createDebug.instances.push(debug);
10691 function destroy() {
10692 var index = createDebug.instances.indexOf(this);
10694 if (index !== -1) {
10695 createDebug.instances.splice(index, 1);
10702 function extend(namespace, delimiter) {
10703 return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
10706 * Enables a debug mode by namespaces. This can include modes
10707 * separated by a colon and wildcards.
10709 * @param {String} namespaces
10714 function enable(namespaces) {
10715 createDebug.save(namespaces);
10716 createDebug.names = [];
10717 createDebug.skips = [];
10719 var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
10720 var len = split.length;
10722 for (i = 0; i < len; i++) {
10724 // ignore empty strings
10728 namespaces = split[i].replace(/\*/g, '.*?');
10730 if (namespaces[0] === '-') {
10731 createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
10733 createDebug.names.push(new RegExp('^' + namespaces + '$'));
10737 for (i = 0; i < createDebug.instances.length; i++) {
10738 var instance = createDebug.instances[i];
10739 instance.enabled = createDebug.enabled(instance.namespace);
10743 * Disable debug output.
10749 function disable() {
10750 createDebug.enable('');
10753 * Returns true if the given mode name is enabled, false otherwise.
10755 * @param {String} name
10756 * @return {Boolean}
10761 function enabled(name) {
10762 if (name[name.length - 1] === '*') {
10769 for (i = 0, len = createDebug.skips.length; i < len; i++) {
10770 if (createDebug.skips[i].test(name)) {
10775 for (i = 0, len = createDebug.names.length; i < len; i++) {
10776 if (createDebug.names[i].test(name)) {
10786 * @param {Mixed} val
10792 function coerce(val) {
10793 if (val instanceof Error) {
10794 return val.stack || val.message;
10800 createDebug.enable(createDebug.load());
10801 return createDebug;
10804 module.exports = setup;
10807 },{"ms":60}],47:[function(require,module,exports){
10810 var keys = require('object-keys');
10811 var hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol';
10813 var toStr = Object.prototype.toString;
10814 var concat = Array.prototype.concat;
10815 var origDefineProperty = Object.defineProperty;
10817 var isFunction = function (fn) {
10818 return typeof fn === 'function' && toStr.call(fn) === '[object Function]';
10821 var arePropertyDescriptorsSupported = function () {
10824 origDefineProperty(obj, 'x', { enumerable: false, value: obj });
10825 // eslint-disable-next-line no-unused-vars, no-restricted-syntax
10826 for (var _ in obj) { // jscs:ignore disallowUnusedVariables
10829 return obj.x === obj;
10830 } catch (e) { /* this is IE 8. */
10834 var supportsDescriptors = origDefineProperty && arePropertyDescriptorsSupported();
10836 var defineProperty = function (object, name, value, predicate) {
10837 if (name in object && (!isFunction(predicate) || !predicate())) {
10840 if (supportsDescriptors) {
10841 origDefineProperty(object, name, {
10842 configurable: true,
10848 object[name] = value;
10852 var defineProperties = function (object, map) {
10853 var predicates = arguments.length > 2 ? arguments[2] : {};
10854 var props = keys(map);
10856 props = concat.call(props, Object.getOwnPropertySymbols(map));
10858 for (var i = 0; i < props.length; i += 1) {
10859 defineProperty(object, props[i], map[props[i]], predicates[props[i]]);
10863 defineProperties.supportsDescriptors = !!supportsDescriptors;
10865 module.exports = defineProperties;
10867 },{"object-keys":62}],48:[function(require,module,exports){
10872 Software License Agreement (BSD License)
10874 Copyright (c) 2009-2015, Kevin Decker <kpdecker@gmail.com>
10876 All rights reserved.
10878 Redistribution and use of this software in source and binary forms, with or without modification,
10879 are permitted provided that the following conditions are met:
10881 * Redistributions of source code must retain the above
10882 copyright notice, this list of conditions and the
10883 following disclaimer.
10885 * Redistributions in binary form must reproduce the above
10886 copyright notice, this list of conditions and the
10887 following disclaimer in the documentation and/or other
10888 materials provided with the distribution.
10890 * Neither the name of Kevin Decker nor the names of its
10891 contributors may be used to endorse or promote products
10892 derived from this software without specific prior
10893 written permission.
10895 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
10896 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
10897 FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
10898 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
10899 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
10900 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
10901 IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
10902 OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
10905 (function webpackUniversalModuleDefinition(root, factory) {
10906 if(typeof exports === 'object' && typeof module === 'object')
10907 module.exports = factory();
10909 define([], factory);
10910 else if(typeof exports === 'object')
10911 exports["JsDiff"] = factory();
10913 root["JsDiff"] = factory();
10914 })(this, function() {
10915 return /******/ (function(modules) { // webpackBootstrap
10916 /******/ // The module cache
10917 /******/ var installedModules = {};
10919 /******/ // The require function
10920 /******/ function __webpack_require__(moduleId) {
10922 /******/ // Check if module is in cache
10923 /******/ if(installedModules[moduleId])
10924 /******/ return installedModules[moduleId].exports;
10926 /******/ // Create a new module (and put it into the cache)
10927 /******/ var module = installedModules[moduleId] = {
10928 /******/ exports: {},
10929 /******/ id: moduleId,
10930 /******/ loaded: false
10933 /******/ // Execute the module function
10934 /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
10936 /******/ // Flag the module as loaded
10937 /******/ module.loaded = true;
10939 /******/ // Return the exports of the module
10940 /******/ return module.exports;
10944 /******/ // expose the modules object (__webpack_modules__)
10945 /******/ __webpack_require__.m = modules;
10947 /******/ // expose the module cache
10948 /******/ __webpack_require__.c = installedModules;
10950 /******/ // __webpack_public_path__
10951 /******/ __webpack_require__.p = "";
10953 /******/ // Load entry module and return exports
10954 /******/ return __webpack_require__(0);
10956 /************************************************************************/
10959 /***/ (function(module, exports, __webpack_require__) {
10961 /*istanbul ignore start*/'use strict';
10963 exports.__esModule = true;
10964 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;
10966 /*istanbul ignore end*/var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
10968 /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
10970 /*istanbul ignore end*/var /*istanbul ignore start*/_character = __webpack_require__(2) /*istanbul ignore end*/;
10972 var /*istanbul ignore start*/_word = __webpack_require__(3) /*istanbul ignore end*/;
10974 var /*istanbul ignore start*/_line = __webpack_require__(5) /*istanbul ignore end*/;
10976 var /*istanbul ignore start*/_sentence = __webpack_require__(6) /*istanbul ignore end*/;
10978 var /*istanbul ignore start*/_css = __webpack_require__(7) /*istanbul ignore end*/;
10980 var /*istanbul ignore start*/_json = __webpack_require__(8) /*istanbul ignore end*/;
10982 var /*istanbul ignore start*/_array = __webpack_require__(9) /*istanbul ignore end*/;
10984 var /*istanbul ignore start*/_apply = __webpack_require__(10) /*istanbul ignore end*/;
10986 var /*istanbul ignore start*/_parse = __webpack_require__(11) /*istanbul ignore end*/;
10988 var /*istanbul ignore start*/_merge = __webpack_require__(13) /*istanbul ignore end*/;
10990 var /*istanbul ignore start*/_create = __webpack_require__(14) /*istanbul ignore end*/;
10992 var /*istanbul ignore start*/_dmp = __webpack_require__(16) /*istanbul ignore end*/;
10994 var /*istanbul ignore start*/_xml = __webpack_require__(17) /*istanbul ignore end*/;
10996 /*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
10998 /* See LICENSE file for terms of use */
11001 * Text diff implementation.
11003 * This library supports the following APIS:
11004 * JsDiff.diffChars: Character by character diff
11005 * JsDiff.diffWords: Word (as defined by \b regex) diff which ignores whitespace
11006 * JsDiff.diffLines: Line based diff
11008 * JsDiff.diffCss: Diff targeted at CSS content
11010 * These methods are based on the implementation proposed in
11011 * "An O(ND) Difference Algorithm and its Variations" (Myers, 1986).
11012 * http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927
11014 exports. /*istanbul ignore end*/Diff = _base2['default'];
11015 /*istanbul ignore start*/exports. /*istanbul ignore end*/diffChars = _character.diffChars;
11016 /*istanbul ignore start*/exports. /*istanbul ignore end*/diffWords = _word.diffWords;
11017 /*istanbul ignore start*/exports. /*istanbul ignore end*/diffWordsWithSpace = _word.diffWordsWithSpace;
11018 /*istanbul ignore start*/exports. /*istanbul ignore end*/diffLines = _line.diffLines;
11019 /*istanbul ignore start*/exports. /*istanbul ignore end*/diffTrimmedLines = _line.diffTrimmedLines;
11020 /*istanbul ignore start*/exports. /*istanbul ignore end*/diffSentences = _sentence.diffSentences;
11021 /*istanbul ignore start*/exports. /*istanbul ignore end*/diffCss = _css.diffCss;
11022 /*istanbul ignore start*/exports. /*istanbul ignore end*/diffJson = _json.diffJson;
11023 /*istanbul ignore start*/exports. /*istanbul ignore end*/diffArrays = _array.diffArrays;
11024 /*istanbul ignore start*/exports. /*istanbul ignore end*/structuredPatch = _create.structuredPatch;
11025 /*istanbul ignore start*/exports. /*istanbul ignore end*/createTwoFilesPatch = _create.createTwoFilesPatch;
11026 /*istanbul ignore start*/exports. /*istanbul ignore end*/createPatch = _create.createPatch;
11027 /*istanbul ignore start*/exports. /*istanbul ignore end*/applyPatch = _apply.applyPatch;
11028 /*istanbul ignore start*/exports. /*istanbul ignore end*/applyPatches = _apply.applyPatches;
11029 /*istanbul ignore start*/exports. /*istanbul ignore end*/parsePatch = _parse.parsePatch;
11030 /*istanbul ignore start*/exports. /*istanbul ignore end*/merge = _merge.merge;
11031 /*istanbul ignore start*/exports. /*istanbul ignore end*/convertChangesToDMP = _dmp.convertChangesToDMP;
11032 /*istanbul ignore start*/exports. /*istanbul ignore end*/convertChangesToXML = _xml.convertChangesToXML;
11033 /*istanbul ignore start*/exports. /*istanbul ignore end*/canonicalize = _json.canonicalize;
11039 /***/ (function(module, exports) {
11041 /*istanbul ignore start*/'use strict';
11043 exports.__esModule = true;
11044 exports['default'] = /*istanbul ignore end*/Diff;
11048 /*istanbul ignore start*/ /*istanbul ignore end*/diff: function diff(oldString, newString) {
11049 /*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
11051 var callback = options.callback;
11052 if (typeof options === 'function') {
11053 callback = options;
11056 this.options = options;
11060 function done(value) {
11062 setTimeout(function () {
11063 callback(undefined, value);
11071 // Allow subclasses to massage the input prior to running
11072 oldString = this.castInput(oldString);
11073 newString = this.castInput(newString);
11075 oldString = this.removeEmpty(this.tokenize(oldString));
11076 newString = this.removeEmpty(this.tokenize(newString));
11078 var newLen = newString.length,
11079 oldLen = oldString.length;
11080 var editLength = 1;
11081 var maxEditLength = newLen + oldLen;
11082 var bestPath = [{ newPos: -1, components: [] }];
11084 // Seed editLength = 0, i.e. the content starts with the same values
11085 var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
11086 if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
11087 // Identity per the equality and tokenizer
11088 return done([{ value: this.join(newString), count: newString.length }]);
11091 // Main worker method. checks all permutations of a given edit length for acceptance.
11092 function execEditLength() {
11093 for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) {
11094 var basePath = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
11095 var addPath = bestPath[diagonalPath - 1],
11096 removePath = bestPath[diagonalPath + 1],
11097 _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
11099 // No one else is going to attempt to use this value, clear it
11100 bestPath[diagonalPath - 1] = undefined;
11103 var canAdd = addPath && addPath.newPos + 1 < newLen,
11104 canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen;
11105 if (!canAdd && !canRemove) {
11106 // If this path is a terminal then prune
11107 bestPath[diagonalPath] = undefined;
11111 // Select the diagonal that we want to branch from. We select the prior
11112 // path whose position in the new string is the farthest from the origin
11113 // and does not pass the bounds of the diff graph
11114 if (!canAdd || canRemove && addPath.newPos < removePath.newPos) {
11115 basePath = clonePath(removePath);
11116 self.pushComponent(basePath.components, undefined, true);
11118 basePath = addPath; // No need to clone, we've pulled it from the list
11120 self.pushComponent(basePath.components, true, undefined);
11123 _oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath);
11125 // If we have hit the end of both strings, then we are done
11126 if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) {
11127 return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken));
11129 // Otherwise track this path as a potential candidate and continue.
11130 bestPath[diagonalPath] = basePath;
11137 // Performs the length of edit iteration. Is a bit fugly as this has to support the
11138 // sync and async mode which is never fun. Loops over execEditLength until a value
11142 setTimeout(function () {
11143 // This should not happen, but we want to be safe.
11144 /* istanbul ignore next */
11145 if (editLength > maxEditLength) {
11149 if (!execEditLength()) {
11155 while (editLength <= maxEditLength) {
11156 var ret = execEditLength();
11163 /*istanbul ignore start*/ /*istanbul ignore end*/pushComponent: function pushComponent(components, added, removed) {
11164 var last = components[components.length - 1];
11165 if (last && last.added === added && last.removed === removed) {
11166 // We need to clone here as the component clone operation is just
11167 // as shallow array clone
11168 components[components.length - 1] = { count: last.count + 1, added: added, removed: removed };
11170 components.push({ count: 1, added: added, removed: removed });
11173 /*istanbul ignore start*/ /*istanbul ignore end*/extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) {
11174 var newLen = newString.length,
11175 oldLen = oldString.length,
11176 newPos = basePath.newPos,
11177 oldPos = newPos - diagonalPath,
11179 while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
11186 basePath.components.push({ count: commonCount });
11189 basePath.newPos = newPos;
11192 /*istanbul ignore start*/ /*istanbul ignore end*/equals: function equals(left, right) {
11193 if (this.options.comparator) {
11194 return this.options.comparator(left, right);
11196 return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase();
11199 /*istanbul ignore start*/ /*istanbul ignore end*/removeEmpty: function removeEmpty(array) {
11201 for (var i = 0; i < array.length; i++) {
11203 ret.push(array[i]);
11208 /*istanbul ignore start*/ /*istanbul ignore end*/castInput: function castInput(value) {
11211 /*istanbul ignore start*/ /*istanbul ignore end*/tokenize: function tokenize(value) {
11212 return value.split('');
11214 /*istanbul ignore start*/ /*istanbul ignore end*/join: function join(chars) {
11215 return chars.join('');
11219 function buildValues(diff, components, newString, oldString, useLongestToken) {
11220 var componentPos = 0,
11221 componentLen = components.length,
11225 for (; componentPos < componentLen; componentPos++) {
11226 var component = components[componentPos];
11227 if (!component.removed) {
11228 if (!component.added && useLongestToken) {
11229 var value = newString.slice(newPos, newPos + component.count);
11230 value = value.map(function (value, i) {
11231 var oldValue = oldString[oldPos + i];
11232 return oldValue.length > value.length ? oldValue : value;
11235 component.value = diff.join(value);
11237 component.value = diff.join(newString.slice(newPos, newPos + component.count));
11239 newPos += component.count;
11242 if (!component.added) {
11243 oldPos += component.count;
11246 component.value = diff.join(oldString.slice(oldPos, oldPos + component.count));
11247 oldPos += component.count;
11249 // Reverse add and remove so removes are output first to match common convention
11250 // The diffing algorithm is tied to add then remove output and this is the simplest
11251 // route to get the desired output with minimal overhead.
11252 if (componentPos && components[componentPos - 1].added) {
11253 var tmp = components[componentPos - 1];
11254 components[componentPos - 1] = components[componentPos];
11255 components[componentPos] = tmp;
11260 // Special case handle for when one terminal is ignored (i.e. whitespace).
11261 // For this case we merge the terminal into the prior string and drop the change.
11262 // This is only available for string mode.
11263 var lastComponent = components[componentLen - 1];
11264 if (componentLen > 1 && typeof lastComponent.value === 'string' && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) {
11265 components[componentLen - 2].value += lastComponent.value;
11272 function clonePath(path) {
11273 return { newPos: path.newPos, components: path.components.slice(0) };
11280 /***/ (function(module, exports, __webpack_require__) {
11282 /*istanbul ignore start*/'use strict';
11284 exports.__esModule = true;
11285 exports.characterDiff = undefined;
11286 exports. /*istanbul ignore end*/diffChars = diffChars;
11288 var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
11290 /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
11292 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
11294 /*istanbul ignore end*/var characterDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/characterDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
11295 function diffChars(oldStr, newStr, options) {
11296 return characterDiff.diff(oldStr, newStr, options);
11303 /***/ (function(module, exports, __webpack_require__) {
11305 /*istanbul ignore start*/'use strict';
11307 exports.__esModule = true;
11308 exports.wordDiff = undefined;
11309 exports. /*istanbul ignore end*/diffWords = diffWords;
11310 /*istanbul ignore start*/exports. /*istanbul ignore end*/diffWordsWithSpace = diffWordsWithSpace;
11312 var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
11314 /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
11316 /*istanbul ignore end*/var /*istanbul ignore start*/_params = __webpack_require__(4) /*istanbul ignore end*/;
11318 /*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
11320 /*istanbul ignore end*/ // Based on https://en.wikipedia.org/wiki/Latin_script_in_Unicode
11322 // Ranges and exceptions:
11323 // Latin-1 Supplement, 0080–00FF
11324 // - U+00D7 × Multiplication sign
11325 // - U+00F7 ÷ Division sign
11326 // Latin Extended-A, 0100–017F
11327 // Latin Extended-B, 0180–024F
11328 // IPA Extensions, 0250–02AF
11329 // Spacing Modifier Letters, 02B0–02FF
11330 // - U+02C7 ˇ ˇ Caron
11331 // - U+02D8 ˘ ˘ Breve
11332 // - U+02D9 ˙ ˙ Dot Above
11333 // - U+02DA ˚ ˚ Ring Above
11334 // - U+02DB ˛ ˛ Ogonek
11335 // - U+02DC ˜ ˜ Small Tilde
11336 // - U+02DD ˝ ˝ Double Acute Accent
11337 // Latin Extended Additional, 1E00–1EFF
11338 var extendedWordChars = /^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/;
11340 var reWhitespace = /\S/;
11342 var wordDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/wordDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
11343 wordDiff.equals = function (left, right) {
11344 if (this.options.ignoreCase) {
11345 left = left.toLowerCase();
11346 right = right.toLowerCase();
11348 return left === right || this.options.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right);
11350 wordDiff.tokenize = function (value) {
11351 var tokens = value.split(/(\s+|\b)/);
11353 // Join the boundary splits that we do not consider to be boundaries. This is primarily the extended Latin character set.
11354 for (var i = 0; i < tokens.length - 1; i++) {
11355 // If we have an empty string in the next field and we have only word chars before and after, merge
11356 if (!tokens[i + 1] && tokens[i + 2] && extendedWordChars.test(tokens[i]) && extendedWordChars.test(tokens[i + 2])) {
11357 tokens[i] += tokens[i + 2];
11358 tokens.splice(i + 1, 2);
11366 function diffWords(oldStr, newStr, options) {
11367 options = /*istanbul ignore start*/(0, _params.generateOptions) /*istanbul ignore end*/(options, { ignoreWhitespace: true });
11368 return wordDiff.diff(oldStr, newStr, options);
11371 function diffWordsWithSpace(oldStr, newStr, options) {
11372 return wordDiff.diff(oldStr, newStr, options);
11379 /***/ (function(module, exports) {
11381 /*istanbul ignore start*/'use strict';
11383 exports.__esModule = true;
11384 exports. /*istanbul ignore end*/generateOptions = generateOptions;
11385 function generateOptions(options, defaults) {
11386 if (typeof options === 'function') {
11387 defaults.callback = options;
11388 } else if (options) {
11389 for (var name in options) {
11390 /* istanbul ignore else */
11391 if (options.hasOwnProperty(name)) {
11392 defaults[name] = options[name];
11403 /***/ (function(module, exports, __webpack_require__) {
11405 /*istanbul ignore start*/'use strict';
11407 exports.__esModule = true;
11408 exports.lineDiff = undefined;
11409 exports. /*istanbul ignore end*/diffLines = diffLines;
11410 /*istanbul ignore start*/exports. /*istanbul ignore end*/diffTrimmedLines = diffTrimmedLines;
11412 var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
11414 /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
11416 /*istanbul ignore end*/var /*istanbul ignore start*/_params = __webpack_require__(4) /*istanbul ignore end*/;
11418 /*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
11420 /*istanbul ignore end*/var lineDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/lineDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
11421 lineDiff.tokenize = function (value) {
11423 linesAndNewlines = value.split(/(\n|\r\n)/);
11425 // Ignore the final empty token that occurs if the string ends with a new line
11426 if (!linesAndNewlines[linesAndNewlines.length - 1]) {
11427 linesAndNewlines.pop();
11430 // Merge the content and line separators into single tokens
11431 for (var i = 0; i < linesAndNewlines.length; i++) {
11432 var line = linesAndNewlines[i];
11434 if (i % 2 && !this.options.newlineIsToken) {
11435 retLines[retLines.length - 1] += line;
11437 if (this.options.ignoreWhitespace) {
11438 line = line.trim();
11440 retLines.push(line);
11447 function diffLines(oldStr, newStr, callback) {
11448 return lineDiff.diff(oldStr, newStr, callback);
11450 function diffTrimmedLines(oldStr, newStr, callback) {
11451 var options = /*istanbul ignore start*/(0, _params.generateOptions) /*istanbul ignore end*/(callback, { ignoreWhitespace: true });
11452 return lineDiff.diff(oldStr, newStr, options);
11459 /***/ (function(module, exports, __webpack_require__) {
11461 /*istanbul ignore start*/'use strict';
11463 exports.__esModule = true;
11464 exports.sentenceDiff = undefined;
11465 exports. /*istanbul ignore end*/diffSentences = diffSentences;
11467 var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
11469 /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
11471 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
11473 /*istanbul ignore end*/var sentenceDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/sentenceDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
11474 sentenceDiff.tokenize = function (value) {
11475 return value.split(/(\S.+?[.!?])(?=\s+|$)/);
11478 function diffSentences(oldStr, newStr, callback) {
11479 return sentenceDiff.diff(oldStr, newStr, callback);
11486 /***/ (function(module, exports, __webpack_require__) {
11488 /*istanbul ignore start*/'use strict';
11490 exports.__esModule = true;
11491 exports.cssDiff = undefined;
11492 exports. /*istanbul ignore end*/diffCss = diffCss;
11494 var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
11496 /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
11498 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
11500 /*istanbul ignore end*/var cssDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/cssDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
11501 cssDiff.tokenize = function (value) {
11502 return value.split(/([{}:;,]|\s+)/);
11505 function diffCss(oldStr, newStr, callback) {
11506 return cssDiff.diff(oldStr, newStr, callback);
11513 /***/ (function(module, exports, __webpack_require__) {
11515 /*istanbul ignore start*/'use strict';
11517 exports.__esModule = true;
11518 exports.jsonDiff = undefined;
11520 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; };
11522 exports. /*istanbul ignore end*/diffJson = diffJson;
11523 /*istanbul ignore start*/exports. /*istanbul ignore end*/canonicalize = canonicalize;
11525 var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
11527 /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
11529 /*istanbul ignore end*/var /*istanbul ignore start*/_line = __webpack_require__(5) /*istanbul ignore end*/;
11531 /*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
11533 /*istanbul ignore end*/var objectPrototypeToString = Object.prototype.toString;
11535 var jsonDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/jsonDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
11536 // Discriminate between two lines of pretty-printed, serialized JSON where one of them has a
11537 // dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output:
11538 jsonDiff.useLongestToken = true;
11540 jsonDiff.tokenize = /*istanbul ignore start*/_line.lineDiff /*istanbul ignore end*/.tokenize;
11541 jsonDiff.castInput = function (value) {
11542 /*istanbul ignore start*/var _options = /*istanbul ignore end*/this.options,
11543 undefinedReplacement = _options.undefinedReplacement,
11544 _options$stringifyRep = _options.stringifyReplacer,
11545 stringifyReplacer = _options$stringifyRep === undefined ? function (k, v) /*istanbul ignore start*/{
11546 return (/*istanbul ignore end*/typeof v === 'undefined' ? undefinedReplacement : v
11548 } : _options$stringifyRep;
11551 return typeof value === 'string' ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, ' ');
11553 jsonDiff.equals = function (left, right) {
11554 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'))
11558 function diffJson(oldObj, newObj, options) {
11559 return jsonDiff.diff(oldObj, newObj, options);
11562 // This function handles the presence of circular references by bailing out when encountering an
11563 // object that is already on the "stack" of items being processed. Accepts an optional replacer
11564 function canonicalize(obj, stack, replacementStack, replacer, key) {
11565 stack = stack || [];
11566 replacementStack = replacementStack || [];
11569 obj = replacer(key, obj);
11572 var i = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
11574 for (i = 0; i < stack.length; i += 1) {
11575 if (stack[i] === obj) {
11576 return replacementStack[i];
11580 var canonicalizedObj = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
11582 if ('[object Array]' === objectPrototypeToString.call(obj)) {
11584 canonicalizedObj = new Array(obj.length);
11585 replacementStack.push(canonicalizedObj);
11586 for (i = 0; i < obj.length; i += 1) {
11587 canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, key);
11590 replacementStack.pop();
11591 return canonicalizedObj;
11594 if (obj && obj.toJSON) {
11595 obj = obj.toJSON();
11598 if ( /*istanbul ignore start*/(typeof /*istanbul ignore end*/obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object' && obj !== null) {
11600 canonicalizedObj = {};
11601 replacementStack.push(canonicalizedObj);
11602 var sortedKeys = [],
11603 _key = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
11604 for (_key in obj) {
11605 /* istanbul ignore else */
11606 if (obj.hasOwnProperty(_key)) {
11607 sortedKeys.push(_key);
11611 for (i = 0; i < sortedKeys.length; i += 1) {
11612 _key = sortedKeys[i];
11613 canonicalizedObj[_key] = canonicalize(obj[_key], stack, replacementStack, replacer, _key);
11616 replacementStack.pop();
11618 canonicalizedObj = obj;
11620 return canonicalizedObj;
11627 /***/ (function(module, exports, __webpack_require__) {
11629 /*istanbul ignore start*/'use strict';
11631 exports.__esModule = true;
11632 exports.arrayDiff = undefined;
11633 exports. /*istanbul ignore end*/diffArrays = diffArrays;
11635 var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
11637 /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
11639 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
11641 /*istanbul ignore end*/var arrayDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/arrayDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
11642 arrayDiff.tokenize = function (value) {
11643 return value.slice();
11645 arrayDiff.join = arrayDiff.removeEmpty = function (value) {
11649 function diffArrays(oldArr, newArr, callback) {
11650 return arrayDiff.diff(oldArr, newArr, callback);
11657 /***/ (function(module, exports, __webpack_require__) {
11659 /*istanbul ignore start*/'use strict';
11661 exports.__esModule = true;
11662 exports. /*istanbul ignore end*/applyPatch = applyPatch;
11663 /*istanbul ignore start*/exports. /*istanbul ignore end*/applyPatches = applyPatches;
11665 var /*istanbul ignore start*/_parse = __webpack_require__(11) /*istanbul ignore end*/;
11667 var /*istanbul ignore start*/_distanceIterator = __webpack_require__(12) /*istanbul ignore end*/;
11669 /*istanbul ignore start*/var _distanceIterator2 = _interopRequireDefault(_distanceIterator);
11671 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
11673 /*istanbul ignore end*/function applyPatch(source, uniDiff) {
11674 /*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
11676 if (typeof uniDiff === 'string') {
11677 uniDiff = /*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(uniDiff);
11680 if (Array.isArray(uniDiff)) {
11681 if (uniDiff.length > 1) {
11682 throw new Error('applyPatch only works with a single input.');
11685 uniDiff = uniDiff[0];
11688 // Apply the diff to the input
11689 var lines = source.split(/\r\n|[\n\v\f\r\x85]/),
11690 delimiters = source.match(/\r\n|[\n\v\f\r\x85]/g) || [],
11691 hunks = uniDiff.hunks,
11692 compareLine = options.compareLine || function (lineNumber, line, operation, patchContent) /*istanbul ignore start*/{
11693 return (/*istanbul ignore end*/line === patchContent
11697 fuzzFactor = options.fuzzFactor || 0,
11700 removeEOFNL = /*istanbul ignore start*/void 0 /*istanbul ignore end*/,
11701 addEOFNL = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
11704 * Checks if the hunk exactly fits on the provided location
11706 function hunkFits(hunk, toPos) {
11707 for (var j = 0; j < hunk.lines.length; j++) {
11708 var line = hunk.lines[j],
11709 operation = line.length > 0 ? line[0] : ' ',
11710 content = line.length > 0 ? line.substr(1) : line;
11712 if (operation === ' ' || operation === '-') {
11713 // Context sanity check
11714 if (!compareLine(toPos + 1, lines[toPos], operation, content)) {
11717 if (errorCount > fuzzFactor) {
11728 // Search best fit offsets for each hunk based on the previous ones
11729 for (var i = 0; i < hunks.length; i++) {
11730 var hunk = hunks[i],
11731 maxLine = lines.length - hunk.oldLines,
11733 toPos = offset + hunk.oldStart - 1;
11735 var iterator = /*istanbul ignore start*/(0, _distanceIterator2['default']) /*istanbul ignore end*/(toPos, minLine, maxLine);
11737 for (; localOffset !== undefined; localOffset = iterator()) {
11738 if (hunkFits(hunk, toPos + localOffset)) {
11739 hunk.offset = offset += localOffset;
11744 if (localOffset === undefined) {
11748 // Set lower text limit to end of the current hunk, so next ones don't try
11749 // to fit over already patched text
11750 minLine = hunk.offset + hunk.oldStart + hunk.oldLines;
11753 // Apply patch hunks
11754 var diffOffset = 0;
11755 for (var _i = 0; _i < hunks.length; _i++) {
11756 var _hunk = hunks[_i],
11757 _toPos = _hunk.oldStart + _hunk.offset + diffOffset - 1;
11758 diffOffset += _hunk.newLines - _hunk.oldLines;
11761 // Creating a new file
11765 for (var j = 0; j < _hunk.lines.length; j++) {
11766 var line = _hunk.lines[j],
11767 operation = line.length > 0 ? line[0] : ' ',
11768 content = line.length > 0 ? line.substr(1) : line,
11769 delimiter = _hunk.linedelimiters[j];
11771 if (operation === ' ') {
11773 } else if (operation === '-') {
11774 lines.splice(_toPos, 1);
11775 delimiters.splice(_toPos, 1);
11776 /* istanbul ignore else */
11777 } else if (operation === '+') {
11778 lines.splice(_toPos, 0, content);
11779 delimiters.splice(_toPos, 0, delimiter);
11781 } else if (operation === '\\') {
11782 var previousOperation = _hunk.lines[j - 1] ? _hunk.lines[j - 1][0] : null;
11783 if (previousOperation === '+') {
11784 removeEOFNL = true;
11785 } else if (previousOperation === '-') {
11792 // Handle EOFNL insertion/removal
11794 while (!lines[lines.length - 1]) {
11798 } else if (addEOFNL) {
11800 delimiters.push('\n');
11802 for (var _k = 0; _k < lines.length - 1; _k++) {
11803 lines[_k] = lines[_k] + delimiters[_k];
11805 return lines.join('');
11808 // Wrapper that supports multiple file patches via callbacks.
11809 function applyPatches(uniDiff, options) {
11810 if (typeof uniDiff === 'string') {
11811 uniDiff = /*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(uniDiff);
11814 var currentIndex = 0;
11815 function processIndex() {
11816 var index = uniDiff[currentIndex++];
11818 return options.complete();
11821 options.loadFile(index, function (err, data) {
11823 return options.complete(err);
11826 var updatedContent = applyPatch(data, index, options);
11827 options.patched(index, updatedContent, function (err) {
11829 return options.complete(err);
11843 /***/ (function(module, exports) {
11845 /*istanbul ignore start*/'use strict';
11847 exports.__esModule = true;
11848 exports. /*istanbul ignore end*/parsePatch = parsePatch;
11849 function parsePatch(uniDiff) {
11850 /*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
11852 var diffstr = uniDiff.split(/\r\n|[\n\v\f\r\x85]/),
11853 delimiters = uniDiff.match(/\r\n|[\n\v\f\r\x85]/g) || [],
11857 function parseIndex() {
11861 // Parse diff metadata
11862 while (i < diffstr.length) {
11863 var line = diffstr[i];
11865 // File header found, end parsing diff metadata
11866 if (/^(\-\-\-|\+\+\+|@@)\s/.test(line)) {
11871 var header = /^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(line);
11873 index.index = header[1];
11879 // Parse file headers if they are defined. Unified diff requires them, but
11880 // there's no technical issues to have an isolated hunk without file header
11881 parseFileHeader(index);
11882 parseFileHeader(index);
11887 while (i < diffstr.length) {
11888 var _line = diffstr[i];
11890 if (/^(Index:|diff|\-\-\-|\+\+\+)\s/.test(_line)) {
11892 } else if (/^@@/.test(_line)) {
11893 index.hunks.push(parseHunk());
11894 } else if (_line && options.strict) {
11895 // Ignore unexpected content unless in strict mode
11896 throw new Error('Unknown line ' + (i + 1) + ' ' + JSON.stringify(_line));
11903 // Parses the --- and +++ headers, if none are found, no lines
11905 function parseFileHeader(index) {
11906 var fileHeader = /^(---|\+\+\+)\s+(.*)$/.exec(diffstr[i]);
11908 var keyPrefix = fileHeader[1] === '---' ? 'old' : 'new';
11909 var data = fileHeader[2].split('\t', 2);
11910 var fileName = data[0].replace(/\\\\/g, '\\');
11911 if (/^".*"$/.test(fileName)) {
11912 fileName = fileName.substr(1, fileName.length - 2);
11914 index[keyPrefix + 'FileName'] = fileName;
11915 index[keyPrefix + 'Header'] = (data[1] || '').trim();
11922 // This assumes that we are at the start of a hunk.
11923 function parseHunk() {
11924 var chunkHeaderIndex = i,
11925 chunkHeaderLine = diffstr[i++],
11926 chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);
11929 oldStart: +chunkHeader[1],
11930 oldLines: +chunkHeader[2] || 1,
11931 newStart: +chunkHeader[3],
11932 newLines: +chunkHeader[4] || 1,
11939 for (; i < diffstr.length; i++) {
11940 // Lines starting with '---' could be mistaken for the "remove line" operation
11941 // But they could be the header for the next file. Therefore prune such cases out.
11942 if (diffstr[i].indexOf('--- ') === 0 && i + 2 < diffstr.length && diffstr[i + 1].indexOf('+++ ') === 0 && diffstr[i + 2].indexOf('@@') === 0) {
11945 var operation = diffstr[i].length == 0 && i != diffstr.length - 1 ? ' ' : diffstr[i][0];
11947 if (operation === '+' || operation === '-' || operation === ' ' || operation === '\\') {
11948 hunk.lines.push(diffstr[i]);
11949 hunk.linedelimiters.push(delimiters[i] || '\n');
11951 if (operation === '+') {
11953 } else if (operation === '-') {
11955 } else if (operation === ' ') {
11964 // Handle the empty block count case
11965 if (!addCount && hunk.newLines === 1) {
11968 if (!removeCount && hunk.oldLines === 1) {
11972 // Perform optional sanity checking
11973 if (options.strict) {
11974 if (addCount !== hunk.newLines) {
11975 throw new Error('Added line count did not match for hunk at line ' + (chunkHeaderIndex + 1));
11977 if (removeCount !== hunk.oldLines) {
11978 throw new Error('Removed line count did not match for hunk at line ' + (chunkHeaderIndex + 1));
11985 while (i < diffstr.length) {
11996 /***/ (function(module, exports) {
11998 /*istanbul ignore start*/"use strict";
12000 exports.__esModule = true;
12002 exports["default"] = /*istanbul ignore end*/function (start, minLine, maxLine) {
12003 var wantForward = true,
12004 backwardExhausted = false,
12005 forwardExhausted = false,
12008 return function iterator() {
12009 if (wantForward && !forwardExhausted) {
12010 if (backwardExhausted) {
12013 wantForward = false;
12016 // Check if trying to fit beyond text length, and if not, check it fits
12017 // after offset location (or desired location on first iteration)
12018 if (start + localOffset <= maxLine) {
12019 return localOffset;
12022 forwardExhausted = true;
12025 if (!backwardExhausted) {
12026 if (!forwardExhausted) {
12027 wantForward = true;
12030 // Check if trying to fit before text beginning, and if not, check it fits
12031 // before offset location
12032 if (minLine <= start - localOffset) {
12033 return -localOffset++;
12036 backwardExhausted = true;
12040 // We tried to fit hunk before text beginning and beyond text length, then
12041 // hunk can't fit on the text. Return undefined
12049 /***/ (function(module, exports, __webpack_require__) {
12051 /*istanbul ignore start*/'use strict';
12053 exports.__esModule = true;
12054 exports. /*istanbul ignore end*/calcLineCount = calcLineCount;
12055 /*istanbul ignore start*/exports. /*istanbul ignore end*/merge = merge;
12057 var /*istanbul ignore start*/_create = __webpack_require__(14) /*istanbul ignore end*/;
12059 var /*istanbul ignore start*/_parse = __webpack_require__(11) /*istanbul ignore end*/;
12061 var /*istanbul ignore start*/_array = __webpack_require__(15) /*istanbul ignore end*/;
12063 /*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); } }
12065 /*istanbul ignore end*/function calcLineCount(hunk) {
12066 /*istanbul ignore start*/var _calcOldNewLineCount = /*istanbul ignore end*/calcOldNewLineCount(hunk.lines),
12067 oldLines = _calcOldNewLineCount.oldLines,
12068 newLines = _calcOldNewLineCount.newLines;
12070 if (oldLines !== undefined) {
12071 hunk.oldLines = oldLines;
12073 delete hunk.oldLines;
12076 if (newLines !== undefined) {
12077 hunk.newLines = newLines;
12079 delete hunk.newLines;
12083 function merge(mine, theirs, base) {
12084 mine = loadPatch(mine, base);
12085 theirs = loadPatch(theirs, base);
12089 // For index we just let it pass through as it doesn't have any necessary meaning.
12090 // Leaving sanity checks on this to the API consumer that may know more about the
12091 // meaning in their own context.
12092 if (mine.index || theirs.index) {
12093 ret.index = mine.index || theirs.index;
12096 if (mine.newFileName || theirs.newFileName) {
12097 if (!fileNameChanged(mine)) {
12098 // No header or no change in ours, use theirs (and ours if theirs does not exist)
12099 ret.oldFileName = theirs.oldFileName || mine.oldFileName;
12100 ret.newFileName = theirs.newFileName || mine.newFileName;
12101 ret.oldHeader = theirs.oldHeader || mine.oldHeader;
12102 ret.newHeader = theirs.newHeader || mine.newHeader;
12103 } else if (!fileNameChanged(theirs)) {
12104 // No header or no change in theirs, use ours
12105 ret.oldFileName = mine.oldFileName;
12106 ret.newFileName = mine.newFileName;
12107 ret.oldHeader = mine.oldHeader;
12108 ret.newHeader = mine.newHeader;
12110 // Both changed... figure it out
12111 ret.oldFileName = selectField(ret, mine.oldFileName, theirs.oldFileName);
12112 ret.newFileName = selectField(ret, mine.newFileName, theirs.newFileName);
12113 ret.oldHeader = selectField(ret, mine.oldHeader, theirs.oldHeader);
12114 ret.newHeader = selectField(ret, mine.newHeader, theirs.newHeader);
12125 while (mineIndex < mine.hunks.length || theirsIndex < theirs.hunks.length) {
12126 var mineCurrent = mine.hunks[mineIndex] || { oldStart: Infinity },
12127 theirsCurrent = theirs.hunks[theirsIndex] || { oldStart: Infinity };
12129 if (hunkBefore(mineCurrent, theirsCurrent)) {
12130 // This patch does not overlap with any of the others, yay.
12131 ret.hunks.push(cloneHunk(mineCurrent, mineOffset));
12133 theirsOffset += mineCurrent.newLines - mineCurrent.oldLines;
12134 } else if (hunkBefore(theirsCurrent, mineCurrent)) {
12135 // This patch does not overlap with any of the others, yay.
12136 ret.hunks.push(cloneHunk(theirsCurrent, theirsOffset));
12138 mineOffset += theirsCurrent.newLines - theirsCurrent.oldLines;
12140 // Overlap, merge as best we can
12142 oldStart: Math.min(mineCurrent.oldStart, theirsCurrent.oldStart),
12144 newStart: Math.min(mineCurrent.newStart + mineOffset, theirsCurrent.oldStart + theirsOffset),
12148 mergeLines(mergedHunk, mineCurrent.oldStart, mineCurrent.lines, theirsCurrent.oldStart, theirsCurrent.lines);
12152 ret.hunks.push(mergedHunk);
12159 function loadPatch(param, base) {
12160 if (typeof param === 'string') {
12161 if (/^@@/m.test(param) || /^Index:/m.test(param)) {
12162 return (/*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(param)[0]
12167 throw new Error('Must provide a base reference or pass in a patch');
12169 return (/*istanbul ignore start*/(0, _create.structuredPatch) /*istanbul ignore end*/(undefined, undefined, base, param)
12176 function fileNameChanged(patch) {
12177 return patch.newFileName && patch.newFileName !== patch.oldFileName;
12180 function selectField(index, mine, theirs) {
12181 if (mine === theirs) {
12184 index.conflict = true;
12185 return { mine: mine, theirs: theirs };
12189 function hunkBefore(test, check) {
12190 return test.oldStart < check.oldStart && test.oldStart + test.oldLines < check.oldStart;
12193 function cloneHunk(hunk, offset) {
12195 oldStart: hunk.oldStart, oldLines: hunk.oldLines,
12196 newStart: hunk.newStart + offset, newLines: hunk.newLines,
12201 function mergeLines(hunk, mineOffset, mineLines, theirOffset, theirLines) {
12202 // This will generally result in a conflicted hunk, but there are cases where the context
12203 // is the only overlap where we can successfully merge the content here.
12204 var mine = { offset: mineOffset, lines: mineLines, index: 0 },
12205 their = { offset: theirOffset, lines: theirLines, index: 0 };
12207 // Handle any leading content
12208 insertLeading(hunk, mine, their);
12209 insertLeading(hunk, their, mine);
12211 // Now in the overlap content. Scan through and select the best changes from each.
12212 while (mine.index < mine.lines.length && their.index < their.lines.length) {
12213 var mineCurrent = mine.lines[mine.index],
12214 theirCurrent = their.lines[their.index];
12216 if ((mineCurrent[0] === '-' || mineCurrent[0] === '+') && (theirCurrent[0] === '-' || theirCurrent[0] === '+')) {
12217 // Both modified ...
12218 mutualChange(hunk, mine, their);
12219 } else if (mineCurrent[0] === '+' && theirCurrent[0] === ' ') {
12220 /*istanbul ignore start*/var _hunk$lines;
12222 /*istanbul ignore end*/ // Mine inserted
12223 /*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)));
12224 } else if (theirCurrent[0] === '+' && mineCurrent[0] === ' ') {
12225 /*istanbul ignore start*/var _hunk$lines2;
12227 /*istanbul ignore end*/ // Theirs inserted
12228 /*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)));
12229 } else if (mineCurrent[0] === '-' && theirCurrent[0] === ' ') {
12230 // Mine removed or edited
12231 removal(hunk, mine, their);
12232 } else if (theirCurrent[0] === '-' && mineCurrent[0] === ' ') {
12233 // Their removed or edited
12234 removal(hunk, their, mine, true);
12235 } else if (mineCurrent === theirCurrent) {
12236 // Context identity
12237 hunk.lines.push(mineCurrent);
12241 // Context mismatch
12242 conflict(hunk, collectChange(mine), collectChange(their));
12246 // Now push anything that may be remaining
12247 insertTrailing(hunk, mine);
12248 insertTrailing(hunk, their);
12250 calcLineCount(hunk);
12253 function mutualChange(hunk, mine, their) {
12254 var myChanges = collectChange(mine),
12255 theirChanges = collectChange(their);
12257 if (allRemoves(myChanges) && allRemoves(theirChanges)) {
12258 // Special case for remove changes that are supersets of one another
12259 if ( /*istanbul ignore start*/(0, _array.arrayStartsWith) /*istanbul ignore end*/(myChanges, theirChanges) && skipRemoveSuperset(their, myChanges, myChanges.length - theirChanges.length)) {
12260 /*istanbul ignore start*/var _hunk$lines3;
12262 /*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));
12264 } else if ( /*istanbul ignore start*/(0, _array.arrayStartsWith) /*istanbul ignore end*/(theirChanges, myChanges) && skipRemoveSuperset(mine, theirChanges, theirChanges.length - myChanges.length)) {
12265 /*istanbul ignore start*/var _hunk$lines4;
12267 /*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));
12270 } else if ( /*istanbul ignore start*/(0, _array.arrayEqual) /*istanbul ignore end*/(myChanges, theirChanges)) {
12271 /*istanbul ignore start*/var _hunk$lines5;
12273 /*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));
12277 conflict(hunk, myChanges, theirChanges);
12280 function removal(hunk, mine, their, swap) {
12281 var myChanges = collectChange(mine),
12282 theirChanges = collectContext(their, myChanges);
12283 if (theirChanges.merged) {
12284 /*istanbul ignore start*/var _hunk$lines6;
12286 /*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));
12288 conflict(hunk, swap ? theirChanges : myChanges, swap ? myChanges : theirChanges);
12292 function conflict(hunk, mine, their) {
12293 hunk.conflict = true;
12301 function insertLeading(hunk, insert, their) {
12302 while (insert.offset < their.offset && insert.index < insert.lines.length) {
12303 var line = insert.lines[insert.index++];
12304 hunk.lines.push(line);
12308 function insertTrailing(hunk, insert) {
12309 while (insert.index < insert.lines.length) {
12310 var line = insert.lines[insert.index++];
12311 hunk.lines.push(line);
12315 function collectChange(state) {
12317 operation = state.lines[state.index][0];
12318 while (state.index < state.lines.length) {
12319 var line = state.lines[state.index];
12321 // Group additions that are immediately after subtractions and treat them as one "atomic" modify change.
12322 if (operation === '-' && line[0] === '+') {
12326 if (operation === line[0]) {
12336 function collectContext(state, matchChanges) {
12340 contextChanges = false,
12341 conflicted = false;
12342 while (matchIndex < matchChanges.length && state.index < state.lines.length) {
12343 var change = state.lines[state.index],
12344 match = matchChanges[matchIndex];
12346 // Once we've hit our add, then we are done
12347 if (match[0] === '+') {
12351 contextChanges = contextChanges || change[0] !== ' ';
12353 merged.push(match);
12356 // Consume any additions in the other block as a conflict to attempt
12357 // to pull in the remaining context after this
12358 if (change[0] === '+') {
12361 while (change[0] === '+') {
12362 changes.push(change);
12363 change = state.lines[++state.index];
12367 if (match.substr(1) === change.substr(1)) {
12368 changes.push(change);
12375 if ((matchChanges[matchIndex] || '')[0] === '+' && contextChanges) {
12383 while (matchIndex < matchChanges.length) {
12384 merged.push(matchChanges[matchIndex++]);
12393 function allRemoves(changes) {
12394 return changes.reduce(function (prev, change) {
12395 return prev && change[0] === '-';
12398 function skipRemoveSuperset(state, removeChanges, delta) {
12399 for (var i = 0; i < delta; i++) {
12400 var changeContent = removeChanges[removeChanges.length - delta + i].substr(1);
12401 if (state.lines[state.index + i] !== ' ' + changeContent) {
12406 state.index += delta;
12410 function calcOldNewLineCount(lines) {
12414 lines.forEach(function (line) {
12415 if (typeof line !== 'string') {
12416 var myCount = calcOldNewLineCount(line.mine);
12417 var theirCount = calcOldNewLineCount(line.theirs);
12419 if (oldLines !== undefined) {
12420 if (myCount.oldLines === theirCount.oldLines) {
12421 oldLines += myCount.oldLines;
12423 oldLines = undefined;
12427 if (newLines !== undefined) {
12428 if (myCount.newLines === theirCount.newLines) {
12429 newLines += myCount.newLines;
12431 newLines = undefined;
12435 if (newLines !== undefined && (line[0] === '+' || line[0] === ' ')) {
12438 if (oldLines !== undefined && (line[0] === '-' || line[0] === ' ')) {
12444 return { oldLines: oldLines, newLines: newLines };
12451 /***/ (function(module, exports, __webpack_require__) {
12453 /*istanbul ignore start*/'use strict';
12455 exports.__esModule = true;
12456 exports. /*istanbul ignore end*/structuredPatch = structuredPatch;
12457 /*istanbul ignore start*/exports. /*istanbul ignore end*/createTwoFilesPatch = createTwoFilesPatch;
12458 /*istanbul ignore start*/exports. /*istanbul ignore end*/createPatch = createPatch;
12460 var /*istanbul ignore start*/_line = __webpack_require__(5) /*istanbul ignore end*/;
12462 /*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); } }
12464 /*istanbul ignore end*/function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
12468 if (typeof options.context === 'undefined') {
12469 options.context = 4;
12472 var diff = /*istanbul ignore start*/(0, _line.diffLines) /*istanbul ignore end*/(oldStr, newStr, options);
12473 diff.push({ value: '', lines: [] }); // Append an empty value to make cleanup easier
12475 function contextLines(lines) {
12476 return lines.map(function (entry) {
12477 return ' ' + entry;
12482 var oldRangeStart = 0,
12488 /*istanbul ignore start*/var _loop = function _loop( /*istanbul ignore end*/i) {
12489 var current = diff[i],
12490 lines = current.lines || current.value.replace(/\n$/, '').split('\n');
12491 current.lines = lines;
12493 if (current.added || current.removed) {
12494 /*istanbul ignore start*/var _curRange;
12496 /*istanbul ignore end*/ // If we have previous context, start with that
12497 if (!oldRangeStart) {
12498 var prev = diff[i - 1];
12499 oldRangeStart = oldLine;
12500 newRangeStart = newLine;
12503 curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : [];
12504 oldRangeStart -= curRange.length;
12505 newRangeStart -= curRange.length;
12509 // Output our changes
12510 /*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) {
12511 return (current.added ? '+' : '-') + entry;
12514 // Track the updated file position
12515 if (current.added) {
12516 newLine += lines.length;
12518 oldLine += lines.length;
12521 // Identical context lines. Track line changes
12522 if (oldRangeStart) {
12523 // Close out any changes that have been output (or join overlapping)
12524 if (lines.length <= options.context * 2 && i < diff.length - 2) {
12525 /*istanbul ignore start*/var _curRange2;
12527 /*istanbul ignore end*/ // Overlapping
12528 /*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)));
12530 /*istanbul ignore start*/var _curRange3;
12532 /*istanbul ignore end*/ // end the range and output
12533 var contextSize = Math.min(lines.length, options.context);
12534 /*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))));
12537 oldStart: oldRangeStart,
12538 oldLines: oldLine - oldRangeStart + contextSize,
12539 newStart: newRangeStart,
12540 newLines: newLine - newRangeStart + contextSize,
12543 if (i >= diff.length - 2 && lines.length <= options.context) {
12544 // EOF is inside this hunk
12545 var oldEOFNewline = /\n$/.test(oldStr);
12546 var newEOFNewline = /\n$/.test(newStr);
12547 if (lines.length == 0 && !oldEOFNewline) {
12548 // special case: old has no eol and no trailing context; no-nl can end up before adds
12549 curRange.splice(hunk.oldLines, 0, '\\ No newline at end of file');
12550 } else if (!oldEOFNewline || !newEOFNewline) {
12551 curRange.push('\\ No newline at end of file');
12561 oldLine += lines.length;
12562 newLine += lines.length;
12566 for (var i = 0; i < diff.length; i++) {
12567 /*istanbul ignore start*/_loop( /*istanbul ignore end*/i);
12571 oldFileName: oldFileName, newFileName: newFileName,
12572 oldHeader: oldHeader, newHeader: newHeader,
12577 function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
12578 var diff = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options);
12581 if (oldFileName == newFileName) {
12582 ret.push('Index: ' + oldFileName);
12584 ret.push('===================================================================');
12585 ret.push('--- ' + diff.oldFileName + (typeof diff.oldHeader === 'undefined' ? '' : '\t' + diff.oldHeader));
12586 ret.push('+++ ' + diff.newFileName + (typeof diff.newHeader === 'undefined' ? '' : '\t' + diff.newHeader));
12588 for (var i = 0; i < diff.hunks.length; i++) {
12589 var hunk = diff.hunks[i];
12590 ret.push('@@ -' + hunk.oldStart + ',' + hunk.oldLines + ' +' + hunk.newStart + ',' + hunk.newLines + ' @@');
12591 ret.push.apply(ret, hunk.lines);
12594 return ret.join('\n') + '\n';
12597 function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) {
12598 return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options);
12605 /***/ (function(module, exports) {
12607 /*istanbul ignore start*/"use strict";
12609 exports.__esModule = true;
12610 exports. /*istanbul ignore end*/arrayEqual = arrayEqual;
12611 /*istanbul ignore start*/exports. /*istanbul ignore end*/arrayStartsWith = arrayStartsWith;
12612 function arrayEqual(a, b) {
12613 if (a.length !== b.length) {
12617 return arrayStartsWith(a, b);
12620 function arrayStartsWith(array, start) {
12621 if (start.length > array.length) {
12625 for (var i = 0; i < start.length; i++) {
12626 if (start[i] !== array[i]) {
12638 /***/ (function(module, exports) {
12640 /*istanbul ignore start*/"use strict";
12642 exports.__esModule = true;
12643 exports. /*istanbul ignore end*/convertChangesToDMP = convertChangesToDMP;
12644 // See: http://code.google.com/p/google-diff-match-patch/wiki/API
12645 function convertChangesToDMP(changes) {
12647 change = /*istanbul ignore start*/void 0 /*istanbul ignore end*/,
12648 operation = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
12649 for (var i = 0; i < changes.length; i++) {
12650 change = changes[i];
12651 if (change.added) {
12653 } else if (change.removed) {
12659 ret.push([operation, change.value]);
12668 /***/ (function(module, exports) {
12670 /*istanbul ignore start*/'use strict';
12672 exports.__esModule = true;
12673 exports. /*istanbul ignore end*/convertChangesToXML = convertChangesToXML;
12674 function convertChangesToXML(changes) {
12676 for (var i = 0; i < changes.length; i++) {
12677 var change = changes[i];
12678 if (change.added) {
12680 } else if (change.removed) {
12684 ret.push(escapeHTML(change.value));
12686 if (change.added) {
12687 ret.push('</ins>');
12688 } else if (change.removed) {
12689 ret.push('</del>');
12692 return ret.join('');
12695 function escapeHTML(s) {
12697 n = n.replace(/&/g, '&');
12698 n = n.replace(/</g, '<');
12699 n = n.replace(/>/g, '>');
12700 n = n.replace(/"/g, '"');
12711 },{}],49:[function(require,module,exports){
12714 var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
12716 module.exports = function (str) {
12717 if (typeof str !== 'string') {
12718 throw new TypeError('Expected a string');
12721 return str.replace(matchOperatorsRe, '\\$&');
12724 },{}],50:[function(require,module,exports){
12725 // Copyright Joyent, Inc. and other Node contributors.
12727 // Permission is hereby granted, free of charge, to any person obtaining a
12728 // copy of this software and associated documentation files (the
12729 // "Software"), to deal in the Software without restriction, including
12730 // without limitation the rights to use, copy, modify, merge, publish,
12731 // distribute, sublicense, and/or sell copies of the Software, and to permit
12732 // persons to whom the Software is furnished to do so, subject to the
12733 // following conditions:
12735 // The above copyright notice and this permission notice shall be included
12736 // in all copies or substantial portions of the Software.
12738 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
12739 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
12740 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
12741 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
12742 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
12743 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
12744 // USE OR OTHER DEALINGS IN THE SOFTWARE.
12746 var objectCreate = Object.create || objectCreatePolyfill
12747 var objectKeys = Object.keys || objectKeysPolyfill
12748 var bind = Function.prototype.bind || functionBindPolyfill
12750 function EventEmitter() {
12751 if (!this._events || !Object.prototype.hasOwnProperty.call(this, '_events')) {
12752 this._events = objectCreate(null);
12753 this._eventsCount = 0;
12756 this._maxListeners = this._maxListeners || undefined;
12758 module.exports = EventEmitter;
12760 // Backwards-compat with node 0.10.x
12761 EventEmitter.EventEmitter = EventEmitter;
12763 EventEmitter.prototype._events = undefined;
12764 EventEmitter.prototype._maxListeners = undefined;
12766 // By default EventEmitters will print a warning if more than 10 listeners are
12767 // added to it. This is a useful default which helps finding memory leaks.
12768 var defaultMaxListeners = 10;
12770 var hasDefineProperty;
12773 if (Object.defineProperty) Object.defineProperty(o, 'x', { value: 0 });
12774 hasDefineProperty = o.x === 0;
12775 } catch (err) { hasDefineProperty = false }
12776 if (hasDefineProperty) {
12777 Object.defineProperty(EventEmitter, 'defaultMaxListeners', {
12780 return defaultMaxListeners;
12782 set: function(arg) {
12783 // check whether the input is a positive number (whose value is zero or
12784 // greater and not a NaN).
12785 if (typeof arg !== 'number' || arg < 0 || arg !== arg)
12786 throw new TypeError('"defaultMaxListeners" must be a positive number');
12787 defaultMaxListeners = arg;
12791 EventEmitter.defaultMaxListeners = defaultMaxListeners;
12794 // Obviously not all Emitters should be limited to 10. This function allows
12795 // that to be increased. Set to zero for unlimited.
12796 EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
12797 if (typeof n !== 'number' || n < 0 || isNaN(n))
12798 throw new TypeError('"n" argument must be a positive number');
12799 this._maxListeners = n;
12803 function $getMaxListeners(that) {
12804 if (that._maxListeners === undefined)
12805 return EventEmitter.defaultMaxListeners;
12806 return that._maxListeners;
12809 EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
12810 return $getMaxListeners(this);
12813 // These standalone emit* functions are used to optimize calling of event
12814 // handlers for fast cases because emit() itself often has a variable number of
12815 // arguments and can be deoptimized because of that. These functions always have
12816 // the same number of arguments and thus do not get deoptimized, so the code
12817 // inside them can execute faster.
12818 function emitNone(handler, isFn, self) {
12820 handler.call(self);
12822 var len = handler.length;
12823 var listeners = arrayClone(handler, len);
12824 for (var i = 0; i < len; ++i)
12825 listeners[i].call(self);
12828 function emitOne(handler, isFn, self, arg1) {
12830 handler.call(self, arg1);
12832 var len = handler.length;
12833 var listeners = arrayClone(handler, len);
12834 for (var i = 0; i < len; ++i)
12835 listeners[i].call(self, arg1);
12838 function emitTwo(handler, isFn, self, arg1, arg2) {
12840 handler.call(self, arg1, arg2);
12842 var len = handler.length;
12843 var listeners = arrayClone(handler, len);
12844 for (var i = 0; i < len; ++i)
12845 listeners[i].call(self, arg1, arg2);
12848 function emitThree(handler, isFn, self, arg1, arg2, arg3) {
12850 handler.call(self, arg1, arg2, arg3);
12852 var len = handler.length;
12853 var listeners = arrayClone(handler, len);
12854 for (var i = 0; i < len; ++i)
12855 listeners[i].call(self, arg1, arg2, arg3);
12859 function emitMany(handler, isFn, self, args) {
12861 handler.apply(self, args);
12863 var len = handler.length;
12864 var listeners = arrayClone(handler, len);
12865 for (var i = 0; i < len; ++i)
12866 listeners[i].apply(self, args);
12870 EventEmitter.prototype.emit = function emit(type) {
12871 var er, handler, len, args, i, events;
12872 var doError = (type === 'error');
12874 events = this._events;
12876 doError = (doError && events.error == null);
12880 // If there is no 'error' event listener then throw.
12882 if (arguments.length > 1)
12884 if (er instanceof Error) {
12885 throw er; // Unhandled 'error' event
12887 // At least give some kind of context to the user
12888 var err = new Error('Unhandled "error" event. (' + er + ')');
12895 handler = events[type];
12900 var isFn = typeof handler === 'function';
12901 len = arguments.length;
12905 emitNone(handler, isFn, this);
12908 emitOne(handler, isFn, this, arguments[1]);
12911 emitTwo(handler, isFn, this, arguments[1], arguments[2]);
12914 emitThree(handler, isFn, this, arguments[1], arguments[2], arguments[3]);
12918 args = new Array(len - 1);
12919 for (i = 1; i < len; i++)
12920 args[i - 1] = arguments[i];
12921 emitMany(handler, isFn, this, args);
12927 function _addListener(target, type, listener, prepend) {
12932 if (typeof listener !== 'function')
12933 throw new TypeError('"listener" argument must be a function');
12935 events = target._events;
12937 events = target._events = objectCreate(null);
12938 target._eventsCount = 0;
12940 // To avoid recursion in the case that type === "newListener"! Before
12941 // adding it to the listeners, first emit "newListener".
12942 if (events.newListener) {
12943 target.emit('newListener', type,
12944 listener.listener ? listener.listener : listener);
12946 // Re-assign `events` because a newListener handler could have caused the
12947 // this._events to be assigned to a new object
12948 events = target._events;
12950 existing = events[type];
12954 // Optimize the case of one listener. Don't need the extra array object.
12955 existing = events[type] = listener;
12956 ++target._eventsCount;
12958 if (typeof existing === 'function') {
12959 // Adding the second element, need to change to array.
12960 existing = events[type] =
12961 prepend ? [listener, existing] : [existing, listener];
12963 // If we've already got an array, just append.
12965 existing.unshift(listener);
12967 existing.push(listener);
12971 // Check for listener leak
12972 if (!existing.warned) {
12973 m = $getMaxListeners(target);
12974 if (m && m > 0 && existing.length > m) {
12975 existing.warned = true;
12976 var w = new Error('Possible EventEmitter memory leak detected. ' +
12977 existing.length + ' "' + String(type) + '" listeners ' +
12978 'added. Use emitter.setMaxListeners() to ' +
12979 'increase limit.');
12980 w.name = 'MaxListenersExceededWarning';
12981 w.emitter = target;
12983 w.count = existing.length;
12984 if (typeof console === 'object' && console.warn) {
12985 console.warn('%s: %s', w.name, w.message);
12994 EventEmitter.prototype.addListener = function addListener(type, listener) {
12995 return _addListener(this, type, listener, false);
12998 EventEmitter.prototype.on = EventEmitter.prototype.addListener;
13000 EventEmitter.prototype.prependListener =
13001 function prependListener(type, listener) {
13002 return _addListener(this, type, listener, true);
13005 function onceWrapper() {
13007 this.target.removeListener(this.type, this.wrapFn);
13009 switch (arguments.length) {
13011 return this.listener.call(this.target);
13013 return this.listener.call(this.target, arguments[0]);
13015 return this.listener.call(this.target, arguments[0], arguments[1]);
13017 return this.listener.call(this.target, arguments[0], arguments[1],
13020 var args = new Array(arguments.length);
13021 for (var i = 0; i < args.length; ++i)
13022 args[i] = arguments[i];
13023 this.listener.apply(this.target, args);
13028 function _onceWrap(target, type, listener) {
13029 var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };
13030 var wrapped = bind.call(onceWrapper, state);
13031 wrapped.listener = listener;
13032 state.wrapFn = wrapped;
13036 EventEmitter.prototype.once = function once(type, listener) {
13037 if (typeof listener !== 'function')
13038 throw new TypeError('"listener" argument must be a function');
13039 this.on(type, _onceWrap(this, type, listener));
13043 EventEmitter.prototype.prependOnceListener =
13044 function prependOnceListener(type, listener) {
13045 if (typeof listener !== 'function')
13046 throw new TypeError('"listener" argument must be a function');
13047 this.prependListener(type, _onceWrap(this, type, listener));
13051 // Emits a 'removeListener' event if and only if the listener was removed.
13052 EventEmitter.prototype.removeListener =
13053 function removeListener(type, listener) {
13054 var list, events, position, i, originalListener;
13056 if (typeof listener !== 'function')
13057 throw new TypeError('"listener" argument must be a function');
13059 events = this._events;
13063 list = events[type];
13067 if (list === listener || list.listener === listener) {
13068 if (--this._eventsCount === 0)
13069 this._events = objectCreate(null);
13071 delete events[type];
13072 if (events.removeListener)
13073 this.emit('removeListener', type, list.listener || listener);
13075 } else if (typeof list !== 'function') {
13078 for (i = list.length - 1; i >= 0; i--) {
13079 if (list[i] === listener || list[i].listener === listener) {
13080 originalListener = list[i].listener;
13089 if (position === 0)
13092 spliceOne(list, position);
13094 if (list.length === 1)
13095 events[type] = list[0];
13097 if (events.removeListener)
13098 this.emit('removeListener', type, originalListener || listener);
13104 EventEmitter.prototype.removeAllListeners =
13105 function removeAllListeners(type) {
13106 var listeners, events, i;
13108 events = this._events;
13112 // not listening for removeListener, no need to emit
13113 if (!events.removeListener) {
13114 if (arguments.length === 0) {
13115 this._events = objectCreate(null);
13116 this._eventsCount = 0;
13117 } else if (events[type]) {
13118 if (--this._eventsCount === 0)
13119 this._events = objectCreate(null);
13121 delete events[type];
13126 // emit removeListener for all listeners on all events
13127 if (arguments.length === 0) {
13128 var keys = objectKeys(events);
13130 for (i = 0; i < keys.length; ++i) {
13132 if (key === 'removeListener') continue;
13133 this.removeAllListeners(key);
13135 this.removeAllListeners('removeListener');
13136 this._events = objectCreate(null);
13137 this._eventsCount = 0;
13141 listeners = events[type];
13143 if (typeof listeners === 'function') {
13144 this.removeListener(type, listeners);
13145 } else if (listeners) {
13147 for (i = listeners.length - 1; i >= 0; i--) {
13148 this.removeListener(type, listeners[i]);
13155 function _listeners(target, type, unwrap) {
13156 var events = target._events;
13161 var evlistener = events[type];
13165 if (typeof evlistener === 'function')
13166 return unwrap ? [evlistener.listener || evlistener] : [evlistener];
13168 return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
13171 EventEmitter.prototype.listeners = function listeners(type) {
13172 return _listeners(this, type, true);
13175 EventEmitter.prototype.rawListeners = function rawListeners(type) {
13176 return _listeners(this, type, false);
13179 EventEmitter.listenerCount = function(emitter, type) {
13180 if (typeof emitter.listenerCount === 'function') {
13181 return emitter.listenerCount(type);
13183 return listenerCount.call(emitter, type);
13187 EventEmitter.prototype.listenerCount = listenerCount;
13188 function listenerCount(type) {
13189 var events = this._events;
13192 var evlistener = events[type];
13194 if (typeof evlistener === 'function') {
13196 } else if (evlistener) {
13197 return evlistener.length;
13204 EventEmitter.prototype.eventNames = function eventNames() {
13205 return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : [];
13208 // About 1.5x faster than the two-arg version of Array#splice().
13209 function spliceOne(list, index) {
13210 for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1)
13215 function arrayClone(arr, n) {
13216 var copy = new Array(n);
13217 for (var i = 0; i < n; ++i)
13222 function unwrapListeners(arr) {
13223 var ret = new Array(arr.length);
13224 for (var i = 0; i < ret.length; ++i) {
13225 ret[i] = arr[i].listener || arr[i];
13230 function objectCreatePolyfill(proto) {
13231 var F = function() {};
13232 F.prototype = proto;
13235 function objectKeysPolyfill(obj) {
13237 for (var k in obj) if (Object.prototype.hasOwnProperty.call(obj, k)) {
13242 function functionBindPolyfill(context) {
13244 return function () {
13245 return fn.apply(context, arguments);
13249 },{}],51:[function(require,module,exports){
13252 /* eslint no-invalid-this: 1 */
13254 var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
13255 var slice = Array.prototype.slice;
13256 var toStr = Object.prototype.toString;
13257 var funcType = '[object Function]';
13259 module.exports = function bind(that) {
13261 if (typeof target !== 'function' || toStr.call(target) !== funcType) {
13262 throw new TypeError(ERROR_MESSAGE + target);
13264 var args = slice.call(arguments, 1);
13267 var binder = function () {
13268 if (this instanceof bound) {
13269 var result = target.apply(
13271 args.concat(slice.call(arguments))
13273 if (Object(result) === result) {
13278 return target.apply(
13280 args.concat(slice.call(arguments))
13285 var boundLength = Math.max(0, target.length - args.length);
13286 var boundArgs = [];
13287 for (var i = 0; i < boundLength; i++) {
13288 boundArgs.push('$' + i);
13291 bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
13293 if (target.prototype) {
13294 var Empty = function Empty() {};
13295 Empty.prototype = target.prototype;
13296 bound.prototype = new Empty();
13297 Empty.prototype = null;
13303 },{}],52:[function(require,module,exports){
13306 var implementation = require('./implementation');
13308 module.exports = Function.prototype.bind || implementation;
13310 },{"./implementation":51}],53:[function(require,module,exports){
13313 /* eslint complexity: [2, 17], max-statements: [2, 33] */
13314 module.exports = function hasSymbols() {
13315 if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
13316 if (typeof Symbol.iterator === 'symbol') { return true; }
13319 var sym = Symbol('test');
13320 var symObj = Object(sym);
13321 if (typeof sym === 'string') { return false; }
13323 if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
13324 if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
13326 // temp disabled per https://github.com/ljharb/object.assign/issues/17
13327 // if (sym instanceof Symbol) { return false; }
13328 // temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
13329 // if (!(symObj instanceof Symbol)) { return false; }
13331 // if (typeof Symbol.prototype.toString !== 'function') { return false; }
13332 // if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
13336 for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax
13337 if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
13339 if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
13341 var syms = Object.getOwnPropertySymbols(obj);
13342 if (syms.length !== 1 || syms[0] !== sym) { return false; }
13344 if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
13346 if (typeof Object.getOwnPropertyDescriptor === 'function') {
13347 var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
13348 if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
13354 },{}],54:[function(require,module,exports){
13355 (function (global){
13356 /*! https://mths.be/he v1.2.0 by @mathias | MIT license */
13359 // Detect free variables `exports`.
13360 var freeExports = typeof exports == 'object' && exports;
13362 // Detect free variable `module`.
13363 var freeModule = typeof module == 'object' && module &&
13364 module.exports == freeExports && module;
13366 // Detect free variable `global`, from Node.js or Browserified code,
13367 // and use it as `root`.
13368 var freeGlobal = typeof global == 'object' && global;
13369 if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {
13373 /*--------------------------------------------------------------------------*/
13375 // All astral symbols.
13376 var regexAstralSymbols = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
13377 // All ASCII symbols (not just printable ASCII) except those listed in the
13378 // first column of the overrides table.
13379 // https://html.spec.whatwg.org/multipage/syntax.html#table-charref-overrides
13380 var regexAsciiWhitelist = /[\x01-\x7F]/g;
13381 // All BMP symbols that are not ASCII newlines, printable ASCII symbols, or
13382 // code points listed in the first column of the overrides table on
13383 // https://html.spec.whatwg.org/multipage/syntax.html#table-charref-overrides.
13384 var regexBmpWhitelist = /[\x01-\t\x0B\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g;
13386 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;
13387 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'};
13389 var regexEscape = /["&'<>`]/g;
13395 // See https://mathiasbynens.be/notes/ambiguous-ampersands: in HTML, the
13396 // following is not strictly necessary unless it’s part of a tag or an
13397 // unquoted attribute value. We’re only escaping it to support those
13398 // situations, and for XML support.
13400 // In Internet Explorer ≤ 8, the backtick character can be used
13401 // to break out of (un)quoted attribute values or HTML comments.
13402 // See http://html5sec.org/#102, http://html5sec.org/#108, and
13403 // http://html5sec.org/#133.
13407 var regexInvalidEntity = /&#(?:[xX][^a-fA-F0-9]|[^0-9xX])/;
13408 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]/;
13409 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;
13410 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'};
13411 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'};
13412 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'};
13413 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];
13415 /*--------------------------------------------------------------------------*/
13417 var stringFromCharCode = String.fromCharCode;
13420 var hasOwnProperty = object.hasOwnProperty;
13421 var has = function(object, propertyName) {
13422 return hasOwnProperty.call(object, propertyName);
13425 var contains = function(array, value) {
13427 var length = array.length;
13428 while (++index < length) {
13429 if (array[index] == value) {
13436 var merge = function(options, defaults) {
13442 for (key in defaults) {
13443 // A `hasOwnProperty` check is not needed here, since only recognized
13444 // option names are used anyway. Any others are ignored.
13445 result[key] = has(options, key) ? options[key] : defaults[key];
13450 // Modified version of `ucs2encode`; see https://mths.be/punycode.
13451 var codePointToSymbol = function(codePoint, strict) {
13453 if ((codePoint >= 0xD800 && codePoint <= 0xDFFF) || codePoint > 0x10FFFF) {
13455 // “Otherwise, if the number is in the range 0xD800 to 0xDFFF or is
13456 // greater than 0x10FFFF, then this is a parse error. Return a U+FFFD
13457 // REPLACEMENT CHARACTER.”
13459 parseError('character reference outside the permissible Unicode range');
13463 if (has(decodeMapNumeric, codePoint)) {
13465 parseError('disallowed character reference');
13467 return decodeMapNumeric[codePoint];
13469 if (strict && contains(invalidReferenceCodePoints, codePoint)) {
13470 parseError('disallowed character reference');
13472 if (codePoint > 0xFFFF) {
13473 codePoint -= 0x10000;
13474 output += stringFromCharCode(codePoint >>> 10 & 0x3FF | 0xD800);
13475 codePoint = 0xDC00 | codePoint & 0x3FF;
13477 output += stringFromCharCode(codePoint);
13481 var hexEscape = function(codePoint) {
13482 return '&#x' + codePoint.toString(16).toUpperCase() + ';';
13485 var decEscape = function(codePoint) {
13486 return '&#' + codePoint + ';';
13489 var parseError = function(message) {
13490 throw Error('Parse error: ' + message);
13493 /*--------------------------------------------------------------------------*/
13495 var encode = function(string, options) {
13496 options = merge(options, encode.options);
13497 var strict = options.strict;
13498 if (strict && regexInvalidRawCodePoint.test(string)) {
13499 parseError('forbidden code point');
13501 var encodeEverything = options.encodeEverything;
13502 var useNamedReferences = options.useNamedReferences;
13503 var allowUnsafeSymbols = options.allowUnsafeSymbols;
13504 var escapeCodePoint = options.decimal ? decEscape : hexEscape;
13506 var escapeBmpSymbol = function(symbol) {
13507 return escapeCodePoint(symbol.charCodeAt(0));
13510 if (encodeEverything) {
13511 // Encode ASCII symbols.
13512 string = string.replace(regexAsciiWhitelist, function(symbol) {
13513 // Use named references if requested & possible.
13514 if (useNamedReferences && has(encodeMap, symbol)) {
13515 return '&' + encodeMap[symbol] + ';';
13517 return escapeBmpSymbol(symbol);
13519 // Shorten a few escapes that represent two symbols, of which at least one
13520 // is within the ASCII range.
13521 if (useNamedReferences) {
13523 .replace(/>\u20D2/g, '>⃒')
13524 .replace(/<\u20D2/g, '<⃒')
13525 .replace(/fj/g, 'fj');
13527 // Encode non-ASCII symbols.
13528 if (useNamedReferences) {
13529 // Encode non-ASCII symbols that can be replaced with a named reference.
13530 string = string.replace(regexEncodeNonAscii, function(string) {
13531 // Note: there is no need to check `has(encodeMap, string)` here.
13532 return '&' + encodeMap[string] + ';';
13535 // Note: any remaining non-ASCII symbols are handled outside of the `if`.
13536 } else if (useNamedReferences) {
13537 // Apply named character references.
13538 // Encode `<>"'&` using named character references.
13539 if (!allowUnsafeSymbols) {
13540 string = string.replace(regexEscape, function(string) {
13541 return '&' + encodeMap[string] + ';'; // no need to check `has()` here
13544 // Shorten escapes that represent two symbols, of which at least one is
13547 .replace(/>\u20D2/g, '>⃒')
13548 .replace(/<\u20D2/g, '<⃒');
13549 // Encode non-ASCII symbols that can be replaced with a named reference.
13550 string = string.replace(regexEncodeNonAscii, function(string) {
13551 // Note: there is no need to check `has(encodeMap, string)` here.
13552 return '&' + encodeMap[string] + ';';
13554 } else if (!allowUnsafeSymbols) {
13555 // Encode `<>"'&` using hexadecimal escapes, now that they’re not handled
13556 // using named character references.
13557 string = string.replace(regexEscape, escapeBmpSymbol);
13560 // Encode astral symbols.
13561 .replace(regexAstralSymbols, function($0) {
13562 // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
13563 var high = $0.charCodeAt(0);
13564 var low = $0.charCodeAt(1);
13565 var codePoint = (high - 0xD800) * 0x400 + low - 0xDC00 + 0x10000;
13566 return escapeCodePoint(codePoint);
13568 // Encode any remaining BMP symbols that are not printable ASCII symbols
13569 // using a hexadecimal escape.
13570 .replace(regexBmpWhitelist, escapeBmpSymbol);
13572 // Expose default options (so they can be overridden globally).
13574 'allowUnsafeSymbols': false,
13575 'encodeEverything': false,
13577 'useNamedReferences': false,
13581 var decode = function(html, options) {
13582 options = merge(options, decode.options);
13583 var strict = options.strict;
13584 if (strict && regexInvalidEntity.test(html)) {
13585 parseError('malformed character reference');
13587 return html.replace(regexDecode, function($0, $1, $2, $3, $4, $5, $6, $7, $8) {
13597 // Note: there is no need to check `has(decodeMap, reference)`.
13598 return decodeMap[reference];
13602 // Decode named character references without trailing `;`, e.g. `&`.
13603 // This is only a parse error if it gets converted to `&`, or if it is
13604 // followed by `=` in an attribute context.
13607 if (next && options.isAttributeValue) {
13608 if (strict && next == '=') {
13609 parseError('`&` did not start a character reference');
13615 'named character reference was not terminated by a semicolon'
13618 // Note: there is no need to check `has(decodeMapLegacy, reference)`.
13619 return decodeMapLegacy[reference] + (next || '');
13624 // Decode decimal escapes, e.g. `𝌆`.
13627 if (strict && !semicolon) {
13628 parseError('character reference was not terminated by a semicolon');
13630 codePoint = parseInt(decDigits, 10);
13631 return codePointToSymbol(codePoint, strict);
13635 // Decode hexadecimal escapes, e.g. `𝌆`.
13638 if (strict && !semicolon) {
13639 parseError('character reference was not terminated by a semicolon');
13641 codePoint = parseInt(hexDigits, 16);
13642 return codePointToSymbol(codePoint, strict);
13645 // If we’re still here, `if ($7)` is implied; it’s an ambiguous
13646 // ampersand for sure. https://mths.be/notes/ambiguous-ampersands
13649 'named character reference was not terminated by a semicolon'
13655 // Expose default options (so they can be overridden globally).
13657 'isAttributeValue': false,
13661 var escape = function(string) {
13662 return string.replace(regexEscape, function($0) {
13663 // Note: there is no need to check `has(escapeMap, $0)` here.
13664 return escapeMap[$0];
13668 /*--------------------------------------------------------------------------*/
13671 'version': '1.2.0',
13678 // Some AMD build optimizers, like r.js, check for specific condition patterns
13679 // like the following:
13683 define(function() {
13686 } else if (freeExports && !freeExports.nodeType) {
13687 if (freeModule) { // in Node.js, io.js, or RingoJS v0.8.0+
13688 freeModule.exports = he;
13689 } else { // in Narwhal or RingoJS v0.7.0-
13690 for (var key in he) {
13691 has(he, key) && (freeExports[key] = he[key]);
13694 } else { // in Rhino or a web browser
13700 }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
13701 },{}],55:[function(require,module,exports){
13702 exports.read = function (buffer, offset, isLE, mLen, nBytes) {
13704 var eLen = (nBytes * 8) - mLen - 1
13705 var eMax = (1 << eLen) - 1
13706 var eBias = eMax >> 1
13708 var i = isLE ? (nBytes - 1) : 0
13709 var d = isLE ? -1 : 1
13710 var s = buffer[offset + i]
13714 e = s & ((1 << (-nBits)) - 1)
13717 for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
13719 m = e & ((1 << (-nBits)) - 1)
13722 for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
13726 } else if (e === eMax) {
13727 return m ? NaN : ((s ? -1 : 1) * Infinity)
13729 m = m + Math.pow(2, mLen)
13732 return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
13735 exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
13737 var eLen = (nBytes * 8) - mLen - 1
13738 var eMax = (1 << eLen) - 1
13739 var eBias = eMax >> 1
13740 var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
13741 var i = isLE ? 0 : (nBytes - 1)
13742 var d = isLE ? 1 : -1
13743 var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
13745 value = Math.abs(value)
13747 if (isNaN(value) || value === Infinity) {
13748 m = isNaN(value) ? 1 : 0
13751 e = Math.floor(Math.log(value) / Math.LN2)
13752 if (value * (c = Math.pow(2, -e)) < 1) {
13756 if (e + eBias >= 1) {
13759 value += rt * Math.pow(2, 1 - eBias)
13761 if (value * c >= 2) {
13766 if (e + eBias >= eMax) {
13769 } else if (e + eBias >= 1) {
13770 m = ((value * c) - 1) * Math.pow(2, mLen)
13773 m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
13778 for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
13780 e = (e << mLen) | m
13782 for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
13784 buffer[offset + i - d] |= s * 128
13787 },{}],56:[function(require,module,exports){
13788 if (typeof Object.create === 'function') {
13789 // implementation from standard node.js 'util' module
13790 module.exports = function inherits(ctor, superCtor) {
13791 ctor.super_ = superCtor
13792 ctor.prototype = Object.create(superCtor.prototype, {
13802 // old school shim for old browsers
13803 module.exports = function inherits(ctor, superCtor) {
13804 ctor.super_ = superCtor
13805 var TempCtor = function () {}
13806 TempCtor.prototype = superCtor.prototype
13807 ctor.prototype = new TempCtor()
13808 ctor.prototype.constructor = ctor
13812 },{}],57:[function(require,module,exports){
13814 * Determine if an object is a Buffer
13816 * @author Feross Aboukhadijeh <https://feross.org>
13820 // The _isBuffer check is for Safari 5-7 support, because it's missing
13821 // Object.prototype.constructor. Remove this eventually
13822 module.exports = function (obj) {
13823 return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
13826 function isBuffer (obj) {
13827 return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
13830 // For Node v0.10 support. Remove this eventually.
13831 function isSlowBuffer (obj) {
13832 return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
13835 },{}],58:[function(require,module,exports){
13836 var toString = {}.toString;
13838 module.exports = Array.isArray || function (arr) {
13839 return toString.call(arr) == '[object Array]';
13842 },{}],59:[function(require,module,exports){
13843 (function (process){
13844 var path = require('path');
13845 var fs = require('fs');
13846 var _0777 = parseInt('0777', 8);
13848 module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP;
13850 function mkdirP (p, opts, f, made) {
13851 if (typeof opts === 'function') {
13855 else if (!opts || typeof opts !== 'object') {
13856 opts = { mode: opts };
13859 var mode = opts.mode;
13860 var xfs = opts.fs || fs;
13862 if (mode === undefined) {
13863 mode = _0777 & (~process.umask());
13865 if (!made) made = null;
13867 var cb = f || function () {};
13868 p = path.resolve(p);
13870 xfs.mkdir(p, mode, function (er) {
13873 return cb(null, made);
13877 mkdirP(path.dirname(p), opts, function (er, made) {
13878 if (er) cb(er, made);
13879 else mkdirP(p, opts, cb, made);
13883 // In the case of any other error, just see if there's a dir
13884 // there already. If so, then hooray! If not, then something
13887 xfs.stat(p, function (er2, stat) {
13888 // if the stat fails, then that's super weird.
13889 // let the original error be the failure reason.
13890 if (er2 || !stat.isDirectory()) cb(er, made)
13891 else cb(null, made);
13898 mkdirP.sync = function sync (p, opts, made) {
13899 if (!opts || typeof opts !== 'object') {
13900 opts = { mode: opts };
13903 var mode = opts.mode;
13904 var xfs = opts.fs || fs;
13906 if (mode === undefined) {
13907 mode = _0777 & (~process.umask());
13909 if (!made) made = null;
13911 p = path.resolve(p);
13914 xfs.mkdirSync(p, mode);
13918 switch (err0.code) {
13920 made = sync(path.dirname(p), opts, made);
13921 sync(p, opts, made);
13924 // In the case of any other error, just see if there's a dir
13925 // there already. If so, then hooray! If not, then something
13930 stat = xfs.statSync(p);
13935 if (!stat.isDirectory()) throw err0;
13943 }).call(this,require('_process'))
13944 },{"_process":69,"fs":42,"path":42}],60:[function(require,module,exports){
13954 var y = d * 365.25;
13957 * Parse or format the given `val`.
13961 * - `long` verbose formatting [false]
13963 * @param {String|Number} val
13964 * @param {Object} [options]
13965 * @throws {Error} throw an error if val is not a non-empty string or a number
13966 * @return {String|Number}
13970 module.exports = function(val, options) {
13971 options = options || {};
13972 var type = typeof val;
13973 if (type === 'string' && val.length > 0) {
13975 } else if (type === 'number' && isNaN(val) === false) {
13976 return options.long ? fmtLong(val) : fmtShort(val);
13979 'val is not a non-empty string or a valid number. val=' +
13980 JSON.stringify(val)
13985 * Parse the given `str` and return milliseconds.
13987 * @param {String} str
13992 function parse(str) {
13994 if (str.length > 100) {
13997 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(
14003 var n = parseFloat(match[1]);
14004 var type = (match[2] || 'ms').toLowerCase();
14038 case 'milliseconds':
14039 case 'millisecond':
14050 * Short format for `ms`.
14052 * @param {Number} ms
14057 function fmtShort(ms) {
14058 var msAbs = Math.abs(ms);
14060 return Math.round(ms / d) + 'd';
14063 return Math.round(ms / h) + 'h';
14066 return Math.round(ms / m) + 'm';
14069 return Math.round(ms / s) + 's';
14075 * Long format for `ms`.
14077 * @param {Number} ms
14082 function fmtLong(ms) {
14083 var msAbs = Math.abs(ms);
14085 return plural(ms, msAbs, d, 'day');
14088 return plural(ms, msAbs, h, 'hour');
14091 return plural(ms, msAbs, m, 'minute');
14094 return plural(ms, msAbs, s, 'second');
14100 * Pluralization helper.
14103 function plural(ms, msAbs, n, name) {
14104 var isPlural = msAbs >= n * 1.5;
14105 return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
14108 },{}],61:[function(require,module,exports){
14112 if (!Object.keys) {
14113 // modified from https://github.com/es-shims/es5-shim
14114 var has = Object.prototype.hasOwnProperty;
14115 var toStr = Object.prototype.toString;
14116 var isArgs = require('./isArguments'); // eslint-disable-line global-require
14117 var isEnumerable = Object.prototype.propertyIsEnumerable;
14118 var hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString');
14119 var hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype');
14126 'propertyIsEnumerable',
14129 var equalsConstructorPrototype = function (o) {
14130 var ctor = o.constructor;
14131 return ctor && ctor.prototype === o;
14133 var excludedKeys = {
14134 $applicationCache: true,
14138 $frameElement: true,
14140 $innerHeight: true,
14142 $outerHeight: true,
14144 $pageXOffset: true,
14145 $pageYOffset: true,
14152 $webkitIndexedDB: true,
14153 $webkitStorageInfo: true,
14156 var hasAutomationEqualityBug = (function () {
14157 /* global window */
14158 if (typeof window === 'undefined') { return false; }
14159 for (var k in window) {
14161 if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') {
14163 equalsConstructorPrototype(window[k]);
14174 var equalsConstructorPrototypeIfNotBuggy = function (o) {
14175 /* global window */
14176 if (typeof window === 'undefined' || !hasAutomationEqualityBug) {
14177 return equalsConstructorPrototype(o);
14180 return equalsConstructorPrototype(o);
14186 keysShim = function keys(object) {
14187 var isObject = object !== null && typeof object === 'object';
14188 var isFunction = toStr.call(object) === '[object Function]';
14189 var isArguments = isArgs(object);
14190 var isString = isObject && toStr.call(object) === '[object String]';
14193 if (!isObject && !isFunction && !isArguments) {
14194 throw new TypeError('Object.keys called on a non-object');
14197 var skipProto = hasProtoEnumBug && isFunction;
14198 if (isString && object.length > 0 && !has.call(object, 0)) {
14199 for (var i = 0; i < object.length; ++i) {
14200 theKeys.push(String(i));
14204 if (isArguments && object.length > 0) {
14205 for (var j = 0; j < object.length; ++j) {
14206 theKeys.push(String(j));
14209 for (var name in object) {
14210 if (!(skipProto && name === 'prototype') && has.call(object, name)) {
14211 theKeys.push(String(name));
14216 if (hasDontEnumBug) {
14217 var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);
14219 for (var k = 0; k < dontEnums.length; ++k) {
14220 if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) {
14221 theKeys.push(dontEnums[k]);
14228 module.exports = keysShim;
14230 },{"./isArguments":63}],62:[function(require,module,exports){
14233 var slice = Array.prototype.slice;
14234 var isArgs = require('./isArguments');
14236 var origKeys = Object.keys;
14237 var keysShim = origKeys ? function keys(o) { return origKeys(o); } : require('./implementation');
14239 var originalKeys = Object.keys;
14241 keysShim.shim = function shimObjectKeys() {
14243 var keysWorksWithArguments = (function () {
14245 var args = Object.keys(arguments);
14246 return args && args.length === arguments.length;
14248 if (!keysWorksWithArguments) {
14249 Object.keys = function keys(object) { // eslint-disable-line func-name-matching
14250 if (isArgs(object)) {
14251 return originalKeys(slice.call(object));
14253 return originalKeys(object);
14257 Object.keys = keysShim;
14259 return Object.keys || keysShim;
14262 module.exports = keysShim;
14264 },{"./implementation":61,"./isArguments":63}],63:[function(require,module,exports){
14267 var toStr = Object.prototype.toString;
14269 module.exports = function isArguments(value) {
14270 var str = toStr.call(value);
14271 var isArgs = str === '[object Arguments]';
14273 isArgs = str !== '[object Array]' &&
14275 typeof value === 'object' &&
14276 typeof value.length === 'number' &&
14277 value.length >= 0 &&
14278 toStr.call(value.callee) === '[object Function]';
14283 },{}],64:[function(require,module,exports){
14286 // modified from https://github.com/es-shims/es6-shim
14287 var keys = require('object-keys');
14288 var bind = require('function-bind');
14289 var canBeObject = function (obj) {
14290 return typeof obj !== 'undefined' && obj !== null;
14292 var hasSymbols = require('has-symbols/shams')();
14293 var toObject = Object;
14294 var push = bind.call(Function.call, Array.prototype.push);
14295 var propIsEnumerable = bind.call(Function.call, Object.prototype.propertyIsEnumerable);
14296 var originalGetSymbols = hasSymbols ? Object.getOwnPropertySymbols : null;
14298 module.exports = function assign(target, source1) {
14299 if (!canBeObject(target)) { throw new TypeError('target must be an object'); }
14300 var objTarget = toObject(target);
14301 var s, source, i, props, syms, value, key;
14302 for (s = 1; s < arguments.length; ++s) {
14303 source = toObject(arguments[s]);
14304 props = keys(source);
14305 var getSymbols = hasSymbols && (Object.getOwnPropertySymbols || originalGetSymbols);
14307 syms = getSymbols(source);
14308 for (i = 0; i < syms.length; ++i) {
14310 if (propIsEnumerable(source, key)) {
14315 for (i = 0; i < props.length; ++i) {
14317 value = source[key];
14318 if (propIsEnumerable(source, key)) {
14319 objTarget[key] = value;
14326 },{"function-bind":52,"has-symbols/shams":53,"object-keys":62}],65:[function(require,module,exports){
14329 var defineProperties = require('define-properties');
14331 var implementation = require('./implementation');
14332 var getPolyfill = require('./polyfill');
14333 var shim = require('./shim');
14335 var polyfill = getPolyfill();
14337 defineProperties(polyfill, {
14338 getPolyfill: getPolyfill,
14339 implementation: implementation,
14343 module.exports = polyfill;
14345 },{"./implementation":64,"./polyfill":66,"./shim":67,"define-properties":47}],66:[function(require,module,exports){
14348 var implementation = require('./implementation');
14350 var lacksProperEnumerationOrder = function () {
14351 if (!Object.assign) {
14354 // v8, specifically in node 4.x, has a bug with incorrect property enumeration order
14355 // note: this does not detect the bug unless there's 20 characters
14356 var str = 'abcdefghijklmnopqrst';
14357 var letters = str.split('');
14359 for (var i = 0; i < letters.length; ++i) {
14360 map[letters[i]] = letters[i];
14362 var obj = Object.assign({}, map);
14364 for (var k in obj) {
14367 return str !== actual;
14370 var assignHasPendingExceptions = function () {
14371 if (!Object.assign || !Object.preventExtensions) {
14374 // Firefox 37 still has "pending exception" logic in its Object.assign implementation,
14375 // which is 72% slower than our shim, and Firefox 40's native implementation.
14376 var thrower = Object.preventExtensions({ 1: 2 });
14378 Object.assign(thrower, 'xy');
14380 return thrower[1] === 'y';
14385 module.exports = function getPolyfill() {
14386 if (!Object.assign) {
14387 return implementation;
14389 if (lacksProperEnumerationOrder()) {
14390 return implementation;
14392 if (assignHasPendingExceptions()) {
14393 return implementation;
14395 return Object.assign;
14398 },{"./implementation":64}],67:[function(require,module,exports){
14401 var define = require('define-properties');
14402 var getPolyfill = require('./polyfill');
14404 module.exports = function shimAssign() {
14405 var polyfill = getPolyfill();
14408 { assign: polyfill },
14409 { assign: function () { return Object.assign !== polyfill; } }
14414 },{"./polyfill":66,"define-properties":47}],68:[function(require,module,exports){
14415 (function (process){
14418 if (!process.version ||
14419 process.version.indexOf('v0.') === 0 ||
14420 process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {
14421 module.exports = { nextTick: nextTick };
14423 module.exports = process
14426 function nextTick(fn, arg1, arg2, arg3) {
14427 if (typeof fn !== 'function') {
14428 throw new TypeError('"callback" argument must be a function');
14430 var len = arguments.length;
14435 return process.nextTick(fn);
14437 return process.nextTick(function afterTickOne() {
14438 fn.call(null, arg1);
14441 return process.nextTick(function afterTickTwo() {
14442 fn.call(null, arg1, arg2);
14445 return process.nextTick(function afterTickThree() {
14446 fn.call(null, arg1, arg2, arg3);
14449 args = new Array(len - 1);
14451 while (i < args.length) {
14452 args[i++] = arguments[i];
14454 return process.nextTick(function afterTick() {
14455 fn.apply(null, args);
14461 }).call(this,require('_process'))
14462 },{"_process":69}],69:[function(require,module,exports){
14463 // shim for using process in browser
14464 var process = module.exports = {};
14466 // cached from whatever global is present so that test runners that stub it
14467 // don't break things. But we need to wrap it in a try catch in case it is
14468 // wrapped in strict mode code which doesn't define any globals. It's inside a
14469 // function because try/catches deoptimize in certain engines.
14471 var cachedSetTimeout;
14472 var cachedClearTimeout;
14474 function defaultSetTimout() {
14475 throw new Error('setTimeout has not been defined');
14477 function defaultClearTimeout () {
14478 throw new Error('clearTimeout has not been defined');
14482 if (typeof setTimeout === 'function') {
14483 cachedSetTimeout = setTimeout;
14485 cachedSetTimeout = defaultSetTimout;
14488 cachedSetTimeout = defaultSetTimout;
14491 if (typeof clearTimeout === 'function') {
14492 cachedClearTimeout = clearTimeout;
14494 cachedClearTimeout = defaultClearTimeout;
14497 cachedClearTimeout = defaultClearTimeout;
14500 function runTimeout(fun) {
14501 if (cachedSetTimeout === setTimeout) {
14502 //normal environments in sane situations
14503 return setTimeout(fun, 0);
14505 // if setTimeout wasn't available but was latter defined
14506 if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
14507 cachedSetTimeout = setTimeout;
14508 return setTimeout(fun, 0);
14511 // when when somebody has screwed with setTimeout but no I.E. madness
14512 return cachedSetTimeout(fun, 0);
14515 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
14516 return cachedSetTimeout.call(null, fun, 0);
14518 // same as above but when it's a version of I.E. that must have the global object for 'this', hopefully our context correct otherwise it will throw a global error
14519 return cachedSetTimeout.call(this, fun, 0);
14525 function runClearTimeout(marker) {
14526 if (cachedClearTimeout === clearTimeout) {
14527 //normal environments in sane situations
14528 return clearTimeout(marker);
14530 // if clearTimeout wasn't available but was latter defined
14531 if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
14532 cachedClearTimeout = clearTimeout;
14533 return clearTimeout(marker);
14536 // when when somebody has screwed with setTimeout but no I.E. madness
14537 return cachedClearTimeout(marker);
14540 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
14541 return cachedClearTimeout.call(null, marker);
14543 // same as above but when it's a version of I.E. that must have the global object for 'this', hopefully our context correct otherwise it will throw a global error.
14544 // Some versions of I.E. have different rules for clearTimeout vs setTimeout
14545 return cachedClearTimeout.call(this, marker);
14553 var draining = false;
14555 var queueIndex = -1;
14557 function cleanUpNextTick() {
14558 if (!draining || !currentQueue) {
14562 if (currentQueue.length) {
14563 queue = currentQueue.concat(queue);
14567 if (queue.length) {
14572 function drainQueue() {
14576 var timeout = runTimeout(cleanUpNextTick);
14579 var len = queue.length;
14581 currentQueue = queue;
14583 while (++queueIndex < len) {
14584 if (currentQueue) {
14585 currentQueue[queueIndex].run();
14589 len = queue.length;
14591 currentQueue = null;
14593 runClearTimeout(timeout);
14596 process.nextTick = function (fun) {
14597 var args = new Array(arguments.length - 1);
14598 if (arguments.length > 1) {
14599 for (var i = 1; i < arguments.length; i++) {
14600 args[i - 1] = arguments[i];
14603 queue.push(new Item(fun, args));
14604 if (queue.length === 1 && !draining) {
14605 runTimeout(drainQueue);
14609 // v8 likes predictable objects
14610 function Item(fun, array) {
14612 this.array = array;
14614 Item.prototype.run = function () {
14615 this.fun.apply(null, this.array);
14617 process.title = 'browser';
14618 process.browser = true;
14621 process.version = ''; // empty string to avoid regexp issues
14622 process.versions = {};
14627 process.addListener = noop;
14628 process.once = noop;
14629 process.off = noop;
14630 process.removeListener = noop;
14631 process.removeAllListeners = noop;
14632 process.emit = noop;
14633 process.prependListener = noop;
14634 process.prependOnceListener = noop;
14636 process.listeners = function (name) { return [] }
14638 process.binding = function (name) {
14639 throw new Error('process.binding is not supported');
14642 process.cwd = function () { return '/' };
14643 process.chdir = function (dir) {
14644 throw new Error('process.chdir is not supported');
14646 process.umask = function() { return 0; };
14648 },{}],70:[function(require,module,exports){
14649 module.exports = require('./lib/_stream_duplex.js');
14651 },{"./lib/_stream_duplex.js":71}],71:[function(require,module,exports){
14652 // Copyright Joyent, Inc. and other Node contributors.
14654 // Permission is hereby granted, free of charge, to any person obtaining a
14655 // copy of this software and associated documentation files (the
14656 // "Software"), to deal in the Software without restriction, including
14657 // without limitation the rights to use, copy, modify, merge, publish,
14658 // distribute, sublicense, and/or sell copies of the Software, and to permit
14659 // persons to whom the Software is furnished to do so, subject to the
14660 // following conditions:
14662 // The above copyright notice and this permission notice shall be included
14663 // in all copies or substantial portions of the Software.
14665 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14666 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14667 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
14668 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
14669 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
14670 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
14671 // USE OR OTHER DEALINGS IN THE SOFTWARE.
14673 // a duplex stream is just a stream that is both readable and writable.
14674 // Since JS doesn't have multiple prototypal inheritance, this class
14675 // prototypally inherits from Readable, and then parasitically from
14682 var pna = require('process-nextick-args');
14686 var objectKeys = Object.keys || function (obj) {
14688 for (var key in obj) {
14694 module.exports = Duplex;
14697 var util = require('core-util-is');
14698 util.inherits = require('inherits');
14701 var Readable = require('./_stream_readable');
14702 var Writable = require('./_stream_writable');
14704 util.inherits(Duplex, Readable);
14707 // avoid scope creep, the keys array can then be collected
14708 var keys = objectKeys(Writable.prototype);
14709 for (var v = 0; v < keys.length; v++) {
14710 var method = keys[v];
14711 if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
14715 function Duplex(options) {
14716 if (!(this instanceof Duplex)) return new Duplex(options);
14718 Readable.call(this, options);
14719 Writable.call(this, options);
14721 if (options && options.readable === false) this.readable = false;
14723 if (options && options.writable === false) this.writable = false;
14725 this.allowHalfOpen = true;
14726 if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
14728 this.once('end', onend);
14731 Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
14732 // making it explicit this property is not enumerable
14733 // because otherwise some prototype manipulation in
14734 // userland will fail
14737 return this._writableState.highWaterMark;
14741 // the no-half-open enforcer
14743 // if we allow half-open state, or if the writable side ended,
14745 if (this.allowHalfOpen || this._writableState.ended) return;
14747 // no more data can be written.
14748 // But allow more writes to happen in this tick.
14749 pna.nextTick(onEndNT, this);
14752 function onEndNT(self) {
14756 Object.defineProperty(Duplex.prototype, 'destroyed', {
14758 if (this._readableState === undefined || this._writableState === undefined) {
14761 return this._readableState.destroyed && this._writableState.destroyed;
14763 set: function (value) {
14764 // we ignore the value if the stream
14765 // has not been initialized yet
14766 if (this._readableState === undefined || this._writableState === undefined) {
14770 // backward compatibility, the user is explicitly
14771 // managing destroyed
14772 this._readableState.destroyed = value;
14773 this._writableState.destroyed = value;
14777 Duplex.prototype._destroy = function (err, cb) {
14781 pna.nextTick(cb, err);
14783 },{"./_stream_readable":73,"./_stream_writable":75,"core-util-is":44,"inherits":56,"process-nextick-args":68}],72:[function(require,module,exports){
14784 // Copyright Joyent, Inc. and other Node contributors.
14786 // Permission is hereby granted, free of charge, to any person obtaining a
14787 // copy of this software and associated documentation files (the
14788 // "Software"), to deal in the Software without restriction, including
14789 // without limitation the rights to use, copy, modify, merge, publish,
14790 // distribute, sublicense, and/or sell copies of the Software, and to permit
14791 // persons to whom the Software is furnished to do so, subject to the
14792 // following conditions:
14794 // The above copyright notice and this permission notice shall be included
14795 // in all copies or substantial portions of the Software.
14797 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14798 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14799 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
14800 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
14801 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
14802 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
14803 // USE OR OTHER DEALINGS IN THE SOFTWARE.
14805 // a passthrough stream.
14806 // basically just the most minimal sort of Transform stream.
14807 // Every written chunk gets output as-is.
14811 module.exports = PassThrough;
14813 var Transform = require('./_stream_transform');
14816 var util = require('core-util-is');
14817 util.inherits = require('inherits');
14820 util.inherits(PassThrough, Transform);
14822 function PassThrough(options) {
14823 if (!(this instanceof PassThrough)) return new PassThrough(options);
14825 Transform.call(this, options);
14828 PassThrough.prototype._transform = function (chunk, encoding, cb) {
14831 },{"./_stream_transform":74,"core-util-is":44,"inherits":56}],73:[function(require,module,exports){
14832 (function (process,global){
14833 // Copyright Joyent, Inc. and other Node contributors.
14835 // Permission is hereby granted, free of charge, to any person obtaining a
14836 // copy of this software and associated documentation files (the
14837 // "Software"), to deal in the Software without restriction, including
14838 // without limitation the rights to use, copy, modify, merge, publish,
14839 // distribute, sublicense, and/or sell copies of the Software, and to permit
14840 // persons to whom the Software is furnished to do so, subject to the
14841 // following conditions:
14843 // The above copyright notice and this permission notice shall be included
14844 // in all copies or substantial portions of the Software.
14846 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14847 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14848 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
14849 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
14850 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
14851 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
14852 // USE OR OTHER DEALINGS IN THE SOFTWARE.
14858 var pna = require('process-nextick-args');
14861 module.exports = Readable;
14864 var isArray = require('isarray');
14871 Readable.ReadableState = ReadableState;
14874 var EE = require('events').EventEmitter;
14876 var EElistenerCount = function (emitter, type) {
14877 return emitter.listeners(type).length;
14882 var Stream = require('./internal/streams/stream');
14887 var Buffer = require('safe-buffer').Buffer;
14888 var OurUint8Array = global.Uint8Array || function () {};
14889 function _uint8ArrayToBuffer(chunk) {
14890 return Buffer.from(chunk);
14892 function _isUint8Array(obj) {
14893 return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
14899 var util = require('core-util-is');
14900 util.inherits = require('inherits');
14904 var debugUtil = require('util');
14905 var debug = void 0;
14906 if (debugUtil && debugUtil.debuglog) {
14907 debug = debugUtil.debuglog('stream');
14909 debug = function () {};
14913 var BufferList = require('./internal/streams/BufferList');
14914 var destroyImpl = require('./internal/streams/destroy');
14917 util.inherits(Readable, Stream);
14919 var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];
14921 function prependListener(emitter, event, fn) {
14922 // Sadly this is not cacheable as some libraries bundle their own
14923 // event emitter implementation with them.
14924 if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn);
14926 // This is a hack to make sure that our error handler is attached before any
14927 // userland ones. NEVER DO THIS. This is here only because this code needs
14928 // to continue to work with older versions of Node.js that do not include
14929 // the prependListener() method. The goal is to eventually remove this hack.
14930 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]];
14933 function ReadableState(options, stream) {
14934 Duplex = Duplex || require('./_stream_duplex');
14936 options = options || {};
14938 // Duplex streams are both readable and writable, but share
14939 // the same options object.
14940 // However, some cases require setting options to different
14941 // values for the readable and the writable sides of the duplex stream.
14942 // These options can be provided separately as readableXXX and writableXXX.
14943 var isDuplex = stream instanceof Duplex;
14945 // object stream flag. Used to make read(n) ignore n and to
14946 // make all the buffer merging and length checks go away
14947 this.objectMode = !!options.objectMode;
14949 if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
14951 // the point at which it stops calling _read() to fill the buffer
14952 // Note: 0 is a valid value, means "don't call _read preemptively ever"
14953 var hwm = options.highWaterMark;
14954 var readableHwm = options.readableHighWaterMark;
14955 var defaultHwm = this.objectMode ? 16 : 16 * 1024;
14957 if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm;
14960 this.highWaterMark = Math.floor(this.highWaterMark);
14962 // A linked list is used to store data chunks instead of an array because the
14963 // linked list can remove elements from the beginning faster than
14965 this.buffer = new BufferList();
14968 this.pipesCount = 0;
14969 this.flowing = null;
14970 this.ended = false;
14971 this.endEmitted = false;
14972 this.reading = false;
14974 // a flag to be able to tell if the event 'readable'/'data' is emitted
14975 // immediately, or on a later tick. We set this to true at first, because
14976 // any actions that shouldn't happen until "later" should generally also
14977 // not happen before the first read call.
14980 // whenever we return null, then we set a flag to say
14981 // that we're awaiting a 'readable' event emission.
14982 this.needReadable = false;
14983 this.emittedReadable = false;
14984 this.readableListening = false;
14985 this.resumeScheduled = false;
14987 // has it been destroyed
14988 this.destroyed = false;
14990 // Crypto is kind of old and crusty. Historically, its default string
14991 // encoding is 'binary' so we have to make this configurable.
14992 // Everything else in the universe uses 'utf8', though.
14993 this.defaultEncoding = options.defaultEncoding || 'utf8';
14995 // the number of writers that are awaiting a drain event in .pipe()s
14996 this.awaitDrain = 0;
14998 // if true, a maybeReadMore has been scheduled
14999 this.readingMore = false;
15001 this.decoder = null;
15002 this.encoding = null;
15003 if (options.encoding) {
15004 if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
15005 this.decoder = new StringDecoder(options.encoding);
15006 this.encoding = options.encoding;
15010 function Readable(options) {
15011 Duplex = Duplex || require('./_stream_duplex');
15013 if (!(this instanceof Readable)) return new Readable(options);
15015 this._readableState = new ReadableState(options, this);
15018 this.readable = true;
15021 if (typeof options.read === 'function') this._read = options.read;
15023 if (typeof options.destroy === 'function') this._destroy = options.destroy;
15029 Object.defineProperty(Readable.prototype, 'destroyed', {
15031 if (this._readableState === undefined) {
15034 return this._readableState.destroyed;
15036 set: function (value) {
15037 // we ignore the value if the stream
15038 // has not been initialized yet
15039 if (!this._readableState) {
15043 // backward compatibility, the user is explicitly
15044 // managing destroyed
15045 this._readableState.destroyed = value;
15049 Readable.prototype.destroy = destroyImpl.destroy;
15050 Readable.prototype._undestroy = destroyImpl.undestroy;
15051 Readable.prototype._destroy = function (err, cb) {
15056 // Manually shove something into the read() buffer.
15057 // This returns true if the highWaterMark has not been hit yet,
15058 // similar to how Writable.write() returns true if you should
15059 // write() some more.
15060 Readable.prototype.push = function (chunk, encoding) {
15061 var state = this._readableState;
15062 var skipChunkCheck;
15064 if (!state.objectMode) {
15065 if (typeof chunk === 'string') {
15066 encoding = encoding || state.defaultEncoding;
15067 if (encoding !== state.encoding) {
15068 chunk = Buffer.from(chunk, encoding);
15071 skipChunkCheck = true;
15074 skipChunkCheck = true;
15077 return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
15080 // Unshift should *always* be something directly out of read()
15081 Readable.prototype.unshift = function (chunk) {
15082 return readableAddChunk(this, chunk, null, true, false);
15085 function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
15086 var state = stream._readableState;
15087 if (chunk === null) {
15088 state.reading = false;
15089 onEofChunk(stream, state);
15092 if (!skipChunkCheck) er = chunkInvalid(state, chunk);
15094 stream.emit('error', er);
15095 } else if (state.objectMode || chunk && chunk.length > 0) {
15096 if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {
15097 chunk = _uint8ArrayToBuffer(chunk);
15101 if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true);
15102 } else if (state.ended) {
15103 stream.emit('error', new Error('stream.push() after EOF'));
15105 state.reading = false;
15106 if (state.decoder && !encoding) {
15107 chunk = state.decoder.write(chunk);
15108 if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);
15110 addChunk(stream, state, chunk, false);
15113 } else if (!addToFront) {
15114 state.reading = false;
15118 return needMoreData(state);
15121 function addChunk(stream, state, chunk, addToFront) {
15122 if (state.flowing && state.length === 0 && !state.sync) {
15123 stream.emit('data', chunk);
15126 // update the buffer info.
15127 state.length += state.objectMode ? 1 : chunk.length;
15128 if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);
15130 if (state.needReadable) emitReadable(stream);
15132 maybeReadMore(stream, state);
15135 function chunkInvalid(state, chunk) {
15137 if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
15138 er = new TypeError('Invalid non-string/buffer chunk');
15143 // if it's past the high water mark, we can push in some more.
15144 // Also, if we have no data yet, we can stand some
15145 // more bytes. This is to work around cases where hwm=0,
15146 // such as the repl. Also, if the push() triggered a
15147 // readable event, and the user called read(largeNumber) such that
15148 // needReadable was set, then we ought to push more, so that another
15149 // 'readable' event will be triggered.
15150 function needMoreData(state) {
15151 return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
15154 Readable.prototype.isPaused = function () {
15155 return this._readableState.flowing === false;
15158 // backwards compatibility.
15159 Readable.prototype.setEncoding = function (enc) {
15160 if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
15161 this._readableState.decoder = new StringDecoder(enc);
15162 this._readableState.encoding = enc;
15166 // Don't raise the hwm > 8MB
15167 var MAX_HWM = 0x800000;
15168 function computeNewHighWaterMark(n) {
15169 if (n >= MAX_HWM) {
15172 // Get the next highest power of 2 to prevent increasing hwm excessively in
15185 // This function is designed to be inlinable, so please take care when making
15186 // changes to the function body.
15187 function howMuchToRead(n, state) {
15188 if (n <= 0 || state.length === 0 && state.ended) return 0;
15189 if (state.objectMode) return 1;
15191 // Only flow one buffer at a time
15192 if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
15194 // If we're asking for more than the current hwm, then raise the hwm.
15195 if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
15196 if (n <= state.length) return n;
15197 // Don't have enough
15198 if (!state.ended) {
15199 state.needReadable = true;
15202 return state.length;
15205 // you can override either this method, or the async _read(n) below.
15206 Readable.prototype.read = function (n) {
15208 n = parseInt(n, 10);
15209 var state = this._readableState;
15212 if (n !== 0) state.emittedReadable = false;
15214 // if we're doing read(0) to trigger a readable event, but we
15215 // already have a bunch of data in the buffer, then just trigger
15216 // the 'readable' event and move on.
15217 if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
15218 debug('read: emitReadable', state.length, state.ended);
15219 if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
15223 n = howMuchToRead(n, state);
15225 // if we've ended, and we're now clear, then finish it up.
15226 if (n === 0 && state.ended) {
15227 if (state.length === 0) endReadable(this);
15231 // All the actual chunk generation logic needs to be
15232 // *below* the call to _read. The reason is that in certain
15233 // synthetic stream cases, such as passthrough streams, _read
15234 // may be a completely synchronous operation which may change
15235 // the state of the read buffer, providing enough data when
15236 // before there was *not* enough.
15238 // So, the steps are:
15239 // 1. Figure out what the state of things will be after we do
15240 // a read from the buffer.
15242 // 2. If that resulting state will trigger a _read, then call _read.
15243 // Note that this may be asynchronous, or synchronous. Yes, it is
15244 // deeply ugly to write APIs this way, but that still doesn't mean
15245 // that the Readable class should behave improperly, as streams are
15246 // designed to be sync/async agnostic.
15247 // Take note if the _read call is sync or async (ie, if the read call
15248 // has returned yet), so that we know whether or not it's safe to emit
15251 // 3. Actually pull the requested chunks out of the buffer and return.
15253 // if we need a readable event, then we need to do some reading.
15254 var doRead = state.needReadable;
15255 debug('need readable', doRead);
15257 // if we currently have less than the highWaterMark, then also read some
15258 if (state.length === 0 || state.length - n < state.highWaterMark) {
15260 debug('length less than watermark', doRead);
15263 // however, if we've ended, then there's no point, and if we're already
15264 // reading, then it's unnecessary.
15265 if (state.ended || state.reading) {
15267 debug('reading or ended', doRead);
15268 } else if (doRead) {
15270 state.reading = true;
15272 // if the length is currently zero, then we *need* a readable event.
15273 if (state.length === 0) state.needReadable = true;
15274 // call internal read method
15275 this._read(state.highWaterMark);
15276 state.sync = false;
15277 // If _read pushed data synchronously, then `reading` will be false,
15278 // and we need to re-evaluate how much data we can return to the user.
15279 if (!state.reading) n = howMuchToRead(nOrig, state);
15283 if (n > 0) ret = fromList(n, state);else ret = null;
15285 if (ret === null) {
15286 state.needReadable = true;
15292 if (state.length === 0) {
15293 // If we have nothing in the buffer, then we want to know
15294 // as soon as we *do* get something into the buffer.
15295 if (!state.ended) state.needReadable = true;
15297 // If we tried to read() past the EOF, then emit end on the next tick.
15298 if (nOrig !== n && state.ended) endReadable(this);
15301 if (ret !== null) this.emit('data', ret);
15306 function onEofChunk(stream, state) {
15307 if (state.ended) return;
15308 if (state.decoder) {
15309 var chunk = state.decoder.end();
15310 if (chunk && chunk.length) {
15311 state.buffer.push(chunk);
15312 state.length += state.objectMode ? 1 : chunk.length;
15315 state.ended = true;
15317 // emit 'readable' now to make sure it gets picked up.
15318 emitReadable(stream);
15321 // Don't emit readable right away in sync mode, because this can trigger
15322 // another read() call => stack overflow. This way, it might trigger
15323 // a nextTick recursion warning, but that's not so bad.
15324 function emitReadable(stream) {
15325 var state = stream._readableState;
15326 state.needReadable = false;
15327 if (!state.emittedReadable) {
15328 debug('emitReadable', state.flowing);
15329 state.emittedReadable = true;
15330 if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream);
15334 function emitReadable_(stream) {
15335 debug('emit readable');
15336 stream.emit('readable');
15340 // at this point, the user has presumably seen the 'readable' event,
15341 // and called read() to consume some data. that may have triggered
15342 // in turn another _read(n) call, in which case reading = true if
15343 // it's in progress.
15344 // However, if we're not ended, or reading, and the length < hwm,
15345 // then go ahead and try to read some more preemptively.
15346 function maybeReadMore(stream, state) {
15347 if (!state.readingMore) {
15348 state.readingMore = true;
15349 pna.nextTick(maybeReadMore_, stream, state);
15353 function maybeReadMore_(stream, state) {
15354 var len = state.length;
15355 while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
15356 debug('maybeReadMore read 0');
15358 if (len === state.length)
15359 // didn't get any data, stop spinning.
15360 break;else len = state.length;
15362 state.readingMore = false;
15365 // abstract method. to be overridden in specific implementation classes.
15366 // call cb(er, data) where data is <= n in length.
15367 // for virtual (non-string, non-buffer) streams, "length" is somewhat
15368 // arbitrary, and perhaps not very meaningful.
15369 Readable.prototype._read = function (n) {
15370 this.emit('error', new Error('_read() is not implemented'));
15373 Readable.prototype.pipe = function (dest, pipeOpts) {
15375 var state = this._readableState;
15377 switch (state.pipesCount) {
15379 state.pipes = dest;
15382 state.pipes = [state.pipes, dest];
15385 state.pipes.push(dest);
15388 state.pipesCount += 1;
15389 debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
15391 var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
15393 var endFn = doEnd ? onend : unpipe;
15394 if (state.endEmitted) pna.nextTick(endFn);else src.once('end', endFn);
15396 dest.on('unpipe', onunpipe);
15397 function onunpipe(readable, unpipeInfo) {
15399 if (readable === src) {
15400 if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
15401 unpipeInfo.hasUnpiped = true;
15412 // when the dest drains, it reduces the awaitDrain counter
15413 // on the source. This would be more elegant with a .once()
15414 // handler in flow(), but adding and removing repeatedly is
15416 var ondrain = pipeOnDrain(src);
15417 dest.on('drain', ondrain);
15419 var cleanedUp = false;
15420 function cleanup() {
15422 // cleanup event handlers once the pipe is broken
15423 dest.removeListener('close', onclose);
15424 dest.removeListener('finish', onfinish);
15425 dest.removeListener('drain', ondrain);
15426 dest.removeListener('error', onerror);
15427 dest.removeListener('unpipe', onunpipe);
15428 src.removeListener('end', onend);
15429 src.removeListener('end', unpipe);
15430 src.removeListener('data', ondata);
15434 // if the reader is waiting for a drain event from this
15435 // specific writer, then it would cause it to never start
15437 // So, if this is awaiting a drain, then we just call it now.
15438 // If we don't know, then assume that we are waiting for one.
15439 if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
15442 // If the user pushes more data while we're writing to dest then we'll end up
15443 // in ondata again. However, we only want to increase awaitDrain once because
15444 // dest will only emit one 'drain' event for the multiple writes.
15445 // => Introduce a guard on increasing awaitDrain.
15446 var increasedAwaitDrain = false;
15447 src.on('data', ondata);
15448 function ondata(chunk) {
15450 increasedAwaitDrain = false;
15451 var ret = dest.write(chunk);
15452 if (false === ret && !increasedAwaitDrain) {
15453 // If the user unpiped during `dest.write()`, it is possible
15454 // to get stuck in a permanently paused state if that write
15455 // also returned false.
15456 // => Check whether `dest` is still a piping destination.
15457 if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
15458 debug('false write response, pause', src._readableState.awaitDrain);
15459 src._readableState.awaitDrain++;
15460 increasedAwaitDrain = true;
15466 // if the dest has an error, then stop piping into it.
15467 // however, don't suppress the throwing behavior for this.
15468 function onerror(er) {
15469 debug('onerror', er);
15471 dest.removeListener('error', onerror);
15472 if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);
15475 // Make sure our error handler is attached before userland ones.
15476 prependListener(dest, 'error', onerror);
15478 // Both close and finish should trigger unpipe, but only once.
15479 function onclose() {
15480 dest.removeListener('finish', onfinish);
15483 dest.once('close', onclose);
15484 function onfinish() {
15486 dest.removeListener('close', onclose);
15489 dest.once('finish', onfinish);
15491 function unpipe() {
15496 // tell the dest that it's being piped to
15497 dest.emit('pipe', src);
15499 // start the flow if it hasn't been started already.
15500 if (!state.flowing) {
15501 debug('pipe resume');
15508 function pipeOnDrain(src) {
15509 return function () {
15510 var state = src._readableState;
15511 debug('pipeOnDrain', state.awaitDrain);
15512 if (state.awaitDrain) state.awaitDrain--;
15513 if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
15514 state.flowing = true;
15520 Readable.prototype.unpipe = function (dest) {
15521 var state = this._readableState;
15522 var unpipeInfo = { hasUnpiped: false };
15524 // if we're not piping anywhere, then do nothing.
15525 if (state.pipesCount === 0) return this;
15527 // just one destination. most common case.
15528 if (state.pipesCount === 1) {
15529 // passed in one, but it's not the right one.
15530 if (dest && dest !== state.pipes) return this;
15532 if (!dest) dest = state.pipes;
15535 state.pipes = null;
15536 state.pipesCount = 0;
15537 state.flowing = false;
15538 if (dest) dest.emit('unpipe', this, unpipeInfo);
15542 // slow case. multiple pipe destinations.
15546 var dests = state.pipes;
15547 var len = state.pipesCount;
15548 state.pipes = null;
15549 state.pipesCount = 0;
15550 state.flowing = false;
15552 for (var i = 0; i < len; i++) {
15553 dests[i].emit('unpipe', this, unpipeInfo);
15557 // try to find the right one.
15558 var index = indexOf(state.pipes, dest);
15559 if (index === -1) return this;
15561 state.pipes.splice(index, 1);
15562 state.pipesCount -= 1;
15563 if (state.pipesCount === 1) state.pipes = state.pipes[0];
15565 dest.emit('unpipe', this, unpipeInfo);
15570 // set up data events if they are asked for
15571 // Ensure readable listeners eventually get something
15572 Readable.prototype.on = function (ev, fn) {
15573 var res = Stream.prototype.on.call(this, ev, fn);
15575 if (ev === 'data') {
15576 // Start flowing on next tick if stream isn't explicitly paused
15577 if (this._readableState.flowing !== false) this.resume();
15578 } else if (ev === 'readable') {
15579 var state = this._readableState;
15580 if (!state.endEmitted && !state.readableListening) {
15581 state.readableListening = state.needReadable = true;
15582 state.emittedReadable = false;
15583 if (!state.reading) {
15584 pna.nextTick(nReadingNextTick, this);
15585 } else if (state.length) {
15586 emitReadable(this);
15593 Readable.prototype.addListener = Readable.prototype.on;
15595 function nReadingNextTick(self) {
15596 debug('readable nexttick read 0');
15600 // pause() and resume() are remnants of the legacy readable stream API
15601 // If the user uses them, then switch into old mode.
15602 Readable.prototype.resume = function () {
15603 var state = this._readableState;
15604 if (!state.flowing) {
15606 state.flowing = true;
15607 resume(this, state);
15612 function resume(stream, state) {
15613 if (!state.resumeScheduled) {
15614 state.resumeScheduled = true;
15615 pna.nextTick(resume_, stream, state);
15619 function resume_(stream, state) {
15620 if (!state.reading) {
15621 debug('resume read 0');
15625 state.resumeScheduled = false;
15626 state.awaitDrain = 0;
15627 stream.emit('resume');
15629 if (state.flowing && !state.reading) stream.read(0);
15632 Readable.prototype.pause = function () {
15633 debug('call pause flowing=%j', this._readableState.flowing);
15634 if (false !== this._readableState.flowing) {
15636 this._readableState.flowing = false;
15637 this.emit('pause');
15642 function flow(stream) {
15643 var state = stream._readableState;
15644 debug('flow', state.flowing);
15645 while (state.flowing && stream.read() !== null) {}
15648 // wrap an old-style stream as the async data source.
15649 // This is *not* part of the readable stream interface.
15650 // It is an ugly unfortunate mess of history.
15651 Readable.prototype.wrap = function (stream) {
15654 var state = this._readableState;
15655 var paused = false;
15657 stream.on('end', function () {
15658 debug('wrapped end');
15659 if (state.decoder && !state.ended) {
15660 var chunk = state.decoder.end();
15661 if (chunk && chunk.length) _this.push(chunk);
15667 stream.on('data', function (chunk) {
15668 debug('wrapped data');
15669 if (state.decoder) chunk = state.decoder.write(chunk);
15671 // don't skip over falsy values in objectMode
15672 if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
15674 var ret = _this.push(chunk);
15681 // proxy all the other methods.
15682 // important when wrapping filters and duplexes.
15683 for (var i in stream) {
15684 if (this[i] === undefined && typeof stream[i] === 'function') {
15685 this[i] = function (method) {
15686 return function () {
15687 return stream[method].apply(stream, arguments);
15693 // proxy certain important events.
15694 for (var n = 0; n < kProxyEvents.length; n++) {
15695 stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
15698 // when we try to consume some more bytes, simply unpause the
15699 // underlying stream.
15700 this._read = function (n) {
15701 debug('wrapped _read', n);
15711 Object.defineProperty(Readable.prototype, 'readableHighWaterMark', {
15712 // making it explicit this property is not enumerable
15713 // because otherwise some prototype manipulation in
15714 // userland will fail
15717 return this._readableState.highWaterMark;
15721 // exposed for testing purposes only.
15722 Readable._fromList = fromList;
15724 // Pluck off n bytes from an array of buffers.
15725 // Length is the combined lengths of all the buffers in the list.
15726 // This function is designed to be inlinable, so please take care when making
15727 // changes to the function body.
15728 function fromList(n, state) {
15729 // nothing buffered
15730 if (state.length === 0) return null;
15733 if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
15734 // read it all, truncate the list
15735 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);
15736 state.buffer.clear();
15738 // read part of list
15739 ret = fromListPartial(n, state.buffer, state.decoder);
15745 // Extracts only enough buffered data to satisfy the amount requested.
15746 // This function is designed to be inlinable, so please take care when making
15747 // changes to the function body.
15748 function fromListPartial(n, list, hasStrings) {
15750 if (n < list.head.data.length) {
15751 // slice is the same for buffers and strings
15752 ret = list.head.data.slice(0, n);
15753 list.head.data = list.head.data.slice(n);
15754 } else if (n === list.head.data.length) {
15755 // first chunk is a perfect match
15756 ret = list.shift();
15758 // result spans more than one buffer
15759 ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
15764 // Copies a specified amount of characters from the list of buffered data
15766 // This function is designed to be inlinable, so please take care when making
15767 // changes to the function body.
15768 function copyFromBufferString(n, list) {
15773 while (p = p.next) {
15775 var nb = n > str.length ? str.length : n;
15776 if (nb === str.length) ret += str;else ret += str.slice(0, n);
15779 if (nb === str.length) {
15781 if (p.next) list.head = p.next;else list.head = list.tail = null;
15784 p.data = str.slice(nb);
15794 // Copies a specified amount of bytes from the list of buffered data chunks.
15795 // This function is designed to be inlinable, so please take care when making
15796 // changes to the function body.
15797 function copyFromBuffer(n, list) {
15798 var ret = Buffer.allocUnsafe(n);
15802 n -= p.data.length;
15803 while (p = p.next) {
15805 var nb = n > buf.length ? buf.length : n;
15806 buf.copy(ret, ret.length - n, 0, nb);
15809 if (nb === buf.length) {
15811 if (p.next) list.head = p.next;else list.head = list.tail = null;
15814 p.data = buf.slice(nb);
15824 function endReadable(stream) {
15825 var state = stream._readableState;
15827 // If we get here before consuming all the bytes, then that is a
15828 // bug in node. Should never happen.
15829 if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream');
15831 if (!state.endEmitted) {
15832 state.ended = true;
15833 pna.nextTick(endReadableNT, state, stream);
15837 function endReadableNT(state, stream) {
15838 // Check that we didn't get one last unshift.
15839 if (!state.endEmitted && state.length === 0) {
15840 state.endEmitted = true;
15841 stream.readable = false;
15842 stream.emit('end');
15846 function indexOf(xs, x) {
15847 for (var i = 0, l = xs.length; i < l; i++) {
15848 if (xs[i] === x) return i;
15852 }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
15853 },{"./_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){
15854 // Copyright Joyent, Inc. and other Node contributors.
15856 // Permission is hereby granted, free of charge, to any person obtaining a
15857 // copy of this software and associated documentation files (the
15858 // "Software"), to deal in the Software without restriction, including
15859 // without limitation the rights to use, copy, modify, merge, publish,
15860 // distribute, sublicense, and/or sell copies of the Software, and to permit
15861 // persons to whom the Software is furnished to do so, subject to the
15862 // following conditions:
15864 // The above copyright notice and this permission notice shall be included
15865 // in all copies or substantial portions of the Software.
15867 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15868 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
15869 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
15870 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
15871 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
15872 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
15873 // USE OR OTHER DEALINGS IN THE SOFTWARE.
15875 // a transform stream is a readable/writable stream where you do
15876 // something with the data. Sometimes it's called a "filter",
15877 // but that's not a great name for it, since that implies a thing where
15878 // some bits pass through, and others are simply ignored. (That would
15879 // be a valid example of a transform, of course.)
15881 // While the output is causally related to the input, it's not a
15882 // necessarily symmetric or synchronous transformation. For example,
15883 // a zlib stream might take multiple plain-text writes(), and then
15884 // emit a single compressed chunk some time in the future.
15886 // Here's how this works:
15888 // The Transform stream has all the aspects of the readable and writable
15889 // stream classes. When you write(chunk), that calls _write(chunk,cb)
15890 // internally, and returns false if there's a lot of pending writes
15891 // buffered up. When you call read(), that calls _read(n) until
15892 // there's enough pending readable data buffered up.
15894 // In a transform stream, the written data is placed in a buffer. When
15895 // _read(n) is called, it transforms the queued up data, calling the
15896 // buffered _write cb's as it consumes chunks. If consuming a single
15897 // written chunk would result in multiple output chunks, then the first
15898 // outputted bit calls the readcb, and subsequent chunks just go into
15899 // the read buffer, and will cause it to emit 'readable' if necessary.
15901 // This way, back-pressure is actually determined by the reading side,
15902 // since _read has to be called to start processing a new chunk. However,
15903 // a pathological inflate type of transform can cause excessive buffering
15904 // here. For example, imagine a stream where every byte of input is
15905 // interpreted as an integer from 0-255, and then results in that many
15906 // bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in
15907 // 1kb of data being output. In this case, you could write a very small
15908 // amount of input, and end up with a very large amount of output. In
15909 // such a pathological inflating mechanism, there'd be no way to tell
15910 // the system to stop doing the transform. A single 4MB write could
15911 // cause the system to run out of memory.
15913 // However, even in such a pathological case, only a single written chunk
15914 // would be consumed, and then the rest would wait (un-transformed) until
15915 // the results of the previous transformed chunk were consumed.
15919 module.exports = Transform;
15921 var Duplex = require('./_stream_duplex');
15924 var util = require('core-util-is');
15925 util.inherits = require('inherits');
15928 util.inherits(Transform, Duplex);
15930 function afterTransform(er, data) {
15931 var ts = this._transformState;
15932 ts.transforming = false;
15934 var cb = ts.writecb;
15937 return this.emit('error', new Error('write callback called multiple times'));
15940 ts.writechunk = null;
15943 if (data != null) // single equals check for both `null` and `undefined`
15948 var rs = this._readableState;
15949 rs.reading = false;
15950 if (rs.needReadable || rs.length < rs.highWaterMark) {
15951 this._read(rs.highWaterMark);
15955 function Transform(options) {
15956 if (!(this instanceof Transform)) return new Transform(options);
15958 Duplex.call(this, options);
15960 this._transformState = {
15961 afterTransform: afterTransform.bind(this),
15962 needTransform: false,
15963 transforming: false,
15966 writeencoding: null
15969 // start out asking for a readable event once data is transformed.
15970 this._readableState.needReadable = true;
15972 // we have implemented the _read method, and done the other things
15973 // that Readable wants before the first _read call, so unset the
15974 // sync guard flag.
15975 this._readableState.sync = false;
15978 if (typeof options.transform === 'function') this._transform = options.transform;
15980 if (typeof options.flush === 'function') this._flush = options.flush;
15983 // When the writable side finishes, then flush out anything remaining.
15984 this.on('prefinish', prefinish);
15987 function prefinish() {
15990 if (typeof this._flush === 'function') {
15991 this._flush(function (er, data) {
15992 done(_this, er, data);
15995 done(this, null, null);
15999 Transform.prototype.push = function (chunk, encoding) {
16000 this._transformState.needTransform = false;
16001 return Duplex.prototype.push.call(this, chunk, encoding);
16004 // This is the part where you do stuff!
16005 // override this function in implementation classes.
16006 // 'chunk' is an input chunk.
16008 // Call `push(newChunk)` to pass along transformed output
16009 // to the readable side. You may call 'push' zero or more times.
16011 // Call `cb(err)` when you are done with this chunk. If you pass
16012 // an error, then that'll put the hurt on the whole operation. If you
16013 // never call cb(), then you'll never get another chunk.
16014 Transform.prototype._transform = function (chunk, encoding, cb) {
16015 throw new Error('_transform() is not implemented');
16018 Transform.prototype._write = function (chunk, encoding, cb) {
16019 var ts = this._transformState;
16021 ts.writechunk = chunk;
16022 ts.writeencoding = encoding;
16023 if (!ts.transforming) {
16024 var rs = this._readableState;
16025 if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
16029 // Doesn't matter what the args are here.
16030 // _transform does all the work.
16031 // That we got here means that the readable side wants more data.
16032 Transform.prototype._read = function (n) {
16033 var ts = this._transformState;
16035 if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
16036 ts.transforming = true;
16037 this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
16039 // mark that we need a transform, so that any data that comes in
16040 // will get processed, now that we've asked for it.
16041 ts.needTransform = true;
16045 Transform.prototype._destroy = function (err, cb) {
16048 Duplex.prototype._destroy.call(this, err, function (err2) {
16050 _this2.emit('close');
16054 function done(stream, er, data) {
16055 if (er) return stream.emit('error', er);
16057 if (data != null) // single equals check for both `null` and `undefined`
16060 // if there's nothing in the write buffer, then that means
16061 // that nothing more will ever be provided
16062 if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0');
16064 if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming');
16066 return stream.push(null);
16068 },{"./_stream_duplex":71,"core-util-is":44,"inherits":56}],75:[function(require,module,exports){
16069 (function (process,global,setImmediate){
16070 // Copyright Joyent, Inc. and other Node contributors.
16072 // Permission is hereby granted, free of charge, to any person obtaining a
16073 // copy of this software and associated documentation files (the
16074 // "Software"), to deal in the Software without restriction, including
16075 // without limitation the rights to use, copy, modify, merge, publish,
16076 // distribute, sublicense, and/or sell copies of the Software, and to permit
16077 // persons to whom the Software is furnished to do so, subject to the
16078 // following conditions:
16080 // The above copyright notice and this permission notice shall be included
16081 // in all copies or substantial portions of the Software.
16083 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16084 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16085 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
16086 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
16087 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
16088 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
16089 // USE OR OTHER DEALINGS IN THE SOFTWARE.
16091 // A bit simpler than readable streams.
16092 // Implement an async ._write(chunk, encoding, cb), and it'll handle all
16093 // the drain event emission and buffering.
16099 var pna = require('process-nextick-args');
16102 module.exports = Writable;
16104 /* <replacement> */
16105 function WriteReq(chunk, encoding, cb) {
16106 this.chunk = chunk;
16107 this.encoding = encoding;
16108 this.callback = cb;
16112 // It seems a linked list but it is not
16113 // there will be only 2 of these for each stream
16114 function CorkedRequest(state) {
16119 this.finish = function () {
16120 onCorkedFinish(_this, state);
16123 /* </replacement> */
16126 var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick;
16133 Writable.WritableState = WritableState;
16136 var util = require('core-util-is');
16137 util.inherits = require('inherits');
16141 var internalUtil = {
16142 deprecate: require('util-deprecate')
16147 var Stream = require('./internal/streams/stream');
16152 var Buffer = require('safe-buffer').Buffer;
16153 var OurUint8Array = global.Uint8Array || function () {};
16154 function _uint8ArrayToBuffer(chunk) {
16155 return Buffer.from(chunk);
16157 function _isUint8Array(obj) {
16158 return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
16163 var destroyImpl = require('./internal/streams/destroy');
16165 util.inherits(Writable, Stream);
16169 function WritableState(options, stream) {
16170 Duplex = Duplex || require('./_stream_duplex');
16172 options = options || {};
16174 // Duplex streams are both readable and writable, but share
16175 // the same options object.
16176 // However, some cases require setting options to different
16177 // values for the readable and the writable sides of the duplex stream.
16178 // These options can be provided separately as readableXXX and writableXXX.
16179 var isDuplex = stream instanceof Duplex;
16181 // object stream flag to indicate whether or not this stream
16182 // contains buffers or objects.
16183 this.objectMode = !!options.objectMode;
16185 if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
16187 // the point at which write() starts returning false
16188 // Note: 0 is a valid value, means that we always return false if
16189 // the entire buffer is not flushed immediately on write()
16190 var hwm = options.highWaterMark;
16191 var writableHwm = options.writableHighWaterMark;
16192 var defaultHwm = this.objectMode ? 16 : 16 * 1024;
16194 if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm;
16197 this.highWaterMark = Math.floor(this.highWaterMark);
16199 // if _final has been called
16200 this.finalCalled = false;
16202 // drain event flag.
16203 this.needDrain = false;
16204 // at the start of calling end()
16205 this.ending = false;
16206 // when end() has been called, and returned
16207 this.ended = false;
16208 // when 'finish' is emitted
16209 this.finished = false;
16211 // has it been destroyed
16212 this.destroyed = false;
16214 // should we decode strings into buffers before passing to _write?
16215 // this is here so that some node-core streams can optimize string
16216 // handling at a lower level.
16217 var noDecode = options.decodeStrings === false;
16218 this.decodeStrings = !noDecode;
16220 // Crypto is kind of old and crusty. Historically, its default string
16221 // encoding is 'binary' so we have to make this configurable.
16222 // Everything else in the universe uses 'utf8', though.
16223 this.defaultEncoding = options.defaultEncoding || 'utf8';
16225 // not an actual buffer we keep track of, but a measurement
16226 // of how much we're waiting to get pushed to some underlying
16230 // a flag to see when we're in the middle of a write.
16231 this.writing = false;
16233 // when true all writes will be buffered until .uncork() call
16236 // a flag to be able to tell if the onwrite cb is called immediately,
16237 // or on a later tick. We set this to true at first, because any
16238 // actions that shouldn't happen until "later" should generally also
16239 // not happen before the first write call.
16242 // a flag to know if we're processing previously buffered items, which
16243 // may call the _write() callback in the same tick, so that we don't
16244 // end up in an overlapped onwrite situation.
16245 this.bufferProcessing = false;
16247 // the callback that's passed to _write(chunk,cb)
16248 this.onwrite = function (er) {
16249 onwrite(stream, er);
16252 // the callback that the user supplies to write(chunk,encoding,cb)
16253 this.writecb = null;
16255 // the amount that is being written when _write is called.
16258 this.bufferedRequest = null;
16259 this.lastBufferedRequest = null;
16261 // number of pending user-supplied write callbacks
16262 // this must be 0 before 'finish' can be emitted
16263 this.pendingcb = 0;
16265 // emit prefinish if the only thing we're waiting for is _write cbs
16266 // This is relevant for synchronous Transform streams
16267 this.prefinished = false;
16269 // True if the error was already emitted and should not be thrown again
16270 this.errorEmitted = false;
16272 // count buffered requests
16273 this.bufferedRequestCount = 0;
16275 // allocate the first CorkedRequest, there is always
16276 // one allocated and free to use, and we maintain at most two
16277 this.corkedRequestsFree = new CorkedRequest(this);
16280 WritableState.prototype.getBuffer = function getBuffer() {
16281 var current = this.bufferedRequest;
16285 current = current.next;
16292 Object.defineProperty(WritableState.prototype, 'buffer', {
16293 get: internalUtil.deprecate(function () {
16294 return this.getBuffer();
16295 }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')
16300 // Test _writableState for inheritance to account for Duplex streams,
16301 // whose prototype chain only points to Readable.
16302 var realHasInstance;
16303 if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {
16304 realHasInstance = Function.prototype[Symbol.hasInstance];
16305 Object.defineProperty(Writable, Symbol.hasInstance, {
16306 value: function (object) {
16307 if (realHasInstance.call(this, object)) return true;
16308 if (this !== Writable) return false;
16310 return object && object._writableState instanceof WritableState;
16314 realHasInstance = function (object) {
16315 return object instanceof this;
16319 function Writable(options) {
16320 Duplex = Duplex || require('./_stream_duplex');
16322 // Writable ctor is applied to Duplexes, too.
16323 // `realHasInstance` is necessary because using plain `instanceof`
16324 // would return false, as no `_writableState` property is attached.
16326 // Trying to use the custom `instanceof` for Writable here will also break the
16327 // Node.js LazyTransform implementation, which has a non-trivial getter for
16328 // `_writableState` that would lead to infinite recursion.
16329 if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
16330 return new Writable(options);
16333 this._writableState = new WritableState(options, this);
16336 this.writable = true;
16339 if (typeof options.write === 'function') this._write = options.write;
16341 if (typeof options.writev === 'function') this._writev = options.writev;
16343 if (typeof options.destroy === 'function') this._destroy = options.destroy;
16345 if (typeof options.final === 'function') this._final = options.final;
16351 // Otherwise people can pipe Writable streams, which is just wrong.
16352 Writable.prototype.pipe = function () {
16353 this.emit('error', new Error('Cannot pipe, not readable'));
16356 function writeAfterEnd(stream, cb) {
16357 var er = new Error('write after end');
16358 // TODO: defer error events consistently everywhere, not just the cb
16359 stream.emit('error', er);
16360 pna.nextTick(cb, er);
16363 // Checks that a user-supplied chunk is valid, especially for the particular
16364 // mode the stream is in. Currently this means that `null` is never accepted
16365 // and undefined/non-string values are only allowed in object mode.
16366 function validChunk(stream, state, chunk, cb) {
16370 if (chunk === null) {
16371 er = new TypeError('May not write null values to stream');
16372 } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
16373 er = new TypeError('Invalid non-string/buffer chunk');
16376 stream.emit('error', er);
16377 pna.nextTick(cb, er);
16383 Writable.prototype.write = function (chunk, encoding, cb) {
16384 var state = this._writableState;
16386 var isBuf = !state.objectMode && _isUint8Array(chunk);
16388 if (isBuf && !Buffer.isBuffer(chunk)) {
16389 chunk = _uint8ArrayToBuffer(chunk);
16392 if (typeof encoding === 'function') {
16397 if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
16399 if (typeof cb !== 'function') cb = nop;
16401 if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {
16403 ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
16409 Writable.prototype.cork = function () {
16410 var state = this._writableState;
16415 Writable.prototype.uncork = function () {
16416 var state = this._writableState;
16418 if (state.corked) {
16421 if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
16425 Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
16426 // node::ParseEncoding() requires lower case.
16427 if (typeof encoding === 'string') encoding = encoding.toLowerCase();
16428 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);
16429 this._writableState.defaultEncoding = encoding;
16433 function decodeChunk(state, chunk, encoding) {
16434 if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
16435 chunk = Buffer.from(chunk, encoding);
16440 Object.defineProperty(Writable.prototype, 'writableHighWaterMark', {
16441 // making it explicit this property is not enumerable
16442 // because otherwise some prototype manipulation in
16443 // userland will fail
16446 return this._writableState.highWaterMark;
16450 // if we're already writing something, then just put this
16451 // in the queue, and wait our turn. Otherwise, call _write
16452 // If we return false, then we need a drain event, so set that flag.
16453 function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
16455 var newChunk = decodeChunk(state, chunk, encoding);
16456 if (chunk !== newChunk) {
16458 encoding = 'buffer';
16462 var len = state.objectMode ? 1 : chunk.length;
16464 state.length += len;
16466 var ret = state.length < state.highWaterMark;
16467 // we must ensure that previous needDrain will not be reset to false.
16468 if (!ret) state.needDrain = true;
16470 if (state.writing || state.corked) {
16471 var last = state.lastBufferedRequest;
16472 state.lastBufferedRequest = {
16474 encoding: encoding,
16480 last.next = state.lastBufferedRequest;
16482 state.bufferedRequest = state.lastBufferedRequest;
16484 state.bufferedRequestCount += 1;
16486 doWrite(stream, state, false, len, chunk, encoding, cb);
16492 function doWrite(stream, state, writev, len, chunk, encoding, cb) {
16493 state.writelen = len;
16494 state.writecb = cb;
16495 state.writing = true;
16497 if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
16498 state.sync = false;
16501 function onwriteError(stream, state, sync, er, cb) {
16505 // defer the callback if we are being called synchronously
16506 // to avoid piling up things on the stack
16507 pna.nextTick(cb, er);
16508 // this can emit finish, and it will always happen
16510 pna.nextTick(finishMaybe, stream, state);
16511 stream._writableState.errorEmitted = true;
16512 stream.emit('error', er);
16514 // the caller expect this to happen before if
16517 stream._writableState.errorEmitted = true;
16518 stream.emit('error', er);
16519 // this can emit finish, but finish must
16520 // always follow error
16521 finishMaybe(stream, state);
16525 function onwriteStateUpdate(state) {
16526 state.writing = false;
16527 state.writecb = null;
16528 state.length -= state.writelen;
16529 state.writelen = 0;
16532 function onwrite(stream, er) {
16533 var state = stream._writableState;
16534 var sync = state.sync;
16535 var cb = state.writecb;
16537 onwriteStateUpdate(state);
16539 if (er) onwriteError(stream, state, sync, er, cb);else {
16540 // Check if we're actually ready to finish, but don't emit yet
16541 var finished = needFinish(state);
16543 if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
16544 clearBuffer(stream, state);
16549 asyncWrite(afterWrite, stream, state, finished, cb);
16552 afterWrite(stream, state, finished, cb);
16557 function afterWrite(stream, state, finished, cb) {
16558 if (!finished) onwriteDrain(stream, state);
16561 finishMaybe(stream, state);
16564 // Must force callback to be called on nextTick, so that we don't
16565 // emit 'drain' before the write() consumer gets the 'false' return
16566 // value, and has a chance to attach a 'drain' listener.
16567 function onwriteDrain(stream, state) {
16568 if (state.length === 0 && state.needDrain) {
16569 state.needDrain = false;
16570 stream.emit('drain');
16574 // if there's something in the buffer waiting, then process it
16575 function clearBuffer(stream, state) {
16576 state.bufferProcessing = true;
16577 var entry = state.bufferedRequest;
16579 if (stream._writev && entry && entry.next) {
16580 // Fast case, write everything using _writev()
16581 var l = state.bufferedRequestCount;
16582 var buffer = new Array(l);
16583 var holder = state.corkedRequestsFree;
16584 holder.entry = entry;
16587 var allBuffers = true;
16589 buffer[count] = entry;
16590 if (!entry.isBuf) allBuffers = false;
16591 entry = entry.next;
16594 buffer.allBuffers = allBuffers;
16596 doWrite(stream, state, true, state.length, buffer, '', holder.finish);
16598 // doWrite is almost always async, defer these to save a bit of time
16599 // as the hot path ends with doWrite
16601 state.lastBufferedRequest = null;
16603 state.corkedRequestsFree = holder.next;
16604 holder.next = null;
16606 state.corkedRequestsFree = new CorkedRequest(state);
16608 state.bufferedRequestCount = 0;
16610 // Slow case, write chunks one-by-one
16612 var chunk = entry.chunk;
16613 var encoding = entry.encoding;
16614 var cb = entry.callback;
16615 var len = state.objectMode ? 1 : chunk.length;
16617 doWrite(stream, state, false, len, chunk, encoding, cb);
16618 entry = entry.next;
16619 state.bufferedRequestCount--;
16620 // if we didn't call the onwrite immediately, then
16621 // it means that we need to wait until it does.
16622 // also, that means that the chunk and cb are currently
16623 // being processed, so move the buffer counter past them.
16624 if (state.writing) {
16629 if (entry === null) state.lastBufferedRequest = null;
16632 state.bufferedRequest = entry;
16633 state.bufferProcessing = false;
16636 Writable.prototype._write = function (chunk, encoding, cb) {
16637 cb(new Error('_write() is not implemented'));
16640 Writable.prototype._writev = null;
16642 Writable.prototype.end = function (chunk, encoding, cb) {
16643 var state = this._writableState;
16645 if (typeof chunk === 'function') {
16649 } else if (typeof encoding === 'function') {
16654 if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
16656 // .end() fully uncorks
16657 if (state.corked) {
16662 // ignore unnecessary end() calls.
16663 if (!state.ending && !state.finished) endWritable(this, state, cb);
16666 function needFinish(state) {
16667 return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
16669 function callFinal(stream, state) {
16670 stream._final(function (err) {
16673 stream.emit('error', err);
16675 state.prefinished = true;
16676 stream.emit('prefinish');
16677 finishMaybe(stream, state);
16680 function prefinish(stream, state) {
16681 if (!state.prefinished && !state.finalCalled) {
16682 if (typeof stream._final === 'function') {
16684 state.finalCalled = true;
16685 pna.nextTick(callFinal, stream, state);
16687 state.prefinished = true;
16688 stream.emit('prefinish');
16693 function finishMaybe(stream, state) {
16694 var need = needFinish(state);
16696 prefinish(stream, state);
16697 if (state.pendingcb === 0) {
16698 state.finished = true;
16699 stream.emit('finish');
16705 function endWritable(stream, state, cb) {
16706 state.ending = true;
16707 finishMaybe(stream, state);
16709 if (state.finished) pna.nextTick(cb);else stream.once('finish', cb);
16711 state.ended = true;
16712 stream.writable = false;
16715 function onCorkedFinish(corkReq, state, err) {
16716 var entry = corkReq.entry;
16717 corkReq.entry = null;
16719 var cb = entry.callback;
16722 entry = entry.next;
16724 if (state.corkedRequestsFree) {
16725 state.corkedRequestsFree.next = corkReq;
16727 state.corkedRequestsFree = corkReq;
16731 Object.defineProperty(Writable.prototype, 'destroyed', {
16733 if (this._writableState === undefined) {
16736 return this._writableState.destroyed;
16738 set: function (value) {
16739 // we ignore the value if the stream
16740 // has not been initialized yet
16741 if (!this._writableState) {
16745 // backward compatibility, the user is explicitly
16746 // managing destroyed
16747 this._writableState.destroyed = value;
16751 Writable.prototype.destroy = destroyImpl.destroy;
16752 Writable.prototype._undestroy = destroyImpl.undestroy;
16753 Writable.prototype._destroy = function (err, cb) {
16757 }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("timers").setImmediate)
16758 },{"./_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){
16761 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
16763 var Buffer = require('safe-buffer').Buffer;
16764 var util = require('util');
16766 function copyBuffer(src, target, offset) {
16767 src.copy(target, offset);
16770 module.exports = function () {
16771 function BufferList() {
16772 _classCallCheck(this, BufferList);
16779 BufferList.prototype.push = function push(v) {
16780 var entry = { data: v, next: null };
16781 if (this.length > 0) this.tail.next = entry;else this.head = entry;
16786 BufferList.prototype.unshift = function unshift(v) {
16787 var entry = { data: v, next: this.head };
16788 if (this.length === 0) this.tail = entry;
16793 BufferList.prototype.shift = function shift() {
16794 if (this.length === 0) return;
16795 var ret = this.head.data;
16796 if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
16801 BufferList.prototype.clear = function clear() {
16802 this.head = this.tail = null;
16806 BufferList.prototype.join = function join(s) {
16807 if (this.length === 0) return '';
16809 var ret = '' + p.data;
16810 while (p = p.next) {
16815 BufferList.prototype.concat = function concat(n) {
16816 if (this.length === 0) return Buffer.alloc(0);
16817 if (this.length === 1) return this.head.data;
16818 var ret = Buffer.allocUnsafe(n >>> 0);
16822 copyBuffer(p.data, ret, i);
16823 i += p.data.length;
16832 if (util && util.inspect && util.inspect.custom) {
16833 module.exports.prototype[util.inspect.custom] = function () {
16834 var obj = util.inspect({ length: this.length });
16835 return this.constructor.name + ' ' + obj;
16838 },{"safe-buffer":83,"util":40}],77:[function(require,module,exports){
16843 var pna = require('process-nextick-args');
16846 // undocumented cb() API, needed for core, not for public API
16847 function destroy(err, cb) {
16850 var readableDestroyed = this._readableState && this._readableState.destroyed;
16851 var writableDestroyed = this._writableState && this._writableState.destroyed;
16853 if (readableDestroyed || writableDestroyed) {
16856 } else if (err && (!this._writableState || !this._writableState.errorEmitted)) {
16857 pna.nextTick(emitErrorNT, this, err);
16862 // we set destroyed to true before firing error callbacks in order
16863 // to make it re-entrance safe in case destroy() is called within callbacks
16865 if (this._readableState) {
16866 this._readableState.destroyed = true;
16869 // if this is a duplex stream mark the writable part as destroyed as well
16870 if (this._writableState) {
16871 this._writableState.destroyed = true;
16874 this._destroy(err || null, function (err) {
16876 pna.nextTick(emitErrorNT, _this, err);
16877 if (_this._writableState) {
16878 _this._writableState.errorEmitted = true;
16888 function undestroy() {
16889 if (this._readableState) {
16890 this._readableState.destroyed = false;
16891 this._readableState.reading = false;
16892 this._readableState.ended = false;
16893 this._readableState.endEmitted = false;
16896 if (this._writableState) {
16897 this._writableState.destroyed = false;
16898 this._writableState.ended = false;
16899 this._writableState.ending = false;
16900 this._writableState.finished = false;
16901 this._writableState.errorEmitted = false;
16905 function emitErrorNT(self, err) {
16906 self.emit('error', err);
16911 undestroy: undestroy
16913 },{"process-nextick-args":68}],78:[function(require,module,exports){
16914 module.exports = require('events').EventEmitter;
16916 },{"events":50}],79:[function(require,module,exports){
16917 module.exports = require('./readable').PassThrough
16919 },{"./readable":80}],80:[function(require,module,exports){
16920 exports = module.exports = require('./lib/_stream_readable.js');
16921 exports.Stream = exports;
16922 exports.Readable = exports;
16923 exports.Writable = require('./lib/_stream_writable.js');
16924 exports.Duplex = require('./lib/_stream_duplex.js');
16925 exports.Transform = require('./lib/_stream_transform.js');
16926 exports.PassThrough = require('./lib/_stream_passthrough.js');
16928 },{"./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){
16929 module.exports = require('./readable').Transform
16931 },{"./readable":80}],82:[function(require,module,exports){
16932 module.exports = require('./lib/_stream_writable.js');
16934 },{"./lib/_stream_writable.js":75}],83:[function(require,module,exports){
16935 /* eslint-disable node/no-deprecated-api */
16936 var buffer = require('buffer')
16937 var Buffer = buffer.Buffer
16939 // alternative to using Object.keys for old browsers
16940 function copyProps (src, dst) {
16941 for (var key in src) {
16942 dst[key] = src[key]
16945 if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
16946 module.exports = buffer
16948 // Copy properties from require('buffer')
16949 copyProps(buffer, exports)
16950 exports.Buffer = SafeBuffer
16953 function SafeBuffer (arg, encodingOrOffset, length) {
16954 return Buffer(arg, encodingOrOffset, length)
16957 // Copy static methods from Buffer
16958 copyProps(Buffer, SafeBuffer)
16960 SafeBuffer.from = function (arg, encodingOrOffset, length) {
16961 if (typeof arg === 'number') {
16962 throw new TypeError('Argument must not be a number')
16964 return Buffer(arg, encodingOrOffset, length)
16967 SafeBuffer.alloc = function (size, fill, encoding) {
16968 if (typeof size !== 'number') {
16969 throw new TypeError('Argument must be a number')
16971 var buf = Buffer(size)
16972 if (fill !== undefined) {
16973 if (typeof encoding === 'string') {
16974 buf.fill(fill, encoding)
16984 SafeBuffer.allocUnsafe = function (size) {
16985 if (typeof size !== 'number') {
16986 throw new TypeError('Argument must be a number')
16988 return Buffer(size)
16991 SafeBuffer.allocUnsafeSlow = function (size) {
16992 if (typeof size !== 'number') {
16993 throw new TypeError('Argument must be a number')
16995 return buffer.SlowBuffer(size)
16998 },{"buffer":43}],84:[function(require,module,exports){
16999 // Copyright Joyent, Inc. and other Node contributors.
17001 // Permission is hereby granted, free of charge, to any person obtaining a
17002 // copy of this software and associated documentation files (the
17003 // "Software"), to deal in the Software without restriction, including
17004 // without limitation the rights to use, copy, modify, merge, publish,
17005 // distribute, sublicense, and/or sell copies of the Software, and to permit
17006 // persons to whom the Software is furnished to do so, subject to the
17007 // following conditions:
17009 // The above copyright notice and this permission notice shall be included
17010 // in all copies or substantial portions of the Software.
17012 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17013 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17014 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17015 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
17016 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
17017 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
17018 // USE OR OTHER DEALINGS IN THE SOFTWARE.
17020 module.exports = Stream;
17022 var EE = require('events').EventEmitter;
17023 var inherits = require('inherits');
17025 inherits(Stream, EE);
17026 Stream.Readable = require('readable-stream/readable.js');
17027 Stream.Writable = require('readable-stream/writable.js');
17028 Stream.Duplex = require('readable-stream/duplex.js');
17029 Stream.Transform = require('readable-stream/transform.js');
17030 Stream.PassThrough = require('readable-stream/passthrough.js');
17032 // Backwards-compat with node 0.4.x
17033 Stream.Stream = Stream;
17037 // old-style streams. Note that the pipe method (the only relevant
17038 // part of this class) is overridden in the Readable class.
17040 function Stream() {
17044 Stream.prototype.pipe = function(dest, options) {
17047 function ondata(chunk) {
17048 if (dest.writable) {
17049 if (false === dest.write(chunk) && source.pause) {
17055 source.on('data', ondata);
17057 function ondrain() {
17058 if (source.readable && source.resume) {
17063 dest.on('drain', ondrain);
17065 // If the 'end' option is not supplied, dest.end() will be called when
17066 // source gets the 'end' or 'close' events. Only dest.end() once.
17067 if (!dest._isStdio && (!options || options.end !== false)) {
17068 source.on('end', onend);
17069 source.on('close', onclose);
17072 var didOnEnd = false;
17074 if (didOnEnd) return;
17081 function onclose() {
17082 if (didOnEnd) return;
17085 if (typeof dest.destroy === 'function') dest.destroy();
17088 // don't leave dangling pipes when there are errors.
17089 function onerror(er) {
17091 if (EE.listenerCount(this, 'error') === 0) {
17092 throw er; // Unhandled stream error in pipe.
17096 source.on('error', onerror);
17097 dest.on('error', onerror);
17099 // remove all the event listeners that were added.
17100 function cleanup() {
17101 source.removeListener('data', ondata);
17102 dest.removeListener('drain', ondrain);
17104 source.removeListener('end', onend);
17105 source.removeListener('close', onclose);
17107 source.removeListener('error', onerror);
17108 dest.removeListener('error', onerror);
17110 source.removeListener('end', cleanup);
17111 source.removeListener('close', cleanup);
17113 dest.removeListener('close', cleanup);
17116 source.on('end', cleanup);
17117 source.on('close', cleanup);
17119 dest.on('close', cleanup);
17121 dest.emit('pipe', source);
17123 // Allow for unix-like usage: A.pipe(B).pipe(C)
17127 },{"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){
17128 // Copyright Joyent, Inc. and other Node contributors.
17130 // Permission is hereby granted, free of charge, to any person obtaining a
17131 // copy of this software and associated documentation files (the
17132 // "Software"), to deal in the Software without restriction, including
17133 // without limitation the rights to use, copy, modify, merge, publish,
17134 // distribute, sublicense, and/or sell copies of the Software, and to permit
17135 // persons to whom the Software is furnished to do so, subject to the
17136 // following conditions:
17138 // The above copyright notice and this permission notice shall be included
17139 // in all copies or substantial portions of the Software.
17141 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17142 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17143 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17144 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
17145 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
17146 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
17147 // USE OR OTHER DEALINGS IN THE SOFTWARE.
17153 var Buffer = require('safe-buffer').Buffer;
17156 var isEncoding = Buffer.isEncoding || function (encoding) {
17157 encoding = '' + encoding;
17158 switch (encoding && encoding.toLowerCase()) {
17159 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':
17166 function _normalizeEncoding(enc) {
17167 if (!enc) return 'utf8';
17187 if (retried) return; // undefined
17188 enc = ('' + enc).toLowerCase();
17194 // Do not cache `Buffer.isEncoding` when checking encoding names as some
17195 // modules monkey-patch it to support additional encodings
17196 function normalizeEncoding(enc) {
17197 var nenc = _normalizeEncoding(enc);
17198 if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);
17199 return nenc || enc;
17202 // StringDecoder provides an interface for efficiently splitting a series of
17203 // buffers into a series of JS strings without breaking apart multi-byte
17205 exports.StringDecoder = StringDecoder;
17206 function StringDecoder(encoding) {
17207 this.encoding = normalizeEncoding(encoding);
17209 switch (this.encoding) {
17211 this.text = utf16Text;
17212 this.end = utf16End;
17216 this.fillLast = utf8FillLast;
17220 this.text = base64Text;
17221 this.end = base64End;
17225 this.write = simpleWrite;
17226 this.end = simpleEnd;
17230 this.lastTotal = 0;
17231 this.lastChar = Buffer.allocUnsafe(nb);
17234 StringDecoder.prototype.write = function (buf) {
17235 if (buf.length === 0) return '';
17238 if (this.lastNeed) {
17239 r = this.fillLast(buf);
17240 if (r === undefined) return '';
17246 if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);
17250 StringDecoder.prototype.end = utf8End;
17252 // Returns only complete characters in a Buffer
17253 StringDecoder.prototype.text = utf8Text;
17255 // Attempts to complete a partial non-UTF-8 character using bytes from a Buffer
17256 StringDecoder.prototype.fillLast = function (buf) {
17257 if (this.lastNeed <= buf.length) {
17258 buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
17259 return this.lastChar.toString(this.encoding, 0, this.lastTotal);
17261 buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
17262 this.lastNeed -= buf.length;
17265 // Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a
17266 // continuation byte. If an invalid byte is detected, -2 is returned.
17267 function utf8CheckByte(byte) {
17268 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;
17269 return byte >> 6 === 0x02 ? -1 : -2;
17272 // Checks at most 3 bytes at the end of a Buffer in order to detect an
17273 // incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)
17274 // needed to complete the UTF-8 character (if applicable) are returned.
17275 function utf8CheckIncomplete(self, buf, i) {
17276 var j = buf.length - 1;
17277 if (j < i) return 0;
17278 var nb = utf8CheckByte(buf[j]);
17280 if (nb > 0) self.lastNeed = nb - 1;
17283 if (--j < i || nb === -2) return 0;
17284 nb = utf8CheckByte(buf[j]);
17286 if (nb > 0) self.lastNeed = nb - 2;
17289 if (--j < i || nb === -2) return 0;
17290 nb = utf8CheckByte(buf[j]);
17293 if (nb === 2) nb = 0;else self.lastNeed = nb - 3;
17300 // Validates as many continuation bytes for a multi-byte UTF-8 character as
17301 // needed or are available. If we see a non-continuation byte where we expect
17302 // one, we "replace" the validated continuation bytes we've seen so far with
17303 // a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding
17304 // behavior. The continuation byte check is included three times in the case
17305 // where all of the continuation bytes for a character exist in the same buffer.
17306 // It is also done this way as a slight performance increase instead of using a
17308 function utf8CheckExtraBytes(self, buf, p) {
17309 if ((buf[0] & 0xC0) !== 0x80) {
17313 if (self.lastNeed > 1 && buf.length > 1) {
17314 if ((buf[1] & 0xC0) !== 0x80) {
17318 if (self.lastNeed > 2 && buf.length > 2) {
17319 if ((buf[2] & 0xC0) !== 0x80) {
17327 // Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.
17328 function utf8FillLast(buf) {
17329 var p = this.lastTotal - this.lastNeed;
17330 var r = utf8CheckExtraBytes(this, buf, p);
17331 if (r !== undefined) return r;
17332 if (this.lastNeed <= buf.length) {
17333 buf.copy(this.lastChar, p, 0, this.lastNeed);
17334 return this.lastChar.toString(this.encoding, 0, this.lastTotal);
17336 buf.copy(this.lastChar, p, 0, buf.length);
17337 this.lastNeed -= buf.length;
17340 // Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a
17341 // partial character, the character's bytes are buffered until the required
17342 // number of bytes are available.
17343 function utf8Text(buf, i) {
17344 var total = utf8CheckIncomplete(this, buf, i);
17345 if (!this.lastNeed) return buf.toString('utf8', i);
17346 this.lastTotal = total;
17347 var end = buf.length - (total - this.lastNeed);
17348 buf.copy(this.lastChar, 0, end);
17349 return buf.toString('utf8', i, end);
17352 // For UTF-8, a replacement character is added when ending on a partial
17354 function utf8End(buf) {
17355 var r = buf && buf.length ? this.write(buf) : '';
17356 if (this.lastNeed) return r + '\ufffd';
17360 // UTF-16LE typically needs two bytes per character, but even if we have an even
17361 // number of bytes available, we need to check if we end on a leading/high
17362 // surrogate. In that case, we need to wait for the next two bytes in order to
17363 // decode the last character properly.
17364 function utf16Text(buf, i) {
17365 if ((buf.length - i) % 2 === 0) {
17366 var r = buf.toString('utf16le', i);
17368 var c = r.charCodeAt(r.length - 1);
17369 if (c >= 0xD800 && c <= 0xDBFF) {
17371 this.lastTotal = 4;
17372 this.lastChar[0] = buf[buf.length - 2];
17373 this.lastChar[1] = buf[buf.length - 1];
17374 return r.slice(0, -1);
17380 this.lastTotal = 2;
17381 this.lastChar[0] = buf[buf.length - 1];
17382 return buf.toString('utf16le', i, buf.length - 1);
17385 // For UTF-16LE we do not explicitly append special replacement characters if we
17386 // end on a partial character, we simply let v8 handle that.
17387 function utf16End(buf) {
17388 var r = buf && buf.length ? this.write(buf) : '';
17389 if (this.lastNeed) {
17390 var end = this.lastTotal - this.lastNeed;
17391 return r + this.lastChar.toString('utf16le', 0, end);
17396 function base64Text(buf, i) {
17397 var n = (buf.length - i) % 3;
17398 if (n === 0) return buf.toString('base64', i);
17399 this.lastNeed = 3 - n;
17400 this.lastTotal = 3;
17402 this.lastChar[0] = buf[buf.length - 1];
17404 this.lastChar[0] = buf[buf.length - 2];
17405 this.lastChar[1] = buf[buf.length - 1];
17407 return buf.toString('base64', i, buf.length - n);
17410 function base64End(buf) {
17411 var r = buf && buf.length ? this.write(buf) : '';
17412 if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);
17416 // Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)
17417 function simpleWrite(buf) {
17418 return buf.toString(this.encoding);
17421 function simpleEnd(buf) {
17422 return buf && buf.length ? this.write(buf) : '';
17424 },{"safe-buffer":83}],86:[function(require,module,exports){
17425 (function (setImmediate,clearImmediate){
17426 var nextTick = require('process/browser.js').nextTick;
17427 var apply = Function.prototype.apply;
17428 var slice = Array.prototype.slice;
17429 var immediateIds = {};
17430 var nextImmediateId = 0;
17432 // DOM APIs, for completeness
17434 exports.setTimeout = function() {
17435 return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);
17437 exports.setInterval = function() {
17438 return new Timeout(apply.call(setInterval, window, arguments), clearInterval);
17440 exports.clearTimeout =
17441 exports.clearInterval = function(timeout) { timeout.close(); };
17443 function Timeout(id, clearFn) {
17445 this._clearFn = clearFn;
17447 Timeout.prototype.unref = Timeout.prototype.ref = function() {};
17448 Timeout.prototype.close = function() {
17449 this._clearFn.call(window, this._id);
17452 // Does not start the time, just sets up the members needed.
17453 exports.enroll = function(item, msecs) {
17454 clearTimeout(item._idleTimeoutId);
17455 item._idleTimeout = msecs;
17458 exports.unenroll = function(item) {
17459 clearTimeout(item._idleTimeoutId);
17460 item._idleTimeout = -1;
17463 exports._unrefActive = exports.active = function(item) {
17464 clearTimeout(item._idleTimeoutId);
17466 var msecs = item._idleTimeout;
17468 item._idleTimeoutId = setTimeout(function onTimeout() {
17469 if (item._onTimeout)
17475 // That's not how node.js implements it but the exposed api is the same.
17476 exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function(fn) {
17477 var id = nextImmediateId++;
17478 var args = arguments.length < 2 ? false : slice.call(arguments, 1);
17480 immediateIds[id] = true;
17482 nextTick(function onNextTick() {
17483 if (immediateIds[id]) {
17484 // fn.call() is faster so we optimize for the common use-case
17485 // @see http://jsperf.com/call-apply-segu
17487 fn.apply(null, args);
17491 // Prevent ids from leaking
17492 exports.clearImmediate(id);
17499 exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function(id) {
17500 delete immediateIds[id];
17502 }).call(this,require("timers").setImmediate,require("timers").clearImmediate)
17503 },{"process/browser.js":69,"timers":86}],87:[function(require,module,exports){
17504 (function (global){
17510 module.exports = deprecate;
17513 * Mark that a method should not be used.
17514 * Returns a modified function which warns once by default.
17516 * If `localStorage.noDeprecation = true` is set, then it is a no-op.
17518 * If `localStorage.throwDeprecation = true` is set, then deprecated functions
17519 * will throw an Error when invoked.
17521 * If `localStorage.traceDeprecation = true` is set, then deprecated functions
17522 * will invoke `console.trace()` instead of `console.error()`.
17524 * @param {Function} fn - the function to deprecate
17525 * @param {String} msg - the string to print to the console when `fn` is invoked
17526 * @returns {Function} a new "deprecated" version of `fn`
17530 function deprecate (fn, msg) {
17531 if (config('noDeprecation')) {
17535 var warned = false;
17536 function deprecated() {
17538 if (config('throwDeprecation')) {
17539 throw new Error(msg);
17540 } else if (config('traceDeprecation')) {
17541 console.trace(msg);
17547 return fn.apply(this, arguments);
17554 * Checks `localStorage` for boolean values for the given `name`.
17556 * @param {String} name
17557 * @returns {Boolean}
17561 function config (name) {
17562 // accessing global.localStorage can trigger a DOMException in sandboxed iframes
17564 if (!global.localStorage) return false;
17568 var val = global.localStorage[name];
17569 if (null == val) return false;
17570 return String(val).toLowerCase() === 'true';
17573 }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
17574 },{}],88:[function(require,module,exports){
17575 module.exports = function isBuffer(arg) {
17576 return arg && typeof arg === 'object'
17577 && typeof arg.copy === 'function'
17578 && typeof arg.fill === 'function'
17579 && typeof arg.readUInt8 === 'function';
17581 },{}],89:[function(require,module,exports){
17582 (function (process,global){
17583 // Copyright Joyent, Inc. and other Node contributors.
17585 // Permission is hereby granted, free of charge, to any person obtaining a
17586 // copy of this software and associated documentation files (the
17587 // "Software"), to deal in the Software without restriction, including
17588 // without limitation the rights to use, copy, modify, merge, publish,
17589 // distribute, sublicense, and/or sell copies of the Software, and to permit
17590 // persons to whom the Software is furnished to do so, subject to the
17591 // following conditions:
17593 // The above copyright notice and this permission notice shall be included
17594 // in all copies or substantial portions of the Software.
17596 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17597 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17598 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17599 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
17600 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
17601 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
17602 // USE OR OTHER DEALINGS IN THE SOFTWARE.
17604 var formatRegExp = /%[sdj%]/g;
17605 exports.format = function(f) {
17606 if (!isString(f)) {
17608 for (var i = 0; i < arguments.length; i++) {
17609 objects.push(inspect(arguments[i]));
17611 return objects.join(' ');
17615 var args = arguments;
17616 var len = args.length;
17617 var str = String(f).replace(formatRegExp, function(x) {
17618 if (x === '%%') return '%';
17619 if (i >= len) return x;
17621 case '%s': return String(args[i++]);
17622 case '%d': return Number(args[i++]);
17625 return JSON.stringify(args[i++]);
17627 return '[Circular]';
17633 for (var x = args[i]; i < len; x = args[++i]) {
17634 if (isNull(x) || !isObject(x)) {
17637 str += ' ' + inspect(x);
17644 // Mark that a method should not be used.
17645 // Returns a modified function which warns once by default.
17646 // If --no-deprecation is set, then it is a no-op.
17647 exports.deprecate = function(fn, msg) {
17648 // Allow for deprecating things in the process of starting up.
17649 if (isUndefined(global.process)) {
17650 return function() {
17651 return exports.deprecate(fn, msg).apply(this, arguments);
17655 if (process.noDeprecation === true) {
17659 var warned = false;
17660 function deprecated() {
17662 if (process.throwDeprecation) {
17663 throw new Error(msg);
17664 } else if (process.traceDeprecation) {
17665 console.trace(msg);
17667 console.error(msg);
17671 return fn.apply(this, arguments);
17680 exports.debuglog = function(set) {
17681 if (isUndefined(debugEnviron))
17682 debugEnviron = process.env.NODE_DEBUG || '';
17683 set = set.toUpperCase();
17684 if (!debugs[set]) {
17685 if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
17686 var pid = process.pid;
17687 debugs[set] = function() {
17688 var msg = exports.format.apply(exports, arguments);
17689 console.error('%s %d: %s', set, pid, msg);
17692 debugs[set] = function() {};
17695 return debugs[set];
17700 * Echos the value of a value. Tries to print the value out
17701 * in the best way possible given the different types.
17703 * @param {Object} obj The object to print out.
17704 * @param {Object} opts Optional options object that alters the output.
17706 /* legacy: obj, showHidden, depth, colors*/
17707 function inspect(obj, opts) {
17711 stylize: stylizeNoColor
17714 if (arguments.length >= 3) ctx.depth = arguments[2];
17715 if (arguments.length >= 4) ctx.colors = arguments[3];
17716 if (isBoolean(opts)) {
17718 ctx.showHidden = opts;
17720 // got an "options" object
17721 exports._extend(ctx, opts);
17723 // set default options
17724 if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
17725 if (isUndefined(ctx.depth)) ctx.depth = 2;
17726 if (isUndefined(ctx.colors)) ctx.colors = false;
17727 if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
17728 if (ctx.colors) ctx.stylize = stylizeWithColor;
17729 return formatValue(ctx, obj, ctx.depth);
17731 exports.inspect = inspect;
17734 // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
17737 'italic' : [3, 23],
17738 'underline' : [4, 24],
17739 'inverse' : [7, 27],
17740 'white' : [37, 39],
17742 'black' : [30, 39],
17745 'green' : [32, 39],
17746 'magenta' : [35, 39],
17748 'yellow' : [33, 39]
17751 // Don't use 'blue' not visible on cmd.exe
17754 'number': 'yellow',
17755 'boolean': 'yellow',
17756 'undefined': 'grey',
17760 // "name": intentionally not styling
17765 function stylizeWithColor(str, styleType) {
17766 var style = inspect.styles[styleType];
17769 return '\u001b[' + inspect.colors[style][0] + 'm' + str +
17770 '\u001b[' + inspect.colors[style][1] + 'm';
17777 function stylizeNoColor(str, styleType) {
17782 function arrayToHash(array) {
17785 array.forEach(function(val, idx) {
17793 function formatValue(ctx, value, recurseTimes) {
17794 // Provide a hook for user-specified inspect functions.
17795 // Check that value is an object with an inspect function on it
17796 if (ctx.customInspect &&
17798 isFunction(value.inspect) &&
17799 // Filter out the util module, it's inspect function is special
17800 value.inspect !== exports.inspect &&
17801 // Also filter out any prototype objects using the circular check.
17802 !(value.constructor && value.constructor.prototype === value)) {
17803 var ret = value.inspect(recurseTimes, ctx);
17804 if (!isString(ret)) {
17805 ret = formatValue(ctx, ret, recurseTimes);
17810 // Primitive types cannot have properties
17811 var primitive = formatPrimitive(ctx, value);
17816 // Look up the keys of the object.
17817 var keys = Object.keys(value);
17818 var visibleKeys = arrayToHash(keys);
17820 if (ctx.showHidden) {
17821 keys = Object.getOwnPropertyNames(value);
17824 // IE doesn't make error fields non-enumerable
17825 // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
17827 && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
17828 return formatError(value);
17831 // Some type of object without properties can be shortcutted.
17832 if (keys.length === 0) {
17833 if (isFunction(value)) {
17834 var name = value.name ? ': ' + value.name : '';
17835 return ctx.stylize('[Function' + name + ']', 'special');
17837 if (isRegExp(value)) {
17838 return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
17840 if (isDate(value)) {
17841 return ctx.stylize(Date.prototype.toString.call(value), 'date');
17843 if (isError(value)) {
17844 return formatError(value);
17848 var base = '', array = false, braces = ['{', '}'];
17850 // Make Array say that they are Array
17851 if (isArray(value)) {
17853 braces = ['[', ']'];
17856 // Make functions say that they are functions
17857 if (isFunction(value)) {
17858 var n = value.name ? ': ' + value.name : '';
17859 base = ' [Function' + n + ']';
17862 // Make RegExps say that they are RegExps
17863 if (isRegExp(value)) {
17864 base = ' ' + RegExp.prototype.toString.call(value);
17867 // Make dates with properties first say the date
17868 if (isDate(value)) {
17869 base = ' ' + Date.prototype.toUTCString.call(value);
17872 // Make error with message first say the error
17873 if (isError(value)) {
17874 base = ' ' + formatError(value);
17877 if (keys.length === 0 && (!array || value.length == 0)) {
17878 return braces[0] + base + braces[1];
17881 if (recurseTimes < 0) {
17882 if (isRegExp(value)) {
17883 return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
17885 return ctx.stylize('[Object]', 'special');
17889 ctx.seen.push(value);
17893 output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
17895 output = keys.map(function(key) {
17896 return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
17902 return reduceToSingleString(output, base, braces);
17906 function formatPrimitive(ctx, value) {
17907 if (isUndefined(value))
17908 return ctx.stylize('undefined', 'undefined');
17909 if (isString(value)) {
17910 var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
17911 .replace(/'/g, "\\'")
17912 .replace(/\\"/g, '"') + '\'';
17913 return ctx.stylize(simple, 'string');
17915 if (isNumber(value))
17916 return ctx.stylize('' + value, 'number');
17917 if (isBoolean(value))
17918 return ctx.stylize('' + value, 'boolean');
17919 // For some reason typeof null is "object", so special case here.
17921 return ctx.stylize('null', 'null');
17925 function formatError(value) {
17926 return '[' + Error.prototype.toString.call(value) + ']';
17930 function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
17932 for (var i = 0, l = value.length; i < l; ++i) {
17933 if (hasOwnProperty(value, String(i))) {
17934 output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
17940 keys.forEach(function(key) {
17941 if (!key.match(/^\d+$/)) {
17942 output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
17950 function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
17951 var name, str, desc;
17952 desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
17955 str = ctx.stylize('[Getter/Setter]', 'special');
17957 str = ctx.stylize('[Getter]', 'special');
17961 str = ctx.stylize('[Setter]', 'special');
17964 if (!hasOwnProperty(visibleKeys, key)) {
17965 name = '[' + key + ']';
17968 if (ctx.seen.indexOf(desc.value) < 0) {
17969 if (isNull(recurseTimes)) {
17970 str = formatValue(ctx, desc.value, null);
17972 str = formatValue(ctx, desc.value, recurseTimes - 1);
17974 if (str.indexOf('\n') > -1) {
17976 str = str.split('\n').map(function(line) {
17978 }).join('\n').substr(2);
17980 str = '\n' + str.split('\n').map(function(line) {
17986 str = ctx.stylize('[Circular]', 'special');
17989 if (isUndefined(name)) {
17990 if (array && key.match(/^\d+$/)) {
17993 name = JSON.stringify('' + key);
17994 if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
17995 name = name.substr(1, name.length - 2);
17996 name = ctx.stylize(name, 'name');
17998 name = name.replace(/'/g, "\\'")
17999 .replace(/\\"/g, '"')
18000 .replace(/(^"|"$)/g, "'");
18001 name = ctx.stylize(name, 'string');
18005 return name + ': ' + str;
18009 function reduceToSingleString(output, base, braces) {
18010 var numLinesEst = 0;
18011 var length = output.reduce(function(prev, cur) {
18013 if (cur.indexOf('\n') >= 0) numLinesEst++;
18014 return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
18019 (base === '' ? '' : base + '\n ') +
18021 output.join(',\n ') +
18026 return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
18030 // NOTE: These type checking functions intentionally don't use `instanceof`
18031 // because it is fragile and can be easily faked with `Object.create()`.
18032 function isArray(ar) {
18033 return Array.isArray(ar);
18035 exports.isArray = isArray;
18037 function isBoolean(arg) {
18038 return typeof arg === 'boolean';
18040 exports.isBoolean = isBoolean;
18042 function isNull(arg) {
18043 return arg === null;
18045 exports.isNull = isNull;
18047 function isNullOrUndefined(arg) {
18048 return arg == null;
18050 exports.isNullOrUndefined = isNullOrUndefined;
18052 function isNumber(arg) {
18053 return typeof arg === 'number';
18055 exports.isNumber = isNumber;
18057 function isString(arg) {
18058 return typeof arg === 'string';
18060 exports.isString = isString;
18062 function isSymbol(arg) {
18063 return typeof arg === 'symbol';
18065 exports.isSymbol = isSymbol;
18067 function isUndefined(arg) {
18068 return arg === void 0;
18070 exports.isUndefined = isUndefined;
18072 function isRegExp(re) {
18073 return isObject(re) && objectToString(re) === '[object RegExp]';
18075 exports.isRegExp = isRegExp;
18077 function isObject(arg) {
18078 return typeof arg === 'object' && arg !== null;
18080 exports.isObject = isObject;
18082 function isDate(d) {
18083 return isObject(d) && objectToString(d) === '[object Date]';
18085 exports.isDate = isDate;
18087 function isError(e) {
18088 return isObject(e) &&
18089 (objectToString(e) === '[object Error]' || e instanceof Error);
18091 exports.isError = isError;
18093 function isFunction(arg) {
18094 return typeof arg === 'function';
18096 exports.isFunction = isFunction;
18098 function isPrimitive(arg) {
18099 return arg === null ||
18100 typeof arg === 'boolean' ||
18101 typeof arg === 'number' ||
18102 typeof arg === 'string' ||
18103 typeof arg === 'symbol' || // ES6 symbol
18104 typeof arg === 'undefined';
18106 exports.isPrimitive = isPrimitive;
18108 exports.isBuffer = require('./support/isBuffer');
18110 function objectToString(o) {
18111 return Object.prototype.toString.call(o);
18116 return n < 10 ? '0' + n.toString(10) : n.toString(10);
18120 var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
18121 'Oct', 'Nov', 'Dec'];
18124 function timestamp() {
18125 var d = new Date();
18126 var time = [pad(d.getHours()),
18127 pad(d.getMinutes()),
18128 pad(d.getSeconds())].join(':');
18129 return [d.getDate(), months[d.getMonth()], time].join(' ');
18133 // log is just a thin wrapper to console.log that prepends a timestamp
18134 exports.log = function() {
18135 console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
18140 * Inherit the prototype methods from one constructor into another.
18142 * The Function.prototype.inherits from lang.js rewritten as a standalone
18143 * function (not on Function.prototype). NOTE: If this file is to be loaded
18144 * during bootstrapping this function needs to be rewritten using some native
18145 * functions as prototype setup using normal JavaScript does not work as
18146 * expected during bootstrapping (see mirror.js in r114903).
18148 * @param {function} ctor Constructor function which needs to inherit the
18150 * @param {function} superCtor Constructor function to inherit prototype from.
18152 exports.inherits = require('inherits');
18154 exports._extend = function(origin, add) {
18155 // Don't do anything if add isn't an object
18156 if (!add || !isObject(add)) return origin;
18158 var keys = Object.keys(add);
18159 var i = keys.length;
18161 origin[keys[i]] = add[keys[i]];
18166 function hasOwnProperty(obj, prop) {
18167 return Object.prototype.hasOwnProperty.call(obj, prop);
18170 }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
18171 },{"./support/isBuffer":88,"_process":69,"inherits":56}],90:[function(require,module,exports){
18174 "version": "7.1.1",
18175 "homepage": "https://mochajs.org/",
18176 "notifyLogo": "https://ibin.co/4QuRuGjXvl36.png"