1 | (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
2 | (function (process,global){
|
3 | 'use strict';
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 | process.stdout = require('browser-stdout')({label: false});
|
13 |
|
14 | var Mocha = require('./lib/mocha');
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 | var mocha = new Mocha({reporter: 'html'});
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
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;
|
33 |
|
34 | var uncaughtExceptionHandlers = [];
|
35 |
|
36 | var originalOnerrorHandler = global.onerror;
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 | process.removeListener = function(e, fn) {
|
44 | if (e === 'uncaughtException') {
|
45 | if (originalOnerrorHandler) {
|
46 | global.onerror = originalOnerrorHandler;
|
47 | } else {
|
48 | global.onerror = function() {};
|
49 | }
|
50 | var i = uncaughtExceptionHandlers.indexOf(fn);
|
51 | if (i !== -1) {
|
52 | uncaughtExceptionHandlers.splice(i, 1);
|
53 | }
|
54 | }
|
55 | };
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
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.allowUncaught;
|
66 | };
|
67 | uncaughtExceptionHandlers.push(fn);
|
68 | }
|
69 | };
|
70 |
|
71 |
|
72 |
|
73 |
|
74 | mocha.suite.removeAllListeners('pre-require');
|
75 |
|
76 | var immediateQueue = [];
|
77 | var immediateTimeout;
|
78 |
|
79 | function timeslice() {
|
80 | var immediateStart = new Date().getTime();
|
81 | while (immediateQueue.length && new Date().getTime() - immediateStart < 100) {
|
82 | immediateQueue.shift()();
|
83 | }
|
84 | if (immediateQueue.length) {
|
85 | immediateTimeout = setTimeout(timeslice, 0);
|
86 | } else {
|
87 | immediateTimeout = null;
|
88 | }
|
89 | }
|
90 |
|
91 |
|
92 |
|
93 |
|
94 |
|
95 | Mocha.Runner.immediately = function(callback) {
|
96 | immediateQueue.push(callback);
|
97 | if (!immediateTimeout) {
|
98 | immediateTimeout = setTimeout(timeslice, 0);
|
99 | }
|
100 | };
|
101 |
|
102 |
|
103 |
|
104 |
|
105 |
|
106 |
|
107 | mocha.throwError = function(err) {
|
108 | uncaughtExceptionHandlers.forEach(function(fn) {
|
109 | fn(err);
|
110 | });
|
111 | throw err;
|
112 | };
|
113 |
|
114 |
|
115 |
|
116 |
|
117 |
|
118 |
|
119 | mocha.ui = function(ui) {
|
120 | Mocha.prototype.ui.call(this, ui);
|
121 | this.suite.emit('pre-require', global, null, this);
|
122 | return this;
|
123 | };
|
124 |
|
125 |
|
126 |
|
127 |
|
128 |
|
129 | mocha.setup = function(opts) {
|
130 | if (typeof opts === 'string') {
|
131 | opts = {ui: opts};
|
132 | }
|
133 | for (var opt in opts) {
|
134 | if (opts.hasOwnProperty(opt)) {
|
135 | this[opt](opts[opt]);
|
136 | }
|
137 | }
|
138 | return this;
|
139 | };
|
140 |
|
141 |
|
142 |
|
143 |
|
144 |
|
145 | mocha.run = function(fn) {
|
146 | var options = mocha.options;
|
147 | mocha.globals('location');
|
148 |
|
149 | var query = Mocha.utils.parseQuery(global.location.search || '');
|
150 | if (query.grep) {
|
151 | mocha.grep(query.grep);
|
152 | }
|
153 | if (query.fgrep) {
|
154 | mocha.fgrep(query.fgrep);
|
155 | }
|
156 | if (query.invert) {
|
157 | mocha.invert();
|
158 | }
|
159 |
|
160 | return Mocha.prototype.run.call(mocha, function(err) {
|
161 |
|
162 | var document = global.document;
|
163 | if (
|
164 | document &&
|
165 | document.getElementById('mocha') &&
|
166 | options.noHighlighting !== true
|
167 | ) {
|
168 | Mocha.utils.highlightTags('code');
|
169 | }
|
170 | if (fn) {
|
171 | fn(err);
|
172 | }
|
173 | });
|
174 | };
|
175 |
|
176 |
|
177 |
|
178 |
|
179 |
|
180 |
|
181 | Mocha.process = process;
|
182 |
|
183 |
|
184 |
|
185 |
|
186 |
|
187 | global.Mocha = Mocha;
|
188 | global.mocha = mocha;
|
189 |
|
190 |
|
191 |
|
192 |
|
193 | module.exports = global;
|
194 |
|
195 | }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
196 | },{"./lib/mocha":14,"_process":69,"browser-stdout":41}],2:[function(require,module,exports){
|
197 | (function (process,global){
|
198 | 'use strict';
|
199 |
|
200 |
|
201 |
|
202 |
|
203 |
|
204 |
|
205 |
|
206 |
|
207 |
|
208 | var Date = global.Date;
|
209 | var setTimeout = global.setTimeout;
|
210 | var EVENT_RUN_END = require('../runner').constants.EVENT_RUN_END;
|
211 |
|
212 |
|
213 |
|
214 |
|
215 |
|
216 |
|
217 |
|
218 |
|
219 |
|
220 |
|
221 |
|
222 | exports.isCapable = function() {
|
223 | var hasNotificationSupport = 'Notification' in window;
|
224 | var hasPromiseSupport = typeof Promise === 'function';
|
225 | return process.browser && hasNotificationSupport && hasPromiseSupport;
|
226 | };
|
227 |
|
228 |
|
229 |
|
230 |
|
231 |
|
232 |
|
233 |
|
234 |
|
235 |
|
236 |
|
237 |
|
238 | exports.notify = function(runner) {
|
239 | var promise = isPermitted();
|
240 |
|
241 | |
242 |
|
243 |
|
244 | var sendNotification = function() {
|
245 |
|
246 | Promise.race([promise, Promise.resolve(undefined)])
|
247 | .then(canNotify)
|
248 | .then(function() {
|
249 | display(runner);
|
250 | })
|
251 | .catch(notPermitted);
|
252 | };
|
253 |
|
254 | runner.once(EVENT_RUN_END, sendNotification);
|
255 | };
|
256 |
|
257 |
|
258 |
|
259 |
|
260 |
|
261 |
|
262 |
|
263 |
|
264 |
|
265 |
|
266 |
|
267 | function isPermitted() {
|
268 | var permitted = {
|
269 | granted: function allow() {
|
270 | return Promise.resolve(true);
|
271 | },
|
272 | denied: function deny() {
|
273 | return Promise.resolve(false);
|
274 | },
|
275 | default: function ask() {
|
276 | return Notification.requestPermission().then(function(permission) {
|
277 | return permission === 'granted';
|
278 | });
|
279 | }
|
280 | };
|
281 |
|
282 | return permitted[Notification.permission]();
|
283 | }
|
284 |
|
285 |
|
286 |
|
287 |
|
288 |
|
289 |
|
290 |
|
291 |
|
292 |
|
293 |
|
294 |
|
295 |
|
296 |
|
297 |
|
298 |
|
299 |
|
300 |
|
301 |
|
302 |
|
303 | function canNotify(value) {
|
304 | if (!value) {
|
305 | var why = value === false ? 'blocked' : 'unacknowledged';
|
306 | var reason = 'not permitted by user (' + why + ')';
|
307 | return Promise.reject(new Error(reason));
|
308 | }
|
309 | return Promise.resolve();
|
310 | }
|
311 |
|
312 |
|
313 |
|
314 |
|
315 |
|
316 |
|
317 |
|
318 | function display(runner) {
|
319 | var stats = runner.stats;
|
320 | var symbol = {
|
321 | cross: '\u274C',
|
322 | tick: '\u2705'
|
323 | };
|
324 | var logo = require('../../package').notifyLogo;
|
325 | var _message;
|
326 | var message;
|
327 | var title;
|
328 |
|
329 | if (stats.failures) {
|
330 | _message = stats.failures + ' of ' + stats.tests + ' tests failed';
|
331 | message = symbol.cross + ' ' + _message;
|
332 | title = 'Failed';
|
333 | } else {
|
334 | _message = stats.passes + ' tests passed in ' + stats.duration + 'ms';
|
335 | message = symbol.tick + ' ' + _message;
|
336 | title = 'Passed';
|
337 | }
|
338 |
|
339 |
|
340 | var options = {
|
341 | badge: logo,
|
342 | body: message,
|
343 | dir: 'ltr',
|
344 | icon: logo,
|
345 | lang: 'en-US',
|
346 | name: 'mocha',
|
347 | requireInteraction: false,
|
348 | timestamp: Date.now()
|
349 | };
|
350 | var notification = new Notification(title, options);
|
351 |
|
352 |
|
353 | var FORCE_DURATION = 4000;
|
354 | setTimeout(notification.close.bind(notification), FORCE_DURATION);
|
355 | }
|
356 |
|
357 |
|
358 |
|
359 |
|
360 |
|
361 |
|
362 |
|
363 | function notPermitted(err) {
|
364 | console.error('notification error:', err.message);
|
365 | }
|
366 |
|
367 | }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
368 | },{"../../package":90,"../runner":34,"_process":69}],3:[function(require,module,exports){
|
369 | 'use strict';
|
370 |
|
371 |
|
372 |
|
373 |
|
374 |
|
375 | module.exports = Progress;
|
376 |
|
377 |
|
378 |
|
379 |
|
380 | function Progress() {
|
381 | this.percent = 0;
|
382 | this.size(0);
|
383 | this.fontSize(11);
|
384 | this.font('helvetica, arial, sans-serif');
|
385 | }
|
386 |
|
387 |
|
388 |
|
389 |
|
390 |
|
391 |
|
392 |
|
393 |
|
394 | Progress.prototype.size = function(size) {
|
395 | this._size = size;
|
396 | return this;
|
397 | };
|
398 |
|
399 |
|
400 |
|
401 |
|
402 |
|
403 |
|
404 |
|
405 |
|
406 | Progress.prototype.text = function(text) {
|
407 | this._text = text;
|
408 | return this;
|
409 | };
|
410 |
|
411 |
|
412 |
|
413 |
|
414 |
|
415 |
|
416 |
|
417 |
|
418 | Progress.prototype.fontSize = function(size) {
|
419 | this._fontSize = size;
|
420 | return this;
|
421 | };
|
422 |
|
423 |
|
424 |
|
425 |
|
426 |
|
427 |
|
428 |
|
429 | Progress.prototype.font = function(family) {
|
430 | this._font = family;
|
431 | return this;
|
432 | };
|
433 |
|
434 |
|
435 |
|
436 |
|
437 |
|
438 |
|
439 |
|
440 | Progress.prototype.update = function(n) {
|
441 | this.percent = n;
|
442 | return this;
|
443 | };
|
444 |
|
445 |
|
446 |
|
447 |
|
448 |
|
449 |
|
450 |
|
451 | Progress.prototype.draw = function(ctx) {
|
452 | try {
|
453 | var percent = Math.min(this.percent, 100);
|
454 | var size = this._size;
|
455 | var half = size / 2;
|
456 | var x = half;
|
457 | var y = half;
|
458 | var rad = half - 1;
|
459 | var fontSize = this._fontSize;
|
460 |
|
461 | ctx.font = fontSize + 'px ' + this._font;
|
462 |
|
463 | var angle = Math.PI * 2 * (percent / 100);
|
464 | ctx.clearRect(0, 0, size, size);
|
465 |
|
466 |
|
467 | ctx.strokeStyle = '#9f9f9f';
|
468 | ctx.beginPath();
|
469 | ctx.arc(x, y, rad, 0, angle, false);
|
470 | ctx.stroke();
|
471 |
|
472 |
|
473 | ctx.strokeStyle = '#eee';
|
474 | ctx.beginPath();
|
475 | ctx.arc(x, y, rad - 1, 0, angle, true);
|
476 | ctx.stroke();
|
477 |
|
478 |
|
479 | var text = this._text || (percent | 0) + '%';
|
480 | var w = ctx.measureText(text).width;
|
481 |
|
482 | ctx.fillText(text, x - w / 2 + 1, y + fontSize / 2 - 1);
|
483 | } catch (ignore) {
|
484 |
|
485 | }
|
486 | return this;
|
487 | };
|
488 |
|
489 | },{}],4:[function(require,module,exports){
|
490 | (function (global){
|
491 | 'use strict';
|
492 |
|
493 | exports.isatty = function isatty() {
|
494 | return true;
|
495 | };
|
496 |
|
497 | exports.getWindowSize = function getWindowSize() {
|
498 | if ('innerHeight' in global) {
|
499 | return [global.innerHeight, global.innerWidth];
|
500 | }
|
501 |
|
502 | return [640, 480];
|
503 | };
|
504 |
|
505 | }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
506 | },{}],5:[function(require,module,exports){
|
507 | 'use strict';
|
508 |
|
509 |
|
510 |
|
511 |
|
512 |
|
513 |
|
514 |
|
515 | module.exports = Context;
|
516 |
|
517 |
|
518 |
|
519 |
|
520 |
|
521 |
|
522 | function Context() {}
|
523 |
|
524 |
|
525 |
|
526 |
|
527 |
|
528 |
|
529 |
|
530 |
|
531 | Context.prototype.runnable = function(runnable) {
|
532 | if (!arguments.length) {
|
533 | return this._runnable;
|
534 | }
|
535 | this.test = this._runnable = runnable;
|
536 | return this;
|
537 | };
|
538 |
|
539 |
|
540 |
|
541 |
|
542 |
|
543 |
|
544 |
|
545 |
|
546 | Context.prototype.timeout = function(ms) {
|
547 | if (!arguments.length) {
|
548 | return this.runnable().timeout();
|
549 | }
|
550 | this.runnable().timeout(ms);
|
551 | return this;
|
552 | };
|
553 |
|
554 |
|
555 |
|
556 |
|
557 |
|
558 |
|
559 |
|
560 |
|
561 | Context.prototype.enableTimeouts = function(enabled) {
|
562 | if (!arguments.length) {
|
563 | return this.runnable().enableTimeouts();
|
564 | }
|
565 | this.runnable().enableTimeouts(enabled);
|
566 | return this;
|
567 | };
|
568 |
|
569 |
|
570 |
|
571 |
|
572 |
|
573 |
|
574 |
|
575 |
|
576 | Context.prototype.slow = function(ms) {
|
577 | if (!arguments.length) {
|
578 | return this.runnable().slow();
|
579 | }
|
580 | this.runnable().slow(ms);
|
581 | return this;
|
582 | };
|
583 |
|
584 |
|
585 |
|
586 |
|
587 |
|
588 |
|
589 |
|
590 | Context.prototype.skip = function() {
|
591 | this.runnable().skip();
|
592 | };
|
593 |
|
594 |
|
595 |
|
596 |
|
597 |
|
598 |
|
599 |
|
600 |
|
601 | Context.prototype.retries = function(n) {
|
602 | if (!arguments.length) {
|
603 | return this.runnable().retries();
|
604 | }
|
605 | this.runnable().retries(n);
|
606 | return this;
|
607 | };
|
608 |
|
609 | },{}],6:[function(require,module,exports){
|
610 | 'use strict';
|
611 |
|
612 |
|
613 |
|
614 |
|
615 |
|
616 |
|
617 |
|
618 |
|
619 |
|
620 |
|
621 |
|
622 |
|
623 |
|
624 |
|
625 |
|
626 | function createNoFilesMatchPatternError(message, pattern) {
|
627 | var err = new Error(message);
|
628 | err.code = 'ERR_MOCHA_NO_FILES_MATCH_PATTERN';
|
629 | err.pattern = pattern;
|
630 | return err;
|
631 | }
|
632 |
|
633 |
|
634 |
|
635 |
|
636 |
|
637 |
|
638 |
|
639 |
|
640 |
|
641 | function createInvalidReporterError(message, reporter) {
|
642 | var err = new TypeError(message);
|
643 | err.code = 'ERR_MOCHA_INVALID_REPORTER';
|
644 | err.reporter = reporter;
|
645 | return err;
|
646 | }
|
647 |
|
648 |
|
649 |
|
650 |
|
651 |
|
652 |
|
653 |
|
654 |
|
655 |
|
656 | function createInvalidInterfaceError(message, ui) {
|
657 | var err = new Error(message);
|
658 | err.code = 'ERR_MOCHA_INVALID_INTERFACE';
|
659 | err.interface = ui;
|
660 | return err;
|
661 | }
|
662 |
|
663 |
|
664 |
|
665 |
|
666 |
|
667 |
|
668 |
|
669 |
|
670 | function createUnsupportedError(message) {
|
671 | var err = new Error(message);
|
672 | err.code = 'ERR_MOCHA_UNSUPPORTED';
|
673 | return err;
|
674 | }
|
675 |
|
676 |
|
677 |
|
678 |
|
679 |
|
680 |
|
681 |
|
682 |
|
683 |
|
684 |
|
685 | function createMissingArgumentError(message, argument, expected) {
|
686 | return createInvalidArgumentTypeError(message, argument, expected);
|
687 | }
|
688 |
|
689 |
|
690 |
|
691 |
|
692 |
|
693 |
|
694 |
|
695 |
|
696 |
|
697 |
|
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;
|
704 | return err;
|
705 | }
|
706 |
|
707 |
|
708 |
|
709 |
|
710 |
|
711 |
|
712 |
|
713 |
|
714 |
|
715 |
|
716 |
|
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;
|
721 | err.value = value;
|
722 | err.reason = typeof reason !== 'undefined' ? reason : 'is invalid';
|
723 | return err;
|
724 | }
|
725 |
|
726 |
|
727 |
|
728 |
|
729 |
|
730 |
|
731 |
|
732 |
|
733 | function createInvalidExceptionError(message, value) {
|
734 | var err = new Error(message);
|
735 | err.code = 'ERR_MOCHA_INVALID_EXCEPTION';
|
736 | err.valueType = typeof value;
|
737 | err.value = value;
|
738 | return err;
|
739 | }
|
740 |
|
741 | module.exports = {
|
742 | createInvalidArgumentTypeError: createInvalidArgumentTypeError,
|
743 | createInvalidArgumentValueError: createInvalidArgumentValueError,
|
744 | createInvalidExceptionError: createInvalidExceptionError,
|
745 | createInvalidInterfaceError: createInvalidInterfaceError,
|
746 | createInvalidReporterError: createInvalidReporterError,
|
747 | createMissingArgumentError: createMissingArgumentError,
|
748 | createNoFilesMatchPatternError: createNoFilesMatchPatternError,
|
749 | createUnsupportedError: createUnsupportedError
|
750 | };
|
751 |
|
752 | },{}],7:[function(require,module,exports){
|
753 | 'use strict';
|
754 |
|
755 | var Runnable = require('./runnable');
|
756 | var inherits = require('./utils').inherits;
|
757 |
|
758 |
|
759 |
|
760 |
|
761 |
|
762 | module.exports = Hook;
|
763 |
|
764 |
|
765 |
|
766 |
|
767 |
|
768 |
|
769 |
|
770 |
|
771 |
|
772 | function Hook(title, fn) {
|
773 | Runnable.call(this, title, fn);
|
774 | this.type = 'hook';
|
775 | }
|
776 |
|
777 |
|
778 |
|
779 |
|
780 | inherits(Hook, Runnable);
|
781 |
|
782 |
|
783 |
|
784 |
|
785 |
|
786 |
|
787 |
|
788 |
|
789 |
|
790 | Hook.prototype.error = function(err) {
|
791 | if (!arguments.length) {
|
792 | err = this._error;
|
793 | this._error = null;
|
794 | return err;
|
795 | }
|
796 |
|
797 | this._error = err;
|
798 | };
|
799 |
|
800 | },{"./runnable":33,"./utils":38}],8:[function(require,module,exports){
|
801 | 'use strict';
|
802 |
|
803 | var Test = require('../test');
|
804 | var EVENT_FILE_PRE_REQUIRE = require('../suite').constants
|
805 | .EVENT_FILE_PRE_REQUIRE;
|
806 |
|
807 |
|
808 |
|
809 |
|
810 |
|
811 |
|
812 |
|
813 |
|
814 |
|
815 |
|
816 |
|
817 |
|
818 |
|
819 |
|
820 |
|
821 |
|
822 |
|
823 |
|
824 | module.exports = function bddInterface(suite) {
|
825 | var suites = [suite];
|
826 |
|
827 | suite.on(EVENT_FILE_PRE_REQUIRE, function(context, file, mocha) {
|
828 | var common = require('./common')(suites, context, mocha);
|
829 |
|
830 | context.before = common.before;
|
831 | context.after = common.after;
|
832 | context.beforeEach = common.beforeEach;
|
833 | context.afterEach = common.afterEach;
|
834 | context.run = mocha.options.delay && common.runWithSuite(suite);
|
835 | |
836 |
|
837 |
|
838 |
|
839 |
|
840 |
|
841 | context.describe = context.context = function(title, fn) {
|
842 | return common.suite.create({
|
843 | title: title,
|
844 | file: file,
|
845 | fn: fn
|
846 | });
|
847 | };
|
848 |
|
849 | |
850 |
|
851 |
|
852 |
|
853 | context.xdescribe = context.xcontext = context.describe.skip = function(
|
854 | title,
|
855 | fn
|
856 | ) {
|
857 | return common.suite.skip({
|
858 | title: title,
|
859 | file: file,
|
860 | fn: fn
|
861 | });
|
862 | };
|
863 |
|
864 | |
865 |
|
866 |
|
867 |
|
868 | context.describe.only = function(title, fn) {
|
869 | return common.suite.only({
|
870 | title: title,
|
871 | file: file,
|
872 | fn: fn
|
873 | });
|
874 | };
|
875 |
|
876 | |
877 |
|
878 |
|
879 |
|
880 |
|
881 |
|
882 | context.it = context.specify = function(title, fn) {
|
883 | var suite = suites[0];
|
884 | if (suite.isPending()) {
|
885 | fn = null;
|
886 | }
|
887 | var test = new Test(title, fn);
|
888 | test.file = file;
|
889 | suite.addTest(test);
|
890 | return test;
|
891 | };
|
892 |
|
893 | |
894 |
|
895 |
|
896 |
|
897 | context.it.only = function(title, fn) {
|
898 | return common.test.only(mocha, context.it(title, fn));
|
899 | };
|
900 |
|
901 | |
902 |
|
903 |
|
904 |
|
905 | context.xit = context.xspecify = context.it.skip = function(title) {
|
906 | return context.it(title);
|
907 | };
|
908 |
|
909 | |
910 |
|
911 |
|
912 | context.it.retries = function(n) {
|
913 | context.retries(n);
|
914 | };
|
915 | });
|
916 | };
|
917 |
|
918 | module.exports.description = 'BDD or RSpec style [default]';
|
919 |
|
920 | },{"../suite":36,"../test":37,"./common":9}],9:[function(require,module,exports){
|
921 | 'use strict';
|
922 |
|
923 | var Suite = require('../suite');
|
924 | var errors = require('../errors');
|
925 | var createMissingArgumentError = errors.createMissingArgumentError;
|
926 |
|
927 |
|
928 |
|
929 |
|
930 |
|
931 |
|
932 |
|
933 |
|
934 |
|
935 | module.exports = function(suites, context, mocha) {
|
936 | |
937 |
|
938 |
|
939 |
|
940 |
|
941 |
|
942 |
|
943 | function shouldBeTested(suite) {
|
944 | return (
|
945 | !mocha.options.grep ||
|
946 | (mocha.options.grep &&
|
947 | mocha.options.grep.test(suite.fullTitle()) &&
|
948 | !mocha.options.invert)
|
949 | );
|
950 | }
|
951 |
|
952 | return {
|
953 | |
954 |
|
955 |
|
956 |
|
957 |
|
958 |
|
959 |
|
960 | runWithSuite: function runWithSuite(suite) {
|
961 | return function run() {
|
962 | suite.run();
|
963 | };
|
964 | },
|
965 |
|
966 | |
967 |
|
968 |
|
969 |
|
970 |
|
971 |
|
972 | before: function(name, fn) {
|
973 | suites[0].beforeAll(name, fn);
|
974 | },
|
975 |
|
976 | |
977 |
|
978 |
|
979 |
|
980 |
|
981 |
|
982 | after: function(name, fn) {
|
983 | suites[0].afterAll(name, fn);
|
984 | },
|
985 |
|
986 | |
987 |
|
988 |
|
989 |
|
990 |
|
991 |
|
992 | beforeEach: function(name, fn) {
|
993 | suites[0].beforeEach(name, fn);
|
994 | },
|
995 |
|
996 | |
997 |
|
998 |
|
999 |
|
1000 |
|
1001 |
|
1002 | afterEach: function(name, fn) {
|
1003 | suites[0].afterEach(name, fn);
|
1004 | },
|
1005 |
|
1006 | suite: {
|
1007 | |
1008 |
|
1009 |
|
1010 |
|
1011 |
|
1012 |
|
1013 |
|
1014 | only: function only(opts) {
|
1015 | opts.isOnly = true;
|
1016 | return this.create(opts);
|
1017 | },
|
1018 |
|
1019 | |
1020 |
|
1021 |
|
1022 |
|
1023 |
|
1024 |
|
1025 |
|
1026 | skip: function skip(opts) {
|
1027 | opts.pending = true;
|
1028 | return this.create(opts);
|
1029 | },
|
1030 |
|
1031 | |
1032 |
|
1033 |
|
1034 |
|
1035 |
|
1036 |
|
1037 |
|
1038 |
|
1039 |
|
1040 |
|
1041 |
|
1042 | create: function create(opts) {
|
1043 | var suite = Suite.create(suites[0], opts.title);
|
1044 | suite.pending = Boolean(opts.pending);
|
1045 | suite.file = opts.file;
|
1046 | suites.unshift(suite);
|
1047 | if (opts.isOnly) {
|
1048 | if (mocha.options.forbidOnly && shouldBeTested(suite)) {
|
1049 | throw new Error('`.only` forbidden');
|
1050 | }
|
1051 |
|
1052 | suite.parent.appendOnlySuite(suite);
|
1053 | }
|
1054 | if (suite.pending) {
|
1055 | if (mocha.options.forbidPending && shouldBeTested(suite)) {
|
1056 | throw new Error('Pending test forbidden');
|
1057 | }
|
1058 | }
|
1059 | if (typeof opts.fn === 'function') {
|
1060 | opts.fn.call(suite);
|
1061 | suites.shift();
|
1062 | } else if (typeof opts.fn === 'undefined' && !suite.pending) {
|
1063 | throw createMissingArgumentError(
|
1064 | 'Suite "' +
|
1065 | suite.fullTitle() +
|
1066 | '" was defined but no callback was supplied. ' +
|
1067 | 'Supply a callback or explicitly skip the suite.',
|
1068 | 'callback',
|
1069 | 'function'
|
1070 | );
|
1071 | } else if (!opts.fn && suite.pending) {
|
1072 | suites.shift();
|
1073 | }
|
1074 |
|
1075 | return suite;
|
1076 | }
|
1077 | },
|
1078 |
|
1079 | test: {
|
1080 | |
1081 |
|
1082 |
|
1083 |
|
1084 |
|
1085 |
|
1086 |
|
1087 | only: function(mocha, test) {
|
1088 | test.parent.appendOnlyTest(test);
|
1089 | return test;
|
1090 | },
|
1091 |
|
1092 | |
1093 |
|
1094 |
|
1095 |
|
1096 |
|
1097 | skip: function(title) {
|
1098 | context.test(title);
|
1099 | },
|
1100 |
|
1101 | |
1102 |
|
1103 |
|
1104 |
|
1105 |
|
1106 | retries: function(n) {
|
1107 | context.retries(n);
|
1108 | }
|
1109 | }
|
1110 | };
|
1111 | };
|
1112 |
|
1113 | },{"../errors":6,"../suite":36}],10:[function(require,module,exports){
|
1114 | 'use strict';
|
1115 | var Suite = require('../suite');
|
1116 | var Test = require('../test');
|
1117 |
|
1118 |
|
1119 |
|
1120 |
|
1121 |
|
1122 |
|
1123 |
|
1124 |
|
1125 |
|
1126 |
|
1127 |
|
1128 |
|
1129 |
|
1130 |
|
1131 |
|
1132 |
|
1133 |
|
1134 |
|
1135 | module.exports = function(suite) {
|
1136 | var suites = [suite];
|
1137 |
|
1138 | suite.on(Suite.constants.EVENT_FILE_REQUIRE, visit);
|
1139 |
|
1140 | function visit(obj, file) {
|
1141 | var suite;
|
1142 | for (var key in obj) {
|
1143 | if (typeof obj[key] === 'function') {
|
1144 | var fn = obj[key];
|
1145 | switch (key) {
|
1146 | case 'before':
|
1147 | suites[0].beforeAll(fn);
|
1148 | break;
|
1149 | case 'after':
|
1150 | suites[0].afterAll(fn);
|
1151 | break;
|
1152 | case 'beforeEach':
|
1153 | suites[0].beforeEach(fn);
|
1154 | break;
|
1155 | case 'afterEach':
|
1156 | suites[0].afterEach(fn);
|
1157 | break;
|
1158 | default:
|
1159 | var test = new Test(key, fn);
|
1160 | test.file = file;
|
1161 | suites[0].addTest(test);
|
1162 | }
|
1163 | } else {
|
1164 | suite = Suite.create(suites[0], key);
|
1165 | suites.unshift(suite);
|
1166 | visit(obj[key], file);
|
1167 | suites.shift();
|
1168 | }
|
1169 | }
|
1170 | }
|
1171 | };
|
1172 |
|
1173 | module.exports.description = 'Node.js module ("exports") style';
|
1174 |
|
1175 | },{"../suite":36,"../test":37}],11:[function(require,module,exports){
|
1176 | 'use strict';
|
1177 |
|
1178 | exports.bdd = require('./bdd');
|
1179 | exports.tdd = require('./tdd');
|
1180 | exports.qunit = require('./qunit');
|
1181 | exports.exports = require('./exports');
|
1182 |
|
1183 | },{"./bdd":8,"./exports":10,"./qunit":12,"./tdd":13}],12:[function(require,module,exports){
|
1184 | 'use strict';
|
1185 |
|
1186 | var Test = require('../test');
|
1187 | var EVENT_FILE_PRE_REQUIRE = require('../suite').constants
|
1188 | .EVENT_FILE_PRE_REQUIRE;
|
1189 |
|
1190 |
|
1191 |
|
1192 |
|
1193 |
|
1194 |
|
1195 |
|
1196 |
|
1197 |
|
1198 |
|
1199 |
|
1200 |
|
1201 |
|
1202 |
|
1203 |
|
1204 |
|
1205 |
|
1206 |
|
1207 |
|
1208 |
|
1209 |
|
1210 |
|
1211 |
|
1212 |
|
1213 |
|
1214 |
|
1215 | module.exports = function qUnitInterface(suite) {
|
1216 | var suites = [suite];
|
1217 |
|
1218 | suite.on(EVENT_FILE_PRE_REQUIRE, function(context, file, mocha) {
|
1219 | var common = require('./common')(suites, context, mocha);
|
1220 |
|
1221 | context.before = common.before;
|
1222 | context.after = common.after;
|
1223 | context.beforeEach = common.beforeEach;
|
1224 | context.afterEach = common.afterEach;
|
1225 | context.run = mocha.options.delay && common.runWithSuite(suite);
|
1226 | |
1227 |
|
1228 |
|
1229 |
|
1230 | context.suite = function(title) {
|
1231 | if (suites.length > 1) {
|
1232 | suites.shift();
|
1233 | }
|
1234 | return common.suite.create({
|
1235 | title: title,
|
1236 | file: file,
|
1237 | fn: false
|
1238 | });
|
1239 | };
|
1240 |
|
1241 | |
1242 |
|
1243 |
|
1244 |
|
1245 | context.suite.only = function(title) {
|
1246 | if (suites.length > 1) {
|
1247 | suites.shift();
|
1248 | }
|
1249 | return common.suite.only({
|
1250 | title: title,
|
1251 | file: file,
|
1252 | fn: false
|
1253 | });
|
1254 | };
|
1255 |
|
1256 | |
1257 |
|
1258 |
|
1259 |
|
1260 |
|
1261 |
|
1262 | context.test = function(title, fn) {
|
1263 | var test = new Test(title, fn);
|
1264 | test.file = file;
|
1265 | suites[0].addTest(test);
|
1266 | return test;
|
1267 | };
|
1268 |
|
1269 | |
1270 |
|
1271 |
|
1272 |
|
1273 | context.test.only = function(title, fn) {
|
1274 | return common.test.only(mocha, context.test(title, fn));
|
1275 | };
|
1276 |
|
1277 | context.test.skip = common.test.skip;
|
1278 | context.test.retries = common.test.retries;
|
1279 | });
|
1280 | };
|
1281 |
|
1282 | module.exports.description = 'QUnit style';
|
1283 |
|
1284 | },{"../suite":36,"../test":37,"./common":9}],13:[function(require,module,exports){
|
1285 | 'use strict';
|
1286 |
|
1287 | var Test = require('../test');
|
1288 | var EVENT_FILE_PRE_REQUIRE = require('../suite').constants
|
1289 | .EVENT_FILE_PRE_REQUIRE;
|
1290 |
|
1291 |
|
1292 |
|
1293 |
|
1294 |
|
1295 |
|
1296 |
|
1297 |
|
1298 |
|
1299 |
|
1300 |
|
1301 |
|
1302 |
|
1303 |
|
1304 |
|
1305 |
|
1306 |
|
1307 |
|
1308 |
|
1309 |
|
1310 |
|
1311 |
|
1312 |
|
1313 |
|
1314 |
|
1315 |
|
1316 | module.exports = function(suite) {
|
1317 | var suites = [suite];
|
1318 |
|
1319 | suite.on(EVENT_FILE_PRE_REQUIRE, function(context, file, mocha) {
|
1320 | var common = require('./common')(suites, context, mocha);
|
1321 |
|
1322 | context.setup = common.beforeEach;
|
1323 | context.teardown = common.afterEach;
|
1324 | context.suiteSetup = common.before;
|
1325 | context.suiteTeardown = common.after;
|
1326 | context.run = mocha.options.delay && common.runWithSuite(suite);
|
1327 |
|
1328 | |
1329 |
|
1330 |
|
1331 |
|
1332 | context.suite = function(title, fn) {
|
1333 | return common.suite.create({
|
1334 | title: title,
|
1335 | file: file,
|
1336 | fn: fn
|
1337 | });
|
1338 | };
|
1339 |
|
1340 | |
1341 |
|
1342 |
|
1343 | context.suite.skip = function(title, fn) {
|
1344 | return common.suite.skip({
|
1345 | title: title,
|
1346 | file: file,
|
1347 | fn: fn
|
1348 | });
|
1349 | };
|
1350 |
|
1351 | |
1352 |
|
1353 |
|
1354 | context.suite.only = function(title, fn) {
|
1355 | return common.suite.only({
|
1356 | title: title,
|
1357 | file: file,
|
1358 | fn: fn
|
1359 | });
|
1360 | };
|
1361 |
|
1362 | |
1363 |
|
1364 |
|
1365 |
|
1366 | context.test = function(title, fn) {
|
1367 | var suite = suites[0];
|
1368 | if (suite.isPending()) {
|
1369 | fn = null;
|
1370 | }
|
1371 | var test = new Test(title, fn);
|
1372 | test.file = file;
|
1373 | suite.addTest(test);
|
1374 | return test;
|
1375 | };
|
1376 |
|
1377 | |
1378 |
|
1379 |
|
1380 |
|
1381 | context.test.only = function(title, fn) {
|
1382 | return common.test.only(mocha, context.test(title, fn));
|
1383 | };
|
1384 |
|
1385 | context.test.skip = common.test.skip;
|
1386 | context.test.retries = common.test.retries;
|
1387 | });
|
1388 | };
|
1389 |
|
1390 | module.exports.description =
|
1391 | 'traditional "suite"/"test" instead of BDD\'s "describe"/"it"';
|
1392 |
|
1393 | },{"../suite":36,"../test":37,"./common":9}],14:[function(require,module,exports){
|
1394 | (function (process,global){
|
1395 | 'use strict';
|
1396 |
|
1397 |
|
1398 |
|
1399 |
|
1400 |
|
1401 |
|
1402 |
|
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;
|
1419 |
|
1420 | exports = module.exports = Mocha;
|
1421 |
|
1422 |
|
1423 |
|
1424 |
|
1425 |
|
1426 | if (!process.browser) {
|
1427 | var cwd = process.cwd();
|
1428 | module.paths.push(cwd, path.join(cwd, 'node_modules'));
|
1429 | }
|
1430 |
|
1431 |
|
1432 |
|
1433 |
|
1434 |
|
1435 |
|
1436 |
|
1437 |
|
1438 |
|
1439 |
|
1440 | exports.utils = utils;
|
1441 | exports.interfaces = require('./interfaces');
|
1442 |
|
1443 |
|
1444 |
|
1445 |
|
1446 | exports.reporters = builtinReporters;
|
1447 | exports.Runnable = require('./runnable');
|
1448 | exports.Context = require('./context');
|
1449 |
|
1450 |
|
1451 |
|
1452 |
|
1453 | exports.Runner = require('./runner');
|
1454 | exports.Suite = Suite;
|
1455 | exports.Hook = require('./hook');
|
1456 | exports.Test = require('./test');
|
1457 |
|
1458 |
|
1459 |
|
1460 |
|
1461 |
|
1462 |
|
1463 |
|
1464 |
|
1465 |
|
1466 |
|
1467 |
|
1468 |
|
1469 |
|
1470 |
|
1471 |
|
1472 |
|
1473 |
|
1474 |
|
1475 |
|
1476 |
|
1477 |
|
1478 |
|
1479 |
|
1480 |
|
1481 |
|
1482 |
|
1483 |
|
1484 |
|
1485 |
|
1486 |
|
1487 |
|
1488 | function Mocha(options) {
|
1489 | options = utils.assign({}, mocharc, options || {});
|
1490 | this.files = [];
|
1491 | this.options = options;
|
1492 |
|
1493 | this.suite = new exports.Suite('', new exports.Context(), true);
|
1494 |
|
1495 | this.grep(options.grep)
|
1496 | .fgrep(options.fgrep)
|
1497 | .ui(options.ui)
|
1498 | .reporter(options.reporter, options.reporterOption)
|
1499 | .slow(options.slow)
|
1500 | .global(options.global);
|
1501 |
|
1502 |
|
1503 | if (typeof options.timeout !== 'undefined') {
|
1504 | this.timeout(options.timeout === false ? 0 : options.timeout);
|
1505 | }
|
1506 |
|
1507 | if ('retries' in options) {
|
1508 | this.retries(options.retries);
|
1509 | }
|
1510 |
|
1511 | [
|
1512 | 'allowUncaught',
|
1513 | 'asyncOnly',
|
1514 | 'bail',
|
1515 | 'checkLeaks',
|
1516 | 'color',
|
1517 | 'delay',
|
1518 | 'diff',
|
1519 | 'forbidOnly',
|
1520 | 'forbidPending',
|
1521 | 'fullTrace',
|
1522 | 'growl',
|
1523 | 'inlineDiffs',
|
1524 | 'invert'
|
1525 | ].forEach(function(opt) {
|
1526 | if (options[opt]) {
|
1527 | this[opt]();
|
1528 | }
|
1529 | }, this);
|
1530 | }
|
1531 |
|
1532 |
|
1533 |
|
1534 |
|
1535 |
|
1536 |
|
1537 |
|
1538 |
|
1539 |
|
1540 |
|
1541 | Mocha.prototype.bail = function(bail) {
|
1542 | this.suite.bail(bail !== false);
|
1543 | return this;
|
1544 | };
|
1545 |
|
1546 |
|
1547 |
|
1548 |
|
1549 |
|
1550 |
|
1551 |
|
1552 |
|
1553 |
|
1554 |
|
1555 |
|
1556 |
|
1557 |
|
1558 |
|
1559 | Mocha.prototype.addFile = function(file) {
|
1560 | this.files.push(file);
|
1561 | return this;
|
1562 | };
|
1563 |
|
1564 |
|
1565 |
|
1566 |
|
1567 |
|
1568 |
|
1569 |
|
1570 |
|
1571 |
|
1572 |
|
1573 |
|
1574 |
|
1575 |
|
1576 |
|
1577 |
|
1578 |
|
1579 |
|
1580 | Mocha.prototype.reporter = function(reporter, reporterOptions) {
|
1581 | if (typeof reporter === 'function') {
|
1582 | this._reporter = reporter;
|
1583 | } else {
|
1584 | reporter = reporter || 'spec';
|
1585 | var _reporter;
|
1586 |
|
1587 | if (builtinReporters[reporter]) {
|
1588 | _reporter = builtinReporters[reporter];
|
1589 | }
|
1590 |
|
1591 | if (!_reporter) {
|
1592 | try {
|
1593 | _reporter = require(reporter);
|
1594 | } catch (err) {
|
1595 | if (
|
1596 | err.code !== 'MODULE_NOT_FOUND' ||
|
1597 | err.message.indexOf('Cannot find module') !== -1
|
1598 | ) {
|
1599 |
|
1600 | try {
|
1601 | _reporter = require(path.resolve(process.cwd(), reporter));
|
1602 | } catch (_err) {
|
1603 | _err.code !== 'MODULE_NOT_FOUND' ||
|
1604 | _err.message.indexOf('Cannot find module') !== -1
|
1605 | ? console.warn(sQuote(reporter) + ' reporter not found')
|
1606 | : console.warn(
|
1607 | sQuote(reporter) +
|
1608 | ' reporter blew up with error:\n' +
|
1609 | err.stack
|
1610 | );
|
1611 | }
|
1612 | } else {
|
1613 | console.warn(
|
1614 | sQuote(reporter) + ' reporter blew up with error:\n' + err.stack
|
1615 | );
|
1616 | }
|
1617 | }
|
1618 | }
|
1619 | if (!_reporter) {
|
1620 | throw createInvalidReporterError(
|
1621 | 'invalid reporter ' + sQuote(reporter),
|
1622 | reporter
|
1623 | );
|
1624 | }
|
1625 | this._reporter = _reporter;
|
1626 | }
|
1627 | this.options.reporterOption = reporterOptions;
|
1628 |
|
1629 | this.options.reporterOptions = reporterOptions;
|
1630 | return this;
|
1631 | };
|
1632 |
|
1633 |
|
1634 |
|
1635 |
|
1636 |
|
1637 |
|
1638 |
|
1639 |
|
1640 |
|
1641 |
|
1642 |
|
1643 |
|
1644 | Mocha.prototype.ui = function(ui) {
|
1645 | var bindInterface;
|
1646 | if (typeof ui === 'function') {
|
1647 | bindInterface = ui;
|
1648 | } else {
|
1649 | ui = ui || 'bdd';
|
1650 | bindInterface = exports.interfaces[ui];
|
1651 | if (!bindInterface) {
|
1652 | try {
|
1653 | bindInterface = require(ui);
|
1654 | } catch (err) {
|
1655 | throw createInvalidInterfaceError(
|
1656 | 'invalid interface ' + sQuote(ui),
|
1657 | ui
|
1658 | );
|
1659 | }
|
1660 | }
|
1661 | }
|
1662 | bindInterface(this.suite);
|
1663 |
|
1664 | this.suite.on(EVENT_FILE_PRE_REQUIRE, function(context) {
|
1665 | exports.afterEach = context.afterEach || context.teardown;
|
1666 | exports.after = context.after || context.suiteTeardown;
|
1667 | exports.beforeEach = context.beforeEach || context.setup;
|
1668 | exports.before = context.before || context.suiteSetup;
|
1669 | exports.describe = context.describe || context.suite;
|
1670 | exports.it = context.it || context.test;
|
1671 | exports.xit = context.xit || (context.test && context.test.skip);
|
1672 | exports.setup = context.setup || context.beforeEach;
|
1673 | exports.suiteSetup = context.suiteSetup || context.before;
|
1674 | exports.suiteTeardown = context.suiteTeardown || context.after;
|
1675 | exports.suite = context.suite || context.describe;
|
1676 | exports.teardown = context.teardown || context.afterEach;
|
1677 | exports.test = context.test || context.it;
|
1678 | exports.run = context.run;
|
1679 | });
|
1680 |
|
1681 | return this;
|
1682 | };
|
1683 |
|
1684 |
|
1685 |
|
1686 |
|
1687 |
|
1688 |
|
1689 |
|
1690 |
|
1691 |
|
1692 |
|
1693 |
|
1694 |
|
1695 |
|
1696 |
|
1697 |
|
1698 |
|
1699 | Mocha.prototype.loadFiles = function(fn) {
|
1700 | var self = this;
|
1701 | var suite = this.suite;
|
1702 | this.files.forEach(function(file) {
|
1703 | file = path.resolve(file);
|
1704 | suite.emit(EVENT_FILE_PRE_REQUIRE, global, file, self);
|
1705 | suite.emit(EVENT_FILE_REQUIRE, require(file), file, self);
|
1706 | suite.emit(EVENT_FILE_POST_REQUIRE, global, file, self);
|
1707 | });
|
1708 | fn && fn();
|
1709 | };
|
1710 |
|
1711 |
|
1712 |
|
1713 |
|
1714 |
|
1715 |
|
1716 |
|
1717 |
|
1718 |
|
1719 |
|
1720 |
|
1721 |
|
1722 |
|
1723 |
|
1724 |
|
1725 |
|
1726 | Mocha.prototype.loadFilesAsync = function() {
|
1727 | var self = this;
|
1728 | var suite = this.suite;
|
1729 |
|
1730 | if (!esmUtils) {
|
1731 | return new Promise(function(resolve) {
|
1732 | self.loadFiles(resolve);
|
1733 | });
|
1734 | }
|
1735 |
|
1736 | return esmUtils.loadFilesAsync(
|
1737 | this.files,
|
1738 | function(file) {
|
1739 | suite.emit(EVENT_FILE_PRE_REQUIRE, global, file, self);
|
1740 | },
|
1741 | function(file, resultModule) {
|
1742 | suite.emit(EVENT_FILE_REQUIRE, resultModule, file, self);
|
1743 | suite.emit(EVENT_FILE_POST_REQUIRE, global, file, self);
|
1744 | }
|
1745 | );
|
1746 | };
|
1747 |
|
1748 |
|
1749 |
|
1750 |
|
1751 |
|
1752 |
|
1753 |
|
1754 |
|
1755 |
|
1756 | Mocha.unloadFile = function(file) {
|
1757 | delete require.cache[require.resolve(file)];
|
1758 | };
|
1759 |
|
1760 |
|
1761 |
|
1762 |
|
1763 |
|
1764 |
|
1765 |
|
1766 |
|
1767 |
|
1768 |
|
1769 |
|
1770 |
|
1771 |
|
1772 |
|
1773 |
|
1774 | Mocha.prototype.unloadFiles = function() {
|
1775 | this.files.forEach(Mocha.unloadFile);
|
1776 | return this;
|
1777 | };
|
1778 |
|
1779 |
|
1780 |
|
1781 |
|
1782 |
|
1783 |
|
1784 |
|
1785 |
|
1786 |
|
1787 |
|
1788 |
|
1789 |
|
1790 |
|
1791 |
|
1792 | Mocha.prototype.fgrep = function(str) {
|
1793 | if (!str) {
|
1794 | return this;
|
1795 | }
|
1796 | return this.grep(new RegExp(escapeRe(str)));
|
1797 | };
|
1798 |
|
1799 |
|
1800 |
|
1801 |
|
1802 |
|
1803 |
|
1804 |
|
1805 |
|
1806 |
|
1807 |
|
1808 |
|
1809 |
|
1810 |
|
1811 |
|
1812 |
|
1813 |
|
1814 |
|
1815 |
|
1816 |
|
1817 |
|
1818 |
|
1819 |
|
1820 |
|
1821 |
|
1822 |
|
1823 |
|
1824 |
|
1825 |
|
1826 |
|
1827 |
|
1828 |
|
1829 |
|
1830 |
|
1831 |
|
1832 |
|
1833 | Mocha.prototype.grep = function(re) {
|
1834 | if (utils.isString(re)) {
|
1835 |
|
1836 | var arg = re.match(/^\/(.*)\/(g|i|)$|.*/);
|
1837 | this.options.grep = new RegExp(arg[1] || arg[0], arg[2]);
|
1838 | } else {
|
1839 | this.options.grep = re;
|
1840 | }
|
1841 | return this;
|
1842 | };
|
1843 |
|
1844 |
|
1845 |
|
1846 |
|
1847 |
|
1848 |
|
1849 |
|
1850 |
|
1851 |
|
1852 |
|
1853 |
|
1854 |
|
1855 |
|
1856 | Mocha.prototype.invert = function() {
|
1857 | this.options.invert = true;
|
1858 | return this;
|
1859 | };
|
1860 |
|
1861 |
|
1862 |
|
1863 |
|
1864 |
|
1865 |
|
1866 |
|
1867 |
|
1868 |
|
1869 |
|
1870 |
|
1871 | Mocha.prototype.ignoreLeaks = function(ignoreLeaks) {
|
1872 | utils.deprecate(
|
1873 | '"ignoreLeaks()" is DEPRECATED, please use "checkLeaks()" instead.'
|
1874 | );
|
1875 | this.options.checkLeaks = !ignoreLeaks;
|
1876 | return this;
|
1877 | };
|
1878 |
|
1879 |
|
1880 |
|
1881 |
|
1882 |
|
1883 |
|
1884 |
|
1885 |
|
1886 |
|
1887 |
|
1888 | Mocha.prototype.checkLeaks = function(checkLeaks) {
|
1889 | this.options.checkLeaks = checkLeaks !== false;
|
1890 | return this;
|
1891 | };
|
1892 |
|
1893 |
|
1894 |
|
1895 |
|
1896 |
|
1897 |
|
1898 |
|
1899 |
|
1900 |
|
1901 |
|
1902 | Mocha.prototype.fullTrace = function(fullTrace) {
|
1903 | this.options.fullTrace = fullTrace !== false;
|
1904 | return this;
|
1905 | };
|
1906 |
|
1907 |
|
1908 |
|
1909 |
|
1910 |
|
1911 |
|
1912 |
|
1913 |
|
1914 |
|
1915 | Mocha.prototype.growl = function() {
|
1916 | this.options.growl = this.isGrowlCapable();
|
1917 | if (!this.options.growl) {
|
1918 | var detail = process.browser
|
1919 | ? 'notification support not available in this browser...'
|
1920 | : 'notification support prerequisites not installed...';
|
1921 | console.error(detail + ' cannot enable!');
|
1922 | }
|
1923 | return this;
|
1924 | };
|
1925 |
|
1926 |
|
1927 |
|
1928 |
|
1929 |
|
1930 |
|
1931 |
|
1932 |
|
1933 |
|
1934 |
|
1935 |
|
1936 |
|
1937 |
|
1938 | Mocha.prototype.isGrowlCapable = growl.isCapable;
|
1939 |
|
1940 |
|
1941 |
|
1942 |
|
1943 |
|
1944 |
|
1945 |
|
1946 |
|
1947 |
|
1948 | Mocha.prototype._growl = growl.notify;
|
1949 |
|
1950 |
|
1951 |
|
1952 |
|
1953 |
|
1954 |
|
1955 |
|
1956 |
|
1957 |
|
1958 |
|
1959 |
|
1960 |
|
1961 |
|
1962 |
|
1963 |
|
1964 | Mocha.prototype.global = function(global) {
|
1965 | this.options.global = (this.options.global || [])
|
1966 | .concat(global)
|
1967 | .filter(Boolean)
|
1968 | .filter(function(elt, idx, arr) {
|
1969 | return arr.indexOf(elt) === idx;
|
1970 | });
|
1971 | return this;
|
1972 | };
|
1973 |
|
1974 | Mocha.prototype.globals = Mocha.prototype.global;
|
1975 |
|
1976 |
|
1977 |
|
1978 |
|
1979 |
|
1980 |
|
1981 |
|
1982 |
|
1983 |
|
1984 |
|
1985 |
|
1986 | Mocha.prototype.useColors = function(colors) {
|
1987 | utils.deprecate('"useColors()" is DEPRECATED, please use "color()" instead.');
|
1988 | if (colors !== undefined) {
|
1989 | this.options.color = colors;
|
1990 | }
|
1991 | return this;
|
1992 | };
|
1993 |
|
1994 |
|
1995 |
|
1996 |
|
1997 |
|
1998 |
|
1999 |
|
2000 |
|
2001 |
|
2002 |
|
2003 | Mocha.prototype.color = function(color) {
|
2004 | this.options.color = color !== false;
|
2005 | return this;
|
2006 | };
|
2007 |
|
2008 |
|
2009 |
|
2010 |
|
2011 |
|
2012 |
|
2013 |
|
2014 |
|
2015 |
|
2016 |
|
2017 |
|
2018 |
|
2019 | Mocha.prototype.useInlineDiffs = function(inlineDiffs) {
|
2020 | utils.deprecate(
|
2021 | '"useInlineDiffs()" is DEPRECATED, please use "inlineDiffs()" instead.'
|
2022 | );
|
2023 | this.options.inlineDiffs = inlineDiffs !== undefined && inlineDiffs;
|
2024 | return this;
|
2025 | };
|
2026 |
|
2027 |
|
2028 |
|
2029 |
|
2030 |
|
2031 |
|
2032 |
|
2033 |
|
2034 |
|
2035 |
|
2036 |
|
2037 | Mocha.prototype.inlineDiffs = function(inlineDiffs) {
|
2038 | this.options.inlineDiffs = inlineDiffs !== false;
|
2039 | return this;
|
2040 | };
|
2041 |
|
2042 |
|
2043 |
|
2044 |
|
2045 |
|
2046 |
|
2047 |
|
2048 |
|
2049 |
|
2050 |
|
2051 |
|
2052 | Mocha.prototype.hideDiff = function(hideDiff) {
|
2053 | utils.deprecate('"hideDiff()" is DEPRECATED, please use "diff()" instead.');
|
2054 | this.options.diff = !(hideDiff === true);
|
2055 | return this;
|
2056 | };
|
2057 |
|
2058 |
|
2059 |
|
2060 |
|
2061 |
|
2062 |
|
2063 |
|
2064 |
|
2065 |
|
2066 |
|
2067 | Mocha.prototype.diff = function(diff) {
|
2068 | this.options.diff = diff !== false;
|
2069 | return this;
|
2070 | };
|
2071 |
|
2072 |
|
2073 |
|
2074 |
|
2075 |
|
2076 |
|
2077 |
|
2078 |
|
2079 |
|
2080 |
|
2081 |
|
2082 |
|
2083 |
|
2084 |
|
2085 |
|
2086 |
|
2087 |
|
2088 |
|
2089 |
|
2090 |
|
2091 |
|
2092 |
|
2093 |
|
2094 |
|
2095 |
|
2096 | Mocha.prototype.timeout = function(msecs) {
|
2097 | this.suite.timeout(msecs);
|
2098 | return this;
|
2099 | };
|
2100 |
|
2101 |
|
2102 |
|
2103 |
|
2104 |
|
2105 |
|
2106 |
|
2107 |
|
2108 |
|
2109 |
|
2110 |
|
2111 |
|
2112 |
|
2113 |
|
2114 |
|
2115 | Mocha.prototype.retries = function(n) {
|
2116 | this.suite.retries(n);
|
2117 | return this;
|
2118 | };
|
2119 |
|
2120 |
|
2121 |
|
2122 |
|
2123 |
|
2124 |
|
2125 |
|
2126 |
|
2127 |
|
2128 |
|
2129 |
|
2130 |
|
2131 |
|
2132 |
|
2133 |
|
2134 |
|
2135 |
|
2136 |
|
2137 | Mocha.prototype.slow = function(msecs) {
|
2138 | this.suite.slow(msecs);
|
2139 | return this;
|
2140 | };
|
2141 |
|
2142 |
|
2143 |
|
2144 |
|
2145 |
|
2146 |
|
2147 |
|
2148 |
|
2149 |
|
2150 |
|
2151 | Mocha.prototype.enableTimeouts = function(enableTimeouts) {
|
2152 | this.suite.enableTimeouts(
|
2153 | arguments.length && enableTimeouts !== undefined ? enableTimeouts : true
|
2154 | );
|
2155 | return this;
|
2156 | };
|
2157 |
|
2158 |
|
2159 |
|
2160 |
|
2161 |
|
2162 |
|
2163 |
|
2164 |
|
2165 |
|
2166 |
|
2167 | Mocha.prototype.asyncOnly = function(asyncOnly) {
|
2168 | this.options.asyncOnly = asyncOnly !== false;
|
2169 | return this;
|
2170 | };
|
2171 |
|
2172 |
|
2173 |
|
2174 |
|
2175 |
|
2176 |
|
2177 |
|
2178 |
|
2179 | Mocha.prototype.noHighlighting = function() {
|
2180 | this.options.noHighlighting = true;
|
2181 | return this;
|
2182 | };
|
2183 |
|
2184 |
|
2185 |
|
2186 |
|
2187 |
|
2188 |
|
2189 |
|
2190 |
|
2191 |
|
2192 |
|
2193 | Mocha.prototype.allowUncaught = function(allowUncaught) {
|
2194 | this.options.allowUncaught = allowUncaught !== false;
|
2195 | return this;
|
2196 | };
|
2197 |
|
2198 |
|
2199 |
|
2200 |
|
2201 |
|
2202 |
|
2203 |
|
2204 |
|
2205 |
|
2206 |
|
2207 |
|
2208 |
|
2209 |
|
2210 | Mocha.prototype.delay = function delay() {
|
2211 | this.options.delay = true;
|
2212 | return this;
|
2213 | };
|
2214 |
|
2215 |
|
2216 |
|
2217 |
|
2218 |
|
2219 |
|
2220 |
|
2221 |
|
2222 |
|
2223 |
|
2224 | Mocha.prototype.forbidOnly = function(forbidOnly) {
|
2225 | this.options.forbidOnly = forbidOnly !== false;
|
2226 | return this;
|
2227 | };
|
2228 |
|
2229 |
|
2230 |
|
2231 |
|
2232 |
|
2233 |
|
2234 |
|
2235 |
|
2236 |
|
2237 |
|
2238 | Mocha.prototype.forbidPending = function(forbidPending) {
|
2239 | this.options.forbidPending = forbidPending !== false;
|
2240 | return this;
|
2241 | };
|
2242 |
|
2243 |
|
2244 |
|
2245 |
|
2246 |
|
2247 |
|
2248 |
|
2249 |
|
2250 | Object.defineProperty(Mocha.prototype, 'version', {
|
2251 | value: require('../package.json').version,
|
2252 | configurable: false,
|
2253 | enumerable: true,
|
2254 | writable: false
|
2255 | });
|
2256 |
|
2257 |
|
2258 |
|
2259 |
|
2260 |
|
2261 |
|
2262 |
|
2263 |
|
2264 |
|
2265 |
|
2266 |
|
2267 |
|
2268 |
|
2269 |
|
2270 |
|
2271 |
|
2272 |
|
2273 |
|
2274 |
|
2275 |
|
2276 |
|
2277 |
|
2278 |
|
2279 |
|
2280 |
|
2281 |
|
2282 | Mocha.prototype.run = function(fn) {
|
2283 | if (this.files.length) {
|
2284 | this.loadFiles();
|
2285 | }
|
2286 | return this._startRunning(fn);
|
2287 | };
|
2288 |
|
2289 | Mocha.prototype._startRunning = function(fn) {
|
2290 | var self = this;
|
2291 | var suite = self.suite;
|
2292 | var options = self.options;
|
2293 | options.files = self.files;
|
2294 | var runner = new exports.Runner(suite, options.delay);
|
2295 | createStatsCollector(runner);
|
2296 | var reporter = new self._reporter(runner, options);
|
2297 | runner.checkLeaks = options.checkLeaks === true;
|
2298 | runner.fullStackTrace = options.fullTrace;
|
2299 | runner.asyncOnly = options.asyncOnly;
|
2300 | runner.allowUncaught = options.allowUncaught;
|
2301 | runner.forbidOnly = options.forbidOnly;
|
2302 | runner.forbidPending = options.forbidPending;
|
2303 | if (options.grep) {
|
2304 | runner.grep(options.grep, options.invert);
|
2305 | }
|
2306 | if (options.global) {
|
2307 | runner.globals(options.global);
|
2308 | }
|
2309 | if (options.growl) {
|
2310 | self._growl(runner);
|
2311 | }
|
2312 | if (options.color !== undefined) {
|
2313 | exports.reporters.Base.useColors = options.color;
|
2314 | }
|
2315 | exports.reporters.Base.inlineDiffs = options.inlineDiffs;
|
2316 | exports.reporters.Base.hideDiff = !options.diff;
|
2317 |
|
2318 | function done(failures) {
|
2319 | fn = fn || utils.noop;
|
2320 | if (reporter.done) {
|
2321 | reporter.done(failures, fn);
|
2322 | } else {
|
2323 | fn(failures);
|
2324 | }
|
2325 | }
|
2326 |
|
2327 | return runner.run(done);
|
2328 | };
|
2329 |
|
2330 |
|
2331 |
|
2332 |
|
2333 |
|
2334 |
|
2335 |
|
2336 |
|
2337 |
|
2338 |
|
2339 |
|
2340 |
|
2341 |
|
2342 |
|
2343 |
|
2344 |
|
2345 | Mocha.prototype.runAsync = function() {
|
2346 | var loadResult = this.files.length
|
2347 | ? this.loadFilesAsync()
|
2348 | : Promise.resolve();
|
2349 |
|
2350 | var self = this;
|
2351 | return loadResult.then(function() {
|
2352 | return new Promise(function(resolve) {
|
2353 | self._startRunning(function(result) {
|
2354 | resolve(result);
|
2355 | });
|
2356 | });
|
2357 | });
|
2358 | };
|
2359 |
|
2360 | }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
2361 | },{"../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){
|
2362 | module.exports={
|
2363 | "diff": true,
|
2364 | "extension": ["js", "cjs", "mjs"],
|
2365 | "opts": "./test/mocha.opts",
|
2366 | "package": "./package.json",
|
2367 | "reporter": "spec",
|
2368 | "slow": 75,
|
2369 | "timeout": 2000,
|
2370 | "ui": "bdd",
|
2371 | "watch-ignore": ["node_modules", ".git"]
|
2372 | }
|
2373 |
|
2374 | },{}],16:[function(require,module,exports){
|
2375 | 'use strict';
|
2376 |
|
2377 | module.exports = Pending;
|
2378 |
|
2379 |
|
2380 |
|
2381 |
|
2382 |
|
2383 |
|
2384 | function Pending(message) {
|
2385 | this.message = message;
|
2386 | }
|
2387 |
|
2388 | },{}],17:[function(require,module,exports){
|
2389 | (function (process){
|
2390 | 'use strict';
|
2391 |
|
2392 |
|
2393 |
|
2394 |
|
2395 |
|
2396 |
|
2397 |
|
2398 | var tty = require('tty');
|
2399 | var diff = require('diff');
|
2400 | var milliseconds = require('ms');
|
2401 | var utils = require('../utils');
|
2402 | var supportsColor = process.browser ? null : require('supports-color');
|
2403 | var constants = require('../runner').constants;
|
2404 | var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
|
2405 | var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
|
2406 |
|
2407 |
|
2408 |
|
2409 |
|
2410 |
|
2411 | exports = module.exports = Base;
|
2412 |
|
2413 |
|
2414 |
|
2415 |
|
2416 |
|
2417 | var isatty = process.stdout.isTTY && process.stderr.isTTY;
|
2418 |
|
2419 |
|
2420 |
|
2421 |
|
2422 | var consoleLog = console.log;
|
2423 |
|
2424 |
|
2425 |
|
2426 |
|
2427 |
|
2428 | exports.useColors =
|
2429 | !process.browser &&
|
2430 | (supportsColor.stdout || process.env.MOCHA_COLORS !== undefined);
|
2431 |
|
2432 |
|
2433 |
|
2434 |
|
2435 |
|
2436 | exports.inlineDiffs = false;
|
2437 |
|
2438 |
|
2439 |
|
2440 |
|
2441 |
|
2442 | exports.colors = {
|
2443 | pass: 90,
|
2444 | fail: 31,
|
2445 | 'bright pass': 92,
|
2446 | 'bright fail': 91,
|
2447 | 'bright yellow': 93,
|
2448 | pending: 36,
|
2449 | suite: 0,
|
2450 | 'error title': 0,
|
2451 | 'error message': 31,
|
2452 | 'error stack': 90,
|
2453 | checkmark: 32,
|
2454 | fast: 90,
|
2455 | medium: 33,
|
2456 | slow: 31,
|
2457 | green: 32,
|
2458 | light: 90,
|
2459 | 'diff gutter': 90,
|
2460 | 'diff added': 32,
|
2461 | 'diff removed': 31
|
2462 | };
|
2463 |
|
2464 |
|
2465 |
|
2466 |
|
2467 |
|
2468 | exports.symbols = {
|
2469 | ok: '✓',
|
2470 | err: '✖',
|
2471 | dot: '․',
|
2472 | comma: ',',
|
2473 | bang: '!'
|
2474 | };
|
2475 |
|
2476 |
|
2477 | if (process.platform === 'win32') {
|
2478 | exports.symbols.ok = '\u221A';
|
2479 | exports.symbols.err = '\u00D7';
|
2480 | exports.symbols.dot = '.';
|
2481 | }
|
2482 |
|
2483 |
|
2484 |
|
2485 |
|
2486 |
|
2487 |
|
2488 |
|
2489 |
|
2490 |
|
2491 |
|
2492 |
|
2493 |
|
2494 | var color = (exports.color = function(type, str) {
|
2495 | if (!exports.useColors) {
|
2496 | return String(str);
|
2497 | }
|
2498 | return '\u001b[' + exports.colors[type] + 'm' + str + '\u001b[0m';
|
2499 | });
|
2500 |
|
2501 |
|
2502 |
|
2503 |
|
2504 |
|
2505 | exports.window = {
|
2506 | width: 75
|
2507 | };
|
2508 |
|
2509 | if (isatty) {
|
2510 | exports.window.width = process.stdout.getWindowSize
|
2511 | ? process.stdout.getWindowSize(1)[0]
|
2512 | : tty.getWindowSize()[1];
|
2513 | }
|
2514 |
|
2515 |
|
2516 |
|
2517 |
|
2518 |
|
2519 | exports.cursor = {
|
2520 | hide: function() {
|
2521 | isatty && process.stdout.write('\u001b[?25l');
|
2522 | },
|
2523 |
|
2524 | show: function() {
|
2525 | isatty && process.stdout.write('\u001b[?25h');
|
2526 | },
|
2527 |
|
2528 | deleteLine: function() {
|
2529 | isatty && process.stdout.write('\u001b[2K');
|
2530 | },
|
2531 |
|
2532 | beginningOfLine: function() {
|
2533 | isatty && process.stdout.write('\u001b[0G');
|
2534 | },
|
2535 |
|
2536 | CR: function() {
|
2537 | if (isatty) {
|
2538 | exports.cursor.deleteLine();
|
2539 | exports.cursor.beginningOfLine();
|
2540 | } else {
|
2541 | process.stdout.write('\r');
|
2542 | }
|
2543 | }
|
2544 | };
|
2545 |
|
2546 | var showDiff = (exports.showDiff = function(err) {
|
2547 | return (
|
2548 | err &&
|
2549 | err.showDiff !== false &&
|
2550 | sameType(err.actual, err.expected) &&
|
2551 | err.expected !== undefined
|
2552 | );
|
2553 | });
|
2554 |
|
2555 | function stringifyDiffObjs(err) {
|
2556 | if (!utils.isString(err.actual) || !utils.isString(err.expected)) {
|
2557 | err.actual = utils.stringify(err.actual);
|
2558 | err.expected = utils.stringify(err.expected);
|
2559 | }
|
2560 | }
|
2561 |
|
2562 |
|
2563 |
|
2564 |
|
2565 |
|
2566 |
|
2567 |
|
2568 |
|
2569 |
|
2570 |
|
2571 |
|
2572 |
|
2573 | var generateDiff = (exports.generateDiff = function(actual, expected) {
|
2574 | try {
|
2575 | return exports.inlineDiffs
|
2576 | ? inlineDiff(actual, expected)
|
2577 | : unifiedDiff(actual, expected);
|
2578 | } catch (err) {
|
2579 | var msg =
|
2580 | '\n ' +
|
2581 | color('diff added', '+ expected') +
|
2582 | ' ' +
|
2583 | color('diff removed', '- actual: failed to generate Mocha diff') +
|
2584 | '\n';
|
2585 | return msg;
|
2586 | }
|
2587 | });
|
2588 |
|
2589 |
|
2590 |
|
2591 |
|
2592 |
|
2593 |
|
2594 |
|
2595 |
|
2596 |
|
2597 |
|
2598 | exports.list = function(failures) {
|
2599 | var multipleErr, multipleTest;
|
2600 | Base.consoleLog();
|
2601 | failures.forEach(function(test, i) {
|
2602 |
|
2603 | var fmt =
|
2604 | color('error title', ' %s) %s:\n') +
|
2605 | color('error message', ' %s') +
|
2606 | color('error stack', '\n%s\n');
|
2607 |
|
2608 |
|
2609 | var msg;
|
2610 | var err;
|
2611 | if (test.err && test.err.multiple) {
|
2612 | if (multipleTest !== test) {
|
2613 | multipleTest = test;
|
2614 | multipleErr = [test.err].concat(test.err.multiple);
|
2615 | }
|
2616 | err = multipleErr.shift();
|
2617 | } else {
|
2618 | err = test.err;
|
2619 | }
|
2620 | var message;
|
2621 | if (err.message && typeof err.message.toString === 'function') {
|
2622 | message = err.message + '';
|
2623 | } else if (typeof err.inspect === 'function') {
|
2624 | message = err.inspect() + '';
|
2625 | } else {
|
2626 | message = '';
|
2627 | }
|
2628 | var stack = err.stack || message;
|
2629 | var index = message ? stack.indexOf(message) : -1;
|
2630 |
|
2631 | if (index === -1) {
|
2632 | msg = message;
|
2633 | } else {
|
2634 | index += message.length;
|
2635 | msg = stack.slice(0, index);
|
2636 |
|
2637 | stack = stack.slice(index + 1);
|
2638 | }
|
2639 |
|
2640 |
|
2641 | if (err.uncaught) {
|
2642 | msg = 'Uncaught ' + msg;
|
2643 | }
|
2644 |
|
2645 | if (!exports.hideDiff && showDiff(err)) {
|
2646 | stringifyDiffObjs(err);
|
2647 | fmt =
|
2648 | color('error title', ' %s) %s:\n%s') + color('error stack', '\n%s\n');
|
2649 | var match = message.match(/^([^:]+): expected/);
|
2650 | msg = '\n ' + color('error message', match ? match[1] : msg);
|
2651 |
|
2652 | msg += generateDiff(err.actual, err.expected);
|
2653 | }
|
2654 |
|
2655 |
|
2656 | stack = stack.replace(/^/gm, ' ');
|
2657 |
|
2658 |
|
2659 | var testTitle = '';
|
2660 | test.titlePath().forEach(function(str, index) {
|
2661 | if (index !== 0) {
|
2662 | testTitle += '\n ';
|
2663 | }
|
2664 | for (var i = 0; i < index; i++) {
|
2665 | testTitle += ' ';
|
2666 | }
|
2667 | testTitle += str;
|
2668 | });
|
2669 |
|
2670 | Base.consoleLog(fmt, i + 1, testTitle, msg, stack);
|
2671 | });
|
2672 | };
|
2673 |
|
2674 |
|
2675 |
|
2676 |
|
2677 |
|
2678 |
|
2679 |
|
2680 |
|
2681 |
|
2682 |
|
2683 |
|
2684 |
|
2685 |
|
2686 | function Base(runner, options) {
|
2687 | var failures = (this.failures = []);
|
2688 |
|
2689 | if (!runner) {
|
2690 | throw new TypeError('Missing runner argument');
|
2691 | }
|
2692 | this.options = options || {};
|
2693 | this.runner = runner;
|
2694 | this.stats = runner.stats;
|
2695 |
|
2696 | runner.on(EVENT_TEST_PASS, function(test) {
|
2697 | if (test.duration > test.slow()) {
|
2698 | test.speed = 'slow';
|
2699 | } else if (test.duration > test.slow() / 2) {
|
2700 | test.speed = 'medium';
|
2701 | } else {
|
2702 | test.speed = 'fast';
|
2703 | }
|
2704 | });
|
2705 |
|
2706 | runner.on(EVENT_TEST_FAIL, function(test, err) {
|
2707 | if (showDiff(err)) {
|
2708 | stringifyDiffObjs(err);
|
2709 | }
|
2710 |
|
2711 | if (test.err && err instanceof Error) {
|
2712 | test.err.multiple = (test.err.multiple || []).concat(err);
|
2713 | } else {
|
2714 | test.err = err;
|
2715 | }
|
2716 | failures.push(test);
|
2717 | });
|
2718 | }
|
2719 |
|
2720 |
|
2721 |
|
2722 |
|
2723 |
|
2724 |
|
2725 |
|
2726 | Base.prototype.epilogue = function() {
|
2727 | var stats = this.stats;
|
2728 | var fmt;
|
2729 |
|
2730 | Base.consoleLog();
|
2731 |
|
2732 |
|
2733 | fmt =
|
2734 | color('bright pass', ' ') +
|
2735 | color('green', ' %d passing') +
|
2736 | color('light', ' (%s)');
|
2737 |
|
2738 | Base.consoleLog(fmt, stats.passes || 0, milliseconds(stats.duration));
|
2739 |
|
2740 |
|
2741 | if (stats.pending) {
|
2742 | fmt = color('pending', ' ') + color('pending', ' %d pending');
|
2743 |
|
2744 | Base.consoleLog(fmt, stats.pending);
|
2745 | }
|
2746 |
|
2747 |
|
2748 | if (stats.failures) {
|
2749 | fmt = color('fail', ' %d failing');
|
2750 |
|
2751 | Base.consoleLog(fmt, stats.failures);
|
2752 |
|
2753 | Base.list(this.failures);
|
2754 | Base.consoleLog();
|
2755 | }
|
2756 |
|
2757 | Base.consoleLog();
|
2758 | };
|
2759 |
|
2760 |
|
2761 |
|
2762 |
|
2763 |
|
2764 |
|
2765 |
|
2766 |
|
2767 |
|
2768 | function pad(str, len) {
|
2769 | str = String(str);
|
2770 | return Array(len - str.length + 1).join(' ') + str;
|
2771 | }
|
2772 |
|
2773 |
|
2774 |
|
2775 |
|
2776 |
|
2777 |
|
2778 |
|
2779 |
|
2780 |
|
2781 | function inlineDiff(actual, expected) {
|
2782 | var msg = errorDiff(actual, expected);
|
2783 |
|
2784 |
|
2785 | var lines = msg.split('\n');
|
2786 | if (lines.length > 4) {
|
2787 | var width = String(lines.length).length;
|
2788 | msg = lines
|
2789 | .map(function(str, i) {
|
2790 | return pad(++i, width) + ' |' + ' ' + str;
|
2791 | })
|
2792 | .join('\n');
|
2793 | }
|
2794 |
|
2795 |
|
2796 | msg =
|
2797 | '\n' +
|
2798 | color('diff removed', 'actual') +
|
2799 | ' ' +
|
2800 | color('diff added', 'expected') +
|
2801 | '\n\n' +
|
2802 | msg +
|
2803 | '\n';
|
2804 |
|
2805 |
|
2806 | msg = msg.replace(/^/gm, ' ');
|
2807 | return msg;
|
2808 | }
|
2809 |
|
2810 |
|
2811 |
|
2812 |
|
2813 |
|
2814 |
|
2815 |
|
2816 |
|
2817 |
|
2818 | function unifiedDiff(actual, expected) {
|
2819 | var indent = ' ';
|
2820 | function cleanUp(line) {
|
2821 | if (line[0] === '+') {
|
2822 | return indent + colorLines('diff added', line);
|
2823 | }
|
2824 | if (line[0] === '-') {
|
2825 | return indent + colorLines('diff removed', line);
|
2826 | }
|
2827 | if (line.match(/@@/)) {
|
2828 | return '--';
|
2829 | }
|
2830 | if (line.match(/\\ No newline/)) {
|
2831 | return null;
|
2832 | }
|
2833 | return indent + line;
|
2834 | }
|
2835 | function notBlank(line) {
|
2836 | return typeof line !== 'undefined' && line !== null;
|
2837 | }
|
2838 | var msg = diff.createPatch('string', actual, expected);
|
2839 | var lines = msg.split('\n').splice(5);
|
2840 | return (
|
2841 | '\n ' +
|
2842 | colorLines('diff added', '+ expected') +
|
2843 | ' ' +
|
2844 | colorLines('diff removed', '- actual') +
|
2845 | '\n\n' +
|
2846 | lines
|
2847 | .map(cleanUp)
|
2848 | .filter(notBlank)
|
2849 | .join('\n')
|
2850 | );
|
2851 | }
|
2852 |
|
2853 |
|
2854 |
|
2855 |
|
2856 |
|
2857 |
|
2858 |
|
2859 |
|
2860 |
|
2861 | function errorDiff(actual, expected) {
|
2862 | return diff
|
2863 | .diffWordsWithSpace(actual, expected)
|
2864 | .map(function(str) {
|
2865 | if (str.added) {
|
2866 | return colorLines('diff added', str.value);
|
2867 | }
|
2868 | if (str.removed) {
|
2869 | return colorLines('diff removed', str.value);
|
2870 | }
|
2871 | return str.value;
|
2872 | })
|
2873 | .join('');
|
2874 | }
|
2875 |
|
2876 |
|
2877 |
|
2878 |
|
2879 |
|
2880 |
|
2881 |
|
2882 |
|
2883 |
|
2884 | function colorLines(name, str) {
|
2885 | return str
|
2886 | .split('\n')
|
2887 | .map(function(str) {
|
2888 | return color(name, str);
|
2889 | })
|
2890 | .join('\n');
|
2891 | }
|
2892 |
|
2893 |
|
2894 |
|
2895 |
|
2896 | var objToString = Object.prototype.toString;
|
2897 |
|
2898 |
|
2899 |
|
2900 |
|
2901 |
|
2902 |
|
2903 |
|
2904 |
|
2905 |
|
2906 | function sameType(a, b) {
|
2907 | return objToString.call(a) === objToString.call(b);
|
2908 | }
|
2909 |
|
2910 | Base.consoleLog = consoleLog;
|
2911 |
|
2912 | Base.abstract = true;
|
2913 |
|
2914 | }).call(this,require('_process'))
|
2915 | },{"../runner":34,"../utils":38,"_process":69,"diff":48,"ms":60,"supports-color":42,"tty":4}],18:[function(require,module,exports){
|
2916 | 'use strict';
|
2917 |
|
2918 |
|
2919 |
|
2920 |
|
2921 |
|
2922 |
|
2923 |
|
2924 | var Base = require('./base');
|
2925 | var utils = require('../utils');
|
2926 | var constants = require('../runner').constants;
|
2927 | var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
|
2928 | var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
|
2929 | var EVENT_SUITE_BEGIN = constants.EVENT_SUITE_BEGIN;
|
2930 | var EVENT_SUITE_END = constants.EVENT_SUITE_END;
|
2931 |
|
2932 |
|
2933 |
|
2934 |
|
2935 |
|
2936 | exports = module.exports = Doc;
|
2937 |
|
2938 |
|
2939 |
|
2940 |
|
2941 |
|
2942 |
|
2943 |
|
2944 |
|
2945 |
|
2946 |
|
2947 |
|
2948 | function Doc(runner, options) {
|
2949 | Base.call(this, runner, options);
|
2950 |
|
2951 | var indents = 2;
|
2952 |
|
2953 | function indent() {
|
2954 | return Array(indents).join(' ');
|
2955 | }
|
2956 |
|
2957 | runner.on(EVENT_SUITE_BEGIN, function(suite) {
|
2958 | if (suite.root) {
|
2959 | return;
|
2960 | }
|
2961 | ++indents;
|
2962 | Base.consoleLog('%s<section class="suite">', indent());
|
2963 | ++indents;
|
2964 | Base.consoleLog('%s<h1>%s</h1>', indent(), utils.escape(suite.title));
|
2965 | Base.consoleLog('%s<dl>', indent());
|
2966 | });
|
2967 |
|
2968 | runner.on(EVENT_SUITE_END, function(suite) {
|
2969 | if (suite.root) {
|
2970 | return;
|
2971 | }
|
2972 | Base.consoleLog('%s</dl>', indent());
|
2973 | --indents;
|
2974 | Base.consoleLog('%s</section>', indent());
|
2975 | --indents;
|
2976 | });
|
2977 |
|
2978 | runner.on(EVENT_TEST_PASS, function(test) {
|
2979 | Base.consoleLog('%s <dt>%s</dt>', indent(), utils.escape(test.title));
|
2980 | var code = utils.escape(utils.clean(test.body));
|
2981 | Base.consoleLog('%s <dd><pre><code>%s</code></pre></dd>', indent(), code);
|
2982 | });
|
2983 |
|
2984 | runner.on(EVENT_TEST_FAIL, function(test, err) {
|
2985 | Base.consoleLog(
|
2986 | '%s <dt class="error">%s</dt>',
|
2987 | indent(),
|
2988 | utils.escape(test.title)
|
2989 | );
|
2990 | var code = utils.escape(utils.clean(test.body));
|
2991 | Base.consoleLog(
|
2992 | '%s <dd class="error"><pre><code>%s</code></pre></dd>',
|
2993 | indent(),
|
2994 | code
|
2995 | );
|
2996 | Base.consoleLog(
|
2997 | '%s <dd class="error">%s</dd>',
|
2998 | indent(),
|
2999 | utils.escape(err)
|
3000 | );
|
3001 | });
|
3002 | }
|
3003 |
|
3004 | Doc.description = 'HTML documentation';
|
3005 |
|
3006 | },{"../runner":34,"../utils":38,"./base":17}],19:[function(require,module,exports){
|
3007 | (function (process){
|
3008 | 'use strict';
|
3009 |
|
3010 |
|
3011 |
|
3012 |
|
3013 |
|
3014 |
|
3015 |
|
3016 | var Base = require('./base');
|
3017 | var inherits = require('../utils').inherits;
|
3018 | var constants = require('../runner').constants;
|
3019 | var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
|
3020 | var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
|
3021 | var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
|
3022 | var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
|
3023 | var EVENT_RUN_END = constants.EVENT_RUN_END;
|
3024 |
|
3025 |
|
3026 |
|
3027 |
|
3028 |
|
3029 | exports = module.exports = Dot;
|
3030 |
|
3031 |
|
3032 |
|
3033 |
|
3034 |
|
3035 |
|
3036 |
|
3037 |
|
3038 |
|
3039 |
|
3040 |
|
3041 | function Dot(runner, options) {
|
3042 | Base.call(this, runner, options);
|
3043 |
|
3044 | var self = this;
|
3045 | var width = (Base.window.width * 0.75) | 0;
|
3046 | var n = -1;
|
3047 |
|
3048 | runner.on(EVENT_RUN_BEGIN, function() {
|
3049 | process.stdout.write('\n');
|
3050 | });
|
3051 |
|
3052 | runner.on(EVENT_TEST_PENDING, function() {
|
3053 | if (++n % width === 0) {
|
3054 | process.stdout.write('\n ');
|
3055 | }
|
3056 | process.stdout.write(Base.color('pending', Base.symbols.comma));
|
3057 | });
|
3058 |
|
3059 | runner.on(EVENT_TEST_PASS, function(test) {
|
3060 | if (++n % width === 0) {
|
3061 | process.stdout.write('\n ');
|
3062 | }
|
3063 | if (test.speed === 'slow') {
|
3064 | process.stdout.write(Base.color('bright yellow', Base.symbols.dot));
|
3065 | } else {
|
3066 | process.stdout.write(Base.color(test.speed, Base.symbols.dot));
|
3067 | }
|
3068 | });
|
3069 |
|
3070 | runner.on(EVENT_TEST_FAIL, function() {
|
3071 | if (++n % width === 0) {
|
3072 | process.stdout.write('\n ');
|
3073 | }
|
3074 | process.stdout.write(Base.color('fail', Base.symbols.bang));
|
3075 | });
|
3076 |
|
3077 | runner.once(EVENT_RUN_END, function() {
|
3078 | process.stdout.write('\n');
|
3079 | self.epilogue();
|
3080 | });
|
3081 | }
|
3082 |
|
3083 |
|
3084 |
|
3085 |
|
3086 | inherits(Dot, Base);
|
3087 |
|
3088 | Dot.description = 'dot matrix representation';
|
3089 |
|
3090 | }).call(this,require('_process'))
|
3091 | },{"../runner":34,"../utils":38,"./base":17,"_process":69}],20:[function(require,module,exports){
|
3092 | (function (global){
|
3093 | 'use strict';
|
3094 |
|
3095 |
|
3096 |
|
3097 |
|
3098 |
|
3099 |
|
3100 |
|
3101 |
|
3102 |
|
3103 | var Base = require('./base');
|
3104 | var utils = require('../utils');
|
3105 | var Progress = require('../browser/progress');
|
3106 | var escapeRe = require('escape-string-regexp');
|
3107 | var constants = require('../runner').constants;
|
3108 | var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
|
3109 | var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
|
3110 | var EVENT_SUITE_BEGIN = constants.EVENT_SUITE_BEGIN;
|
3111 | var EVENT_SUITE_END = constants.EVENT_SUITE_END;
|
3112 | var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
|
3113 | var escape = utils.escape;
|
3114 |
|
3115 |
|
3116 |
|
3117 |
|
3118 |
|
3119 | var Date = global.Date;
|
3120 |
|
3121 |
|
3122 |
|
3123 |
|
3124 |
|
3125 | exports = module.exports = HTML;
|
3126 |
|
3127 |
|
3128 |
|
3129 |
|
3130 |
|
3131 | var statsTemplate =
|
3132 | '<ul id="mocha-stats">' +
|
3133 | '<li class="progress"><canvas width="40" height="40"></canvas></li>' +
|
3134 | '<li class="passes"><a href="javascript:void(0);">passes:</a> <em>0</em></li>' +
|
3135 | '<li class="failures"><a href="javascript:void(0);">failures:</a> <em>0</em></li>' +
|
3136 | '<li class="duration">duration: <em>0</em>s</li>' +
|
3137 | '</ul>';
|
3138 |
|
3139 | var playIcon = '‣';
|
3140 |
|
3141 |
|
3142 |
|
3143 |
|
3144 |
|
3145 |
|
3146 |
|
3147 |
|
3148 |
|
3149 |
|
3150 |
|
3151 | function HTML(runner, options) {
|
3152 | Base.call(this, runner, options);
|
3153 |
|
3154 | var self = this;
|
3155 | var stats = this.stats;
|
3156 | var stat = fragment(statsTemplate);
|
3157 | var items = stat.getElementsByTagName('li');
|
3158 | var passes = items[1].getElementsByTagName('em')[0];
|
3159 | var passesLink = items[1].getElementsByTagName('a')[0];
|
3160 | var failures = items[2].getElementsByTagName('em')[0];
|
3161 | var failuresLink = items[2].getElementsByTagName('a')[0];
|
3162 | var duration = items[3].getElementsByTagName('em')[0];
|
3163 | var canvas = stat.getElementsByTagName('canvas')[0];
|
3164 | var report = fragment('<ul id="mocha-report"></ul>');
|
3165 | var stack = [report];
|
3166 | var progress;
|
3167 | var ctx;
|
3168 | var root = document.getElementById('mocha');
|
3169 |
|
3170 | if (canvas.getContext) {
|
3171 | var ratio = window.devicePixelRatio || 1;
|
3172 | canvas.style.width = canvas.width;
|
3173 | canvas.style.height = canvas.height;
|
3174 | canvas.width *= ratio;
|
3175 | canvas.height *= ratio;
|
3176 | ctx = canvas.getContext('2d');
|
3177 | ctx.scale(ratio, ratio);
|
3178 | progress = new Progress();
|
3179 | }
|
3180 |
|
3181 | if (!root) {
|
3182 | return error('#mocha div missing, add it to your document');
|
3183 | }
|
3184 |
|
3185 |
|
3186 | on(passesLink, 'click', function(evt) {
|
3187 | evt.preventDefault();
|
3188 | unhide();
|
3189 | var name = /pass/.test(report.className) ? '' : ' pass';
|
3190 | report.className = report.className.replace(/fail|pass/g, '') + name;
|
3191 | if (report.className.trim()) {
|
3192 | hideSuitesWithout('test pass');
|
3193 | }
|
3194 | });
|
3195 |
|
3196 |
|
3197 | on(failuresLink, 'click', function(evt) {
|
3198 | evt.preventDefault();
|
3199 | unhide();
|
3200 | var name = /fail/.test(report.className) ? '' : ' fail';
|
3201 | report.className = report.className.replace(/fail|pass/g, '') + name;
|
3202 | if (report.className.trim()) {
|
3203 | hideSuitesWithout('test fail');
|
3204 | }
|
3205 | });
|
3206 |
|
3207 | root.appendChild(stat);
|
3208 | root.appendChild(report);
|
3209 |
|
3210 | if (progress) {
|
3211 | progress.size(40);
|
3212 | }
|
3213 |
|
3214 | runner.on(EVENT_SUITE_BEGIN, function(suite) {
|
3215 | if (suite.root) {
|
3216 | return;
|
3217 | }
|
3218 |
|
3219 |
|
3220 | var url = self.suiteURL(suite);
|
3221 | var el = fragment(
|
3222 | '<li class="suite"><h1><a href="%s">%s</a></h1></li>',
|
3223 | url,
|
3224 | escape(suite.title)
|
3225 | );
|
3226 |
|
3227 |
|
3228 | stack[0].appendChild(el);
|
3229 | stack.unshift(document.createElement('ul'));
|
3230 | el.appendChild(stack[0]);
|
3231 | });
|
3232 |
|
3233 | runner.on(EVENT_SUITE_END, function(suite) {
|
3234 | if (suite.root) {
|
3235 | updateStats();
|
3236 | return;
|
3237 | }
|
3238 | stack.shift();
|
3239 | });
|
3240 |
|
3241 | runner.on(EVENT_TEST_PASS, function(test) {
|
3242 | var url = self.testURL(test);
|
3243 | var markup =
|
3244 | '<li class="test pass %e"><h2>%e<span class="duration">%ems</span> ' +
|
3245 | '<a href="%s" class="replay">' +
|
3246 | playIcon +
|
3247 | '</a></h2></li>';
|
3248 | var el = fragment(markup, test.speed, test.title, test.duration, url);
|
3249 | self.addCodeToggle(el, test.body);
|
3250 | appendToStack(el);
|
3251 | updateStats();
|
3252 | });
|
3253 |
|
3254 | runner.on(EVENT_TEST_FAIL, function(test) {
|
3255 | var el = fragment(
|
3256 | '<li class="test fail"><h2>%e <a href="%e" class="replay">' +
|
3257 | playIcon +
|
3258 | '</a></h2></li>',
|
3259 | test.title,
|
3260 | self.testURL(test)
|
3261 | );
|
3262 | var stackString;
|
3263 | var message = test.err.toString();
|
3264 |
|
3265 |
|
3266 |
|
3267 | if (message === '[object Error]') {
|
3268 | message = test.err.message;
|
3269 | }
|
3270 |
|
3271 | if (test.err.stack) {
|
3272 | var indexOfMessage = test.err.stack.indexOf(test.err.message);
|
3273 | if (indexOfMessage === -1) {
|
3274 | stackString = test.err.stack;
|
3275 | } else {
|
3276 | stackString = test.err.stack.substr(
|
3277 | test.err.message.length + indexOfMessage
|
3278 | );
|
3279 | }
|
3280 | } else if (test.err.sourceURL && test.err.line !== undefined) {
|
3281 |
|
3282 | stackString = '\n(' + test.err.sourceURL + ':' + test.err.line + ')';
|
3283 | }
|
3284 |
|
3285 | stackString = stackString || '';
|
3286 |
|
3287 | if (test.err.htmlMessage && stackString) {
|
3288 | el.appendChild(
|
3289 | fragment(
|
3290 | '<div class="html-error">%s\n<pre class="error">%e</pre></div>',
|
3291 | test.err.htmlMessage,
|
3292 | stackString
|
3293 | )
|
3294 | );
|
3295 | } else if (test.err.htmlMessage) {
|
3296 | el.appendChild(
|
3297 | fragment('<div class="html-error">%s</div>', test.err.htmlMessage)
|
3298 | );
|
3299 | } else {
|
3300 | el.appendChild(
|
3301 | fragment('<pre class="error">%e%e</pre>', message, stackString)
|
3302 | );
|
3303 | }
|
3304 |
|
3305 | self.addCodeToggle(el, test.body);
|
3306 | appendToStack(el);
|
3307 | updateStats();
|
3308 | });
|
3309 |
|
3310 | runner.on(EVENT_TEST_PENDING, function(test) {
|
3311 | var el = fragment(
|
3312 | '<li class="test pass pending"><h2>%e</h2></li>',
|
3313 | test.title
|
3314 | );
|
3315 | appendToStack(el);
|
3316 | updateStats();
|
3317 | });
|
3318 |
|
3319 | function appendToStack(el) {
|
3320 |
|
3321 | if (stack[0]) {
|
3322 | stack[0].appendChild(el);
|
3323 | }
|
3324 | }
|
3325 |
|
3326 | function updateStats() {
|
3327 |
|
3328 | var percent = ((stats.tests / runner.total) * 100) | 0;
|
3329 | if (progress) {
|
3330 | progress.update(percent).draw(ctx);
|
3331 | }
|
3332 |
|
3333 |
|
3334 | var ms = new Date() - stats.start;
|
3335 | text(passes, stats.passes);
|
3336 | text(failures, stats.failures);
|
3337 | text(duration, (ms / 1000).toFixed(2));
|
3338 | }
|
3339 | }
|
3340 |
|
3341 |
|
3342 |
|
3343 |
|
3344 |
|
3345 |
|
3346 |
|
3347 | function makeUrl(s) {
|
3348 | var search = window.location.search;
|
3349 |
|
3350 |
|
3351 | if (search) {
|
3352 | search = search.replace(/[?&]grep=[^&\s]*/g, '').replace(/^&/, '?');
|
3353 | }
|
3354 |
|
3355 | return (
|
3356 | window.location.pathname +
|
3357 | (search ? search + '&' : '?') +
|
3358 | 'grep=' +
|
3359 | encodeURIComponent(escapeRe(s))
|
3360 | );
|
3361 | }
|
3362 |
|
3363 |
|
3364 |
|
3365 |
|
3366 |
|
3367 |
|
3368 | HTML.prototype.suiteURL = function(suite) {
|
3369 | return makeUrl(suite.fullTitle());
|
3370 | };
|
3371 |
|
3372 |
|
3373 |
|
3374 |
|
3375 |
|
3376 |
|
3377 | HTML.prototype.testURL = function(test) {
|
3378 | return makeUrl(test.fullTitle());
|
3379 | };
|
3380 |
|
3381 |
|
3382 |
|
3383 |
|
3384 |
|
3385 |
|
3386 |
|
3387 | HTML.prototype.addCodeToggle = function(el, contents) {
|
3388 | var h2 = el.getElementsByTagName('h2')[0];
|
3389 |
|
3390 | on(h2, 'click', function() {
|
3391 | pre.style.display = pre.style.display === 'none' ? 'block' : 'none';
|
3392 | });
|
3393 |
|
3394 | var pre = fragment('<pre><code>%e</code></pre>', utils.clean(contents));
|
3395 | el.appendChild(pre);
|
3396 | pre.style.display = 'none';
|
3397 | };
|
3398 |
|
3399 |
|
3400 |
|
3401 |
|
3402 |
|
3403 |
|
3404 | function error(msg) {
|
3405 | document.body.appendChild(fragment('<div id="mocha-error">%s</div>', msg));
|
3406 | }
|
3407 |
|
3408 |
|
3409 |
|
3410 |
|
3411 |
|
3412 |
|
3413 | function fragment(html) {
|
3414 | var args = arguments;
|
3415 | var div = document.createElement('div');
|
3416 | var i = 1;
|
3417 |
|
3418 | div.innerHTML = html.replace(/%([se])/g, function(_, type) {
|
3419 | switch (type) {
|
3420 | case 's':
|
3421 | return String(args[i++]);
|
3422 | case 'e':
|
3423 | return escape(args[i++]);
|
3424 |
|
3425 | }
|
3426 | });
|
3427 |
|
3428 | return div.firstChild;
|
3429 | }
|
3430 |
|
3431 |
|
3432 |
|
3433 |
|
3434 |
|
3435 |
|
3436 |
|
3437 | function hideSuitesWithout(classname) {
|
3438 | var suites = document.getElementsByClassName('suite');
|
3439 | for (var i = 0; i < suites.length; i++) {
|
3440 | var els = suites[i].getElementsByClassName(classname);
|
3441 | if (!els.length) {
|
3442 | suites[i].className += ' hidden';
|
3443 | }
|
3444 | }
|
3445 | }
|
3446 |
|
3447 |
|
3448 |
|
3449 |
|
3450 | function unhide() {
|
3451 | var els = document.getElementsByClassName('suite hidden');
|
3452 | while (els.length > 0) {
|
3453 | els[0].className = els[0].className.replace('suite hidden', 'suite');
|
3454 | }
|
3455 | }
|
3456 |
|
3457 |
|
3458 |
|
3459 |
|
3460 |
|
3461 |
|
3462 |
|
3463 | function text(el, contents) {
|
3464 | if (el.textContent) {
|
3465 | el.textContent = contents;
|
3466 | } else {
|
3467 | el.innerText = contents;
|
3468 | }
|
3469 | }
|
3470 |
|
3471 |
|
3472 |
|
3473 |
|
3474 | function on(el, event, fn) {
|
3475 | if (el.addEventListener) {
|
3476 | el.addEventListener(event, fn, false);
|
3477 | } else {
|
3478 | el.attachEvent('on' + event, fn);
|
3479 | }
|
3480 | }
|
3481 |
|
3482 | HTML.browserOnly = true;
|
3483 |
|
3484 | }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
3485 | },{"../browser/progress":3,"../runner":34,"../utils":38,"./base":17,"escape-string-regexp":49}],21:[function(require,module,exports){
|
3486 | 'use strict';
|
3487 |
|
3488 |
|
3489 |
|
3490 | exports.Base = exports.base = require('./base');
|
3491 | exports.Dot = exports.dot = require('./dot');
|
3492 | exports.Doc = exports.doc = require('./doc');
|
3493 | exports.TAP = exports.tap = require('./tap');
|
3494 | exports.JSON = exports.json = require('./json');
|
3495 | exports.HTML = exports.html = require('./html');
|
3496 | exports.List = exports.list = require('./list');
|
3497 | exports.Min = exports.min = require('./min');
|
3498 | exports.Spec = exports.spec = require('./spec');
|
3499 | exports.Nyan = exports.nyan = require('./nyan');
|
3500 | exports.XUnit = exports.xunit = require('./xunit');
|
3501 | exports.Markdown = exports.markdown = require('./markdown');
|
3502 | exports.Progress = exports.progress = require('./progress');
|
3503 | exports.Landing = exports.landing = require('./landing');
|
3504 | exports.JSONStream = exports['json-stream'] = require('./json-stream');
|
3505 |
|
3506 | },{"./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){
|
3507 | (function (process){
|
3508 | 'use strict';
|
3509 |
|
3510 |
|
3511 |
|
3512 |
|
3513 |
|
3514 |
|
3515 |
|
3516 | var Base = require('./base');
|
3517 | var constants = require('../runner').constants;
|
3518 | var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
|
3519 | var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
|
3520 | var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
|
3521 | var EVENT_RUN_END = constants.EVENT_RUN_END;
|
3522 |
|
3523 |
|
3524 |
|
3525 |
|
3526 |
|
3527 | exports = module.exports = JSONStream;
|
3528 |
|
3529 |
|
3530 |
|
3531 |
|
3532 |
|
3533 |
|
3534 |
|
3535 |
|
3536 |
|
3537 |
|
3538 |
|
3539 | function JSONStream(runner, options) {
|
3540 | Base.call(this, runner, options);
|
3541 |
|
3542 | var self = this;
|
3543 | var total = runner.total;
|
3544 |
|
3545 | runner.once(EVENT_RUN_BEGIN, function() {
|
3546 | writeEvent(['start', {total: total}]);
|
3547 | });
|
3548 |
|
3549 | runner.on(EVENT_TEST_PASS, function(test) {
|
3550 | writeEvent(['pass', clean(test)]);
|
3551 | });
|
3552 |
|
3553 | runner.on(EVENT_TEST_FAIL, function(test, err) {
|
3554 | test = clean(test);
|
3555 | test.err = err.message;
|
3556 | test.stack = err.stack || null;
|
3557 | writeEvent(['fail', test]);
|
3558 | });
|
3559 |
|
3560 | runner.once(EVENT_RUN_END, function() {
|
3561 | writeEvent(['end', self.stats]);
|
3562 | });
|
3563 | }
|
3564 |
|
3565 |
|
3566 |
|
3567 |
|
3568 |
|
3569 |
|
3570 |
|
3571 |
|
3572 |
|
3573 |
|
3574 |
|
3575 |
|
3576 | function writeEvent(event) {
|
3577 | process.stdout.write(JSON.stringify(event) + '\n');
|
3578 | }
|
3579 |
|
3580 |
|
3581 |
|
3582 |
|
3583 |
|
3584 |
|
3585 |
|
3586 |
|
3587 |
|
3588 | function clean(test) {
|
3589 | return {
|
3590 | title: test.title,
|
3591 | fullTitle: test.fullTitle(),
|
3592 | duration: test.duration,
|
3593 | currentRetry: test.currentRetry()
|
3594 | };
|
3595 | }
|
3596 |
|
3597 | JSONStream.description = 'newline delimited JSON events';
|
3598 |
|
3599 | }).call(this,require('_process'))
|
3600 | },{"../runner":34,"./base":17,"_process":69}],23:[function(require,module,exports){
|
3601 | (function (process){
|
3602 | 'use strict';
|
3603 |
|
3604 |
|
3605 |
|
3606 |
|
3607 |
|
3608 |
|
3609 |
|
3610 | var Base = require('./base');
|
3611 | var constants = require('../runner').constants;
|
3612 | var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
|
3613 | var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
|
3614 | var EVENT_TEST_END = constants.EVENT_TEST_END;
|
3615 | var EVENT_RUN_END = constants.EVENT_RUN_END;
|
3616 | var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
|
3617 |
|
3618 |
|
3619 |
|
3620 |
|
3621 |
|
3622 | exports = module.exports = JSONReporter;
|
3623 |
|
3624 |
|
3625 |
|
3626 |
|
3627 |
|
3628 |
|
3629 |
|
3630 |
|
3631 |
|
3632 |
|
3633 |
|
3634 | function JSONReporter(runner, options) {
|
3635 | Base.call(this, runner, options);
|
3636 |
|
3637 | var self = this;
|
3638 | var tests = [];
|
3639 | var pending = [];
|
3640 | var failures = [];
|
3641 | var passes = [];
|
3642 |
|
3643 | runner.on(EVENT_TEST_END, function(test) {
|
3644 | tests.push(test);
|
3645 | });
|
3646 |
|
3647 | runner.on(EVENT_TEST_PASS, function(test) {
|
3648 | passes.push(test);
|
3649 | });
|
3650 |
|
3651 | runner.on(EVENT_TEST_FAIL, function(test) {
|
3652 | failures.push(test);
|
3653 | });
|
3654 |
|
3655 | runner.on(EVENT_TEST_PENDING, function(test) {
|
3656 | pending.push(test);
|
3657 | });
|
3658 |
|
3659 | runner.once(EVENT_RUN_END, function() {
|
3660 | var obj = {
|
3661 | stats: self.stats,
|
3662 | tests: tests.map(clean),
|
3663 | pending: pending.map(clean),
|
3664 | failures: failures.map(clean),
|
3665 | passes: passes.map(clean)
|
3666 | };
|
3667 |
|
3668 | runner.testResults = obj;
|
3669 |
|
3670 | process.stdout.write(JSON.stringify(obj, null, 2));
|
3671 | });
|
3672 | }
|
3673 |
|
3674 |
|
3675 |
|
3676 |
|
3677 |
|
3678 |
|
3679 |
|
3680 |
|
3681 |
|
3682 | function clean(test) {
|
3683 | var err = test.err || {};
|
3684 | if (err instanceof Error) {
|
3685 | err = errorJSON(err);
|
3686 | }
|
3687 |
|
3688 | return {
|
3689 | title: test.title,
|
3690 | fullTitle: test.fullTitle(),
|
3691 | duration: test.duration,
|
3692 | currentRetry: test.currentRetry(),
|
3693 | err: cleanCycles(err)
|
3694 | };
|
3695 | }
|
3696 |
|
3697 |
|
3698 |
|
3699 |
|
3700 |
|
3701 |
|
3702 |
|
3703 |
|
3704 | function cleanCycles(obj) {
|
3705 | var cache = [];
|
3706 | return JSON.parse(
|
3707 | JSON.stringify(obj, function(key, value) {
|
3708 | if (typeof value === 'object' && value !== null) {
|
3709 | if (cache.indexOf(value) !== -1) {
|
3710 |
|
3711 | return '' + value;
|
3712 | }
|
3713 | cache.push(value);
|
3714 | }
|
3715 |
|
3716 | return value;
|
3717 | })
|
3718 | );
|
3719 | }
|
3720 |
|
3721 |
|
3722 |
|
3723 |
|
3724 |
|
3725 |
|
3726 |
|
3727 |
|
3728 | function errorJSON(err) {
|
3729 | var res = {};
|
3730 | Object.getOwnPropertyNames(err).forEach(function(key) {
|
3731 | res[key] = err[key];
|
3732 | }, err);
|
3733 | return res;
|
3734 | }
|
3735 |
|
3736 | JSONReporter.description = 'single JSON object';
|
3737 |
|
3738 | }).call(this,require('_process'))
|
3739 | },{"../runner":34,"./base":17,"_process":69}],24:[function(require,module,exports){
|
3740 | (function (process){
|
3741 | 'use strict';
|
3742 |
|
3743 |
|
3744 |
|
3745 |
|
3746 |
|
3747 |
|
3748 |
|
3749 | var Base = require('./base');
|
3750 | var inherits = require('../utils').inherits;
|
3751 | var constants = require('../runner').constants;
|
3752 | var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
|
3753 | var EVENT_RUN_END = constants.EVENT_RUN_END;
|
3754 | var EVENT_TEST_END = constants.EVENT_TEST_END;
|
3755 | var STATE_FAILED = require('../runnable').constants.STATE_FAILED;
|
3756 |
|
3757 | var cursor = Base.cursor;
|
3758 | var color = Base.color;
|
3759 |
|
3760 |
|
3761 |
|
3762 |
|
3763 |
|
3764 | exports = module.exports = Landing;
|
3765 |
|
3766 |
|
3767 |
|
3768 |
|
3769 |
|
3770 | Base.colors.plane = 0;
|
3771 |
|
3772 |
|
3773 |
|
3774 |
|
3775 |
|
3776 | Base.colors['plane crash'] = 31;
|
3777 |
|
3778 |
|
3779 |
|
3780 |
|
3781 |
|
3782 | Base.colors.runway = 90;
|
3783 |
|
3784 |
|
3785 |
|
3786 |
|
3787 |
|
3788 |
|
3789 |
|
3790 |
|
3791 |
|
3792 |
|
3793 |
|
3794 | function Landing(runner, options) {
|
3795 | Base.call(this, runner, options);
|
3796 |
|
3797 | var self = this;
|
3798 | var width = (Base.window.width * 0.75) | 0;
|
3799 | var total = runner.total;
|
3800 | var stream = process.stdout;
|
3801 | var plane = color('plane', '✈');
|
3802 | var crashed = -1;
|
3803 | var n = 0;
|
3804 |
|
3805 | function runway() {
|
3806 | var buf = Array(width).join('-');
|
3807 | return ' ' + color('runway', buf);
|
3808 | }
|
3809 |
|
3810 | runner.on(EVENT_RUN_BEGIN, function() {
|
3811 | stream.write('\n\n\n ');
|
3812 | cursor.hide();
|
3813 | });
|
3814 |
|
3815 | runner.on(EVENT_TEST_END, function(test) {
|
3816 |
|
3817 | var col = crashed === -1 ? ((width * ++n) / total) | 0 : crashed;
|
3818 |
|
3819 |
|
3820 | if (test.state === STATE_FAILED) {
|
3821 | plane = color('plane crash', '✈');
|
3822 | crashed = col;
|
3823 | }
|
3824 |
|
3825 |
|
3826 | stream.write('\u001b[' + (width + 1) + 'D\u001b[2A');
|
3827 | stream.write(runway());
|
3828 | stream.write('\n ');
|
3829 | stream.write(color('runway', Array(col).join('⋅')));
|
3830 | stream.write(plane);
|
3831 | stream.write(color('runway', Array(width - col).join('⋅') + '\n'));
|
3832 | stream.write(runway());
|
3833 | stream.write('\u001b[0m');
|
3834 | });
|
3835 |
|
3836 | runner.once(EVENT_RUN_END, function() {
|
3837 | cursor.show();
|
3838 | process.stdout.write('\n');
|
3839 | self.epilogue();
|
3840 | });
|
3841 | }
|
3842 |
|
3843 |
|
3844 |
|
3845 |
|
3846 | inherits(Landing, Base);
|
3847 |
|
3848 | Landing.description = 'Unicode landing strip';
|
3849 |
|
3850 | }).call(this,require('_process'))
|
3851 | },{"../runnable":33,"../runner":34,"../utils":38,"./base":17,"_process":69}],25:[function(require,module,exports){
|
3852 | (function (process){
|
3853 | 'use strict';
|
3854 |
|
3855 |
|
3856 |
|
3857 |
|
3858 |
|
3859 |
|
3860 |
|
3861 | var Base = require('./base');
|
3862 | var inherits = require('../utils').inherits;
|
3863 | var constants = require('../runner').constants;
|
3864 | var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
|
3865 | var EVENT_RUN_END = constants.EVENT_RUN_END;
|
3866 | var EVENT_TEST_BEGIN = constants.EVENT_TEST_BEGIN;
|
3867 | var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
|
3868 | var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
|
3869 | var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
|
3870 | var color = Base.color;
|
3871 | var cursor = Base.cursor;
|
3872 |
|
3873 |
|
3874 |
|
3875 |
|
3876 |
|
3877 | exports = module.exports = List;
|
3878 |
|
3879 |
|
3880 |
|
3881 |
|
3882 |
|
3883 |
|
3884 |
|
3885 |
|
3886 |
|
3887 |
|
3888 |
|
3889 | function List(runner, options) {
|
3890 | Base.call(this, runner, options);
|
3891 |
|
3892 | var self = this;
|
3893 | var n = 0;
|
3894 |
|
3895 | runner.on(EVENT_RUN_BEGIN, function() {
|
3896 | Base.consoleLog();
|
3897 | });
|
3898 |
|
3899 | runner.on(EVENT_TEST_BEGIN, function(test) {
|
3900 | process.stdout.write(color('pass', ' ' + test.fullTitle() + ': '));
|
3901 | });
|
3902 |
|
3903 | runner.on(EVENT_TEST_PENDING, function(test) {
|
3904 | var fmt = color('checkmark', ' -') + color('pending', ' %s');
|
3905 | Base.consoleLog(fmt, test.fullTitle());
|
3906 | });
|
3907 |
|
3908 | runner.on(EVENT_TEST_PASS, function(test) {
|
3909 | var fmt =
|
3910 | color('checkmark', ' ' + Base.symbols.ok) +
|
3911 | color('pass', ' %s: ') +
|
3912 | color(test.speed, '%dms');
|
3913 | cursor.CR();
|
3914 | Base.consoleLog(fmt, test.fullTitle(), test.duration);
|
3915 | });
|
3916 |
|
3917 | runner.on(EVENT_TEST_FAIL, function(test) {
|
3918 | cursor.CR();
|
3919 | Base.consoleLog(color('fail', ' %d) %s'), ++n, test.fullTitle());
|
3920 | });
|
3921 |
|
3922 | runner.once(EVENT_RUN_END, self.epilogue.bind(self));
|
3923 | }
|
3924 |
|
3925 |
|
3926 |
|
3927 |
|
3928 | inherits(List, Base);
|
3929 |
|
3930 | List.description = 'like "spec" reporter but flat';
|
3931 |
|
3932 | }).call(this,require('_process'))
|
3933 | },{"../runner":34,"../utils":38,"./base":17,"_process":69}],26:[function(require,module,exports){
|
3934 | (function (process){
|
3935 | 'use strict';
|
3936 |
|
3937 |
|
3938 |
|
3939 |
|
3940 |
|
3941 |
|
3942 |
|
3943 | var Base = require('./base');
|
3944 | var utils = require('../utils');
|
3945 | var constants = require('../runner').constants;
|
3946 | var EVENT_RUN_END = constants.EVENT_RUN_END;
|
3947 | var EVENT_SUITE_BEGIN = constants.EVENT_SUITE_BEGIN;
|
3948 | var EVENT_SUITE_END = constants.EVENT_SUITE_END;
|
3949 | var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
|
3950 |
|
3951 |
|
3952 |
|
3953 |
|
3954 |
|
3955 | var SUITE_PREFIX = '$';
|
3956 |
|
3957 |
|
3958 |
|
3959 |
|
3960 |
|
3961 | exports = module.exports = Markdown;
|
3962 |
|
3963 |
|
3964 |
|
3965 |
|
3966 |
|
3967 |
|
3968 |
|
3969 |
|
3970 |
|
3971 |
|
3972 |
|
3973 | function Markdown(runner, options) {
|
3974 | Base.call(this, runner, options);
|
3975 |
|
3976 | var level = 0;
|
3977 | var buf = '';
|
3978 |
|
3979 | function title(str) {
|
3980 | return Array(level).join('#') + ' ' + str;
|
3981 | }
|
3982 |
|
3983 | function mapTOC(suite, obj) {
|
3984 | var ret = obj;
|
3985 | var key = SUITE_PREFIX + suite.title;
|
3986 |
|
3987 | obj = obj[key] = obj[key] || {suite: suite};
|
3988 | suite.suites.forEach(function(suite) {
|
3989 | mapTOC(suite, obj);
|
3990 | });
|
3991 |
|
3992 | return ret;
|
3993 | }
|
3994 |
|
3995 | function stringifyTOC(obj, level) {
|
3996 | ++level;
|
3997 | var buf = '';
|
3998 | var link;
|
3999 | for (var key in obj) {
|
4000 | if (key === 'suite') {
|
4001 | continue;
|
4002 | }
|
4003 | if (key !== SUITE_PREFIX) {
|
4004 | link = ' - [' + key.substring(1) + ']';
|
4005 | link += '(#' + utils.slug(obj[key].suite.fullTitle()) + ')\n';
|
4006 | buf += Array(level).join(' ') + link;
|
4007 | }
|
4008 | buf += stringifyTOC(obj[key], level);
|
4009 | }
|
4010 | return buf;
|
4011 | }
|
4012 |
|
4013 | function generateTOC(suite) {
|
4014 | var obj = mapTOC(suite, {});
|
4015 | return stringifyTOC(obj, 0);
|
4016 | }
|
4017 |
|
4018 | generateTOC(runner.suite);
|
4019 |
|
4020 | runner.on(EVENT_SUITE_BEGIN, function(suite) {
|
4021 | ++level;
|
4022 | var slug = utils.slug(suite.fullTitle());
|
4023 | buf += '<a name="' + slug + '"></a>' + '\n';
|
4024 | buf += title(suite.title) + '\n';
|
4025 | });
|
4026 |
|
4027 | runner.on(EVENT_SUITE_END, function() {
|
4028 | --level;
|
4029 | });
|
4030 |
|
4031 | runner.on(EVENT_TEST_PASS, function(test) {
|
4032 | var code = utils.clean(test.body);
|
4033 | buf += test.title + '.\n';
|
4034 | buf += '\n```js\n';
|
4035 | buf += code + '\n';
|
4036 | buf += '```\n\n';
|
4037 | });
|
4038 |
|
4039 | runner.once(EVENT_RUN_END, function() {
|
4040 | process.stdout.write('# TOC\n');
|
4041 | process.stdout.write(generateTOC(runner.suite));
|
4042 | process.stdout.write(buf);
|
4043 | });
|
4044 | }
|
4045 |
|
4046 | Markdown.description = 'GitHub Flavored Markdown';
|
4047 |
|
4048 | }).call(this,require('_process'))
|
4049 | },{"../runner":34,"../utils":38,"./base":17,"_process":69}],27:[function(require,module,exports){
|
4050 | (function (process){
|
4051 | 'use strict';
|
4052 |
|
4053 |
|
4054 |
|
4055 |
|
4056 |
|
4057 |
|
4058 |
|
4059 | var Base = require('./base');
|
4060 | var inherits = require('../utils').inherits;
|
4061 | var constants = require('../runner').constants;
|
4062 | var EVENT_RUN_END = constants.EVENT_RUN_END;
|
4063 | var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
|
4064 |
|
4065 |
|
4066 |
|
4067 |
|
4068 |
|
4069 | exports = module.exports = Min;
|
4070 |
|
4071 |
|
4072 |
|
4073 |
|
4074 |
|
4075 |
|
4076 |
|
4077 |
|
4078 |
|
4079 |
|
4080 |
|
4081 |
|
4082 |
|
4083 |
|
4084 | function Min(runner, options) {
|
4085 | Base.call(this, runner, options);
|
4086 |
|
4087 | runner.on(EVENT_RUN_BEGIN, function() {
|
4088 |
|
4089 | process.stdout.write('\u001b[2J');
|
4090 |
|
4091 | process.stdout.write('\u001b[1;3H');
|
4092 | });
|
4093 |
|
4094 | runner.once(EVENT_RUN_END, this.epilogue.bind(this));
|
4095 | }
|
4096 |
|
4097 |
|
4098 |
|
4099 |
|
4100 | inherits(Min, Base);
|
4101 |
|
4102 | Min.description = 'essentially just a summary';
|
4103 |
|
4104 | }).call(this,require('_process'))
|
4105 | },{"../runner":34,"../utils":38,"./base":17,"_process":69}],28:[function(require,module,exports){
|
4106 | (function (process){
|
4107 | 'use strict';
|
4108 |
|
4109 |
|
4110 |
|
4111 |
|
4112 |
|
4113 |
|
4114 |
|
4115 | var Base = require('./base');
|
4116 | var constants = require('../runner').constants;
|
4117 | var inherits = require('../utils').inherits;
|
4118 | var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
|
4119 | var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
|
4120 | var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
|
4121 | var EVENT_RUN_END = constants.EVENT_RUN_END;
|
4122 | var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
|
4123 |
|
4124 |
|
4125 |
|
4126 |
|
4127 |
|
4128 | exports = module.exports = NyanCat;
|
4129 |
|
4130 |
|
4131 |
|
4132 |
|
4133 |
|
4134 |
|
4135 |
|
4136 |
|
4137 |
|
4138 |
|
4139 |
|
4140 | function NyanCat(runner, options) {
|
4141 | Base.call(this, runner, options);
|
4142 |
|
4143 | var self = this;
|
4144 | var width = (Base.window.width * 0.75) | 0;
|
4145 | var nyanCatWidth = (this.nyanCatWidth = 11);
|
4146 |
|
4147 | this.colorIndex = 0;
|
4148 | this.numberOfLines = 4;
|
4149 | this.rainbowColors = self.generateColors();
|
4150 | this.scoreboardWidth = 5;
|
4151 | this.tick = 0;
|
4152 | this.trajectories = [[], [], [], []];
|
4153 | this.trajectoryWidthMax = width - nyanCatWidth;
|
4154 |
|
4155 | runner.on(EVENT_RUN_BEGIN, function() {
|
4156 | Base.cursor.hide();
|
4157 | self.draw();
|
4158 | });
|
4159 |
|
4160 | runner.on(EVENT_TEST_PENDING, function() {
|
4161 | self.draw();
|
4162 | });
|
4163 |
|
4164 | runner.on(EVENT_TEST_PASS, function() {
|
4165 | self.draw();
|
4166 | });
|
4167 |
|
4168 | runner.on(EVENT_TEST_FAIL, function() {
|
4169 | self.draw();
|
4170 | });
|
4171 |
|
4172 | runner.once(EVENT_RUN_END, function() {
|
4173 | Base.cursor.show();
|
4174 | for (var i = 0; i < self.numberOfLines; i++) {
|
4175 | write('\n');
|
4176 | }
|
4177 | self.epilogue();
|
4178 | });
|
4179 | }
|
4180 |
|
4181 |
|
4182 |
|
4183 |
|
4184 | inherits(NyanCat, Base);
|
4185 |
|
4186 |
|
4187 |
|
4188 |
|
4189 |
|
4190 |
|
4191 |
|
4192 | NyanCat.prototype.draw = function() {
|
4193 | this.appendRainbow();
|
4194 | this.drawScoreboard();
|
4195 | this.drawRainbow();
|
4196 | this.drawNyanCat();
|
4197 | this.tick = !this.tick;
|
4198 | };
|
4199 |
|
4200 |
|
4201 |
|
4202 |
|
4203 |
|
4204 |
|
4205 |
|
4206 |
|
4207 | NyanCat.prototype.drawScoreboard = function() {
|
4208 | var stats = this.stats;
|
4209 |
|
4210 | function draw(type, n) {
|
4211 | write(' ');
|
4212 | write(Base.color(type, n));
|
4213 | write('\n');
|
4214 | }
|
4215 |
|
4216 | draw('green', stats.passes);
|
4217 | draw('fail', stats.failures);
|
4218 | draw('pending', stats.pending);
|
4219 | write('\n');
|
4220 |
|
4221 | this.cursorUp(this.numberOfLines);
|
4222 | };
|
4223 |
|
4224 |
|
4225 |
|
4226 |
|
4227 |
|
4228 |
|
4229 |
|
4230 | NyanCat.prototype.appendRainbow = function() {
|
4231 | var segment = this.tick ? '_' : '-';
|
4232 | var rainbowified = this.rainbowify(segment);
|
4233 |
|
4234 | for (var index = 0; index < this.numberOfLines; index++) {
|
4235 | var trajectory = this.trajectories[index];
|
4236 | if (trajectory.length >= this.trajectoryWidthMax) {
|
4237 | trajectory.shift();
|
4238 | }
|
4239 | trajectory.push(rainbowified);
|
4240 | }
|
4241 | };
|
4242 |
|
4243 |
|
4244 |
|
4245 |
|
4246 |
|
4247 |
|
4248 |
|
4249 | NyanCat.prototype.drawRainbow = function() {
|
4250 | var self = this;
|
4251 |
|
4252 | this.trajectories.forEach(function(line) {
|
4253 | write('\u001b[' + self.scoreboardWidth + 'C');
|
4254 | write(line.join(''));
|
4255 | write('\n');
|
4256 | });
|
4257 |
|
4258 | this.cursorUp(this.numberOfLines);
|
4259 | };
|
4260 |
|
4261 |
|
4262 |
|
4263 |
|
4264 |
|
4265 |
|
4266 | NyanCat.prototype.drawNyanCat = function() {
|
4267 | var self = this;
|
4268 | var startWidth = this.scoreboardWidth + this.trajectories[0].length;
|
4269 | var dist = '\u001b[' + startWidth + 'C';
|
4270 | var padding = '';
|
4271 |
|
4272 | write(dist);
|
4273 | write('_,------,');
|
4274 | write('\n');
|
4275 |
|
4276 | write(dist);
|
4277 | padding = self.tick ? ' ' : ' ';
|
4278 | write('_|' + padding + '/\\_/\\ ');
|
4279 | write('\n');
|
4280 |
|
4281 | write(dist);
|
4282 | padding = self.tick ? '_' : '__';
|
4283 | var tail = self.tick ? '~' : '^';
|
4284 | write(tail + '|' + padding + this.face() + ' ');
|
4285 | write('\n');
|
4286 |
|
4287 | write(dist);
|
4288 | padding = self.tick ? ' ' : ' ';
|
4289 | write(padding + '"" "" ');
|
4290 | write('\n');
|
4291 |
|
4292 | this.cursorUp(this.numberOfLines);
|
4293 | };
|
4294 |
|
4295 |
|
4296 |
|
4297 |
|
4298 |
|
4299 |
|
4300 |
|
4301 |
|
4302 | NyanCat.prototype.face = function() {
|
4303 | var stats = this.stats;
|
4304 | if (stats.failures) {
|
4305 | return '( x .x)';
|
4306 | } else if (stats.pending) {
|
4307 | return '( o .o)';
|
4308 | } else if (stats.passes) {
|
4309 | return '( ^ .^)';
|
4310 | }
|
4311 | return '( - .-)';
|
4312 | };
|
4313 |
|
4314 |
|
4315 |
|
4316 |
|
4317 |
|
4318 |
|
4319 |
|
4320 |
|
4321 | NyanCat.prototype.cursorUp = function(n) {
|
4322 | write('\u001b[' + n + 'A');
|
4323 | };
|
4324 |
|
4325 |
|
4326 |
|
4327 |
|
4328 |
|
4329 |
|
4330 |
|
4331 |
|
4332 | NyanCat.prototype.cursorDown = function(n) {
|
4333 | write('\u001b[' + n + 'B');
|
4334 | };
|
4335 |
|
4336 |
|
4337 |
|
4338 |
|
4339 |
|
4340 |
|
4341 |
|
4342 | NyanCat.prototype.generateColors = function() {
|
4343 | var colors = [];
|
4344 |
|
4345 | for (var i = 0; i < 6 * 7; i++) {
|
4346 | var pi3 = Math.floor(Math.PI / 3);
|
4347 | var n = i * (1.0 / 6);
|
4348 | var r = Math.floor(3 * Math.sin(n) + 3);
|
4349 | var g = Math.floor(3 * Math.sin(n + 2 * pi3) + 3);
|
4350 | var b = Math.floor(3 * Math.sin(n + 4 * pi3) + 3);
|
4351 | colors.push(36 * r + 6 * g + b + 16);
|
4352 | }
|
4353 |
|
4354 | return colors;
|
4355 | };
|
4356 |
|
4357 |
|
4358 |
|
4359 |
|
4360 |
|
4361 |
|
4362 |
|
4363 |
|
4364 | NyanCat.prototype.rainbowify = function(str) {
|
4365 | if (!Base.useColors) {
|
4366 | return str;
|
4367 | }
|
4368 | var color = this.rainbowColors[this.colorIndex % this.rainbowColors.length];
|
4369 | this.colorIndex += 1;
|
4370 | return '\u001b[38;5;' + color + 'm' + str + '\u001b[0m';
|
4371 | };
|
4372 |
|
4373 |
|
4374 |
|
4375 |
|
4376 |
|
4377 |
|
4378 | function write(string) {
|
4379 | process.stdout.write(string);
|
4380 | }
|
4381 |
|
4382 | NyanCat.description = '"nyan cat"';
|
4383 |
|
4384 | }).call(this,require('_process'))
|
4385 | },{"../runner":34,"../utils":38,"./base":17,"_process":69}],29:[function(require,module,exports){
|
4386 | (function (process){
|
4387 | 'use strict';
|
4388 |
|
4389 |
|
4390 |
|
4391 |
|
4392 |
|
4393 |
|
4394 |
|
4395 | var Base = require('./base');
|
4396 | var constants = require('../runner').constants;
|
4397 | var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
|
4398 | var EVENT_TEST_END = constants.EVENT_TEST_END;
|
4399 | var EVENT_RUN_END = constants.EVENT_RUN_END;
|
4400 | var inherits = require('../utils').inherits;
|
4401 | var color = Base.color;
|
4402 | var cursor = Base.cursor;
|
4403 |
|
4404 |
|
4405 |
|
4406 |
|
4407 |
|
4408 | exports = module.exports = Progress;
|
4409 |
|
4410 |
|
4411 |
|
4412 |
|
4413 |
|
4414 | Base.colors.progress = 90;
|
4415 |
|
4416 |
|
4417 |
|
4418 |
|
4419 |
|
4420 |
|
4421 |
|
4422 |
|
4423 |
|
4424 |
|
4425 |
|
4426 | function Progress(runner, options) {
|
4427 | Base.call(this, runner, options);
|
4428 |
|
4429 | var self = this;
|
4430 | var width = (Base.window.width * 0.5) | 0;
|
4431 | var total = runner.total;
|
4432 | var complete = 0;
|
4433 | var lastN = -1;
|
4434 |
|
4435 |
|
4436 | options = options || {};
|
4437 | var reporterOptions = options.reporterOptions || {};
|
4438 |
|
4439 | options.open = reporterOptions.open || '[';
|
4440 | options.complete = reporterOptions.complete || '▬';
|
4441 | options.incomplete = reporterOptions.incomplete || Base.symbols.dot;
|
4442 | options.close = reporterOptions.close || ']';
|
4443 | options.verbose = reporterOptions.verbose || false;
|
4444 |
|
4445 |
|
4446 | runner.on(EVENT_RUN_BEGIN, function() {
|
4447 | process.stdout.write('\n');
|
4448 | cursor.hide();
|
4449 | });
|
4450 |
|
4451 |
|
4452 | runner.on(EVENT_TEST_END, function() {
|
4453 | complete++;
|
4454 |
|
4455 | var percent = complete / total;
|
4456 | var n = (width * percent) | 0;
|
4457 | var i = width - n;
|
4458 |
|
4459 | if (n === lastN && !options.verbose) {
|
4460 |
|
4461 | return;
|
4462 | }
|
4463 | lastN = n;
|
4464 |
|
4465 | cursor.CR();
|
4466 | process.stdout.write('\u001b[J');
|
4467 | process.stdout.write(color('progress', ' ' + options.open));
|
4468 | process.stdout.write(Array(n).join(options.complete));
|
4469 | process.stdout.write(Array(i).join(options.incomplete));
|
4470 | process.stdout.write(color('progress', options.close));
|
4471 | if (options.verbose) {
|
4472 | process.stdout.write(color('progress', ' ' + complete + ' of ' + total));
|
4473 | }
|
4474 | });
|
4475 |
|
4476 |
|
4477 |
|
4478 | runner.once(EVENT_RUN_END, function() {
|
4479 | cursor.show();
|
4480 | process.stdout.write('\n');
|
4481 | self.epilogue();
|
4482 | });
|
4483 | }
|
4484 |
|
4485 |
|
4486 |
|
4487 |
|
4488 | inherits(Progress, Base);
|
4489 |
|
4490 | Progress.description = 'a progress bar';
|
4491 |
|
4492 | }).call(this,require('_process'))
|
4493 | },{"../runner":34,"../utils":38,"./base":17,"_process":69}],30:[function(require,module,exports){
|
4494 | 'use strict';
|
4495 |
|
4496 |
|
4497 |
|
4498 |
|
4499 |
|
4500 |
|
4501 |
|
4502 | var Base = require('./base');
|
4503 | var constants = require('../runner').constants;
|
4504 | var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
|
4505 | var EVENT_RUN_END = constants.EVENT_RUN_END;
|
4506 | var EVENT_SUITE_BEGIN = constants.EVENT_SUITE_BEGIN;
|
4507 | var EVENT_SUITE_END = constants.EVENT_SUITE_END;
|
4508 | var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
|
4509 | var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
|
4510 | var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
|
4511 | var inherits = require('../utils').inherits;
|
4512 | var color = Base.color;
|
4513 |
|
4514 |
|
4515 |
|
4516 |
|
4517 |
|
4518 | exports = module.exports = Spec;
|
4519 |
|
4520 |
|
4521 |
|
4522 |
|
4523 |
|
4524 |
|
4525 |
|
4526 |
|
4527 |
|
4528 |
|
4529 |
|
4530 | function Spec(runner, options) {
|
4531 | Base.call(this, runner, options);
|
4532 |
|
4533 | var self = this;
|
4534 | var indents = 0;
|
4535 | var n = 0;
|
4536 |
|
4537 | function indent() {
|
4538 | return Array(indents).join(' ');
|
4539 | }
|
4540 |
|
4541 | runner.on(EVENT_RUN_BEGIN, function() {
|
4542 | Base.consoleLog();
|
4543 | });
|
4544 |
|
4545 | runner.on(EVENT_SUITE_BEGIN, function(suite) {
|
4546 | ++indents;
|
4547 | Base.consoleLog(color('suite', '%s%s'), indent(), suite.title);
|
4548 | });
|
4549 |
|
4550 | runner.on(EVENT_SUITE_END, function() {
|
4551 | --indents;
|
4552 | if (indents === 1) {
|
4553 | Base.consoleLog();
|
4554 | }
|
4555 | });
|
4556 |
|
4557 | runner.on(EVENT_TEST_PENDING, function(test) {
|
4558 | var fmt = indent() + color('pending', ' - %s');
|
4559 | Base.consoleLog(fmt, test.title);
|
4560 | });
|
4561 |
|
4562 | runner.on(EVENT_TEST_PASS, function(test) {
|
4563 | var fmt;
|
4564 | if (test.speed === 'fast') {
|
4565 | fmt =
|
4566 | indent() +
|
4567 | color('checkmark', ' ' + Base.symbols.ok) +
|
4568 | color('pass', ' %s');
|
4569 | Base.consoleLog(fmt, test.title);
|
4570 | } else {
|
4571 | fmt =
|
4572 | indent() +
|
4573 | color('checkmark', ' ' + Base.symbols.ok) +
|
4574 | color('pass', ' %s') +
|
4575 | color(test.speed, ' (%dms)');
|
4576 | Base.consoleLog(fmt, test.title, test.duration);
|
4577 | }
|
4578 | });
|
4579 |
|
4580 | runner.on(EVENT_TEST_FAIL, function(test) {
|
4581 | Base.consoleLog(indent() + color('fail', ' %d) %s'), ++n, test.title);
|
4582 | });
|
4583 |
|
4584 | runner.once(EVENT_RUN_END, self.epilogue.bind(self));
|
4585 | }
|
4586 |
|
4587 |
|
4588 |
|
4589 |
|
4590 | inherits(Spec, Base);
|
4591 |
|
4592 | Spec.description = 'hierarchical & verbose [default]';
|
4593 |
|
4594 | },{"../runner":34,"../utils":38,"./base":17}],31:[function(require,module,exports){
|
4595 | (function (process){
|
4596 | 'use strict';
|
4597 |
|
4598 |
|
4599 |
|
4600 |
|
4601 |
|
4602 |
|
4603 |
|
4604 | var util = require('util');
|
4605 | var Base = require('./base');
|
4606 | var constants = require('../runner').constants;
|
4607 | var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
|
4608 | var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
|
4609 | var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
|
4610 | var EVENT_RUN_END = constants.EVENT_RUN_END;
|
4611 | var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
|
4612 | var EVENT_TEST_END = constants.EVENT_TEST_END;
|
4613 | var inherits = require('../utils').inherits;
|
4614 | var sprintf = util.format;
|
4615 |
|
4616 |
|
4617 |
|
4618 |
|
4619 |
|
4620 | exports = module.exports = TAP;
|
4621 |
|
4622 |
|
4623 |
|
4624 |
|
4625 |
|
4626 |
|
4627 |
|
4628 |
|
4629 |
|
4630 |
|
4631 |
|
4632 | function TAP(runner, options) {
|
4633 | Base.call(this, runner, options);
|
4634 |
|
4635 | var self = this;
|
4636 | var n = 1;
|
4637 |
|
4638 | var tapVersion = '12';
|
4639 | if (options && options.reporterOptions) {
|
4640 | if (options.reporterOptions.tapVersion) {
|
4641 | tapVersion = options.reporterOptions.tapVersion.toString();
|
4642 | }
|
4643 | }
|
4644 |
|
4645 | this._producer = createProducer(tapVersion);
|
4646 |
|
4647 | runner.once(EVENT_RUN_BEGIN, function() {
|
4648 | var ntests = runner.grepTotal(runner.suite);
|
4649 | self._producer.writeVersion();
|
4650 | self._producer.writePlan(ntests);
|
4651 | });
|
4652 |
|
4653 | runner.on(EVENT_TEST_END, function() {
|
4654 | ++n;
|
4655 | });
|
4656 |
|
4657 | runner.on(EVENT_TEST_PENDING, function(test) {
|
4658 | self._producer.writePending(n, test);
|
4659 | });
|
4660 |
|
4661 | runner.on(EVENT_TEST_PASS, function(test) {
|
4662 | self._producer.writePass(n, test);
|
4663 | });
|
4664 |
|
4665 | runner.on(EVENT_TEST_FAIL, function(test, err) {
|
4666 | self._producer.writeFail(n, test, err);
|
4667 | });
|
4668 |
|
4669 | runner.once(EVENT_RUN_END, function() {
|
4670 | self._producer.writeEpilogue(runner.stats);
|
4671 | });
|
4672 | }
|
4673 |
|
4674 |
|
4675 |
|
4676 |
|
4677 | inherits(TAP, Base);
|
4678 |
|
4679 |
|
4680 |
|
4681 |
|
4682 |
|
4683 |
|
4684 |
|
4685 |
|
4686 | function title(test) {
|
4687 | return test.fullTitle().replace(/#/g, '');
|
4688 | }
|
4689 |
|
4690 |
|
4691 |
|
4692 |
|
4693 |
|
4694 |
|
4695 |
|
4696 |
|
4697 | function println(format, varArgs) {
|
4698 | var vargs = Array.from(arguments);
|
4699 | vargs[0] += '\n';
|
4700 | process.stdout.write(sprintf.apply(null, vargs));
|
4701 | }
|
4702 |
|
4703 |
|
4704 |
|
4705 |
|
4706 |
|
4707 |
|
4708 |
|
4709 |
|
4710 |
|
4711 | function createProducer(tapVersion) {
|
4712 | var producers = {
|
4713 | '12': new TAP12Producer(),
|
4714 | '13': new TAP13Producer()
|
4715 | };
|
4716 | var producer = producers[tapVersion];
|
4717 |
|
4718 | if (!producer) {
|
4719 | throw new Error(
|
4720 | 'invalid or unsupported TAP version: ' + JSON.stringify(tapVersion)
|
4721 | );
|
4722 | }
|
4723 |
|
4724 | return producer;
|
4725 | }
|
4726 |
|
4727 |
|
4728 |
|
4729 |
|
4730 |
|
4731 |
|
4732 |
|
4733 |
|
4734 |
|
4735 |
|
4736 |
|
4737 | function TAPProducer() {}
|
4738 |
|
4739 |
|
4740 |
|
4741 |
|
4742 |
|
4743 |
|
4744 | TAPProducer.prototype.writeVersion = function() {};
|
4745 |
|
4746 |
|
4747 |
|
4748 |
|
4749 |
|
4750 |
|
4751 |
|
4752 | TAPProducer.prototype.writePlan = function(ntests) {
|
4753 | println('%d..%d', 1, ntests);
|
4754 | };
|
4755 |
|
4756 |
|
4757 |
|
4758 |
|
4759 |
|
4760 |
|
4761 |
|
4762 |
|
4763 | TAPProducer.prototype.writePass = function(n, test) {
|
4764 | println('ok %d %s', n, title(test));
|
4765 | };
|
4766 |
|
4767 |
|
4768 |
|
4769 |
|
4770 |
|
4771 |
|
4772 |
|
4773 |
|
4774 | TAPProducer.prototype.writePending = function(n, test) {
|
4775 | println('ok %d %s # SKIP -', n, title(test));
|
4776 | };
|
4777 |
|
4778 |
|
4779 |
|
4780 |
|
4781 |
|
4782 |
|
4783 |
|
4784 |
|
4785 |
|
4786 | TAPProducer.prototype.writeFail = function(n, test, err) {
|
4787 | println('not ok %d %s', n, title(test));
|
4788 | };
|
4789 |
|
4790 |
|
4791 |
|
4792 |
|
4793 |
|
4794 |
|
4795 |
|
4796 | TAPProducer.prototype.writeEpilogue = function(stats) {
|
4797 |
|
4798 | println('# tests ' + (stats.passes + stats.failures));
|
4799 | println('# pass ' + stats.passes);
|
4800 |
|
4801 | println('# fail ' + stats.failures);
|
4802 | };
|
4803 |
|
4804 |
|
4805 |
|
4806 |
|
4807 |
|
4808 |
|
4809 |
|
4810 |
|
4811 |
|
4812 |
|
4813 |
|
4814 |
|
4815 |
|
4816 | function TAP12Producer() {
|
4817 | |
4818 |
|
4819 |
|
4820 |
|
4821 | this.writeFail = function(n, test, err) {
|
4822 | TAPProducer.prototype.writeFail.call(this, n, test, err);
|
4823 | if (err.message) {
|
4824 | println(err.message.replace(/^/gm, ' '));
|
4825 | }
|
4826 | if (err.stack) {
|
4827 | println(err.stack.replace(/^/gm, ' '));
|
4828 | }
|
4829 | };
|
4830 | }
|
4831 |
|
4832 |
|
4833 |
|
4834 |
|
4835 | inherits(TAP12Producer, TAPProducer);
|
4836 |
|
4837 |
|
4838 |
|
4839 |
|
4840 |
|
4841 |
|
4842 |
|
4843 |
|
4844 |
|
4845 |
|
4846 |
|
4847 |
|
4848 |
|
4849 | function TAP13Producer() {
|
4850 | |
4851 |
|
4852 |
|
4853 |
|
4854 | this.writeVersion = function() {
|
4855 | println('TAP version 13');
|
4856 | };
|
4857 |
|
4858 | |
4859 |
|
4860 |
|
4861 |
|
4862 | this.writeFail = function(n, test, err) {
|
4863 | TAPProducer.prototype.writeFail.call(this, n, test, err);
|
4864 | var emitYamlBlock = err.message != null || err.stack != null;
|
4865 | if (emitYamlBlock) {
|
4866 | println(indent(1) + '---');
|
4867 | if (err.message) {
|
4868 | println(indent(2) + 'message: |-');
|
4869 | println(err.message.replace(/^/gm, indent(3)));
|
4870 | }
|
4871 | if (err.stack) {
|
4872 | println(indent(2) + 'stack: |-');
|
4873 | println(err.stack.replace(/^/gm, indent(3)));
|
4874 | }
|
4875 | println(indent(1) + '...');
|
4876 | }
|
4877 | };
|
4878 |
|
4879 | function indent(level) {
|
4880 | return Array(level + 1).join(' ');
|
4881 | }
|
4882 | }
|
4883 |
|
4884 |
|
4885 |
|
4886 |
|
4887 | inherits(TAP13Producer, TAPProducer);
|
4888 |
|
4889 | TAP.description = 'TAP-compatible output';
|
4890 |
|
4891 | }).call(this,require('_process'))
|
4892 | },{"../runner":34,"../utils":38,"./base":17,"_process":69,"util":89}],32:[function(require,module,exports){
|
4893 | (function (process,global){
|
4894 | 'use strict';
|
4895 |
|
4896 |
|
4897 |
|
4898 |
|
4899 |
|
4900 |
|
4901 |
|
4902 | var Base = require('./base');
|
4903 | var utils = require('../utils');
|
4904 | var fs = require('fs');
|
4905 | var mkdirp = require('mkdirp');
|
4906 | var path = require('path');
|
4907 | var errors = require('../errors');
|
4908 | var createUnsupportedError = errors.createUnsupportedError;
|
4909 | var constants = require('../runner').constants;
|
4910 | var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
|
4911 | var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
|
4912 | var EVENT_RUN_END = constants.EVENT_RUN_END;
|
4913 | var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
|
4914 | var STATE_FAILED = require('../runnable').constants.STATE_FAILED;
|
4915 | var inherits = utils.inherits;
|
4916 | var escape = utils.escape;
|
4917 |
|
4918 |
|
4919 |
|
4920 |
|
4921 | var Date = global.Date;
|
4922 |
|
4923 |
|
4924 |
|
4925 |
|
4926 |
|
4927 | exports = module.exports = XUnit;
|
4928 |
|
4929 |
|
4930 |
|
4931 |
|
4932 |
|
4933 |
|
4934 |
|
4935 |
|
4936 |
|
4937 |
|
4938 |
|
4939 | function XUnit(runner, options) {
|
4940 | Base.call(this, runner, options);
|
4941 |
|
4942 | var stats = this.stats;
|
4943 | var tests = [];
|
4944 | var self = this;
|
4945 |
|
4946 |
|
4947 | var suiteName;
|
4948 |
|
4949 |
|
4950 | var DEFAULT_SUITE_NAME = 'Mocha Tests';
|
4951 |
|
4952 | if (options && options.reporterOptions) {
|
4953 | if (options.reporterOptions.output) {
|
4954 | if (!fs.createWriteStream) {
|
4955 | throw createUnsupportedError('file output not supported in browser');
|
4956 | }
|
4957 |
|
4958 | mkdirp.sync(path.dirname(options.reporterOptions.output));
|
4959 | self.fileStream = fs.createWriteStream(options.reporterOptions.output);
|
4960 | }
|
4961 |
|
4962 |
|
4963 | suiteName = options.reporterOptions.suiteName;
|
4964 | }
|
4965 |
|
4966 |
|
4967 | suiteName = suiteName || DEFAULT_SUITE_NAME;
|
4968 |
|
4969 | runner.on(EVENT_TEST_PENDING, function(test) {
|
4970 | tests.push(test);
|
4971 | });
|
4972 |
|
4973 | runner.on(EVENT_TEST_PASS, function(test) {
|
4974 | tests.push(test);
|
4975 | });
|
4976 |
|
4977 | runner.on(EVENT_TEST_FAIL, function(test) {
|
4978 | tests.push(test);
|
4979 | });
|
4980 |
|
4981 | runner.once(EVENT_RUN_END, function() {
|
4982 | self.write(
|
4983 | tag(
|
4984 | 'testsuite',
|
4985 | {
|
4986 | name: suiteName,
|
4987 | tests: stats.tests,
|
4988 | failures: 0,
|
4989 | errors: stats.failures,
|
4990 | skipped: stats.tests - stats.failures - stats.passes,
|
4991 | timestamp: new Date().toUTCString(),
|
4992 | time: stats.duration / 1000 || 0
|
4993 | },
|
4994 | false
|
4995 | )
|
4996 | );
|
4997 |
|
4998 | tests.forEach(function(t) {
|
4999 | self.test(t);
|
5000 | });
|
5001 |
|
5002 | self.write('</testsuite>');
|
5003 | });
|
5004 | }
|
5005 |
|
5006 |
|
5007 |
|
5008 |
|
5009 | inherits(XUnit, Base);
|
5010 |
|
5011 |
|
5012 |
|
5013 |
|
5014 |
|
5015 |
|
5016 |
|
5017 | XUnit.prototype.done = function(failures, fn) {
|
5018 | if (this.fileStream) {
|
5019 | this.fileStream.end(function() {
|
5020 | fn(failures);
|
5021 | });
|
5022 | } else {
|
5023 | fn(failures);
|
5024 | }
|
5025 | };
|
5026 |
|
5027 |
|
5028 |
|
5029 |
|
5030 |
|
5031 |
|
5032 | XUnit.prototype.write = function(line) {
|
5033 | if (this.fileStream) {
|
5034 | this.fileStream.write(line + '\n');
|
5035 | } else if (typeof process === 'object' && process.stdout) {
|
5036 | process.stdout.write(line + '\n');
|
5037 | } else {
|
5038 | Base.consoleLog(line);
|
5039 | }
|
5040 | };
|
5041 |
|
5042 |
|
5043 |
|
5044 |
|
5045 |
|
5046 |
|
5047 | XUnit.prototype.test = function(test) {
|
5048 | Base.useColors = false;
|
5049 |
|
5050 | var attrs = {
|
5051 | classname: test.parent.fullTitle(),
|
5052 | name: test.title,
|
5053 | time: test.duration / 1000 || 0
|
5054 | };
|
5055 |
|
5056 | if (test.state === STATE_FAILED) {
|
5057 | var err = test.err;
|
5058 | var diff =
|
5059 | !Base.hideDiff && Base.showDiff(err)
|
5060 | ? '\n' + Base.generateDiff(err.actual, err.expected)
|
5061 | : '';
|
5062 | this.write(
|
5063 | tag(
|
5064 | 'testcase',
|
5065 | attrs,
|
5066 | false,
|
5067 | tag(
|
5068 | 'failure',
|
5069 | {},
|
5070 | false,
|
5071 | escape(err.message) + escape(diff) + '\n' + escape(err.stack)
|
5072 | )
|
5073 | )
|
5074 | );
|
5075 | } else if (test.isPending()) {
|
5076 | this.write(tag('testcase', attrs, false, tag('skipped', {}, true)));
|
5077 | } else {
|
5078 | this.write(tag('testcase', attrs, true));
|
5079 | }
|
5080 | };
|
5081 |
|
5082 |
|
5083 |
|
5084 |
|
5085 |
|
5086 |
|
5087 |
|
5088 |
|
5089 |
|
5090 |
|
5091 | function tag(name, attrs, close, content) {
|
5092 | var end = close ? '/>' : '>';
|
5093 | var pairs = [];
|
5094 | var tag;
|
5095 |
|
5096 | for (var key in attrs) {
|
5097 | if (Object.prototype.hasOwnProperty.call(attrs, key)) {
|
5098 | pairs.push(key + '="' + escape(attrs[key]) + '"');
|
5099 | }
|
5100 | }
|
5101 |
|
5102 | tag = '<' + name + (pairs.length ? ' ' + pairs.join(' ') : '') + end;
|
5103 | if (content) {
|
5104 | tag += content + '</' + name + end;
|
5105 | }
|
5106 | return tag;
|
5107 | }
|
5108 |
|
5109 | XUnit.description = 'XUnit-compatible XML output';
|
5110 |
|
5111 | }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
5112 | },{"../errors":6,"../runnable":33,"../runner":34,"../utils":38,"./base":17,"_process":69,"fs":42,"mkdirp":59,"path":42}],33:[function(require,module,exports){
|
5113 | (function (global){
|
5114 | 'use strict';
|
5115 |
|
5116 | var EventEmitter = require('events').EventEmitter;
|
5117 | var Pending = require('./pending');
|
5118 | var debug = require('debug')('mocha:runnable');
|
5119 | var milliseconds = require('ms');
|
5120 | var utils = require('./utils');
|
5121 | var createInvalidExceptionError = require('./errors')
|
5122 | .createInvalidExceptionError;
|
5123 |
|
5124 |
|
5125 |
|
5126 |
|
5127 | var Date = global.Date;
|
5128 | var setTimeout = global.setTimeout;
|
5129 | var clearTimeout = global.clearTimeout;
|
5130 | var toString = Object.prototype.toString;
|
5131 |
|
5132 | module.exports = Runnable;
|
5133 |
|
5134 |
|
5135 |
|
5136 |
|
5137 |
|
5138 |
|
5139 |
|
5140 |
|
5141 |
|
5142 |
|
5143 | function Runnable(title, fn) {
|
5144 | this.title = title;
|
5145 | this.fn = fn;
|
5146 | this.body = (fn || '').toString();
|
5147 | this.async = fn && fn.length;
|
5148 | this.sync = !this.async;
|
5149 | this._timeout = 2000;
|
5150 | this._slow = 75;
|
5151 | this._enableTimeouts = true;
|
5152 | this.timedOut = false;
|
5153 | this._retries = -1;
|
5154 | this._currentRetry = 0;
|
5155 | this.pending = false;
|
5156 | }
|
5157 |
|
5158 |
|
5159 |
|
5160 |
|
5161 | utils.inherits(Runnable, EventEmitter);
|
5162 |
|
5163 |
|
5164 |
|
5165 |
|
5166 |
|
5167 |
|
5168 |
|
5169 |
|
5170 |
|
5171 |
|
5172 |
|
5173 |
|
5174 |
|
5175 |
|
5176 |
|
5177 |
|
5178 |
|
5179 |
|
5180 |
|
5181 |
|
5182 |
|
5183 |
|
5184 | Runnable.prototype.timeout = function(ms) {
|
5185 | if (!arguments.length) {
|
5186 | return this._timeout;
|
5187 | }
|
5188 | if (typeof ms === 'string') {
|
5189 | ms = milliseconds(ms);
|
5190 | }
|
5191 |
|
5192 |
|
5193 | var INT_MAX = Math.pow(2, 31) - 1;
|
5194 | var range = [0, INT_MAX];
|
5195 | ms = utils.clamp(ms, range);
|
5196 |
|
5197 |
|
5198 | if (ms === range[0] || ms === range[1]) {
|
5199 | this._enableTimeouts = false;
|
5200 | }
|
5201 | debug('timeout %d', ms);
|
5202 | this._timeout = ms;
|
5203 | if (this.timer) {
|
5204 | this.resetTimeout();
|
5205 | }
|
5206 | return this;
|
5207 | };
|
5208 |
|
5209 |
|
5210 |
|
5211 |
|
5212 |
|
5213 |
|
5214 |
|
5215 |
|
5216 | Runnable.prototype.slow = function(ms) {
|
5217 | if (!arguments.length || typeof ms === 'undefined') {
|
5218 | return this._slow;
|
5219 | }
|
5220 | if (typeof ms === 'string') {
|
5221 | ms = milliseconds(ms);
|
5222 | }
|
5223 | debug('slow %d', ms);
|
5224 | this._slow = ms;
|
5225 | return this;
|
5226 | };
|
5227 |
|
5228 |
|
5229 |
|
5230 |
|
5231 |
|
5232 |
|
5233 |
|
5234 |
|
5235 | Runnable.prototype.enableTimeouts = function(enabled) {
|
5236 | if (!arguments.length) {
|
5237 | return this._enableTimeouts;
|
5238 | }
|
5239 | debug('enableTimeouts %s', enabled);
|
5240 | this._enableTimeouts = enabled;
|
5241 | return this;
|
5242 | };
|
5243 |
|
5244 |
|
5245 |
|
5246 |
|
5247 |
|
5248 |
|
5249 |
|
5250 | Runnable.prototype.skip = function() {
|
5251 | this.pending = true;
|
5252 | throw new Pending('sync skip; aborting execution');
|
5253 | };
|
5254 |
|
5255 |
|
5256 |
|
5257 |
|
5258 |
|
5259 |
|
5260 | Runnable.prototype.isPending = function() {
|
5261 | return this.pending || (this.parent && this.parent.isPending());
|
5262 | };
|
5263 |
|
5264 |
|
5265 |
|
5266 |
|
5267 |
|
5268 |
|
5269 | Runnable.prototype.isFailed = function() {
|
5270 | return !this.isPending() && this.state === constants.STATE_FAILED;
|
5271 | };
|
5272 |
|
5273 |
|
5274 |
|
5275 |
|
5276 |
|
5277 |
|
5278 | Runnable.prototype.isPassed = function() {
|
5279 | return !this.isPending() && this.state === constants.STATE_PASSED;
|
5280 | };
|
5281 |
|
5282 |
|
5283 |
|
5284 |
|
5285 |
|
5286 |
|
5287 | Runnable.prototype.retries = function(n) {
|
5288 | if (!arguments.length) {
|
5289 | return this._retries;
|
5290 | }
|
5291 | this._retries = n;
|
5292 | };
|
5293 |
|
5294 |
|
5295 |
|
5296 |
|
5297 |
|
5298 |
|
5299 | Runnable.prototype.currentRetry = function(n) {
|
5300 | if (!arguments.length) {
|
5301 | return this._currentRetry;
|
5302 | }
|
5303 | this._currentRetry = n;
|
5304 | };
|
5305 |
|
5306 |
|
5307 |
|
5308 |
|
5309 |
|
5310 |
|
5311 |
|
5312 |
|
5313 |
|
5314 | Runnable.prototype.fullTitle = function() {
|
5315 | return this.titlePath().join(' ');
|
5316 | };
|
5317 |
|
5318 |
|
5319 |
|
5320 |
|
5321 |
|
5322 |
|
5323 |
|
5324 |
|
5325 | Runnable.prototype.titlePath = function() {
|
5326 | return this.parent.titlePath().concat([this.title]);
|
5327 | };
|
5328 |
|
5329 |
|
5330 |
|
5331 |
|
5332 |
|
5333 |
|
5334 | Runnable.prototype.clearTimeout = function() {
|
5335 | clearTimeout(this.timer);
|
5336 | };
|
5337 |
|
5338 |
|
5339 |
|
5340 |
|
5341 |
|
5342 |
|
5343 |
|
5344 | Runnable.prototype.inspect = function() {
|
5345 | return JSON.stringify(
|
5346 | this,
|
5347 | function(key, val) {
|
5348 | if (key[0] === '_') {
|
5349 | return;
|
5350 | }
|
5351 | if (key === 'parent') {
|
5352 | return '#<Suite>';
|
5353 | }
|
5354 | if (key === 'ctx') {
|
5355 | return '#<Context>';
|
5356 | }
|
5357 | return val;
|
5358 | },
|
5359 | 2
|
5360 | );
|
5361 | };
|
5362 |
|
5363 |
|
5364 |
|
5365 |
|
5366 |
|
5367 |
|
5368 | Runnable.prototype.resetTimeout = function() {
|
5369 | var self = this;
|
5370 | var ms = this.timeout() || 1e9;
|
5371 |
|
5372 | if (!this._enableTimeouts) {
|
5373 | return;
|
5374 | }
|
5375 | this.clearTimeout();
|
5376 | this.timer = setTimeout(function() {
|
5377 | if (!self._enableTimeouts) {
|
5378 | return;
|
5379 | }
|
5380 | self.callback(self._timeoutError(ms));
|
5381 | self.timedOut = true;
|
5382 | }, ms);
|
5383 | };
|
5384 |
|
5385 |
|
5386 |
|
5387 |
|
5388 |
|
5389 |
|
5390 |
|
5391 | Runnable.prototype.globals = function(globals) {
|
5392 | if (!arguments.length) {
|
5393 | return this._allowedGlobals;
|
5394 | }
|
5395 | this._allowedGlobals = globals;
|
5396 | };
|
5397 |
|
5398 |
|
5399 |
|
5400 |
|
5401 |
|
5402 |
|
5403 |
|
5404 | Runnable.prototype.run = function(fn) {
|
5405 | var self = this;
|
5406 | var start = new Date();
|
5407 | var ctx = this.ctx;
|
5408 | var finished;
|
5409 | var emitted;
|
5410 |
|
5411 |
|
5412 | if (ctx && ctx.runnable) {
|
5413 | ctx.runnable(this);
|
5414 | }
|
5415 |
|
5416 |
|
5417 | function multiple(err) {
|
5418 | if (emitted) {
|
5419 | return;
|
5420 | }
|
5421 | emitted = true;
|
5422 | var msg = 'done() called multiple times';
|
5423 | if (err && err.message) {
|
5424 | err.message += " (and Mocha's " + msg + ')';
|
5425 | self.emit('error', err);
|
5426 | } else {
|
5427 | self.emit('error', new Error(msg));
|
5428 | }
|
5429 | }
|
5430 |
|
5431 |
|
5432 | function done(err) {
|
5433 | var ms = self.timeout();
|
5434 | if (self.timedOut) {
|
5435 | return;
|
5436 | }
|
5437 |
|
5438 | if (finished) {
|
5439 | return multiple(err);
|
5440 | }
|
5441 |
|
5442 | self.clearTimeout();
|
5443 | self.duration = new Date() - start;
|
5444 | finished = true;
|
5445 | if (!err && self.duration > ms && self._enableTimeouts) {
|
5446 | err = self._timeoutError(ms);
|
5447 | }
|
5448 | fn(err);
|
5449 | }
|
5450 |
|
5451 |
|
5452 | this.callback = done;
|
5453 |
|
5454 |
|
5455 | if (this.async) {
|
5456 | this.resetTimeout();
|
5457 |
|
5458 |
|
5459 | this.skip = function asyncSkip() {
|
5460 | this.pending = true;
|
5461 | done();
|
5462 |
|
5463 | throw new Pending('async skip; aborting execution');
|
5464 | };
|
5465 |
|
5466 | try {
|
5467 | callFnAsync(this.fn);
|
5468 | } catch (err) {
|
5469 |
|
5470 | emitted = true;
|
5471 | if (err instanceof Pending) {
|
5472 | return;
|
5473 | } else if (this.allowUncaught) {
|
5474 | throw err;
|
5475 | }
|
5476 | done(Runnable.toValueOrError(err));
|
5477 | }
|
5478 | return;
|
5479 | }
|
5480 |
|
5481 |
|
5482 | try {
|
5483 | if (this.isPending()) {
|
5484 | done();
|
5485 | } else {
|
5486 | callFn(this.fn);
|
5487 | }
|
5488 | } catch (err) {
|
5489 | emitted = true;
|
5490 | if (err instanceof Pending) {
|
5491 | return done();
|
5492 | } else if (this.allowUncaught) {
|
5493 | throw err;
|
5494 | }
|
5495 | done(Runnable.toValueOrError(err));
|
5496 | }
|
5497 |
|
5498 | function callFn(fn) {
|
5499 | var result = fn.call(ctx);
|
5500 | if (result && typeof result.then === 'function') {
|
5501 | self.resetTimeout();
|
5502 | result.then(
|
5503 | function() {
|
5504 | done();
|
5505 |
|
5506 |
|
5507 | return null;
|
5508 | },
|
5509 | function(reason) {
|
5510 | done(reason || new Error('Promise rejected with no or falsy reason'));
|
5511 | }
|
5512 | );
|
5513 | } else {
|
5514 | if (self.asyncOnly) {
|
5515 | return done(
|
5516 | new Error(
|
5517 | '--async-only option in use without declaring `done()` or returning a promise'
|
5518 | )
|
5519 | );
|
5520 | }
|
5521 |
|
5522 | done();
|
5523 | }
|
5524 | }
|
5525 |
|
5526 | function callFnAsync(fn) {
|
5527 | var result = fn.call(ctx, function(err) {
|
5528 | if (err instanceof Error || toString.call(err) === '[object Error]') {
|
5529 | return done(err);
|
5530 | }
|
5531 | if (err) {
|
5532 | if (Object.prototype.toString.call(err) === '[object Object]') {
|
5533 | return done(
|
5534 | new Error('done() invoked with non-Error: ' + JSON.stringify(err))
|
5535 | );
|
5536 | }
|
5537 | return done(new Error('done() invoked with non-Error: ' + err));
|
5538 | }
|
5539 | if (result && utils.isPromise(result)) {
|
5540 | return done(
|
5541 | new Error(
|
5542 | 'Resolution method is overspecified. Specify a callback *or* return a Promise; not both.'
|
5543 | )
|
5544 | );
|
5545 | }
|
5546 |
|
5547 | done();
|
5548 | });
|
5549 | }
|
5550 | };
|
5551 |
|
5552 |
|
5553 |
|
5554 |
|
5555 |
|
5556 |
|
5557 |
|
5558 |
|
5559 | Runnable.prototype._timeoutError = function(ms) {
|
5560 | var msg =
|
5561 | 'Timeout of ' +
|
5562 | ms +
|
5563 | 'ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.';
|
5564 | if (this.file) {
|
5565 | msg += ' (' + this.file + ')';
|
5566 | }
|
5567 | return new Error(msg);
|
5568 | };
|
5569 |
|
5570 | var constants = utils.defineConstants(
|
5571 | |
5572 |
|
5573 |
|
5574 |
|
5575 |
|
5576 |
|
5577 |
|
5578 |
|
5579 |
|
5580 | {
|
5581 | |
5582 |
|
5583 |
|
5584 | STATE_FAILED: 'failed',
|
5585 | |
5586 |
|
5587 |
|
5588 | STATE_PASSED: 'passed'
|
5589 | }
|
5590 | );
|
5591 |
|
5592 |
|
5593 |
|
5594 |
|
5595 |
|
5596 |
|
5597 |
|
5598 | Runnable.toValueOrError = function(value) {
|
5599 | return (
|
5600 | value ||
|
5601 | createInvalidExceptionError(
|
5602 | 'Runnable failed with falsy or undefined exception. Please throw an Error instead.',
|
5603 | value
|
5604 | )
|
5605 | );
|
5606 | };
|
5607 |
|
5608 | Runnable.constants = constants;
|
5609 |
|
5610 | }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
5611 | },{"./errors":6,"./pending":16,"./utils":38,"debug":45,"events":50,"ms":60}],34:[function(require,module,exports){
|
5612 | (function (process,global){
|
5613 | 'use strict';
|
5614 |
|
5615 |
|
5616 |
|
5617 |
|
5618 | var util = require('util');
|
5619 | var EventEmitter = require('events').EventEmitter;
|
5620 | var Pending = require('./pending');
|
5621 | var utils = require('./utils');
|
5622 | var inherits = utils.inherits;
|
5623 | var debug = require('debug')('mocha:runner');
|
5624 | var Runnable = require('./runnable');
|
5625 | var Suite = require('./suite');
|
5626 | var HOOK_TYPE_BEFORE_EACH = Suite.constants.HOOK_TYPE_BEFORE_EACH;
|
5627 | var HOOK_TYPE_AFTER_EACH = Suite.constants.HOOK_TYPE_AFTER_EACH;
|
5628 | var HOOK_TYPE_AFTER_ALL = Suite.constants.HOOK_TYPE_AFTER_ALL;
|
5629 | var HOOK_TYPE_BEFORE_ALL = Suite.constants.HOOK_TYPE_BEFORE_ALL;
|
5630 | var EVENT_ROOT_SUITE_RUN = Suite.constants.EVENT_ROOT_SUITE_RUN;
|
5631 | var STATE_FAILED = Runnable.constants.STATE_FAILED;
|
5632 | var STATE_PASSED = Runnable.constants.STATE_PASSED;
|
5633 | var dQuote = utils.dQuote;
|
5634 | var ngettext = utils.ngettext;
|
5635 | var sQuote = utils.sQuote;
|
5636 | var stackFilter = utils.stackTraceFilter();
|
5637 | var stringify = utils.stringify;
|
5638 | var type = utils.type;
|
5639 | var errors = require('./errors');
|
5640 | var createInvalidExceptionError = errors.createInvalidExceptionError;
|
5641 | var createUnsupportedError = errors.createUnsupportedError;
|
5642 |
|
5643 |
|
5644 |
|
5645 |
|
5646 |
|
5647 | var globals = [
|
5648 | 'setTimeout',
|
5649 | 'clearTimeout',
|
5650 | 'setInterval',
|
5651 | 'clearInterval',
|
5652 | 'XMLHttpRequest',
|
5653 | 'Date',
|
5654 | 'setImmediate',
|
5655 | 'clearImmediate'
|
5656 | ];
|
5657 |
|
5658 | var constants = utils.defineConstants(
|
5659 | |
5660 |
|
5661 |
|
5662 |
|
5663 |
|
5664 |
|
5665 |
|
5666 |
|
5667 |
|
5668 | {
|
5669 | |
5670 |
|
5671 |
|
5672 | EVENT_HOOK_BEGIN: 'hook',
|
5673 | |
5674 |
|
5675 |
|
5676 | EVENT_HOOK_END: 'hook end',
|
5677 | |
5678 |
|
5679 |
|
5680 | EVENT_RUN_BEGIN: 'start',
|
5681 | |
5682 |
|
5683 |
|
5684 | EVENT_DELAY_BEGIN: 'waiting',
|
5685 | |
5686 |
|
5687 |
|
5688 | EVENT_DELAY_END: 'ready',
|
5689 | |
5690 |
|
5691 |
|
5692 | EVENT_RUN_END: 'end',
|
5693 | |
5694 |
|
5695 |
|
5696 | EVENT_SUITE_BEGIN: 'suite',
|
5697 | |
5698 |
|
5699 |
|
5700 | EVENT_SUITE_END: 'suite end',
|
5701 | |
5702 |
|
5703 |
|
5704 | EVENT_TEST_BEGIN: 'test',
|
5705 | |
5706 |
|
5707 |
|
5708 | EVENT_TEST_END: 'test end',
|
5709 | |
5710 |
|
5711 |
|
5712 | EVENT_TEST_FAIL: 'fail',
|
5713 | |
5714 |
|
5715 |
|
5716 | EVENT_TEST_PASS: 'pass',
|
5717 | |
5718 |
|
5719 |
|
5720 | EVENT_TEST_PENDING: 'pending',
|
5721 | |
5722 |
|
5723 |
|
5724 | EVENT_TEST_RETRY: 'retry'
|
5725 | }
|
5726 | );
|
5727 |
|
5728 | module.exports = Runner;
|
5729 |
|
5730 |
|
5731 |
|
5732 |
|
5733 |
|
5734 |
|
5735 |
|
5736 |
|
5737 |
|
5738 |
|
5739 |
|
5740 | function Runner(suite, delay) {
|
5741 | var self = this;
|
5742 | this._globals = [];
|
5743 | this._abort = false;
|
5744 | this._delay = delay;
|
5745 | this.suite = suite;
|
5746 | this.started = false;
|
5747 | this.total = suite.total();
|
5748 | this.failures = 0;
|
5749 | this.on(constants.EVENT_TEST_END, function(test) {
|
5750 | self.checkGlobals(test);
|
5751 | });
|
5752 | this.on(constants.EVENT_HOOK_END, function(hook) {
|
5753 | self.checkGlobals(hook);
|
5754 | });
|
5755 | this._defaultGrep = /.*/;
|
5756 | this.grep(this._defaultGrep);
|
5757 | this.globals(this.globalProps());
|
5758 | }
|
5759 |
|
5760 |
|
5761 |
|
5762 |
|
5763 |
|
5764 |
|
5765 |
|
5766 | Runner.immediately = global.setImmediate || process.nextTick;
|
5767 |
|
5768 |
|
5769 |
|
5770 |
|
5771 | inherits(Runner, EventEmitter);
|
5772 |
|
5773 |
|
5774 |
|
5775 |
|
5776 |
|
5777 |
|
5778 |
|
5779 |
|
5780 |
|
5781 |
|
5782 |
|
5783 | Runner.prototype.grep = function(re, invert) {
|
5784 | debug('grep %s', re);
|
5785 | this._grep = re;
|
5786 | this._invert = invert;
|
5787 | this.total = this.grepTotal(this.suite);
|
5788 | return this;
|
5789 | };
|
5790 |
|
5791 |
|
5792 |
|
5793 |
|
5794 |
|
5795 |
|
5796 |
|
5797 |
|
5798 |
|
5799 |
|
5800 | Runner.prototype.grepTotal = function(suite) {
|
5801 | var self = this;
|
5802 | var total = 0;
|
5803 |
|
5804 | suite.eachTest(function(test) {
|
5805 | var match = self._grep.test(test.fullTitle());
|
5806 | if (self._invert) {
|
5807 | match = !match;
|
5808 | }
|
5809 | if (match) {
|
5810 | total++;
|
5811 | }
|
5812 | });
|
5813 |
|
5814 | return total;
|
5815 | };
|
5816 |
|
5817 |
|
5818 |
|
5819 |
|
5820 |
|
5821 |
|
5822 |
|
5823 | Runner.prototype.globalProps = function() {
|
5824 | var props = Object.keys(global);
|
5825 |
|
5826 |
|
5827 | for (var i = 0; i < globals.length; ++i) {
|
5828 | if (~props.indexOf(globals[i])) {
|
5829 | continue;
|
5830 | }
|
5831 | props.push(globals[i]);
|
5832 | }
|
5833 |
|
5834 | return props;
|
5835 | };
|
5836 |
|
5837 |
|
5838 |
|
5839 |
|
5840 |
|
5841 |
|
5842 |
|
5843 |
|
5844 |
|
5845 | Runner.prototype.globals = function(arr) {
|
5846 | if (!arguments.length) {
|
5847 | return this._globals;
|
5848 | }
|
5849 | debug('globals %j', arr);
|
5850 | this._globals = this._globals.concat(arr);
|
5851 | return this;
|
5852 | };
|
5853 |
|
5854 |
|
5855 |
|
5856 |
|
5857 |
|
5858 |
|
5859 | Runner.prototype.checkGlobals = function(test) {
|
5860 | if (!this.checkLeaks) {
|
5861 | return;
|
5862 | }
|
5863 | var ok = this._globals;
|
5864 |
|
5865 | var globals = this.globalProps();
|
5866 | var leaks;
|
5867 |
|
5868 | if (test) {
|
5869 | ok = ok.concat(test._allowedGlobals || []);
|
5870 | }
|
5871 |
|
5872 | if (this.prevGlobalsLength === globals.length) {
|
5873 | return;
|
5874 | }
|
5875 | this.prevGlobalsLength = globals.length;
|
5876 |
|
5877 | leaks = filterLeaks(ok, globals);
|
5878 | this._globals = this._globals.concat(leaks);
|
5879 |
|
5880 | if (leaks.length) {
|
5881 | var format = ngettext(
|
5882 | leaks.length,
|
5883 | 'global leak detected: %s',
|
5884 | 'global leaks detected: %s'
|
5885 | );
|
5886 | var error = new Error(util.format(format, leaks.map(sQuote).join(', ')));
|
5887 | this.fail(test, error);
|
5888 | }
|
5889 | };
|
5890 |
|
5891 |
|
5892 |
|
5893 |
|
5894 |
|
5895 |
|
5896 |
|
5897 |
|
5898 | Runner.prototype.fail = function(test, err) {
|
5899 | if (test.isPending()) {
|
5900 | return;
|
5901 | }
|
5902 |
|
5903 | ++this.failures;
|
5904 | test.state = STATE_FAILED;
|
5905 |
|
5906 | if (!isError(err)) {
|
5907 | err = thrown2Error(err);
|
5908 | }
|
5909 |
|
5910 | try {
|
5911 | err.stack =
|
5912 | this.fullStackTrace || !err.stack ? err.stack : stackFilter(err.stack);
|
5913 | } catch (ignore) {
|
5914 |
|
5915 | }
|
5916 |
|
5917 | this.emit(constants.EVENT_TEST_FAIL, test, err);
|
5918 | };
|
5919 |
|
5920 |
|
5921 |
|
5922 |
|
5923 |
|
5924 |
|
5925 |
|
5926 |
|
5927 |
|
5928 |
|
5929 |
|
5930 |
|
5931 |
|
5932 |
|
5933 |
|
5934 |
|
5935 |
|
5936 |
|
5937 |
|
5938 |
|
5939 |
|
5940 | Runner.prototype.failHook = function(hook, err) {
|
5941 | hook.originalTitle = hook.originalTitle || hook.title;
|
5942 | if (hook.ctx && hook.ctx.currentTest) {
|
5943 | hook.title =
|
5944 | hook.originalTitle + ' for ' + dQuote(hook.ctx.currentTest.title);
|
5945 | } else {
|
5946 | var parentTitle;
|
5947 | if (hook.parent.title) {
|
5948 | parentTitle = hook.parent.title;
|
5949 | } else {
|
5950 | parentTitle = hook.parent.root ? '{root}' : '';
|
5951 | }
|
5952 | hook.title = hook.originalTitle + ' in ' + dQuote(parentTitle);
|
5953 | }
|
5954 |
|
5955 | this.fail(hook, err);
|
5956 | };
|
5957 |
|
5958 |
|
5959 |
|
5960 |
|
5961 |
|
5962 |
|
5963 |
|
5964 |
|
5965 |
|
5966 | Runner.prototype.hook = function(name, fn) {
|
5967 | var suite = this.suite;
|
5968 | var hooks = suite.getHooks(name);
|
5969 | var self = this;
|
5970 |
|
5971 | function next(i) {
|
5972 | var hook = hooks[i];
|
5973 | if (!hook) {
|
5974 | return fn();
|
5975 | }
|
5976 | self.currentRunnable = hook;
|
5977 |
|
5978 | if (name === HOOK_TYPE_BEFORE_ALL) {
|
5979 | hook.ctx.currentTest = hook.parent.tests[0];
|
5980 | } else if (name === HOOK_TYPE_AFTER_ALL) {
|
5981 | hook.ctx.currentTest = hook.parent.tests[hook.parent.tests.length - 1];
|
5982 | } else {
|
5983 | hook.ctx.currentTest = self.test;
|
5984 | }
|
5985 |
|
5986 | hook.allowUncaught = self.allowUncaught;
|
5987 |
|
5988 | self.emit(constants.EVENT_HOOK_BEGIN, hook);
|
5989 |
|
5990 | if (!hook.listeners('error').length) {
|
5991 | hook.on('error', function(err) {
|
5992 | self.failHook(hook, err);
|
5993 | });
|
5994 | }
|
5995 |
|
5996 | hook.run(function(err) {
|
5997 | var testError = hook.error();
|
5998 | if (testError) {
|
5999 | self.fail(self.test, testError);
|
6000 | }
|
6001 |
|
6002 | if (hook.pending) {
|
6003 | if (name === HOOK_TYPE_AFTER_EACH) {
|
6004 |
|
6005 | if (self.test) {
|
6006 | self.test.pending = true;
|
6007 | }
|
6008 | } else if (name === HOOK_TYPE_BEFORE_EACH) {
|
6009 | if (self.test) {
|
6010 | self.test.pending = true;
|
6011 | }
|
6012 | self.emit(constants.EVENT_HOOK_END, hook);
|
6013 | hook.pending = false;
|
6014 | return fn(new Error('abort hookDown'));
|
6015 | } else if (name === HOOK_TYPE_BEFORE_ALL) {
|
6016 | suite.tests.forEach(function(test) {
|
6017 | test.pending = true;
|
6018 | });
|
6019 | suite.suites.forEach(function(suite) {
|
6020 | suite.pending = true;
|
6021 | });
|
6022 | } else {
|
6023 | hook.pending = false;
|
6024 | var errForbid = createUnsupportedError('`this.skip` forbidden');
|
6025 | self.failHook(hook, errForbid);
|
6026 | return fn(errForbid);
|
6027 | }
|
6028 | } else if (err) {
|
6029 | self.failHook(hook, err);
|
6030 |
|
6031 | return fn(err);
|
6032 | }
|
6033 | self.emit(constants.EVENT_HOOK_END, hook);
|
6034 | delete hook.ctx.currentTest;
|
6035 | next(++i);
|
6036 | });
|
6037 | }
|
6038 |
|
6039 | Runner.immediately(function() {
|
6040 | next(0);
|
6041 | });
|
6042 | };
|
6043 |
|
6044 |
|
6045 |
|
6046 |
|
6047 |
|
6048 |
|
6049 |
|
6050 |
|
6051 |
|
6052 |
|
6053 | Runner.prototype.hooks = function(name, suites, fn) {
|
6054 | var self = this;
|
6055 | var orig = this.suite;
|
6056 |
|
6057 | function next(suite) {
|
6058 | self.suite = suite;
|
6059 |
|
6060 | if (!suite) {
|
6061 | self.suite = orig;
|
6062 | return fn();
|
6063 | }
|
6064 |
|
6065 | self.hook(name, function(err) {
|
6066 | if (err) {
|
6067 | var errSuite = self.suite;
|
6068 | self.suite = orig;
|
6069 | return fn(err, errSuite);
|
6070 | }
|
6071 |
|
6072 | next(suites.pop());
|
6073 | });
|
6074 | }
|
6075 |
|
6076 | next(suites.pop());
|
6077 | };
|
6078 |
|
6079 |
|
6080 |
|
6081 |
|
6082 |
|
6083 |
|
6084 |
|
6085 |
|
6086 | Runner.prototype.hookUp = function(name, fn) {
|
6087 | var suites = [this.suite].concat(this.parents()).reverse();
|
6088 | this.hooks(name, suites, fn);
|
6089 | };
|
6090 |
|
6091 |
|
6092 |
|
6093 |
|
6094 |
|
6095 |
|
6096 |
|
6097 |
|
6098 | Runner.prototype.hookDown = function(name, fn) {
|
6099 | var suites = [this.suite].concat(this.parents());
|
6100 | this.hooks(name, suites, fn);
|
6101 | };
|
6102 |
|
6103 |
|
6104 |
|
6105 |
|
6106 |
|
6107 |
|
6108 |
|
6109 |
|
6110 | Runner.prototype.parents = function() {
|
6111 | var suite = this.suite;
|
6112 | var suites = [];
|
6113 | while (suite.parent) {
|
6114 | suite = suite.parent;
|
6115 | suites.push(suite);
|
6116 | }
|
6117 | return suites;
|
6118 | };
|
6119 |
|
6120 |
|
6121 |
|
6122 |
|
6123 |
|
6124 |
|
6125 |
|
6126 | Runner.prototype.runTest = function(fn) {
|
6127 | var self = this;
|
6128 | var test = this.test;
|
6129 |
|
6130 | if (!test) {
|
6131 | return;
|
6132 | }
|
6133 |
|
6134 | var suite = this.parents().reverse()[0] || this.suite;
|
6135 | if (this.forbidOnly && suite.hasOnly()) {
|
6136 | fn(new Error('`.only` forbidden'));
|
6137 | return;
|
6138 | }
|
6139 | if (this.asyncOnly) {
|
6140 | test.asyncOnly = true;
|
6141 | }
|
6142 | test.on('error', function(err) {
|
6143 | if (err instanceof Pending) {
|
6144 | return;
|
6145 | }
|
6146 | self.fail(test, err);
|
6147 | });
|
6148 | if (this.allowUncaught) {
|
6149 | test.allowUncaught = true;
|
6150 | return test.run(fn);
|
6151 | }
|
6152 | try {
|
6153 | test.run(fn);
|
6154 | } catch (err) {
|
6155 | fn(err);
|
6156 | }
|
6157 | };
|
6158 |
|
6159 |
|
6160 |
|
6161 |
|
6162 |
|
6163 |
|
6164 |
|
6165 |
|
6166 | Runner.prototype.runTests = function(suite, fn) {
|
6167 | var self = this;
|
6168 | var tests = suite.tests.slice();
|
6169 | var test;
|
6170 |
|
6171 | function hookErr(_, errSuite, after) {
|
6172 |
|
6173 | var orig = self.suite;
|
6174 |
|
6175 |
|
6176 |
|
6177 | self.suite = after ? errSuite.parent : errSuite;
|
6178 |
|
6179 | if (self.suite) {
|
6180 |
|
6181 | self.hookUp(HOOK_TYPE_AFTER_EACH, function(err2, errSuite2) {
|
6182 | self.suite = orig;
|
6183 |
|
6184 | if (err2) {
|
6185 | return hookErr(err2, errSuite2, true);
|
6186 | }
|
6187 |
|
6188 | fn(errSuite);
|
6189 | });
|
6190 | } else {
|
6191 |
|
6192 | self.suite = orig;
|
6193 | fn(errSuite);
|
6194 | }
|
6195 | }
|
6196 |
|
6197 | function next(err, errSuite) {
|
6198 |
|
6199 | if (self.failures && suite._bail) {
|
6200 | tests = [];
|
6201 | }
|
6202 |
|
6203 | if (self._abort) {
|
6204 | return fn();
|
6205 | }
|
6206 |
|
6207 | if (err) {
|
6208 | return hookErr(err, errSuite, true);
|
6209 | }
|
6210 |
|
6211 |
|
6212 | test = tests.shift();
|
6213 |
|
6214 |
|
6215 | if (!test) {
|
6216 | return fn();
|
6217 | }
|
6218 |
|
6219 |
|
6220 | var match = self._grep.test(test.fullTitle());
|
6221 | if (self._invert) {
|
6222 | match = !match;
|
6223 | }
|
6224 | if (!match) {
|
6225 |
|
6226 |
|
6227 |
|
6228 |
|
6229 |
|
6230 |
|
6231 |
|
6232 |
|
6233 | if (self._grep !== self._defaultGrep) {
|
6234 | Runner.immediately(next);
|
6235 | } else {
|
6236 | next();
|
6237 | }
|
6238 | return;
|
6239 | }
|
6240 |
|
6241 |
|
6242 | if (test.isPending()) {
|
6243 | if (self.forbidPending) {
|
6244 | test.isPending = alwaysFalse;
|
6245 | self.fail(test, new Error('Pending test forbidden'));
|
6246 | delete test.isPending;
|
6247 | } else {
|
6248 | self.emit(constants.EVENT_TEST_PENDING, test);
|
6249 | }
|
6250 | self.emit(constants.EVENT_TEST_END, test);
|
6251 | return next();
|
6252 | }
|
6253 |
|
6254 |
|
6255 | self.emit(constants.EVENT_TEST_BEGIN, (self.test = test));
|
6256 | self.hookDown(HOOK_TYPE_BEFORE_EACH, function(err, errSuite) {
|
6257 |
|
6258 | if (test.isPending()) {
|
6259 | if (self.forbidPending) {
|
6260 | test.isPending = alwaysFalse;
|
6261 | self.fail(test, new Error('Pending test forbidden'));
|
6262 | delete test.isPending;
|
6263 | } else {
|
6264 | self.emit(constants.EVENT_TEST_PENDING, test);
|
6265 | }
|
6266 | self.emit(constants.EVENT_TEST_END, test);
|
6267 |
|
6268 | var origSuite = self.suite;
|
6269 | self.suite = errSuite;
|
6270 | return self.hookUp(HOOK_TYPE_AFTER_EACH, function(e, eSuite) {
|
6271 | self.suite = origSuite;
|
6272 | next(e, eSuite);
|
6273 | });
|
6274 | }
|
6275 | if (err) {
|
6276 | return hookErr(err, errSuite, false);
|
6277 | }
|
6278 | self.currentRunnable = self.test;
|
6279 | self.runTest(function(err) {
|
6280 | test = self.test;
|
6281 |
|
6282 | if (test.pending) {
|
6283 | if (self.forbidPending) {
|
6284 | test.isPending = alwaysFalse;
|
6285 | self.fail(test, new Error('Pending test forbidden'));
|
6286 | delete test.isPending;
|
6287 | } else {
|
6288 | self.emit(constants.EVENT_TEST_PENDING, test);
|
6289 | }
|
6290 | self.emit(constants.EVENT_TEST_END, test);
|
6291 | return self.hookUp(HOOK_TYPE_AFTER_EACH, next);
|
6292 | } else if (err) {
|
6293 | var retry = test.currentRetry();
|
6294 | if (retry < test.retries()) {
|
6295 | var clonedTest = test.clone();
|
6296 | clonedTest.currentRetry(retry + 1);
|
6297 | tests.unshift(clonedTest);
|
6298 |
|
6299 | self.emit(constants.EVENT_TEST_RETRY, test, err);
|
6300 |
|
6301 |
|
6302 |
|
6303 | return self.hookUp(HOOK_TYPE_AFTER_EACH, next);
|
6304 | } else {
|
6305 | self.fail(test, err);
|
6306 | }
|
6307 | self.emit(constants.EVENT_TEST_END, test);
|
6308 | return self.hookUp(HOOK_TYPE_AFTER_EACH, next);
|
6309 | }
|
6310 |
|
6311 | test.state = STATE_PASSED;
|
6312 | self.emit(constants.EVENT_TEST_PASS, test);
|
6313 | self.emit(constants.EVENT_TEST_END, test);
|
6314 | self.hookUp(HOOK_TYPE_AFTER_EACH, next);
|
6315 | });
|
6316 | });
|
6317 | }
|
6318 |
|
6319 | this.next = next;
|
6320 | this.hookErr = hookErr;
|
6321 | next();
|
6322 | };
|
6323 |
|
6324 | function alwaysFalse() {
|
6325 | return false;
|
6326 | }
|
6327 |
|
6328 |
|
6329 |
|
6330 |
|
6331 |
|
6332 |
|
6333 |
|
6334 |
|
6335 | Runner.prototype.runSuite = function(suite, fn) {
|
6336 | var i = 0;
|
6337 | var self = this;
|
6338 | var total = this.grepTotal(suite);
|
6339 | var afterAllHookCalled = false;
|
6340 |
|
6341 | debug('run suite %s', suite.fullTitle());
|
6342 |
|
6343 | if (!total || (self.failures && suite._bail)) {
|
6344 | return fn();
|
6345 | }
|
6346 |
|
6347 | this.emit(constants.EVENT_SUITE_BEGIN, (this.suite = suite));
|
6348 |
|
6349 | function next(errSuite) {
|
6350 | if (errSuite) {
|
6351 |
|
6352 | if (errSuite === suite) {
|
6353 |
|
6354 |
|
6355 | return done();
|
6356 | }
|
6357 |
|
6358 |
|
6359 | return done(errSuite);
|
6360 | }
|
6361 |
|
6362 | if (self._abort) {
|
6363 | return done();
|
6364 | }
|
6365 |
|
6366 | var curr = suite.suites[i++];
|
6367 | if (!curr) {
|
6368 | return done();
|
6369 | }
|
6370 |
|
6371 |
|
6372 |
|
6373 |
|
6374 | if (self._grep !== self._defaultGrep) {
|
6375 | Runner.immediately(function() {
|
6376 | self.runSuite(curr, next);
|
6377 | });
|
6378 | } else {
|
6379 | self.runSuite(curr, next);
|
6380 | }
|
6381 | }
|
6382 |
|
6383 | function done(errSuite) {
|
6384 | self.suite = suite;
|
6385 | self.nextSuite = next;
|
6386 |
|
6387 | if (afterAllHookCalled) {
|
6388 | fn(errSuite);
|
6389 | } else {
|
6390 |
|
6391 |
|
6392 | afterAllHookCalled = true;
|
6393 |
|
6394 |
|
6395 | delete self.test;
|
6396 |
|
6397 | self.hook(HOOK_TYPE_AFTER_ALL, function() {
|
6398 | self.emit(constants.EVENT_SUITE_END, suite);
|
6399 | fn(errSuite);
|
6400 | });
|
6401 | }
|
6402 | }
|
6403 |
|
6404 | this.nextSuite = next;
|
6405 |
|
6406 | this.hook(HOOK_TYPE_BEFORE_ALL, function(err) {
|
6407 | if (err) {
|
6408 | return done();
|
6409 | }
|
6410 | self.runTests(suite, next);
|
6411 | });
|
6412 | };
|
6413 |
|
6414 |
|
6415 |
|
6416 |
|
6417 |
|
6418 |
|
6419 |
|
6420 | Runner.prototype.uncaught = function(err) {
|
6421 | if (err instanceof Pending) {
|
6422 | return;
|
6423 | }
|
6424 | if (this.allowUncaught) {
|
6425 | throw err;
|
6426 | }
|
6427 |
|
6428 | if (err) {
|
6429 | debug('uncaught exception %O', err);
|
6430 | } else {
|
6431 | debug('uncaught undefined/falsy exception');
|
6432 | err = createInvalidExceptionError(
|
6433 | 'Caught falsy/undefined exception which would otherwise be uncaught. No stack trace found; try a debugger',
|
6434 | err
|
6435 | );
|
6436 | }
|
6437 |
|
6438 | if (!isError(err)) {
|
6439 | err = thrown2Error(err);
|
6440 | }
|
6441 | err.uncaught = true;
|
6442 |
|
6443 | var runnable = this.currentRunnable;
|
6444 |
|
6445 | if (!runnable) {
|
6446 | runnable = new Runnable('Uncaught error outside test suite');
|
6447 | runnable.parent = this.suite;
|
6448 |
|
6449 | if (this.started) {
|
6450 | this.fail(runnable, err);
|
6451 | } else {
|
6452 |
|
6453 | this.emit(constants.EVENT_RUN_BEGIN);
|
6454 | this.fail(runnable, err);
|
6455 | this.emit(constants.EVENT_RUN_END);
|
6456 | }
|
6457 |
|
6458 | return;
|
6459 | }
|
6460 |
|
6461 | runnable.clearTimeout();
|
6462 |
|
6463 | if (runnable.isFailed()) {
|
6464 |
|
6465 | return;
|
6466 | } else if (runnable.isPending()) {
|
6467 |
|
6468 | runnable.isPending = alwaysFalse;
|
6469 | this.fail(runnable, err);
|
6470 | delete runnable.isPending;
|
6471 | return;
|
6472 | }
|
6473 |
|
6474 |
|
6475 |
|
6476 | var alreadyPassed = runnable.isPassed();
|
6477 |
|
6478 | this.fail(runnable, err);
|
6479 | if (!alreadyPassed) {
|
6480 |
|
6481 | if (runnable.type === constants.EVENT_TEST_BEGIN) {
|
6482 | this.emit(constants.EVENT_TEST_END, runnable);
|
6483 | this.hookUp(HOOK_TYPE_AFTER_EACH, this.next);
|
6484 | return;
|
6485 | }
|
6486 | debug(runnable);
|
6487 |
|
6488 |
|
6489 | var errSuite = this.suite;
|
6490 |
|
6491 |
|
6492 |
|
6493 | if (runnable.fullTitle().indexOf('after each') > -1) {
|
6494 | return this.hookErr(err, errSuite, true);
|
6495 | }
|
6496 |
|
6497 | if (runnable.fullTitle().indexOf('before each') > -1) {
|
6498 | return this.hookErr(err, errSuite, false);
|
6499 | }
|
6500 |
|
6501 | return this.nextSuite(errSuite);
|
6502 | }
|
6503 |
|
6504 |
|
6505 | this.abort();
|
6506 | };
|
6507 |
|
6508 |
|
6509 |
|
6510 |
|
6511 |
|
6512 |
|
6513 |
|
6514 |
|
6515 |
|
6516 |
|
6517 | Runner.prototype.run = function(fn) {
|
6518 | var self = this;
|
6519 | var rootSuite = this.suite;
|
6520 |
|
6521 | fn = fn || function() {};
|
6522 |
|
6523 | function uncaught(err) {
|
6524 | self.uncaught(err);
|
6525 | }
|
6526 |
|
6527 | function start() {
|
6528 |
|
6529 | if (rootSuite.hasOnly()) {
|
6530 | rootSuite.filterOnly();
|
6531 | }
|
6532 | self.started = true;
|
6533 | if (self._delay) {
|
6534 | self.emit(constants.EVENT_DELAY_END);
|
6535 | }
|
6536 | self.emit(constants.EVENT_RUN_BEGIN);
|
6537 |
|
6538 | self.runSuite(rootSuite, function() {
|
6539 | debug('finished running');
|
6540 | self.emit(constants.EVENT_RUN_END);
|
6541 | });
|
6542 | }
|
6543 |
|
6544 | debug(constants.EVENT_RUN_BEGIN);
|
6545 |
|
6546 |
|
6547 | this.on(constants.EVENT_SUITE_END, function(suite) {
|
6548 | suite.cleanReferences();
|
6549 | });
|
6550 |
|
6551 |
|
6552 | this.on(constants.EVENT_RUN_END, function() {
|
6553 | debug(constants.EVENT_RUN_END);
|
6554 | process.removeListener('uncaughtException', uncaught);
|
6555 | process.on('uncaughtException', function(err) {
|
6556 | if (err instanceof Pending) {
|
6557 | return;
|
6558 | }
|
6559 | throw err;
|
6560 | });
|
6561 | fn(self.failures);
|
6562 | });
|
6563 |
|
6564 |
|
6565 | process.on('uncaughtException', uncaught);
|
6566 |
|
6567 | if (this._delay) {
|
6568 |
|
6569 |
|
6570 | this.emit(constants.EVENT_DELAY_BEGIN, rootSuite);
|
6571 | rootSuite.once(EVENT_ROOT_SUITE_RUN, start);
|
6572 | } else {
|
6573 | start();
|
6574 | }
|
6575 |
|
6576 | return this;
|
6577 | };
|
6578 |
|
6579 |
|
6580 |
|
6581 |
|
6582 |
|
6583 |
|
6584 |
|
6585 |
|
6586 | Runner.prototype.abort = function() {
|
6587 | debug('aborting');
|
6588 | this._abort = true;
|
6589 |
|
6590 | return this;
|
6591 | };
|
6592 |
|
6593 |
|
6594 |
|
6595 |
|
6596 |
|
6597 |
|
6598 |
|
6599 |
|
6600 |
|
6601 | function filterLeaks(ok, globals) {
|
6602 | return globals.filter(function(key) {
|
6603 |
|
6604 | if (/^\d+/.test(key)) {
|
6605 | return false;
|
6606 | }
|
6607 |
|
6608 |
|
6609 |
|
6610 |
|
6611 | if (global.navigator && /^getInterface/.test(key)) {
|
6612 | return false;
|
6613 | }
|
6614 |
|
6615 |
|
6616 |
|
6617 | if (global.navigator && /^\d+/.test(key)) {
|
6618 | return false;
|
6619 | }
|
6620 |
|
6621 |
|
6622 | if (/^mocha-/.test(key)) {
|
6623 | return false;
|
6624 | }
|
6625 |
|
6626 | var matched = ok.filter(function(ok) {
|
6627 | if (~ok.indexOf('*')) {
|
6628 | return key.indexOf(ok.split('*')[0]) === 0;
|
6629 | }
|
6630 | return key === ok;
|
6631 | });
|
6632 | return !matched.length && (!global.navigator || key !== 'onerror');
|
6633 | });
|
6634 | }
|
6635 |
|
6636 |
|
6637 |
|
6638 |
|
6639 |
|
6640 |
|
6641 |
|
6642 |
|
6643 |
|
6644 | function isError(err) {
|
6645 | return err instanceof Error || (err && typeof err.message === 'string');
|
6646 | }
|
6647 |
|
6648 |
|
6649 |
|
6650 |
|
6651 |
|
6652 |
|
6653 |
|
6654 |
|
6655 |
|
6656 | function thrown2Error(err) {
|
6657 | return new Error(
|
6658 | 'the ' + type(err) + ' ' + stringify(err) + ' was thrown, throw an Error :)'
|
6659 | );
|
6660 | }
|
6661 |
|
6662 | Runner.constants = constants;
|
6663 |
|
6664 |
|
6665 |
|
6666 |
|
6667 |
|
6668 |
|
6669 |
|
6670 | }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
6671 | },{"./errors":6,"./pending":16,"./runnable":33,"./suite":36,"./utils":38,"_process":69,"debug":45,"events":50,"util":89}],35:[function(require,module,exports){
|
6672 | (function (global){
|
6673 | 'use strict';
|
6674 |
|
6675 |
|
6676 |
|
6677 |
|
6678 |
|
6679 |
|
6680 | var constants = require('./runner').constants;
|
6681 | var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
|
6682 | var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
|
6683 | var EVENT_SUITE_BEGIN = constants.EVENT_SUITE_BEGIN;
|
6684 | var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
|
6685 | var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
|
6686 | var EVENT_RUN_END = constants.EVENT_RUN_END;
|
6687 | var EVENT_TEST_END = constants.EVENT_TEST_END;
|
6688 |
|
6689 |
|
6690 |
|
6691 |
|
6692 |
|
6693 |
|
6694 |
|
6695 |
|
6696 |
|
6697 |
|
6698 |
|
6699 |
|
6700 |
|
6701 |
|
6702 |
|
6703 |
|
6704 | var Date = global.Date;
|
6705 |
|
6706 |
|
6707 |
|
6708 |
|
6709 |
|
6710 |
|
6711 |
|
6712 |
|
6713 | function createStatsCollector(runner) {
|
6714 | |
6715 |
|
6716 |
|
6717 | var stats = {
|
6718 | suites: 0,
|
6719 | tests: 0,
|
6720 | passes: 0,
|
6721 | pending: 0,
|
6722 | failures: 0
|
6723 | };
|
6724 |
|
6725 | if (!runner) {
|
6726 | throw new TypeError('Missing runner argument');
|
6727 | }
|
6728 |
|
6729 | runner.stats = stats;
|
6730 |
|
6731 | runner.once(EVENT_RUN_BEGIN, function() {
|
6732 | stats.start = new Date();
|
6733 | });
|
6734 | runner.on(EVENT_SUITE_BEGIN, function(suite) {
|
6735 | suite.root || stats.suites++;
|
6736 | });
|
6737 | runner.on(EVENT_TEST_PASS, function() {
|
6738 | stats.passes++;
|
6739 | });
|
6740 | runner.on(EVENT_TEST_FAIL, function() {
|
6741 | stats.failures++;
|
6742 | });
|
6743 | runner.on(EVENT_TEST_PENDING, function() {
|
6744 | stats.pending++;
|
6745 | });
|
6746 | runner.on(EVENT_TEST_END, function() {
|
6747 | stats.tests++;
|
6748 | });
|
6749 | runner.once(EVENT_RUN_END, function() {
|
6750 | stats.end = new Date();
|
6751 | stats.duration = stats.end - stats.start;
|
6752 | });
|
6753 | }
|
6754 |
|
6755 | module.exports = createStatsCollector;
|
6756 |
|
6757 | }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
6758 | },{"./runner":34}],36:[function(require,module,exports){
|
6759 | 'use strict';
|
6760 |
|
6761 |
|
6762 |
|
6763 |
|
6764 | var EventEmitter = require('events').EventEmitter;
|
6765 | var Hook = require('./hook');
|
6766 | var utils = require('./utils');
|
6767 | var inherits = utils.inherits;
|
6768 | var debug = require('debug')('mocha:suite');
|
6769 | var milliseconds = require('ms');
|
6770 | var errors = require('./errors');
|
6771 | var createInvalidArgumentTypeError = errors.createInvalidArgumentTypeError;
|
6772 |
|
6773 |
|
6774 |
|
6775 |
|
6776 |
|
6777 | exports = module.exports = Suite;
|
6778 |
|
6779 |
|
6780 |
|
6781 |
|
6782 |
|
6783 |
|
6784 |
|
6785 |
|
6786 |
|
6787 | Suite.create = function(parent, title) {
|
6788 | var suite = new Suite(title, parent.ctx);
|
6789 | suite.parent = parent;
|
6790 | title = suite.fullTitle();
|
6791 | parent.addSuite(suite);
|
6792 | return suite;
|
6793 | };
|
6794 |
|
6795 |
|
6796 |
|
6797 |
|
6798 |
|
6799 |
|
6800 |
|
6801 |
|
6802 |
|
6803 |
|
6804 |
|
6805 |
|
6806 | function Suite(title, parentContext, isRoot) {
|
6807 | if (!utils.isString(title)) {
|
6808 | throw createInvalidArgumentTypeError(
|
6809 | 'Suite argument "title" must be a string. Received type "' +
|
6810 | typeof title +
|
6811 | '"',
|
6812 | 'title',
|
6813 | 'string'
|
6814 | );
|
6815 | }
|
6816 | this.title = title;
|
6817 | function Context() {}
|
6818 | Context.prototype = parentContext;
|
6819 | this.ctx = new Context();
|
6820 | this.suites = [];
|
6821 | this.tests = [];
|
6822 | this.pending = false;
|
6823 | this._beforeEach = [];
|
6824 | this._beforeAll = [];
|
6825 | this._afterEach = [];
|
6826 | this._afterAll = [];
|
6827 | this.root = isRoot === true;
|
6828 | this._timeout = 2000;
|
6829 | this._enableTimeouts = true;
|
6830 | this._slow = 75;
|
6831 | this._bail = false;
|
6832 | this._retries = -1;
|
6833 | this._onlyTests = [];
|
6834 | this._onlySuites = [];
|
6835 | this.delayed = false;
|
6836 |
|
6837 | this.on('newListener', function(event) {
|
6838 | if (deprecatedEvents[event]) {
|
6839 | utils.deprecate(
|
6840 | 'Event "' +
|
6841 | event +
|
6842 | '" is deprecated. Please let the Mocha team know about your use case: https://git.io/v6Lwm'
|
6843 | );
|
6844 | }
|
6845 | });
|
6846 | }
|
6847 |
|
6848 |
|
6849 |
|
6850 |
|
6851 | inherits(Suite, EventEmitter);
|
6852 |
|
6853 |
|
6854 |
|
6855 |
|
6856 |
|
6857 |
|
6858 |
|
6859 | Suite.prototype.clone = function() {
|
6860 | var suite = new Suite(this.title);
|
6861 | debug('clone');
|
6862 | suite.ctx = this.ctx;
|
6863 | suite.root = this.root;
|
6864 | suite.timeout(this.timeout());
|
6865 | suite.retries(this.retries());
|
6866 | suite.enableTimeouts(this.enableTimeouts());
|
6867 | suite.slow(this.slow());
|
6868 | suite.bail(this.bail());
|
6869 | return suite;
|
6870 | };
|
6871 |
|
6872 |
|
6873 |
|
6874 |
|
6875 |
|
6876 |
|
6877 |
|
6878 |
|
6879 |
|
6880 | Suite.prototype.timeout = function(ms) {
|
6881 | if (!arguments.length) {
|
6882 | return this._timeout;
|
6883 | }
|
6884 | if (ms.toString() === '0') {
|
6885 | this._enableTimeouts = false;
|
6886 | }
|
6887 | if (typeof ms === 'string') {
|
6888 | ms = milliseconds(ms);
|
6889 | }
|
6890 | debug('timeout %d', ms);
|
6891 | this._timeout = parseInt(ms, 10);
|
6892 | return this;
|
6893 | };
|
6894 |
|
6895 |
|
6896 |
|
6897 |
|
6898 |
|
6899 |
|
6900 |
|
6901 |
|
6902 | Suite.prototype.retries = function(n) {
|
6903 | if (!arguments.length) {
|
6904 | return this._retries;
|
6905 | }
|
6906 | debug('retries %d', n);
|
6907 | this._retries = parseInt(n, 10) || 0;
|
6908 | return this;
|
6909 | };
|
6910 |
|
6911 |
|
6912 |
|
6913 |
|
6914 |
|
6915 |
|
6916 |
|
6917 |
|
6918 | Suite.prototype.enableTimeouts = function(enabled) {
|
6919 | if (!arguments.length) {
|
6920 | return this._enableTimeouts;
|
6921 | }
|
6922 | debug('enableTimeouts %s', enabled);
|
6923 | this._enableTimeouts = enabled;
|
6924 | return this;
|
6925 | };
|
6926 |
|
6927 |
|
6928 |
|
6929 |
|
6930 |
|
6931 |
|
6932 |
|
6933 |
|
6934 | Suite.prototype.slow = function(ms) {
|
6935 | if (!arguments.length) {
|
6936 | return this._slow;
|
6937 | }
|
6938 | if (typeof ms === 'string') {
|
6939 | ms = milliseconds(ms);
|
6940 | }
|
6941 | debug('slow %d', ms);
|
6942 | this._slow = ms;
|
6943 | return this;
|
6944 | };
|
6945 |
|
6946 |
|
6947 |
|
6948 |
|
6949 |
|
6950 |
|
6951 |
|
6952 |
|
6953 | Suite.prototype.bail = function(bail) {
|
6954 | if (!arguments.length) {
|
6955 | return this._bail;
|
6956 | }
|
6957 | debug('bail %s', bail);
|
6958 | this._bail = bail;
|
6959 | return this;
|
6960 | };
|
6961 |
|
6962 |
|
6963 |
|
6964 |
|
6965 |
|
6966 |
|
6967 | Suite.prototype.isPending = function() {
|
6968 | return this.pending || (this.parent && this.parent.isPending());
|
6969 | };
|
6970 |
|
6971 |
|
6972 |
|
6973 |
|
6974 |
|
6975 |
|
6976 |
|
6977 |
|
6978 | Suite.prototype._createHook = function(title, fn) {
|
6979 | var hook = new Hook(title, fn);
|
6980 | hook.parent = this;
|
6981 | hook.timeout(this.timeout());
|
6982 | hook.retries(this.retries());
|
6983 | hook.enableTimeouts(this.enableTimeouts());
|
6984 | hook.slow(this.slow());
|
6985 | hook.ctx = this.ctx;
|
6986 | hook.file = this.file;
|
6987 | return hook;
|
6988 | };
|
6989 |
|
6990 |
|
6991 |
|
6992 |
|
6993 |
|
6994 |
|
6995 |
|
6996 |
|
6997 |
|
6998 | Suite.prototype.beforeAll = function(title, fn) {
|
6999 | if (this.isPending()) {
|
7000 | return this;
|
7001 | }
|
7002 | if (typeof title === 'function') {
|
7003 | fn = title;
|
7004 | title = fn.name;
|
7005 | }
|
7006 | title = '"before all" hook' + (title ? ': ' + title : '');
|
7007 |
|
7008 | var hook = this._createHook(title, fn);
|
7009 | this._beforeAll.push(hook);
|
7010 | this.emit(constants.EVENT_SUITE_ADD_HOOK_BEFORE_ALL, hook);
|
7011 | return this;
|
7012 | };
|
7013 |
|
7014 |
|
7015 |
|
7016 |
|
7017 |
|
7018 |
|
7019 |
|
7020 |
|
7021 |
|
7022 | Suite.prototype.afterAll = function(title, fn) {
|
7023 | if (this.isPending()) {
|
7024 | return this;
|
7025 | }
|
7026 | if (typeof title === 'function') {
|
7027 | fn = title;
|
7028 | title = fn.name;
|
7029 | }
|
7030 | title = '"after all" hook' + (title ? ': ' + title : '');
|
7031 |
|
7032 | var hook = this._createHook(title, fn);
|
7033 | this._afterAll.push(hook);
|
7034 | this.emit(constants.EVENT_SUITE_ADD_HOOK_AFTER_ALL, hook);
|
7035 | return this;
|
7036 | };
|
7037 |
|
7038 |
|
7039 |
|
7040 |
|
7041 |
|
7042 |
|
7043 |
|
7044 |
|
7045 |
|
7046 | Suite.prototype.beforeEach = function(title, fn) {
|
7047 | if (this.isPending()) {
|
7048 | return this;
|
7049 | }
|
7050 | if (typeof title === 'function') {
|
7051 | fn = title;
|
7052 | title = fn.name;
|
7053 | }
|
7054 | title = '"before each" hook' + (title ? ': ' + title : '');
|
7055 |
|
7056 | var hook = this._createHook(title, fn);
|
7057 | this._beforeEach.push(hook);
|
7058 | this.emit(constants.EVENT_SUITE_ADD_HOOK_BEFORE_EACH, hook);
|
7059 | return this;
|
7060 | };
|
7061 |
|
7062 |
|
7063 |
|
7064 |
|
7065 |
|
7066 |
|
7067 |
|
7068 |
|
7069 |
|
7070 | Suite.prototype.afterEach = function(title, fn) {
|
7071 | if (this.isPending()) {
|
7072 | return this;
|
7073 | }
|
7074 | if (typeof title === 'function') {
|
7075 | fn = title;
|
7076 | title = fn.name;
|
7077 | }
|
7078 | title = '"after each" hook' + (title ? ': ' + title : '');
|
7079 |
|
7080 | var hook = this._createHook(title, fn);
|
7081 | this._afterEach.push(hook);
|
7082 | this.emit(constants.EVENT_SUITE_ADD_HOOK_AFTER_EACH, hook);
|
7083 | return this;
|
7084 | };
|
7085 |
|
7086 |
|
7087 |
|
7088 |
|
7089 |
|
7090 |
|
7091 |
|
7092 |
|
7093 | Suite.prototype.addSuite = function(suite) {
|
7094 | suite.parent = this;
|
7095 | suite.root = false;
|
7096 | suite.timeout(this.timeout());
|
7097 | suite.retries(this.retries());
|
7098 | suite.enableTimeouts(this.enableTimeouts());
|
7099 | suite.slow(this.slow());
|
7100 | suite.bail(this.bail());
|
7101 | this.suites.push(suite);
|
7102 | this.emit(constants.EVENT_SUITE_ADD_SUITE, suite);
|
7103 | return this;
|
7104 | };
|
7105 |
|
7106 |
|
7107 |
|
7108 |
|
7109 |
|
7110 |
|
7111 |
|
7112 |
|
7113 | Suite.prototype.addTest = function(test) {
|
7114 | test.parent = this;
|
7115 | test.timeout(this.timeout());
|
7116 | test.retries(this.retries());
|
7117 | test.enableTimeouts(this.enableTimeouts());
|
7118 | test.slow(this.slow());
|
7119 | test.ctx = this.ctx;
|
7120 | this.tests.push(test);
|
7121 | this.emit(constants.EVENT_SUITE_ADD_TEST, test);
|
7122 | return this;
|
7123 | };
|
7124 |
|
7125 |
|
7126 |
|
7127 |
|
7128 |
|
7129 |
|
7130 |
|
7131 |
|
7132 |
|
7133 | Suite.prototype.fullTitle = function() {
|
7134 | return this.titlePath().join(' ');
|
7135 | };
|
7136 |
|
7137 |
|
7138 |
|
7139 |
|
7140 |
|
7141 |
|
7142 |
|
7143 |
|
7144 |
|
7145 | Suite.prototype.titlePath = function() {
|
7146 | var result = [];
|
7147 | if (this.parent) {
|
7148 | result = result.concat(this.parent.titlePath());
|
7149 | }
|
7150 | if (!this.root) {
|
7151 | result.push(this.title);
|
7152 | }
|
7153 | return result;
|
7154 | };
|
7155 |
|
7156 |
|
7157 |
|
7158 |
|
7159 |
|
7160 |
|
7161 |
|
7162 |
|
7163 | Suite.prototype.total = function() {
|
7164 | return (
|
7165 | this.suites.reduce(function(sum, suite) {
|
7166 | return sum + suite.total();
|
7167 | }, 0) + this.tests.length
|
7168 | );
|
7169 | };
|
7170 |
|
7171 |
|
7172 |
|
7173 |
|
7174 |
|
7175 |
|
7176 |
|
7177 |
|
7178 |
|
7179 | Suite.prototype.eachTest = function(fn) {
|
7180 | this.tests.forEach(fn);
|
7181 | this.suites.forEach(function(suite) {
|
7182 | suite.eachTest(fn);
|
7183 | });
|
7184 | return this;
|
7185 | };
|
7186 |
|
7187 |
|
7188 |
|
7189 |
|
7190 |
|
7191 | Suite.prototype.run = function run() {
|
7192 | if (this.root) {
|
7193 | this.emit(constants.EVENT_ROOT_SUITE_RUN);
|
7194 | }
|
7195 | };
|
7196 |
|
7197 |
|
7198 |
|
7199 |
|
7200 |
|
7201 |
|
7202 |
|
7203 | Suite.prototype.hasOnly = function hasOnly() {
|
7204 | return (
|
7205 | this._onlyTests.length > 0 ||
|
7206 | this._onlySuites.length > 0 ||
|
7207 | this.suites.some(function(suite) {
|
7208 | return suite.hasOnly();
|
7209 | })
|
7210 | );
|
7211 | };
|
7212 |
|
7213 |
|
7214 |
|
7215 |
|
7216 |
|
7217 |
|
7218 |
|
7219 | Suite.prototype.filterOnly = function filterOnly() {
|
7220 | if (this._onlyTests.length) {
|
7221 |
|
7222 | this.tests = this._onlyTests;
|
7223 | this.suites = [];
|
7224 | } else {
|
7225 |
|
7226 | this.tests = [];
|
7227 | this._onlySuites.forEach(function(onlySuite) {
|
7228 |
|
7229 |
|
7230 | if (onlySuite.hasOnly()) {
|
7231 | onlySuite.filterOnly();
|
7232 | }
|
7233 | });
|
7234 |
|
7235 | var onlySuites = this._onlySuites;
|
7236 | this.suites = this.suites.filter(function(childSuite) {
|
7237 | return onlySuites.indexOf(childSuite) !== -1 || childSuite.filterOnly();
|
7238 | });
|
7239 | }
|
7240 |
|
7241 | return this.tests.length > 0 || this.suites.length > 0;
|
7242 | };
|
7243 |
|
7244 |
|
7245 |
|
7246 |
|
7247 |
|
7248 |
|
7249 |
|
7250 | Suite.prototype.appendOnlySuite = function(suite) {
|
7251 | this._onlySuites.push(suite);
|
7252 | };
|
7253 |
|
7254 |
|
7255 |
|
7256 |
|
7257 |
|
7258 |
|
7259 |
|
7260 | Suite.prototype.appendOnlyTest = function(test) {
|
7261 | this._onlyTests.push(test);
|
7262 | };
|
7263 |
|
7264 |
|
7265 |
|
7266 |
|
7267 |
|
7268 | Suite.prototype.getHooks = function getHooks(name) {
|
7269 | return this['_' + name];
|
7270 | };
|
7271 |
|
7272 |
|
7273 |
|
7274 |
|
7275 |
|
7276 |
|
7277 |
|
7278 |
|
7279 |
|
7280 |
|
7281 |
|
7282 | Suite.prototype.cleanReferences = function cleanReferences() {
|
7283 | function cleanArrReferences(arr) {
|
7284 | for (var i = 0; i < arr.length; i++) {
|
7285 | delete arr[i].fn;
|
7286 | }
|
7287 | }
|
7288 |
|
7289 | if (Array.isArray(this._beforeAll)) {
|
7290 | cleanArrReferences(this._beforeAll);
|
7291 | }
|
7292 |
|
7293 | if (Array.isArray(this._beforeEach)) {
|
7294 | cleanArrReferences(this._beforeEach);
|
7295 | }
|
7296 |
|
7297 | if (Array.isArray(this._afterAll)) {
|
7298 | cleanArrReferences(this._afterAll);
|
7299 | }
|
7300 |
|
7301 | if (Array.isArray(this._afterEach)) {
|
7302 | cleanArrReferences(this._afterEach);
|
7303 | }
|
7304 |
|
7305 | for (var i = 0; i < this.tests.length; i++) {
|
7306 | delete this.tests[i].fn;
|
7307 | }
|
7308 | };
|
7309 |
|
7310 | var constants = utils.defineConstants(
|
7311 | |
7312 |
|
7313 |
|
7314 |
|
7315 |
|
7316 |
|
7317 |
|
7318 |
|
7319 |
|
7320 | {
|
7321 | |
7322 |
|
7323 |
|
7324 | EVENT_FILE_POST_REQUIRE: 'post-require',
|
7325 | |
7326 |
|
7327 |
|
7328 | EVENT_FILE_PRE_REQUIRE: 'pre-require',
|
7329 | |
7330 |
|
7331 |
|
7332 | EVENT_FILE_REQUIRE: 'require',
|
7333 | |
7334 |
|
7335 |
|
7336 | EVENT_ROOT_SUITE_RUN: 'run',
|
7337 |
|
7338 | |
7339 |
|
7340 |
|
7341 | HOOK_TYPE_AFTER_ALL: 'afterAll',
|
7342 | |
7343 |
|
7344 |
|
7345 | HOOK_TYPE_AFTER_EACH: 'afterEach',
|
7346 | |
7347 |
|
7348 |
|
7349 | HOOK_TYPE_BEFORE_ALL: 'beforeAll',
|
7350 | |
7351 |
|
7352 |
|
7353 | HOOK_TYPE_BEFORE_EACH: 'beforeEach',
|
7354 |
|
7355 |
|
7356 |
|
7357 | |
7358 |
|
7359 |
|
7360 | EVENT_SUITE_ADD_HOOK_AFTER_ALL: 'afterAll',
|
7361 | |
7362 |
|
7363 |
|
7364 | EVENT_SUITE_ADD_HOOK_AFTER_EACH: 'afterEach',
|
7365 | |
7366 |
|
7367 |
|
7368 | EVENT_SUITE_ADD_HOOK_BEFORE_ALL: 'beforeAll',
|
7369 | |
7370 |
|
7371 |
|
7372 | EVENT_SUITE_ADD_HOOK_BEFORE_EACH: 'beforeEach',
|
7373 | |
7374 |
|
7375 |
|
7376 | EVENT_SUITE_ADD_SUITE: 'suite',
|
7377 | |
7378 |
|
7379 |
|
7380 | EVENT_SUITE_ADD_TEST: 'test'
|
7381 | }
|
7382 | );
|
7383 |
|
7384 |
|
7385 |
|
7386 |
|
7387 |
|
7388 |
|
7389 |
|
7390 |
|
7391 | var deprecatedEvents = Object.keys(constants)
|
7392 | .filter(function(constant) {
|
7393 | return constant.substring(0, 15) === 'EVENT_SUITE_ADD';
|
7394 | })
|
7395 | .reduce(function(acc, constant) {
|
7396 | acc[constants[constant]] = true;
|
7397 | return acc;
|
7398 | }, utils.createMap());
|
7399 |
|
7400 | Suite.constants = constants;
|
7401 |
|
7402 | },{"./errors":6,"./hook":7,"./utils":38,"debug":45,"events":50,"ms":60}],37:[function(require,module,exports){
|
7403 | 'use strict';
|
7404 | var Runnable = require('./runnable');
|
7405 | var utils = require('./utils');
|
7406 | var errors = require('./errors');
|
7407 | var createInvalidArgumentTypeError = errors.createInvalidArgumentTypeError;
|
7408 | var isString = utils.isString;
|
7409 |
|
7410 | module.exports = Test;
|
7411 |
|
7412 |
|
7413 |
|
7414 |
|
7415 |
|
7416 |
|
7417 |
|
7418 |
|
7419 |
|
7420 |
|
7421 | function Test(title, fn) {
|
7422 | if (!isString(title)) {
|
7423 | throw createInvalidArgumentTypeError(
|
7424 | 'Test argument "title" should be a string. Received type "' +
|
7425 | typeof title +
|
7426 | '"',
|
7427 | 'title',
|
7428 | 'string'
|
7429 | );
|
7430 | }
|
7431 | Runnable.call(this, title, fn);
|
7432 | this.pending = !fn;
|
7433 | this.type = 'test';
|
7434 | }
|
7435 |
|
7436 |
|
7437 |
|
7438 |
|
7439 | utils.inherits(Test, Runnable);
|
7440 |
|
7441 | Test.prototype.clone = function() {
|
7442 | var test = new Test(this.title, this.fn);
|
7443 | test.timeout(this.timeout());
|
7444 | test.slow(this.slow());
|
7445 | test.enableTimeouts(this.enableTimeouts());
|
7446 | test.retries(this.retries());
|
7447 | test.currentRetry(this.currentRetry());
|
7448 | test.globals(this.globals());
|
7449 | test.parent = this.parent;
|
7450 | test.file = this.file;
|
7451 | test.ctx = this.ctx;
|
7452 | return test;
|
7453 | };
|
7454 |
|
7455 | },{"./errors":6,"./runnable":33,"./utils":38}],38:[function(require,module,exports){
|
7456 | (function (process,Buffer){
|
7457 | 'use strict';
|
7458 |
|
7459 |
|
7460 |
|
7461 |
|
7462 |
|
7463 |
|
7464 |
|
7465 |
|
7466 |
|
7467 |
|
7468 | var fs = require('fs');
|
7469 | var path = require('path');
|
7470 | var util = require('util');
|
7471 | var glob = require('glob');
|
7472 | var he = require('he');
|
7473 | var errors = require('./errors');
|
7474 | var createNoFilesMatchPatternError = errors.createNoFilesMatchPatternError;
|
7475 | var createMissingArgumentError = errors.createMissingArgumentError;
|
7476 |
|
7477 | var assign = (exports.assign = require('object.assign').getPolyfill());
|
7478 |
|
7479 |
|
7480 |
|
7481 |
|
7482 |
|
7483 |
|
7484 |
|
7485 |
|
7486 |
|
7487 |
|
7488 | exports.inherits = util.inherits;
|
7489 |
|
7490 |
|
7491 |
|
7492 |
|
7493 |
|
7494 |
|
7495 |
|
7496 |
|
7497 | exports.escape = function(html) {
|
7498 | return he.encode(String(html), {useNamedReferences: false});
|
7499 | };
|
7500 |
|
7501 |
|
7502 |
|
7503 |
|
7504 |
|
7505 |
|
7506 |
|
7507 |
|
7508 | exports.isString = function(obj) {
|
7509 | return typeof obj === 'string';
|
7510 | };
|
7511 |
|
7512 |
|
7513 |
|
7514 |
|
7515 |
|
7516 |
|
7517 |
|
7518 |
|
7519 | exports.slug = function(str) {
|
7520 | return str
|
7521 | .toLowerCase()
|
7522 | .replace(/ +/g, '-')
|
7523 | .replace(/[^-\w]/g, '');
|
7524 | };
|
7525 |
|
7526 |
|
7527 |
|
7528 |
|
7529 |
|
7530 |
|
7531 |
|
7532 | exports.clean = function(str) {
|
7533 | str = str
|
7534 | .replace(/\r\n?|[\n\u2028\u2029]/g, '\n')
|
7535 | .replace(/^\uFEFF/, '')
|
7536 |
|
7537 | .replace(
|
7538 | /^function(?:\s*|\s+[^(]*)\([^)]*\)\s*\{((?:.|\n)*?)\s*\}$|^\([^)]*\)\s*=>\s*(?:\{((?:.|\n)*?)\s*\}|((?:.|\n)*))$/,
|
7539 | '$1$2$3'
|
7540 | );
|
7541 |
|
7542 | var spaces = str.match(/^\n?( *)/)[1].length;
|
7543 | var tabs = str.match(/^\n?(\t*)/)[1].length;
|
7544 | var re = new RegExp(
|
7545 | '^\n?' + (tabs ? '\t' : ' ') + '{' + (tabs || spaces) + '}',
|
7546 | 'gm'
|
7547 | );
|
7548 |
|
7549 | str = str.replace(re, '');
|
7550 |
|
7551 | return str.trim();
|
7552 | };
|
7553 |
|
7554 |
|
7555 |
|
7556 |
|
7557 |
|
7558 |
|
7559 |
|
7560 |
|
7561 | exports.parseQuery = function(qs) {
|
7562 | return qs
|
7563 | .replace('?', '')
|
7564 | .split('&')
|
7565 | .reduce(function(obj, pair) {
|
7566 | var i = pair.indexOf('=');
|
7567 | var key = pair.slice(0, i);
|
7568 | var val = pair.slice(++i);
|
7569 |
|
7570 |
|
7571 | obj[key] = decodeURIComponent(val.replace(/\+/g, '%20'));
|
7572 |
|
7573 | return obj;
|
7574 | }, {});
|
7575 | };
|
7576 |
|
7577 |
|
7578 |
|
7579 |
|
7580 |
|
7581 |
|
7582 |
|
7583 |
|
7584 | function highlight(js) {
|
7585 | return js
|
7586 | .replace(/</g, '<')
|
7587 | .replace(/>/g, '>')
|
7588 | .replace(/\/\/(.*)/gm, '<span class="comment">//$1</span>')
|
7589 | .replace(/('.*?')/gm, '<span class="string">$1</span>')
|
7590 | .replace(/(\d+\.\d+)/gm, '<span class="number">$1</span>')
|
7591 | .replace(/(\d+)/gm, '<span class="number">$1</span>')
|
7592 | .replace(
|
7593 | /\bnew[ \t]+(\w+)/gm,
|
7594 | '<span class="keyword">new</span> <span class="init">$1</span>'
|
7595 | )
|
7596 | .replace(
|
7597 | /\b(function|new|throw|return|var|if|else)\b/gm,
|
7598 | '<span class="keyword">$1</span>'
|
7599 | );
|
7600 | }
|
7601 |
|
7602 | /**
|
7603 | * Highlight the contents of tag `name`.
|
7604 | *
|
7605 | * @private
|
7606 | * @param {string} name
|
7607 | */
|
7608 | exports.highlightTags = function(name) {
|
7609 | var code = document.getElementById('mocha').getElementsByTagName(name);
|
7610 | for (var i = 0, len = code.length; i < len; ++i) {
|
7611 | code[i].innerHTML = highlight(code[i].innerHTML);
|
7612 | }
|
7613 | };
|
7614 |
|
7615 |
|
7616 |
|
7617 |
|
7618 |
|
7619 |
|
7620 |
|
7621 |
|
7622 |
|
7623 |
|
7624 |
|
7625 |
|
7626 |
|
7627 |
|
7628 |
|
7629 | function emptyRepresentation(value, typeHint) {
|
7630 | switch (typeHint) {
|
7631 | case 'function':
|
7632 | return '[Function]';
|
7633 | case 'object':
|
7634 | return '{}';
|
7635 | case 'array':
|
7636 | return '[]';
|
7637 | default:
|
7638 | return value.toString();
|
7639 | }
|
7640 | }
|
7641 |
|
7642 |
|
7643 |
|
7644 |
|
7645 |
|
7646 |
|
7647 |
|
7648 |
|
7649 |
|
7650 |
|
7651 |
|
7652 |
|
7653 |
|
7654 |
|
7655 |
|
7656 |
|
7657 |
|
7658 |
|
7659 |
|
7660 |
|
7661 |
|
7662 |
|
7663 | var type = (exports.type = function type(value) {
|
7664 | if (value === undefined) {
|
7665 | return 'undefined';
|
7666 | } else if (value === null) {
|
7667 | return 'null';
|
7668 | } else if (Buffer.isBuffer(value)) {
|
7669 | return 'buffer';
|
7670 | }
|
7671 | return Object.prototype.toString
|
7672 | .call(value)
|
7673 | .replace(/^\[.+\s(.+?)]$/, '$1')
|
7674 | .toLowerCase();
|
7675 | });
|
7676 |
|
7677 |
|
7678 |
|
7679 |
|
7680 |
|
7681 |
|
7682 |
|
7683 |
|
7684 |
|
7685 |
|
7686 |
|
7687 |
|
7688 |
|
7689 |
|
7690 |
|
7691 |
|
7692 | exports.stringify = function(value) {
|
7693 | var typeHint = type(value);
|
7694 |
|
7695 | if (!~['object', 'array', 'function'].indexOf(typeHint)) {
|
7696 | if (typeHint === 'buffer') {
|
7697 | var json = Buffer.prototype.toJSON.call(value);
|
7698 |
|
7699 | return jsonStringify(
|
7700 | json.data && json.type ? json.data : json,
|
7701 | 2
|
7702 | ).replace(/,(\n|$)/g, '$1');
|
7703 | }
|
7704 |
|
7705 |
|
7706 |
|
7707 | if (typeHint === 'string' && typeof value === 'object') {
|
7708 | value = value.split('').reduce(function(acc, char, idx) {
|
7709 | acc[idx] = char;
|
7710 | return acc;
|
7711 | }, {});
|
7712 | typeHint = 'object';
|
7713 | } else {
|
7714 | return jsonStringify(value);
|
7715 | }
|
7716 | }
|
7717 |
|
7718 | for (var prop in value) {
|
7719 | if (Object.prototype.hasOwnProperty.call(value, prop)) {
|
7720 | return jsonStringify(
|
7721 | exports.canonicalize(value, null, typeHint),
|
7722 | 2
|
7723 | ).replace(/,(\n|$)/g, '$1');
|
7724 | }
|
7725 | }
|
7726 |
|
7727 | return emptyRepresentation(value, typeHint);
|
7728 | };
|
7729 |
|
7730 |
|
7731 |
|
7732 |
|
7733 |
|
7734 |
|
7735 |
|
7736 |
|
7737 |
|
7738 |
|
7739 | function jsonStringify(object, spaces, depth) {
|
7740 | if (typeof spaces === 'undefined') {
|
7741 |
|
7742 | return _stringify(object);
|
7743 | }
|
7744 |
|
7745 | depth = depth || 1;
|
7746 | var space = spaces * depth;
|
7747 | var str = Array.isArray(object) ? '[' : '{';
|
7748 | var end = Array.isArray(object) ? ']' : '}';
|
7749 | var length =
|
7750 | typeof object.length === 'number'
|
7751 | ? object.length
|
7752 | : Object.keys(object).length;
|
7753 |
|
7754 | function repeat(s, n) {
|
7755 | return new Array(n).join(s);
|
7756 | }
|
7757 |
|
7758 | function _stringify(val) {
|
7759 | switch (type(val)) {
|
7760 | case 'null':
|
7761 | case 'undefined':
|
7762 | val = '[' + val + ']';
|
7763 | break;
|
7764 | case 'array':
|
7765 | case 'object':
|
7766 | val = jsonStringify(val, spaces, depth + 1);
|
7767 | break;
|
7768 | case 'boolean':
|
7769 | case 'regexp':
|
7770 | case 'symbol':
|
7771 | case 'number':
|
7772 | val =
|
7773 | val === 0 && 1 / val === -Infinity
|
7774 | ? '-0'
|
7775 | : val.toString();
|
7776 | break;
|
7777 | case 'date':
|
7778 | var sDate = isNaN(val.getTime()) ? val.toString() : val.toISOString();
|
7779 | val = '[Date: ' + sDate + ']';
|
7780 | break;
|
7781 | case 'buffer':
|
7782 | var json = val.toJSON();
|
7783 |
|
7784 | json = json.data && json.type ? json.data : json;
|
7785 | val = '[Buffer: ' + jsonStringify(json, 2, depth + 1) + ']';
|
7786 | break;
|
7787 | default:
|
7788 | val =
|
7789 | val === '[Function]' || val === '[Circular]'
|
7790 | ? val
|
7791 | : JSON.stringify(val);
|
7792 | }
|
7793 | return val;
|
7794 | }
|
7795 |
|
7796 | for (var i in object) {
|
7797 | if (!Object.prototype.hasOwnProperty.call(object, i)) {
|
7798 | continue;
|
7799 | }
|
7800 | --length;
|
7801 | str +=
|
7802 | '\n ' +
|
7803 | repeat(' ', space) +
|
7804 | (Array.isArray(object) ? '' : '"' + i + '": ') +
|
7805 | _stringify(object[i]) +
|
7806 | (length ? ',' : '');
|
7807 | }
|
7808 |
|
7809 | return (
|
7810 | str +
|
7811 |
|
7812 | (str.length !== 1 ? '\n' + repeat(' ', --space) + end : end)
|
7813 | );
|
7814 | }
|
7815 |
|
7816 |
|
7817 |
|
7818 |
|
7819 |
|
7820 |
|
7821 |
|
7822 |
|
7823 |
|
7824 |
|
7825 |
|
7826 |
|
7827 |
|
7828 |
|
7829 |
|
7830 |
|
7831 |
|
7832 |
|
7833 |
|
7834 |
|
7835 | exports.canonicalize = function canonicalize(value, stack, typeHint) {
|
7836 | var canonicalizedObj;
|
7837 |
|
7838 | var prop;
|
7839 |
|
7840 | typeHint = typeHint || type(value);
|
7841 | function withStack(value, fn) {
|
7842 | stack.push(value);
|
7843 | fn();
|
7844 | stack.pop();
|
7845 | }
|
7846 |
|
7847 | stack = stack || [];
|
7848 |
|
7849 | if (stack.indexOf(value) !== -1) {
|
7850 | return '[Circular]';
|
7851 | }
|
7852 |
|
7853 | switch (typeHint) {
|
7854 | case 'undefined':
|
7855 | case 'buffer':
|
7856 | case 'null':
|
7857 | canonicalizedObj = value;
|
7858 | break;
|
7859 | case 'array':
|
7860 | withStack(value, function() {
|
7861 | canonicalizedObj = value.map(function(item) {
|
7862 | return exports.canonicalize(item, stack);
|
7863 | });
|
7864 | });
|
7865 | break;
|
7866 | case 'function':
|
7867 |
|
7868 | for (prop in value) {
|
7869 | canonicalizedObj = {};
|
7870 | break;
|
7871 | }
|
7872 |
|
7873 | if (!canonicalizedObj) {
|
7874 | canonicalizedObj = emptyRepresentation(value, typeHint);
|
7875 | break;
|
7876 | }
|
7877 |
|
7878 | case 'object':
|
7879 | canonicalizedObj = canonicalizedObj || {};
|
7880 | withStack(value, function() {
|
7881 | Object.keys(value)
|
7882 | .sort()
|
7883 | .forEach(function(key) {
|
7884 | canonicalizedObj[key] = exports.canonicalize(value[key], stack);
|
7885 | });
|
7886 | });
|
7887 | break;
|
7888 | case 'date':
|
7889 | case 'number':
|
7890 | case 'regexp':
|
7891 | case 'boolean':
|
7892 | case 'symbol':
|
7893 | canonicalizedObj = value;
|
7894 | break;
|
7895 | default:
|
7896 | canonicalizedObj = value + '';
|
7897 | }
|
7898 |
|
7899 | return canonicalizedObj;
|
7900 | };
|
7901 |
|
7902 |
|
7903 |
|
7904 |
|
7905 |
|
7906 |
|
7907 |
|
7908 |
|
7909 |
|
7910 |
|
7911 |
|
7912 | function hasMatchingExtname(pathname, exts) {
|
7913 | var suffix = path.extname(pathname).slice(1);
|
7914 | return exts.some(function(element) {
|
7915 | return suffix === element;
|
7916 | });
|
7917 | }
|
7918 |
|
7919 |
|
7920 |
|
7921 |
|
7922 |
|
7923 |
|
7924 |
|
7925 |
|
7926 |
|
7927 |
|
7928 |
|
7929 |
|
7930 |
|
7931 |
|
7932 |
|
7933 |
|
7934 | function isHiddenOnUnix(pathname) {
|
7935 | return path.basename(pathname)[0] === '.';
|
7936 | }
|
7937 |
|
7938 |
|
7939 |
|
7940 |
|
7941 |
|
7942 |
|
7943 |
|
7944 |
|
7945 |
|
7946 |
|
7947 |
|
7948 |
|
7949 |
|
7950 |
|
7951 |
|
7952 |
|
7953 |
|
7954 | exports.lookupFiles = function lookupFiles(filepath, extensions, recursive) {
|
7955 | extensions = extensions || [];
|
7956 | recursive = recursive || false;
|
7957 | var files = [];
|
7958 | var stat;
|
7959 |
|
7960 | if (!fs.existsSync(filepath)) {
|
7961 | var pattern;
|
7962 | if (glob.hasMagic(filepath)) {
|
7963 |
|
7964 | pattern = filepath;
|
7965 | } else {
|
7966 |
|
7967 | var strExtensions = extensions
|
7968 | .map(function(v) {
|
7969 | return '.' + v;
|
7970 | })
|
7971 | .join('|');
|
7972 | pattern = filepath + '+(' + strExtensions + ')';
|
7973 | }
|
7974 | files = glob.sync(pattern, {nodir: true});
|
7975 | if (!files.length) {
|
7976 | throw createNoFilesMatchPatternError(
|
7977 | 'Cannot find any files matching pattern ' + exports.dQuote(filepath),
|
7978 | filepath
|
7979 | );
|
7980 | }
|
7981 | return files;
|
7982 | }
|
7983 |
|
7984 |
|
7985 | try {
|
7986 | stat = fs.statSync(filepath);
|
7987 | if (stat.isFile()) {
|
7988 | return filepath;
|
7989 | }
|
7990 | } catch (err) {
|
7991 |
|
7992 | return;
|
7993 | }
|
7994 |
|
7995 |
|
7996 | fs.readdirSync(filepath).forEach(function(dirent) {
|
7997 | var pathname = path.join(filepath, dirent);
|
7998 | var stat;
|
7999 |
|
8000 | try {
|
8001 | stat = fs.statSync(pathname);
|
8002 | if (stat.isDirectory()) {
|
8003 | if (recursive) {
|
8004 | files = files.concat(lookupFiles(pathname, extensions, recursive));
|
8005 | }
|
8006 | return;
|
8007 | }
|
8008 | } catch (err) {
|
8009 |
|
8010 | return;
|
8011 | }
|
8012 | if (!extensions.length) {
|
8013 | throw createMissingArgumentError(
|
8014 | util.format(
|
8015 | 'Argument %s required when argument %s is a directory',
|
8016 | exports.sQuote('extensions'),
|
8017 | exports.sQuote('filepath')
|
8018 | ),
|
8019 | 'extensions',
|
8020 | 'array'
|
8021 | );
|
8022 | }
|
8023 |
|
8024 | if (
|
8025 | !stat.isFile() ||
|
8026 | !hasMatchingExtname(pathname, extensions) ||
|
8027 | isHiddenOnUnix(pathname)
|
8028 | ) {
|
8029 | return;
|
8030 | }
|
8031 | files.push(pathname);
|
8032 | });
|
8033 |
|
8034 | return files;
|
8035 | };
|
8036 |
|
8037 |
|
8038 |
|
8039 |
|
8040 |
|
8041 |
|
8042 | function emitWarning(msg, type) {
|
8043 | if (process.emitWarning) {
|
8044 | process.emitWarning(msg, type);
|
8045 | } else {
|
8046 | process.nextTick(function() {
|
8047 | console.warn(type + ': ' + msg);
|
8048 | });
|
8049 | }
|
8050 | }
|
8051 |
|
8052 |
|
8053 |
|
8054 |
|
8055 |
|
8056 |
|
8057 |
|
8058 |
|
8059 | exports.deprecate = function deprecate(msg) {
|
8060 | msg = String(msg);
|
8061 | if (msg && !deprecate.cache[msg]) {
|
8062 | deprecate.cache[msg] = true;
|
8063 | emitWarning(msg, 'DeprecationWarning');
|
8064 | }
|
8065 | };
|
8066 | exports.deprecate.cache = {};
|
8067 |
|
8068 |
|
8069 |
|
8070 |
|
8071 |
|
8072 |
|
8073 |
|
8074 |
|
8075 | exports.warn = function warn(msg) {
|
8076 | if (msg) {
|
8077 | emitWarning(msg);
|
8078 | }
|
8079 | };
|
8080 |
|
8081 |
|
8082 |
|
8083 |
|
8084 |
|
8085 |
|
8086 |
|
8087 |
|
8088 |
|
8089 |
|
8090 | exports.stackTraceFilter = function() {
|
8091 |
|
8092 | var is = typeof document === 'undefined' ? {node: true} : {browser: true};
|
8093 | var slash = path.sep;
|
8094 | var cwd;
|
8095 | if (is.node) {
|
8096 | cwd = process.cwd() + slash;
|
8097 | } else {
|
8098 | cwd = (typeof location === 'undefined'
|
8099 | ? window.location
|
8100 | : location
|
8101 | ).href.replace(/\/[^/]*$/, '/');
|
8102 | slash = '/';
|
8103 | }
|
8104 |
|
8105 | function isMochaInternal(line) {
|
8106 | return (
|
8107 | ~line.indexOf('node_modules' + slash + 'mocha' + slash) ||
|
8108 | ~line.indexOf(slash + 'mocha.js') ||
|
8109 | ~line.indexOf(slash + 'mocha.min.js')
|
8110 | );
|
8111 | }
|
8112 |
|
8113 | function isNodeInternal(line) {
|
8114 | return (
|
8115 | ~line.indexOf('(timers.js:') ||
|
8116 | ~line.indexOf('(events.js:') ||
|
8117 | ~line.indexOf('(node.js:') ||
|
8118 | ~line.indexOf('(module.js:') ||
|
8119 | ~line.indexOf('GeneratorFunctionPrototype.next (native)') ||
|
8120 | false
|
8121 | );
|
8122 | }
|
8123 |
|
8124 | return function(stack) {
|
8125 | stack = stack.split('\n');
|
8126 |
|
8127 | stack = stack.reduce(function(list, line) {
|
8128 | if (isMochaInternal(line)) {
|
8129 | return list;
|
8130 | }
|
8131 |
|
8132 | if (is.node && isNodeInternal(line)) {
|
8133 | return list;
|
8134 | }
|
8135 |
|
8136 |
|
8137 | if (/:\d+:\d+\)?$/.test(line)) {
|
8138 | line = line.replace('(' + cwd, '(');
|
8139 | }
|
8140 |
|
8141 | list.push(line);
|
8142 | return list;
|
8143 | }, []);
|
8144 |
|
8145 | return stack.join('\n');
|
8146 | };
|
8147 | };
|
8148 |
|
8149 |
|
8150 |
|
8151 |
|
8152 |
|
8153 |
|
8154 |
|
8155 | exports.isPromise = function isPromise(value) {
|
8156 | return (
|
8157 | typeof value === 'object' &&
|
8158 | value !== null &&
|
8159 | typeof value.then === 'function'
|
8160 | );
|
8161 | };
|
8162 |
|
8163 |
|
8164 |
|
8165 |
|
8166 |
|
8167 |
|
8168 |
|
8169 |
|
8170 | exports.clamp = function clamp(value, range) {
|
8171 | return Math.min(Math.max(value, range[0]), range[1]);
|
8172 | };
|
8173 |
|
8174 |
|
8175 |
|
8176 |
|
8177 |
|
8178 |
|
8179 |
|
8180 |
|
8181 |
|
8182 |
|
8183 |
|
8184 |
|
8185 |
|
8186 |
|
8187 |
|
8188 |
|
8189 | exports.sQuote = function(str) {
|
8190 | return "'" + str + "'";
|
8191 | };
|
8192 |
|
8193 |
|
8194 |
|
8195 |
|
8196 |
|
8197 |
|
8198 |
|
8199 |
|
8200 |
|
8201 |
|
8202 |
|
8203 |
|
8204 |
|
8205 |
|
8206 |
|
8207 |
|
8208 | exports.dQuote = function(str) {
|
8209 | return '"' + str + '"';
|
8210 | };
|
8211 |
|
8212 |
|
8213 |
|
8214 |
|
8215 |
|
8216 |
|
8217 |
|
8218 |
|
8219 |
|
8220 |
|
8221 |
|
8222 |
|
8223 |
|
8224 |
|
8225 |
|
8226 |
|
8227 |
|
8228 |
|
8229 |
|
8230 |
|
8231 |
|
8232 |
|
8233 |
|
8234 |
|
8235 |
|
8236 |
|
8237 |
|
8238 | exports.ngettext = function(n, msg1, msg2) {
|
8239 | if (typeof n === 'number' && n >= 0) {
|
8240 | return n === 1 ? msg1 : msg2;
|
8241 | }
|
8242 | };
|
8243 |
|
8244 |
|
8245 |
|
8246 |
|
8247 |
|
8248 | exports.noop = function() {};
|
8249 |
|
8250 |
|
8251 |
|
8252 |
|
8253 |
|
8254 |
|
8255 |
|
8256 |
|
8257 |
|
8258 |
|
8259 |
|
8260 |
|
8261 |
|
8262 |
|
8263 |
|
8264 |
|
8265 | exports.createMap = function(obj) {
|
8266 | return assign.apply(
|
8267 | null,
|
8268 | [Object.create(null)].concat(Array.prototype.slice.call(arguments))
|
8269 | );
|
8270 | };
|
8271 |
|
8272 |
|
8273 |
|
8274 |
|
8275 |
|
8276 |
|
8277 |
|
8278 |
|
8279 |
|
8280 |
|
8281 |
|
8282 |
|
8283 |
|
8284 | exports.defineConstants = function(obj) {
|
8285 | if (type(obj) !== 'object' || !Object.keys(obj).length) {
|
8286 | throw new TypeError('Invalid argument; expected a non-empty object');
|
8287 | }
|
8288 | return Object.freeze(exports.createMap(obj));
|
8289 | };
|
8290 |
|
8291 |
|
8292 |
|
8293 |
|
8294 |
|
8295 |
|
8296 |
|
8297 |
|
8298 |
|
8299 |
|
8300 |
|
8301 |
|
8302 | exports.supportsEsModules = function(unflagged) {
|
8303 | if (typeof document !== 'undefined') {
|
8304 | return false;
|
8305 | }
|
8306 | if (
|
8307 | typeof process !== 'object' ||
|
8308 | !process.versions ||
|
8309 | !process.versions.node
|
8310 | ) {
|
8311 | return false;
|
8312 | }
|
8313 | var versionFields = process.versions.node.split('.');
|
8314 | var major = +versionFields[0];
|
8315 | var minor = +versionFields[1];
|
8316 |
|
8317 | if (major >= 13) {
|
8318 | if (unflagged) {
|
8319 | return minor >= 2;
|
8320 | }
|
8321 | return true;
|
8322 | }
|
8323 | if (unflagged) {
|
8324 | return false;
|
8325 | }
|
8326 | if (major < 12) {
|
8327 | return false;
|
8328 | }
|
8329 |
|
8330 |
|
8331 | return minor >= 11;
|
8332 | };
|
8333 |
|
8334 | }).call(this,require('_process'),require("buffer").Buffer)
|
8335 | },{"./errors":6,"_process":69,"buffer":43,"fs":42,"glob":42,"he":54,"object.assign":65,"path":42,"util":89}],39:[function(require,module,exports){
|
8336 | 'use strict'
|
8337 |
|
8338 | exports.byteLength = byteLength
|
8339 | exports.toByteArray = toByteArray
|
8340 | exports.fromByteArray = fromByteArray
|
8341 |
|
8342 | var lookup = []
|
8343 | var revLookup = []
|
8344 | var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
|
8345 |
|
8346 | var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
|
8347 | for (var i = 0, len = code.length; i < len; ++i) {
|
8348 | lookup[i] = code[i]
|
8349 | revLookup[code.charCodeAt(i)] = i
|
8350 | }
|
8351 |
|
8352 |
|
8353 |
|
8354 | revLookup['-'.charCodeAt(0)] = 62
|
8355 | revLookup['_'.charCodeAt(0)] = 63
|
8356 |
|
8357 | function getLens (b64) {
|
8358 | var len = b64.length
|
8359 |
|
8360 | if (len % 4 > 0) {
|
8361 | throw new Error('Invalid string. Length must be a multiple of 4')
|
8362 | }
|
8363 |
|
8364 |
|
8365 |
|
8366 | var validLen = b64.indexOf('=')
|
8367 | if (validLen === -1) validLen = len
|
8368 |
|
8369 | var placeHoldersLen = validLen === len
|
8370 | ? 0
|
8371 | : 4 - (validLen % 4)
|
8372 |
|
8373 | return [validLen, placeHoldersLen]
|
8374 | }
|
8375 |
|
8376 |
|
8377 | function byteLength (b64) {
|
8378 | var lens = getLens(b64)
|
8379 | var validLen = lens[0]
|
8380 | var placeHoldersLen = lens[1]
|
8381 | return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
|
8382 | }
|
8383 |
|
8384 | function _byteLength (b64, validLen, placeHoldersLen) {
|
8385 | return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
|
8386 | }
|
8387 |
|
8388 | function toByteArray (b64) {
|
8389 | var tmp
|
8390 | var lens = getLens(b64)
|
8391 | var validLen = lens[0]
|
8392 | var placeHoldersLen = lens[1]
|
8393 |
|
8394 | var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
|
8395 |
|
8396 | var curByte = 0
|
8397 |
|
8398 |
|
8399 | var len = placeHoldersLen > 0
|
8400 | ? validLen - 4
|
8401 | : validLen
|
8402 |
|
8403 | for (var i = 0; i < len; i += 4) {
|
8404 | tmp =
|
8405 | (revLookup[b64.charCodeAt(i)] << 18) |
|
8406 | (revLookup[b64.charCodeAt(i + 1)] << 12) |
|
8407 | (revLookup[b64.charCodeAt(i + 2)] << 6) |
|
8408 | revLookup[b64.charCodeAt(i + 3)]
|
8409 | arr[curByte++] = (tmp >> 16) & 0xFF
|
8410 | arr[curByte++] = (tmp >> 8) & 0xFF
|
8411 | arr[curByte++] = tmp & 0xFF
|
8412 | }
|
8413 |
|
8414 | if (placeHoldersLen === 2) {
|
8415 | tmp =
|
8416 | (revLookup[b64.charCodeAt(i)] << 2) |
|
8417 | (revLookup[b64.charCodeAt(i + 1)] >> 4)
|
8418 | arr[curByte++] = tmp & 0xFF
|
8419 | }
|
8420 |
|
8421 | if (placeHoldersLen === 1) {
|
8422 | tmp =
|
8423 | (revLookup[b64.charCodeAt(i)] << 10) |
|
8424 | (revLookup[b64.charCodeAt(i + 1)] << 4) |
|
8425 | (revLookup[b64.charCodeAt(i + 2)] >> 2)
|
8426 | arr[curByte++] = (tmp >> 8) & 0xFF
|
8427 | arr[curByte++] = tmp & 0xFF
|
8428 | }
|
8429 |
|
8430 | return arr
|
8431 | }
|
8432 |
|
8433 | function tripletToBase64 (num) {
|
8434 | return lookup[num >> 18 & 0x3F] +
|
8435 | lookup[num >> 12 & 0x3F] +
|
8436 | lookup[num >> 6 & 0x3F] +
|
8437 | lookup[num & 0x3F]
|
8438 | }
|
8439 |
|
8440 | function encodeChunk (uint8, start, end) {
|
8441 | var tmp
|
8442 | var output = []
|
8443 | for (var i = start; i < end; i += 3) {
|
8444 | tmp =
|
8445 | ((uint8[i] << 16) & 0xFF0000) +
|
8446 | ((uint8[i + 1] << 8) & 0xFF00) +
|
8447 | (uint8[i + 2] & 0xFF)
|
8448 | output.push(tripletToBase64(tmp))
|
8449 | }
|
8450 | return output.join('')
|
8451 | }
|
8452 |
|
8453 | function fromByteArray (uint8) {
|
8454 | var tmp
|
8455 | var len = uint8.length
|
8456 | var extraBytes = len % 3
|
8457 | var parts = []
|
8458 | var maxChunkLength = 16383
|
8459 |
|
8460 |
|
8461 | for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
|
8462 | parts.push(encodeChunk(
|
8463 | uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
|
8464 | ))
|
8465 | }
|
8466 |
|
8467 |
|
8468 | if (extraBytes === 1) {
|
8469 | tmp = uint8[len - 1]
|
8470 | parts.push(
|
8471 | lookup[tmp >> 2] +
|
8472 | lookup[(tmp << 4) & 0x3F] +
|
8473 | '=='
|
8474 | )
|
8475 | } else if (extraBytes === 2) {
|
8476 | tmp = (uint8[len - 2] << 8) + uint8[len - 1]
|
8477 | parts.push(
|
8478 | lookup[tmp >> 10] +
|
8479 | lookup[(tmp >> 4) & 0x3F] +
|
8480 | lookup[(tmp << 2) & 0x3F] +
|
8481 | '='
|
8482 | )
|
8483 | }
|
8484 |
|
8485 | return parts.join('')
|
8486 | }
|
8487 |
|
8488 | },{}],40:[function(require,module,exports){
|
8489 |
|
8490 | },{}],41:[function(require,module,exports){
|
8491 | (function (process){
|
8492 | var WritableStream = require('stream').Writable
|
8493 | var inherits = require('util').inherits
|
8494 |
|
8495 | module.exports = BrowserStdout
|
8496 |
|
8497 |
|
8498 | inherits(BrowserStdout, WritableStream)
|
8499 |
|
8500 | function BrowserStdout(opts) {
|
8501 | if (!(this instanceof BrowserStdout)) return new BrowserStdout(opts)
|
8502 |
|
8503 | opts = opts || {}
|
8504 | WritableStream.call(this, opts)
|
8505 | this.label = (opts.label !== undefined) ? opts.label : 'stdout'
|
8506 | }
|
8507 |
|
8508 | BrowserStdout.prototype._write = function(chunks, encoding, cb) {
|
8509 | var output = chunks.toString ? chunks.toString() : chunks
|
8510 | if (this.label === false) {
|
8511 | console.log(output)
|
8512 | } else {
|
8513 | console.log(this.label+':', output)
|
8514 | }
|
8515 | process.nextTick(cb)
|
8516 | }
|
8517 |
|
8518 | }).call(this,require('_process'))
|
8519 | },{"_process":69,"stream":84,"util":89}],42:[function(require,module,exports){
|
8520 | arguments[4][40][0].apply(exports,arguments)
|
8521 | },{"dup":40}],43:[function(require,module,exports){
|
8522 | (function (Buffer){
|
8523 |
|
8524 |
|
8525 |
|
8526 |
|
8527 |
|
8528 |
|
8529 |
|
8530 |
|
8531 | 'use strict'
|
8532 |
|
8533 | var base64 = require('base64-js')
|
8534 | var ieee754 = require('ieee754')
|
8535 |
|
8536 | exports.Buffer = Buffer
|
8537 | exports.SlowBuffer = SlowBuffer
|
8538 | exports.INSPECT_MAX_BYTES = 50
|
8539 |
|
8540 | var K_MAX_LENGTH = 0x7fffffff
|
8541 | exports.kMaxLength = K_MAX_LENGTH
|
8542 |
|
8543 |
|
8544 |
|
8545 |
|
8546 |
|
8547 |
|
8548 |
|
8549 |
|
8550 |
|
8551 |
|
8552 |
|
8553 |
|
8554 |
|
8555 |
|
8556 |
|
8557 | Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport()
|
8558 |
|
8559 | if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&
|
8560 | typeof console.error === 'function') {
|
8561 | console.error(
|
8562 | 'This browser lacks typed array (Uint8Array) support which is required by ' +
|
8563 | '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'
|
8564 | )
|
8565 | }
|
8566 |
|
8567 | function typedArraySupport () {
|
8568 |
|
8569 | try {
|
8570 | var arr = new Uint8Array(1)
|
8571 | arr.__proto__ = { __proto__: Uint8Array.prototype, foo: function () { return 42 } }
|
8572 | return arr.foo() === 42
|
8573 | } catch (e) {
|
8574 | return false
|
8575 | }
|
8576 | }
|
8577 |
|
8578 | Object.defineProperty(Buffer.prototype, 'parent', {
|
8579 | enumerable: true,
|
8580 | get: function () {
|
8581 | if (!Buffer.isBuffer(this)) return undefined
|
8582 | return this.buffer
|
8583 | }
|
8584 | })
|
8585 |
|
8586 | Object.defineProperty(Buffer.prototype, 'offset', {
|
8587 | enumerable: true,
|
8588 | get: function () {
|
8589 | if (!Buffer.isBuffer(this)) return undefined
|
8590 | return this.byteOffset
|
8591 | }
|
8592 | })
|
8593 |
|
8594 | function createBuffer (length) {
|
8595 | if (length > K_MAX_LENGTH) {
|
8596 | throw new RangeError('The value "' + length + '" is invalid for option "size"')
|
8597 | }
|
8598 |
|
8599 | var buf = new Uint8Array(length)
|
8600 | buf.__proto__ = Buffer.prototype
|
8601 | return buf
|
8602 | }
|
8603 |
|
8604 |
|
8605 |
|
8606 |
|
8607 |
|
8608 |
|
8609 |
|
8610 |
|
8611 |
|
8612 |
|
8613 |
|
8614 | function Buffer (arg, encodingOrOffset, length) {
|
8615 |
|
8616 | if (typeof arg === 'number') {
|
8617 | if (typeof encodingOrOffset === 'string') {
|
8618 | throw new TypeError(
|
8619 | 'The "string" argument must be of type string. Received type number'
|
8620 | )
|
8621 | }
|
8622 | return allocUnsafe(arg)
|
8623 | }
|
8624 | return from(arg, encodingOrOffset, length)
|
8625 | }
|
8626 |
|
8627 |
|
8628 | if (typeof Symbol !== 'undefined' && Symbol.species != null &&
|
8629 | Buffer[Symbol.species] === Buffer) {
|
8630 | Object.defineProperty(Buffer, Symbol.species, {
|
8631 | value: null,
|
8632 | configurable: true,
|
8633 | enumerable: false,
|
8634 | writable: false
|
8635 | })
|
8636 | }
|
8637 |
|
8638 | Buffer.poolSize = 8192
|
8639 |
|
8640 | function from (value, encodingOrOffset, length) {
|
8641 | if (typeof value === 'string') {
|
8642 | return fromString(value, encodingOrOffset)
|
8643 | }
|
8644 |
|
8645 | if (ArrayBuffer.isView(value)) {
|
8646 | return fromArrayLike(value)
|
8647 | }
|
8648 |
|
8649 | if (value == null) {
|
8650 | throw TypeError(
|
8651 | 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
|
8652 | 'or Array-like Object. Received type ' + (typeof value)
|
8653 | )
|
8654 | }
|
8655 |
|
8656 | if (isInstance(value, ArrayBuffer) ||
|
8657 | (value && isInstance(value.buffer, ArrayBuffer))) {
|
8658 | return fromArrayBuffer(value, encodingOrOffset, length)
|
8659 | }
|
8660 |
|
8661 | if (typeof value === 'number') {
|
8662 | throw new TypeError(
|
8663 | 'The "value" argument must not be of type number. Received type number'
|
8664 | )
|
8665 | }
|
8666 |
|
8667 | var valueOf = value.valueOf && value.valueOf()
|
8668 | if (valueOf != null && valueOf !== value) {
|
8669 | return Buffer.from(valueOf, encodingOrOffset, length)
|
8670 | }
|
8671 |
|
8672 | var b = fromObject(value)
|
8673 | if (b) return b
|
8674 |
|
8675 | if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&
|
8676 | typeof value[Symbol.toPrimitive] === 'function') {
|
8677 | return Buffer.from(
|
8678 | value[Symbol.toPrimitive]('string'), encodingOrOffset, length
|
8679 | )
|
8680 | }
|
8681 |
|
8682 | throw new TypeError(
|
8683 | 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
|
8684 | 'or Array-like Object. Received type ' + (typeof value)
|
8685 | )
|
8686 | }
|
8687 |
|
8688 |
|
8689 |
|
8690 |
|
8691 |
|
8692 |
|
8693 |
|
8694 |
|
8695 |
|
8696 | Buffer.from = function (value, encodingOrOffset, length) {
|
8697 | return from(value, encodingOrOffset, length)
|
8698 | }
|
8699 |
|
8700 |
|
8701 |
|
8702 | Buffer.prototype.__proto__ = Uint8Array.prototype
|
8703 | Buffer.__proto__ = Uint8Array
|
8704 |
|
8705 | function assertSize (size) {
|
8706 | if (typeof size !== 'number') {
|
8707 | throw new TypeError('"size" argument must be of type number')
|
8708 | } else if (size < 0) {
|
8709 | throw new RangeError('The value "' + size + '" is invalid for option "size"')
|
8710 | }
|
8711 | }
|
8712 |
|
8713 | function alloc (size, fill, encoding) {
|
8714 | assertSize(size)
|
8715 | if (size <= 0) {
|
8716 | return createBuffer(size)
|
8717 | }
|
8718 | if (fill !== undefined) {
|
8719 |
|
8720 |
|
8721 |
|
8722 | return typeof encoding === 'string'
|
8723 | ? createBuffer(size).fill(fill, encoding)
|
8724 | : createBuffer(size).fill(fill)
|
8725 | }
|
8726 | return createBuffer(size)
|
8727 | }
|
8728 |
|
8729 |
|
8730 |
|
8731 |
|
8732 |
|
8733 | Buffer.alloc = function (size, fill, encoding) {
|
8734 | return alloc(size, fill, encoding)
|
8735 | }
|
8736 |
|
8737 | function allocUnsafe (size) {
|
8738 | assertSize(size)
|
8739 | return createBuffer(size < 0 ? 0 : checked(size) | 0)
|
8740 | }
|
8741 |
|
8742 |
|
8743 |
|
8744 |
|
8745 | Buffer.allocUnsafe = function (size) {
|
8746 | return allocUnsafe(size)
|
8747 | }
|
8748 |
|
8749 |
|
8750 |
|
8751 | Buffer.allocUnsafeSlow = function (size) {
|
8752 | return allocUnsafe(size)
|
8753 | }
|
8754 |
|
8755 | function fromString (string, encoding) {
|
8756 | if (typeof encoding !== 'string' || encoding === '') {
|
8757 | encoding = 'utf8'
|
8758 | }
|
8759 |
|
8760 | if (!Buffer.isEncoding(encoding)) {
|
8761 | throw new TypeError('Unknown encoding: ' + encoding)
|
8762 | }
|
8763 |
|
8764 | var length = byteLength(string, encoding) | 0
|
8765 | var buf = createBuffer(length)
|
8766 |
|
8767 | var actual = buf.write(string, encoding)
|
8768 |
|
8769 | if (actual !== length) {
|
8770 |
|
8771 |
|
8772 |
|
8773 | buf = buf.slice(0, actual)
|
8774 | }
|
8775 |
|
8776 | return buf
|
8777 | }
|
8778 |
|
8779 | function fromArrayLike (array) {
|
8780 | var length = array.length < 0 ? 0 : checked(array.length) | 0
|
8781 | var buf = createBuffer(length)
|
8782 | for (var i = 0; i < length; i += 1) {
|
8783 | buf[i] = array[i] & 255
|
8784 | }
|
8785 | return buf
|
8786 | }
|
8787 |
|
8788 | function fromArrayBuffer (array, byteOffset, length) {
|
8789 | if (byteOffset < 0 || array.byteLength < byteOffset) {
|
8790 | throw new RangeError('"offset" is outside of buffer bounds')
|
8791 | }
|
8792 |
|
8793 | if (array.byteLength < byteOffset + (length || 0)) {
|
8794 | throw new RangeError('"length" is outside of buffer bounds')
|
8795 | }
|
8796 |
|
8797 | var buf
|
8798 | if (byteOffset === undefined && length === undefined) {
|
8799 | buf = new Uint8Array(array)
|
8800 | } else if (length === undefined) {
|
8801 | buf = new Uint8Array(array, byteOffset)
|
8802 | } else {
|
8803 | buf = new Uint8Array(array, byteOffset, length)
|
8804 | }
|
8805 |
|
8806 |
|
8807 | buf.__proto__ = Buffer.prototype
|
8808 | return buf
|
8809 | }
|
8810 |
|
8811 | function fromObject (obj) {
|
8812 | if (Buffer.isBuffer(obj)) {
|
8813 | var len = checked(obj.length) | 0
|
8814 | var buf = createBuffer(len)
|
8815 |
|
8816 | if (buf.length === 0) {
|
8817 | return buf
|
8818 | }
|
8819 |
|
8820 | obj.copy(buf, 0, 0, len)
|
8821 | return buf
|
8822 | }
|
8823 |
|
8824 | if (obj.length !== undefined) {
|
8825 | if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {
|
8826 | return createBuffer(0)
|
8827 | }
|
8828 | return fromArrayLike(obj)
|
8829 | }
|
8830 |
|
8831 | if (obj.type === 'Buffer' && Array.isArray(obj.data)) {
|
8832 | return fromArrayLike(obj.data)
|
8833 | }
|
8834 | }
|
8835 |
|
8836 | function checked (length) {
|
8837 |
|
8838 |
|
8839 | if (length >= K_MAX_LENGTH) {
|
8840 | throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
|
8841 | 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')
|
8842 | }
|
8843 | return length | 0
|
8844 | }
|
8845 |
|
8846 | function SlowBuffer (length) {
|
8847 | if (+length != length) {
|
8848 | length = 0
|
8849 | }
|
8850 | return Buffer.alloc(+length)
|
8851 | }
|
8852 |
|
8853 | Buffer.isBuffer = function isBuffer (b) {
|
8854 | return b != null && b._isBuffer === true &&
|
8855 | b !== Buffer.prototype
|
8856 | }
|
8857 |
|
8858 | Buffer.compare = function compare (a, b) {
|
8859 | if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength)
|
8860 | if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength)
|
8861 | if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
|
8862 | throw new TypeError(
|
8863 | 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
|
8864 | )
|
8865 | }
|
8866 |
|
8867 | if (a === b) return 0
|
8868 |
|
8869 | var x = a.length
|
8870 | var y = b.length
|
8871 |
|
8872 | for (var i = 0, len = Math.min(x, y); i < len; ++i) {
|
8873 | if (a[i] !== b[i]) {
|
8874 | x = a[i]
|
8875 | y = b[i]
|
8876 | break
|
8877 | }
|
8878 | }
|
8879 |
|
8880 | if (x < y) return -1
|
8881 | if (y < x) return 1
|
8882 | return 0
|
8883 | }
|
8884 |
|
8885 | Buffer.isEncoding = function isEncoding (encoding) {
|
8886 | switch (String(encoding).toLowerCase()) {
|
8887 | case 'hex':
|
8888 | case 'utf8':
|
8889 | case 'utf-8':
|
8890 | case 'ascii':
|
8891 | case 'latin1':
|
8892 | case 'binary':
|
8893 | case 'base64':
|
8894 | case 'ucs2':
|
8895 | case 'ucs-2':
|
8896 | case 'utf16le':
|
8897 | case 'utf-16le':
|
8898 | return true
|
8899 | default:
|
8900 | return false
|
8901 | }
|
8902 | }
|
8903 |
|
8904 | Buffer.concat = function concat (list, length) {
|
8905 | if (!Array.isArray(list)) {
|
8906 | throw new TypeError('"list" argument must be an Array of Buffers')
|
8907 | }
|
8908 |
|
8909 | if (list.length === 0) {
|
8910 | return Buffer.alloc(0)
|
8911 | }
|
8912 |
|
8913 | var i
|
8914 | if (length === undefined) {
|
8915 | length = 0
|
8916 | for (i = 0; i < list.length; ++i) {
|
8917 | length += list[i].length
|
8918 | }
|
8919 | }
|
8920 |
|
8921 | var buffer = Buffer.allocUnsafe(length)
|
8922 | var pos = 0
|
8923 | for (i = 0; i < list.length; ++i) {
|
8924 | var buf = list[i]
|
8925 | if (isInstance(buf, Uint8Array)) {
|
8926 | buf = Buffer.from(buf)
|
8927 | }
|
8928 | if (!Buffer.isBuffer(buf)) {
|
8929 | throw new TypeError('"list" argument must be an Array of Buffers')
|
8930 | }
|
8931 | buf.copy(buffer, pos)
|
8932 | pos += buf.length
|
8933 | }
|
8934 | return buffer
|
8935 | }
|
8936 |
|
8937 | function byteLength (string, encoding) {
|
8938 | if (Buffer.isBuffer(string)) {
|
8939 | return string.length
|
8940 | }
|
8941 | if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {
|
8942 | return string.byteLength
|
8943 | }
|
8944 | if (typeof string !== 'string') {
|
8945 | throw new TypeError(
|
8946 | 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' +
|
8947 | 'Received type ' + typeof string
|
8948 | )
|
8949 | }
|
8950 |
|
8951 | var len = string.length
|
8952 | var mustMatch = (arguments.length > 2 && arguments[2] === true)
|
8953 | if (!mustMatch && len === 0) return 0
|
8954 |
|
8955 |
|
8956 | var loweredCase = false
|
8957 | for (;;) {
|
8958 | switch (encoding) {
|
8959 | case 'ascii':
|
8960 | case 'latin1':
|
8961 | case 'binary':
|
8962 | return len
|
8963 | case 'utf8':
|
8964 | case 'utf-8':
|
8965 | return utf8ToBytes(string).length
|
8966 | case 'ucs2':
|
8967 | case 'ucs-2':
|
8968 | case 'utf16le':
|
8969 | case 'utf-16le':
|
8970 | return len * 2
|
8971 | case 'hex':
|
8972 | return len >>> 1
|
8973 | case 'base64':
|
8974 | return base64ToBytes(string).length
|
8975 | default:
|
8976 | if (loweredCase) {
|
8977 | return mustMatch ? -1 : utf8ToBytes(string).length
|
8978 | }
|
8979 | encoding = ('' + encoding).toLowerCase()
|
8980 | loweredCase = true
|
8981 | }
|
8982 | }
|
8983 | }
|
8984 | Buffer.byteLength = byteLength
|
8985 |
|
8986 | function slowToString (encoding, start, end) {
|
8987 | var loweredCase = false
|
8988 |
|
8989 |
|
8990 |
|
8991 |
|
8992 |
|
8993 |
|
8994 |
|
8995 |
|
8996 | if (start === undefined || start < 0) {
|
8997 | start = 0
|
8998 | }
|
8999 |
|
9000 |
|
9001 | if (start > this.length) {
|
9002 | return ''
|
9003 | }
|
9004 |
|
9005 | if (end === undefined || end > this.length) {
|
9006 | end = this.length
|
9007 | }
|
9008 |
|
9009 | if (end <= 0) {
|
9010 | return ''
|
9011 | }
|
9012 |
|
9013 |
|
9014 | end >>>= 0
|
9015 | start >>>= 0
|
9016 |
|
9017 | if (end <= start) {
|
9018 | return ''
|
9019 | }
|
9020 |
|
9021 | if (!encoding) encoding = 'utf8'
|
9022 |
|
9023 | while (true) {
|
9024 | switch (encoding) {
|
9025 | case 'hex':
|
9026 | return hexSlice(this, start, end)
|
9027 |
|
9028 | case 'utf8':
|
9029 | case 'utf-8':
|
9030 | return utf8Slice(this, start, end)
|
9031 |
|
9032 | case 'ascii':
|
9033 | return asciiSlice(this, start, end)
|
9034 |
|
9035 | case 'latin1':
|
9036 | case 'binary':
|
9037 | return latin1Slice(this, start, end)
|
9038 |
|
9039 | case 'base64':
|
9040 | return base64Slice(this, start, end)
|
9041 |
|
9042 | case 'ucs2':
|
9043 | case 'ucs-2':
|
9044 | case 'utf16le':
|
9045 | case 'utf-16le':
|
9046 | return utf16leSlice(this, start, end)
|
9047 |
|
9048 | default:
|
9049 | if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
|
9050 | encoding = (encoding + '').toLowerCase()
|
9051 | loweredCase = true
|
9052 | }
|
9053 | }
|
9054 | }
|
9055 |
|
9056 |
|
9057 |
|
9058 |
|
9059 |
|
9060 |
|
9061 |
|
9062 | Buffer.prototype._isBuffer = true
|
9063 |
|
9064 | function swap (b, n, m) {
|
9065 | var i = b[n]
|
9066 | b[n] = b[m]
|
9067 | b[m] = i
|
9068 | }
|
9069 |
|
9070 | Buffer.prototype.swap16 = function swap16 () {
|
9071 | var len = this.length
|
9072 | if (len % 2 !== 0) {
|
9073 | throw new RangeError('Buffer size must be a multiple of 16-bits')
|
9074 | }
|
9075 | for (var i = 0; i < len; i += 2) {
|
9076 | swap(this, i, i + 1)
|
9077 | }
|
9078 | return this
|
9079 | }
|
9080 |
|
9081 | Buffer.prototype.swap32 = function swap32 () {
|
9082 | var len = this.length
|
9083 | if (len % 4 !== 0) {
|
9084 | throw new RangeError('Buffer size must be a multiple of 32-bits')
|
9085 | }
|
9086 | for (var i = 0; i < len; i += 4) {
|
9087 | swap(this, i, i + 3)
|
9088 | swap(this, i + 1, i + 2)
|
9089 | }
|
9090 | return this
|
9091 | }
|
9092 |
|
9093 | Buffer.prototype.swap64 = function swap64 () {
|
9094 | var len = this.length
|
9095 | if (len % 8 !== 0) {
|
9096 | throw new RangeError('Buffer size must be a multiple of 64-bits')
|
9097 | }
|
9098 | for (var i = 0; i < len; i += 8) {
|
9099 | swap(this, i, i + 7)
|
9100 | swap(this, i + 1, i + 6)
|
9101 | swap(this, i + 2, i + 5)
|
9102 | swap(this, i + 3, i + 4)
|
9103 | }
|
9104 | return this
|
9105 | }
|
9106 |
|
9107 | Buffer.prototype.toString = function toString () {
|
9108 | var length = this.length
|
9109 | if (length === 0) return ''
|
9110 | if (arguments.length === 0) return utf8Slice(this, 0, length)
|
9111 | return slowToString.apply(this, arguments)
|
9112 | }
|
9113 |
|
9114 | Buffer.prototype.toLocaleString = Buffer.prototype.toString
|
9115 |
|
9116 | Buffer.prototype.equals = function equals (b) {
|
9117 | if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
|
9118 | if (this === b) return true
|
9119 | return Buffer.compare(this, b) === 0
|
9120 | }
|
9121 |
|
9122 | Buffer.prototype.inspect = function inspect () {
|
9123 | var str = ''
|
9124 | var max = exports.INSPECT_MAX_BYTES
|
9125 | str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()
|
9126 | if (this.length > max) str += ' ... '
|
9127 | return '<Buffer ' + str + '>'
|
9128 | }
|
9129 |
|
9130 | Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
|
9131 | if (isInstance(target, Uint8Array)) {
|
9132 | target = Buffer.from(target, target.offset, target.byteLength)
|
9133 | }
|
9134 | if (!Buffer.isBuffer(target)) {
|
9135 | throw new TypeError(
|
9136 | 'The "target" argument must be one of type Buffer or Uint8Array. ' +
|
9137 | 'Received type ' + (typeof target)
|
9138 | )
|
9139 | }
|
9140 |
|
9141 | if (start === undefined) {
|
9142 | start = 0
|
9143 | }
|
9144 | if (end === undefined) {
|
9145 | end = target ? target.length : 0
|
9146 | }
|
9147 | if (thisStart === undefined) {
|
9148 | thisStart = 0
|
9149 | }
|
9150 | if (thisEnd === undefined) {
|
9151 | thisEnd = this.length
|
9152 | }
|
9153 |
|
9154 | if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
|
9155 | throw new RangeError('out of range index')
|
9156 | }
|
9157 |
|
9158 | if (thisStart >= thisEnd && start >= end) {
|
9159 | return 0
|
9160 | }
|
9161 | if (thisStart >= thisEnd) {
|
9162 | return -1
|
9163 | }
|
9164 | if (start >= end) {
|
9165 | return 1
|
9166 | }
|
9167 |
|
9168 | start >>>= 0
|
9169 | end >>>= 0
|
9170 | thisStart >>>= 0
|
9171 | thisEnd >>>= 0
|
9172 |
|
9173 | if (this === target) return 0
|
9174 |
|
9175 | var x = thisEnd - thisStart
|
9176 | var y = end - start
|
9177 | var len = Math.min(x, y)
|
9178 |
|
9179 | var thisCopy = this.slice(thisStart, thisEnd)
|
9180 | var targetCopy = target.slice(start, end)
|
9181 |
|
9182 | for (var i = 0; i < len; ++i) {
|
9183 | if (thisCopy[i] !== targetCopy[i]) {
|
9184 | x = thisCopy[i]
|
9185 | y = targetCopy[i]
|
9186 | break
|
9187 | }
|
9188 | }
|
9189 |
|
9190 | if (x < y) return -1
|
9191 | if (y < x) return 1
|
9192 | return 0
|
9193 | }
|
9194 |
|
9195 |
|
9196 |
|
9197 |
|
9198 |
|
9199 |
|
9200 |
|
9201 |
|
9202 |
|
9203 |
|
9204 | function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
|
9205 |
|
9206 | if (buffer.length === 0) return -1
|
9207 |
|
9208 |
|
9209 | if (typeof byteOffset === 'string') {
|
9210 | encoding = byteOffset
|
9211 | byteOffset = 0
|
9212 | } else if (byteOffset > 0x7fffffff) {
|
9213 | byteOffset = 0x7fffffff
|
9214 | } else if (byteOffset < -0x80000000) {
|
9215 | byteOffset = -0x80000000
|
9216 | }
|
9217 | byteOffset = +byteOffset
|
9218 | if (numberIsNaN(byteOffset)) {
|
9219 |
|
9220 | byteOffset = dir ? 0 : (buffer.length - 1)
|
9221 | }
|
9222 |
|
9223 |
|
9224 | if (byteOffset < 0) byteOffset = buffer.length + byteOffset
|
9225 | if (byteOffset >= buffer.length) {
|
9226 | if (dir) return -1
|
9227 | else byteOffset = buffer.length - 1
|
9228 | } else if (byteOffset < 0) {
|
9229 | if (dir) byteOffset = 0
|
9230 | else return -1
|
9231 | }
|
9232 |
|
9233 |
|
9234 | if (typeof val === 'string') {
|
9235 | val = Buffer.from(val, encoding)
|
9236 | }
|
9237 |
|
9238 |
|
9239 | if (Buffer.isBuffer(val)) {
|
9240 |
|
9241 | if (val.length === 0) {
|
9242 | return -1
|
9243 | }
|
9244 | return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
|
9245 | } else if (typeof val === 'number') {
|
9246 | val = val & 0xFF
|
9247 | if (typeof Uint8Array.prototype.indexOf === 'function') {
|
9248 | if (dir) {
|
9249 | return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
|
9250 | } else {
|
9251 | return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
|
9252 | }
|
9253 | }
|
9254 | return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
|
9255 | }
|
9256 |
|
9257 | throw new TypeError('val must be string, number or Buffer')
|
9258 | }
|
9259 |
|
9260 | function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
|
9261 | var indexSize = 1
|
9262 | var arrLength = arr.length
|
9263 | var valLength = val.length
|
9264 |
|
9265 | if (encoding !== undefined) {
|
9266 | encoding = String(encoding).toLowerCase()
|
9267 | if (encoding === 'ucs2' || encoding === 'ucs-2' ||
|
9268 | encoding === 'utf16le' || encoding === 'utf-16le') {
|
9269 | if (arr.length < 2 || val.length < 2) {
|
9270 | return -1
|
9271 | }
|
9272 | indexSize = 2
|
9273 | arrLength /= 2
|
9274 | valLength /= 2
|
9275 | byteOffset /= 2
|
9276 | }
|
9277 | }
|
9278 |
|
9279 | function read (buf, i) {
|
9280 | if (indexSize === 1) {
|
9281 | return buf[i]
|
9282 | } else {
|
9283 | return buf.readUInt16BE(i * indexSize)
|
9284 | }
|
9285 | }
|
9286 |
|
9287 | var i
|
9288 | if (dir) {
|
9289 | var foundIndex = -1
|
9290 | for (i = byteOffset; i < arrLength; i++) {
|
9291 | if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
|
9292 | if (foundIndex === -1) foundIndex = i
|
9293 | if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
|
9294 | } else {
|
9295 | if (foundIndex !== -1) i -= i - foundIndex
|
9296 | foundIndex = -1
|
9297 | }
|
9298 | }
|
9299 | } else {
|
9300 | if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
|
9301 | for (i = byteOffset; i >= 0; i--) {
|
9302 | var found = true
|
9303 | for (var j = 0; j < valLength; j++) {
|
9304 | if (read(arr, i + j) !== read(val, j)) {
|
9305 | found = false
|
9306 | break
|
9307 | }
|
9308 | }
|
9309 | if (found) return i
|
9310 | }
|
9311 | }
|
9312 |
|
9313 | return -1
|
9314 | }
|
9315 |
|
9316 | Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
|
9317 | return this.indexOf(val, byteOffset, encoding) !== -1
|
9318 | }
|
9319 |
|
9320 | Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
|
9321 | return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
|
9322 | }
|
9323 |
|
9324 | Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
|
9325 | return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
|
9326 | }
|
9327 |
|
9328 | function hexWrite (buf, string, offset, length) {
|
9329 | offset = Number(offset) || 0
|
9330 | var remaining = buf.length - offset
|
9331 | if (!length) {
|
9332 | length = remaining
|
9333 | } else {
|
9334 | length = Number(length)
|
9335 | if (length > remaining) {
|
9336 | length = remaining
|
9337 | }
|
9338 | }
|
9339 |
|
9340 | var strLen = string.length
|
9341 |
|
9342 | if (length > strLen / 2) {
|
9343 | length = strLen / 2
|
9344 | }
|
9345 | for (var i = 0; i < length; ++i) {
|
9346 | var parsed = parseInt(string.substr(i * 2, 2), 16)
|
9347 | if (numberIsNaN(parsed)) return i
|
9348 | buf[offset + i] = parsed
|
9349 | }
|
9350 | return i
|
9351 | }
|
9352 |
|
9353 | function utf8Write (buf, string, offset, length) {
|
9354 | return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
|
9355 | }
|
9356 |
|
9357 | function asciiWrite (buf, string, offset, length) {
|
9358 | return blitBuffer(asciiToBytes(string), buf, offset, length)
|
9359 | }
|
9360 |
|
9361 | function latin1Write (buf, string, offset, length) {
|
9362 | return asciiWrite(buf, string, offset, length)
|
9363 | }
|
9364 |
|
9365 | function base64Write (buf, string, offset, length) {
|
9366 | return blitBuffer(base64ToBytes(string), buf, offset, length)
|
9367 | }
|
9368 |
|
9369 | function ucs2Write (buf, string, offset, length) {
|
9370 | return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
|
9371 | }
|
9372 |
|
9373 | Buffer.prototype.write = function write (string, offset, length, encoding) {
|
9374 |
|
9375 | if (offset === undefined) {
|
9376 | encoding = 'utf8'
|
9377 | length = this.length
|
9378 | offset = 0
|
9379 |
|
9380 | } else if (length === undefined && typeof offset === 'string') {
|
9381 | encoding = offset
|
9382 | length = this.length
|
9383 | offset = 0
|
9384 |
|
9385 | } else if (isFinite(offset)) {
|
9386 | offset = offset >>> 0
|
9387 | if (isFinite(length)) {
|
9388 | length = length >>> 0
|
9389 | if (encoding === undefined) encoding = 'utf8'
|
9390 | } else {
|
9391 | encoding = length
|
9392 | length = undefined
|
9393 | }
|
9394 | } else {
|
9395 | throw new Error(
|
9396 | 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
|
9397 | )
|
9398 | }
|
9399 |
|
9400 | var remaining = this.length - offset
|
9401 | if (length === undefined || length > remaining) length = remaining
|
9402 |
|
9403 | if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
|
9404 | throw new RangeError('Attempt to write outside buffer bounds')
|
9405 | }
|
9406 |
|
9407 | if (!encoding) encoding = 'utf8'
|
9408 |
|
9409 | var loweredCase = false
|
9410 | for (;;) {
|
9411 | switch (encoding) {
|
9412 | case 'hex':
|
9413 | return hexWrite(this, string, offset, length)
|
9414 |
|
9415 | case 'utf8':
|
9416 | case 'utf-8':
|
9417 | return utf8Write(this, string, offset, length)
|
9418 |
|
9419 | case 'ascii':
|
9420 | return asciiWrite(this, string, offset, length)
|
9421 |
|
9422 | case 'latin1':
|
9423 | case 'binary':
|
9424 | return latin1Write(this, string, offset, length)
|
9425 |
|
9426 | case 'base64':
|
9427 |
|
9428 | return base64Write(this, string, offset, length)
|
9429 |
|
9430 | case 'ucs2':
|
9431 | case 'ucs-2':
|
9432 | case 'utf16le':
|
9433 | case 'utf-16le':
|
9434 | return ucs2Write(this, string, offset, length)
|
9435 |
|
9436 | default:
|
9437 | if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
|
9438 | encoding = ('' + encoding).toLowerCase()
|
9439 | loweredCase = true
|
9440 | }
|
9441 | }
|
9442 | }
|
9443 |
|
9444 | Buffer.prototype.toJSON = function toJSON () {
|
9445 | return {
|
9446 | type: 'Buffer',
|
9447 | data: Array.prototype.slice.call(this._arr || this, 0)
|
9448 | }
|
9449 | }
|
9450 |
|
9451 | function base64Slice (buf, start, end) {
|
9452 | if (start === 0 && end === buf.length) {
|
9453 | return base64.fromByteArray(buf)
|
9454 | } else {
|
9455 | return base64.fromByteArray(buf.slice(start, end))
|
9456 | }
|
9457 | }
|
9458 |
|
9459 | function utf8Slice (buf, start, end) {
|
9460 | end = Math.min(buf.length, end)
|
9461 | var res = []
|
9462 |
|
9463 | var i = start
|
9464 | while (i < end) {
|
9465 | var firstByte = buf[i]
|
9466 | var codePoint = null
|
9467 | var bytesPerSequence = (firstByte > 0xEF) ? 4
|
9468 | : (firstByte > 0xDF) ? 3
|
9469 | : (firstByte > 0xBF) ? 2
|
9470 | : 1
|
9471 |
|
9472 | if (i + bytesPerSequence <= end) {
|
9473 | var secondByte, thirdByte, fourthByte, tempCodePoint
|
9474 |
|
9475 | switch (bytesPerSequence) {
|
9476 | case 1:
|
9477 | if (firstByte < 0x80) {
|
9478 | codePoint = firstByte
|
9479 | }
|
9480 | break
|
9481 | case 2:
|
9482 | secondByte = buf[i + 1]
|
9483 | if ((secondByte & 0xC0) === 0x80) {
|
9484 | tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
|
9485 | if (tempCodePoint > 0x7F) {
|
9486 | codePoint = tempCodePoint
|
9487 | }
|
9488 | }
|
9489 | break
|
9490 | case 3:
|
9491 | secondByte = buf[i + 1]
|
9492 | thirdByte = buf[i + 2]
|
9493 | if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
|
9494 | tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
|
9495 | if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
|
9496 | codePoint = tempCodePoint
|
9497 | }
|
9498 | }
|
9499 | break
|
9500 | case 4:
|
9501 | secondByte = buf[i + 1]
|
9502 | thirdByte = buf[i + 2]
|
9503 | fourthByte = buf[i + 3]
|
9504 | if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
|
9505 | tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
|
9506 | if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
|
9507 | codePoint = tempCodePoint
|
9508 | }
|
9509 | }
|
9510 | }
|
9511 | }
|
9512 |
|
9513 | if (codePoint === null) {
|
9514 |
|
9515 |
|
9516 | codePoint = 0xFFFD
|
9517 | bytesPerSequence = 1
|
9518 | } else if (codePoint > 0xFFFF) {
|
9519 |
|
9520 | codePoint -= 0x10000
|
9521 | res.push(codePoint >>> 10 & 0x3FF | 0xD800)
|
9522 | codePoint = 0xDC00 | codePoint & 0x3FF
|
9523 | }
|
9524 |
|
9525 | res.push(codePoint)
|
9526 | i += bytesPerSequence
|
9527 | }
|
9528 |
|
9529 | return decodeCodePointsArray(res)
|
9530 | }
|
9531 |
|
9532 |
|
9533 |
|
9534 |
|
9535 | var MAX_ARGUMENTS_LENGTH = 0x1000
|
9536 |
|
9537 | function decodeCodePointsArray (codePoints) {
|
9538 | var len = codePoints.length
|
9539 | if (len <= MAX_ARGUMENTS_LENGTH) {
|
9540 | return String.fromCharCode.apply(String, codePoints)
|
9541 | }
|
9542 |
|
9543 |
|
9544 | var res = ''
|
9545 | var i = 0
|
9546 | while (i < len) {
|
9547 | res += String.fromCharCode.apply(
|
9548 | String,
|
9549 | codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
|
9550 | )
|
9551 | }
|
9552 | return res
|
9553 | }
|
9554 |
|
9555 | function asciiSlice (buf, start, end) {
|
9556 | var ret = ''
|
9557 | end = Math.min(buf.length, end)
|
9558 |
|
9559 | for (var i = start; i < end; ++i) {
|
9560 | ret += String.fromCharCode(buf[i] & 0x7F)
|
9561 | }
|
9562 | return ret
|
9563 | }
|
9564 |
|
9565 | function latin1Slice (buf, start, end) {
|
9566 | var ret = ''
|
9567 | end = Math.min(buf.length, end)
|
9568 |
|
9569 | for (var i = start; i < end; ++i) {
|
9570 | ret += String.fromCharCode(buf[i])
|
9571 | }
|
9572 | return ret
|
9573 | }
|
9574 |
|
9575 | function hexSlice (buf, start, end) {
|
9576 | var len = buf.length
|
9577 |
|
9578 | if (!start || start < 0) start = 0
|
9579 | if (!end || end < 0 || end > len) end = len
|
9580 |
|
9581 | var out = ''
|
9582 | for (var i = start; i < end; ++i) {
|
9583 | out += toHex(buf[i])
|
9584 | }
|
9585 | return out
|
9586 | }
|
9587 |
|
9588 | function utf16leSlice (buf, start, end) {
|
9589 | var bytes = buf.slice(start, end)
|
9590 | var res = ''
|
9591 | for (var i = 0; i < bytes.length; i += 2) {
|
9592 | res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))
|
9593 | }
|
9594 | return res
|
9595 | }
|
9596 |
|
9597 | Buffer.prototype.slice = function slice (start, end) {
|
9598 | var len = this.length
|
9599 | start = ~~start
|
9600 | end = end === undefined ? len : ~~end
|
9601 |
|
9602 | if (start < 0) {
|
9603 | start += len
|
9604 | if (start < 0) start = 0
|
9605 | } else if (start > len) {
|
9606 | start = len
|
9607 | }
|
9608 |
|
9609 | if (end < 0) {
|
9610 | end += len
|
9611 | if (end < 0) end = 0
|
9612 | } else if (end > len) {
|
9613 | end = len
|
9614 | }
|
9615 |
|
9616 | if (end < start) end = start
|
9617 |
|
9618 | var newBuf = this.subarray(start, end)
|
9619 |
|
9620 | newBuf.__proto__ = Buffer.prototype
|
9621 | return newBuf
|
9622 | }
|
9623 |
|
9624 |
|
9625 |
|
9626 |
|
9627 | function checkOffset (offset, ext, length) {
|
9628 | if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
|
9629 | if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
|
9630 | }
|
9631 |
|
9632 | Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
|
9633 | offset = offset >>> 0
|
9634 | byteLength = byteLength >>> 0
|
9635 | if (!noAssert) checkOffset(offset, byteLength, this.length)
|
9636 |
|
9637 | var val = this[offset]
|
9638 | var mul = 1
|
9639 | var i = 0
|
9640 | while (++i < byteLength && (mul *= 0x100)) {
|
9641 | val += this[offset + i] * mul
|
9642 | }
|
9643 |
|
9644 | return val
|
9645 | }
|
9646 |
|
9647 | Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
|
9648 | offset = offset >>> 0
|
9649 | byteLength = byteLength >>> 0
|
9650 | if (!noAssert) {
|
9651 | checkOffset(offset, byteLength, this.length)
|
9652 | }
|
9653 |
|
9654 | var val = this[offset + --byteLength]
|
9655 | var mul = 1
|
9656 | while (byteLength > 0 && (mul *= 0x100)) {
|
9657 | val += this[offset + --byteLength] * mul
|
9658 | }
|
9659 |
|
9660 | return val
|
9661 | }
|
9662 |
|
9663 | Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
|
9664 | offset = offset >>> 0
|
9665 | if (!noAssert) checkOffset(offset, 1, this.length)
|
9666 | return this[offset]
|
9667 | }
|
9668 |
|
9669 | Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
|
9670 | offset = offset >>> 0
|
9671 | if (!noAssert) checkOffset(offset, 2, this.length)
|
9672 | return this[offset] | (this[offset + 1] << 8)
|
9673 | }
|
9674 |
|
9675 | Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
|
9676 | offset = offset >>> 0
|
9677 | if (!noAssert) checkOffset(offset, 2, this.length)
|
9678 | return (this[offset] << 8) | this[offset + 1]
|
9679 | }
|
9680 |
|
9681 | Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
|
9682 | offset = offset >>> 0
|
9683 | if (!noAssert) checkOffset(offset, 4, this.length)
|
9684 |
|
9685 | return ((this[offset]) |
|
9686 | (this[offset + 1] << 8) |
|
9687 | (this[offset + 2] << 16)) +
|
9688 | (this[offset + 3] * 0x1000000)
|
9689 | }
|
9690 |
|
9691 | Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
|
9692 | offset = offset >>> 0
|
9693 | if (!noAssert) checkOffset(offset, 4, this.length)
|
9694 |
|
9695 | return (this[offset] * 0x1000000) +
|
9696 | ((this[offset + 1] << 16) |
|
9697 | (this[offset + 2] << 8) |
|
9698 | this[offset + 3])
|
9699 | }
|
9700 |
|
9701 | Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
|
9702 | offset = offset >>> 0
|
9703 | byteLength = byteLength >>> 0
|
9704 | if (!noAssert) checkOffset(offset, byteLength, this.length)
|
9705 |
|
9706 | var val = this[offset]
|
9707 | var mul = 1
|
9708 | var i = 0
|
9709 | while (++i < byteLength && (mul *= 0x100)) {
|
9710 | val += this[offset + i] * mul
|
9711 | }
|
9712 | mul *= 0x80
|
9713 |
|
9714 | if (val >= mul) val -= Math.pow(2, 8 * byteLength)
|
9715 |
|
9716 | return val
|
9717 | }
|
9718 |
|
9719 | Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
|
9720 | offset = offset >>> 0
|
9721 | byteLength = byteLength >>> 0
|
9722 | if (!noAssert) checkOffset(offset, byteLength, this.length)
|
9723 |
|
9724 | var i = byteLength
|
9725 | var mul = 1
|
9726 | var val = this[offset + --i]
|
9727 | while (i > 0 && (mul *= 0x100)) {
|
9728 | val += this[offset + --i] * mul
|
9729 | }
|
9730 | mul *= 0x80
|
9731 |
|
9732 | if (val >= mul) val -= Math.pow(2, 8 * byteLength)
|
9733 |
|
9734 | return val
|
9735 | }
|
9736 |
|
9737 | Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
|
9738 | offset = offset >>> 0
|
9739 | if (!noAssert) checkOffset(offset, 1, this.length)
|
9740 | if (!(this[offset] & 0x80)) return (this[offset])
|
9741 | return ((0xff - this[offset] + 1) * -1)
|
9742 | }
|
9743 |
|
9744 | Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
|
9745 | offset = offset >>> 0
|
9746 | if (!noAssert) checkOffset(offset, 2, this.length)
|
9747 | var val = this[offset] | (this[offset + 1] << 8)
|
9748 | return (val & 0x8000) ? val | 0xFFFF0000 : val
|
9749 | }
|
9750 |
|
9751 | Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
|
9752 | offset = offset >>> 0
|
9753 | if (!noAssert) checkOffset(offset, 2, this.length)
|
9754 | var val = this[offset + 1] | (this[offset] << 8)
|
9755 | return (val & 0x8000) ? val | 0xFFFF0000 : val
|
9756 | }
|
9757 |
|
9758 | Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
|
9759 | offset = offset >>> 0
|
9760 | if (!noAssert) checkOffset(offset, 4, this.length)
|
9761 |
|
9762 | return (this[offset]) |
|
9763 | (this[offset + 1] << 8) |
|
9764 | (this[offset + 2] << 16) |
|
9765 | (this[offset + 3] << 24)
|
9766 | }
|
9767 |
|
9768 | Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
|
9769 | offset = offset >>> 0
|
9770 | if (!noAssert) checkOffset(offset, 4, this.length)
|
9771 |
|
9772 | return (this[offset] << 24) |
|
9773 | (this[offset + 1] << 16) |
|
9774 | (this[offset + 2] << 8) |
|
9775 | (this[offset + 3])
|
9776 | }
|
9777 |
|
9778 | Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
|
9779 | offset = offset >>> 0
|
9780 | if (!noAssert) checkOffset(offset, 4, this.length)
|
9781 | return ieee754.read(this, offset, true, 23, 4)
|
9782 | }
|
9783 |
|
9784 | Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
|
9785 | offset = offset >>> 0
|
9786 | if (!noAssert) checkOffset(offset, 4, this.length)
|
9787 | return ieee754.read(this, offset, false, 23, 4)
|
9788 | }
|
9789 |
|
9790 | Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
|
9791 | offset = offset >>> 0
|
9792 | if (!noAssert) checkOffset(offset, 8, this.length)
|
9793 | return ieee754.read(this, offset, true, 52, 8)
|
9794 | }
|
9795 |
|
9796 | Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
|
9797 | offset = offset >>> 0
|
9798 | if (!noAssert) checkOffset(offset, 8, this.length)
|
9799 | return ieee754.read(this, offset, false, 52, 8)
|
9800 | }
|
9801 |
|
9802 | function checkInt (buf, value, offset, ext, max, min) {
|
9803 | if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
|
9804 | if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
|
9805 | if (offset + ext > buf.length) throw new RangeError('Index out of range')
|
9806 | }
|
9807 |
|
9808 | Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
|
9809 | value = +value
|
9810 | offset = offset >>> 0
|
9811 | byteLength = byteLength >>> 0
|
9812 | if (!noAssert) {
|
9813 | var maxBytes = Math.pow(2, 8 * byteLength) - 1
|
9814 | checkInt(this, value, offset, byteLength, maxBytes, 0)
|
9815 | }
|
9816 |
|
9817 | var mul = 1
|
9818 | var i = 0
|
9819 | this[offset] = value & 0xFF
|
9820 | while (++i < byteLength && (mul *= 0x100)) {
|
9821 | this[offset + i] = (value / mul) & 0xFF
|
9822 | }
|
9823 |
|
9824 | return offset + byteLength
|
9825 | }
|
9826 |
|
9827 | Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
|
9828 | value = +value
|
9829 | offset = offset >>> 0
|
9830 | byteLength = byteLength >>> 0
|
9831 | if (!noAssert) {
|
9832 | var maxBytes = Math.pow(2, 8 * byteLength) - 1
|
9833 | checkInt(this, value, offset, byteLength, maxBytes, 0)
|
9834 | }
|
9835 |
|
9836 | var i = byteLength - 1
|
9837 | var mul = 1
|
9838 | this[offset + i] = value & 0xFF
|
9839 | while (--i >= 0 && (mul *= 0x100)) {
|
9840 | this[offset + i] = (value / mul) & 0xFF
|
9841 | }
|
9842 |
|
9843 | return offset + byteLength
|
9844 | }
|
9845 |
|
9846 | Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
|
9847 | value = +value
|
9848 | offset = offset >>> 0
|
9849 | if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
|
9850 | this[offset] = (value & 0xff)
|
9851 | return offset + 1
|
9852 | }
|
9853 |
|
9854 | Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
|
9855 | value = +value
|
9856 | offset = offset >>> 0
|
9857 | if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
|
9858 | this[offset] = (value & 0xff)
|
9859 | this[offset + 1] = (value >>> 8)
|
9860 | return offset + 2
|
9861 | }
|
9862 |
|
9863 | Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
|
9864 | value = +value
|
9865 | offset = offset >>> 0
|
9866 | if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
|
9867 | this[offset] = (value >>> 8)
|
9868 | this[offset + 1] = (value & 0xff)
|
9869 | return offset + 2
|
9870 | }
|
9871 |
|
9872 | Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
|
9873 | value = +value
|
9874 | offset = offset >>> 0
|
9875 | if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
|
9876 | this[offset + 3] = (value >>> 24)
|
9877 | this[offset + 2] = (value >>> 16)
|
9878 | this[offset + 1] = (value >>> 8)
|
9879 | this[offset] = (value & 0xff)
|
9880 | return offset + 4
|
9881 | }
|
9882 |
|
9883 | Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
|
9884 | value = +value
|
9885 | offset = offset >>> 0
|
9886 | if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
|
9887 | this[offset] = (value >>> 24)
|
9888 | this[offset + 1] = (value >>> 16)
|
9889 | this[offset + 2] = (value >>> 8)
|
9890 | this[offset + 3] = (value & 0xff)
|
9891 | return offset + 4
|
9892 | }
|
9893 |
|
9894 | Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
|
9895 | value = +value
|
9896 | offset = offset >>> 0
|
9897 | if (!noAssert) {
|
9898 | var limit = Math.pow(2, (8 * byteLength) - 1)
|
9899 |
|
9900 | checkInt(this, value, offset, byteLength, limit - 1, -limit)
|
9901 | }
|
9902 |
|
9903 | var i = 0
|
9904 | var mul = 1
|
9905 | var sub = 0
|
9906 | this[offset] = value & 0xFF
|
9907 | while (++i < byteLength && (mul *= 0x100)) {
|
9908 | if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
|
9909 | sub = 1
|
9910 | }
|
9911 | this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
|
9912 | }
|
9913 |
|
9914 | return offset + byteLength
|
9915 | }
|
9916 |
|
9917 | Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
|
9918 | value = +value
|
9919 | offset = offset >>> 0
|
9920 | if (!noAssert) {
|
9921 | var limit = Math.pow(2, (8 * byteLength) - 1)
|
9922 |
|
9923 | checkInt(this, value, offset, byteLength, limit - 1, -limit)
|
9924 | }
|
9925 |
|
9926 | var i = byteLength - 1
|
9927 | var mul = 1
|
9928 | var sub = 0
|
9929 | this[offset + i] = value & 0xFF
|
9930 | while (--i >= 0 && (mul *= 0x100)) {
|
9931 | if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
|
9932 | sub = 1
|
9933 | }
|
9934 | this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
|
9935 | }
|
9936 |
|
9937 | return offset + byteLength
|
9938 | }
|
9939 |
|
9940 | Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
|
9941 | value = +value
|
9942 | offset = offset >>> 0
|
9943 | if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
|
9944 | if (value < 0) value = 0xff + value + 1
|
9945 | this[offset] = (value & 0xff)
|
9946 | return offset + 1
|
9947 | }
|
9948 |
|
9949 | Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
|
9950 | value = +value
|
9951 | offset = offset >>> 0
|
9952 | if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
|
9953 | this[offset] = (value & 0xff)
|
9954 | this[offset + 1] = (value >>> 8)
|
9955 | return offset + 2
|
9956 | }
|
9957 |
|
9958 | Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
|
9959 | value = +value
|
9960 | offset = offset >>> 0
|
9961 | if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
|
9962 | this[offset] = (value >>> 8)
|
9963 | this[offset + 1] = (value & 0xff)
|
9964 | return offset + 2
|
9965 | }
|
9966 |
|
9967 | Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
|
9968 | value = +value
|
9969 | offset = offset >>> 0
|
9970 | if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
|
9971 | this[offset] = (value & 0xff)
|
9972 | this[offset + 1] = (value >>> 8)
|
9973 | this[offset + 2] = (value >>> 16)
|
9974 | this[offset + 3] = (value >>> 24)
|
9975 | return offset + 4
|
9976 | }
|
9977 |
|
9978 | Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
|
9979 | value = +value
|
9980 | offset = offset >>> 0
|
9981 | if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
|
9982 | if (value < 0) value = 0xffffffff + value + 1
|
9983 | this[offset] = (value >>> 24)
|
9984 | this[offset + 1] = (value >>> 16)
|
9985 | this[offset + 2] = (value >>> 8)
|
9986 | this[offset + 3] = (value & 0xff)
|
9987 | return offset + 4
|
9988 | }
|
9989 |
|
9990 | function checkIEEE754 (buf, value, offset, ext, max, min) {
|
9991 | if (offset + ext > buf.length) throw new RangeError('Index out of range')
|
9992 | if (offset < 0) throw new RangeError('Index out of range')
|
9993 | }
|
9994 |
|
9995 | function writeFloat (buf, value, offset, littleEndian, noAssert) {
|
9996 | value = +value
|
9997 | offset = offset >>> 0
|
9998 | if (!noAssert) {
|
9999 | checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
|
10000 | }
|
10001 | ieee754.write(buf, value, offset, littleEndian, 23, 4)
|
10002 | return offset + 4
|
10003 | }
|
10004 |
|
10005 | Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
|
10006 | return writeFloat(this, value, offset, true, noAssert)
|
10007 | }
|
10008 |
|
10009 | Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
|
10010 | return writeFloat(this, value, offset, false, noAssert)
|
10011 | }
|
10012 |
|
10013 | function writeDouble (buf, value, offset, littleEndian, noAssert) {
|
10014 | value = +value
|
10015 | offset = offset >>> 0
|
10016 | if (!noAssert) {
|
10017 | checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
|
10018 | }
|
10019 | ieee754.write(buf, value, offset, littleEndian, 52, 8)
|
10020 | return offset + 8
|
10021 | }
|
10022 |
|
10023 | Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
|
10024 | return writeDouble(this, value, offset, true, noAssert)
|
10025 | }
|
10026 |
|
10027 | Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
|
10028 | return writeDouble(this, value, offset, false, noAssert)
|
10029 | }
|
10030 |
|
10031 |
|
10032 | Buffer.prototype.copy = function copy (target, targetStart, start, end) {
|
10033 | if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')
|
10034 | if (!start) start = 0
|
10035 | if (!end && end !== 0) end = this.length
|
10036 | if (targetStart >= target.length) targetStart = target.length
|
10037 | if (!targetStart) targetStart = 0
|
10038 | if (end > 0 && end < start) end = start
|
10039 |
|
10040 |
|
10041 | if (end === start) return 0
|
10042 | if (target.length === 0 || this.length === 0) return 0
|
10043 |
|
10044 |
|
10045 | if (targetStart < 0) {
|
10046 | throw new RangeError('targetStart out of bounds')
|
10047 | }
|
10048 | if (start < 0 || start >= this.length) throw new RangeError('Index out of range')
|
10049 | if (end < 0) throw new RangeError('sourceEnd out of bounds')
|
10050 |
|
10051 |
|
10052 | if (end > this.length) end = this.length
|
10053 | if (target.length - targetStart < end - start) {
|
10054 | end = target.length - targetStart + start
|
10055 | }
|
10056 |
|
10057 | var len = end - start
|
10058 |
|
10059 | if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {
|
10060 |
|
10061 | this.copyWithin(targetStart, start, end)
|
10062 | } else if (this === target && start < targetStart && targetStart < end) {
|
10063 |
|
10064 | for (var i = len - 1; i >= 0; --i) {
|
10065 | target[i + targetStart] = this[i + start]
|
10066 | }
|
10067 | } else {
|
10068 | Uint8Array.prototype.set.call(
|
10069 | target,
|
10070 | this.subarray(start, end),
|
10071 | targetStart
|
10072 | )
|
10073 | }
|
10074 |
|
10075 | return len
|
10076 | }
|
10077 |
|
10078 |
|
10079 |
|
10080 |
|
10081 |
|
10082 | Buffer.prototype.fill = function fill (val, start, end, encoding) {
|
10083 |
|
10084 | if (typeof val === 'string') {
|
10085 | if (typeof start === 'string') {
|
10086 | encoding = start
|
10087 | start = 0
|
10088 | end = this.length
|
10089 | } else if (typeof end === 'string') {
|
10090 | encoding = end
|
10091 | end = this.length
|
10092 | }
|
10093 | if (encoding !== undefined && typeof encoding !== 'string') {
|
10094 | throw new TypeError('encoding must be a string')
|
10095 | }
|
10096 | if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
|
10097 | throw new TypeError('Unknown encoding: ' + encoding)
|
10098 | }
|
10099 | if (val.length === 1) {
|
10100 | var code = val.charCodeAt(0)
|
10101 | if ((encoding === 'utf8' && code < 128) ||
|
10102 | encoding === 'latin1') {
|
10103 |
|
10104 | val = code
|
10105 | }
|
10106 | }
|
10107 | } else if (typeof val === 'number') {
|
10108 | val = val & 255
|
10109 | }
|
10110 |
|
10111 |
|
10112 | if (start < 0 || this.length < start || this.length < end) {
|
10113 | throw new RangeError('Out of range index')
|
10114 | }
|
10115 |
|
10116 | if (end <= start) {
|
10117 | return this
|
10118 | }
|
10119 |
|
10120 | start = start >>> 0
|
10121 | end = end === undefined ? this.length : end >>> 0
|
10122 |
|
10123 | if (!val) val = 0
|
10124 |
|
10125 | var i
|
10126 | if (typeof val === 'number') {
|
10127 | for (i = start; i < end; ++i) {
|
10128 | this[i] = val
|
10129 | }
|
10130 | } else {
|
10131 | var bytes = Buffer.isBuffer(val)
|
10132 | ? val
|
10133 | : Buffer.from(val, encoding)
|
10134 | var len = bytes.length
|
10135 | if (len === 0) {
|
10136 | throw new TypeError('The value "' + val +
|
10137 | '" is invalid for argument "value"')
|
10138 | }
|
10139 | for (i = 0; i < end - start; ++i) {
|
10140 | this[i + start] = bytes[i % len]
|
10141 | }
|
10142 | }
|
10143 |
|
10144 | return this
|
10145 | }
|
10146 |
|
10147 |
|
10148 |
|
10149 |
|
10150 | var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g
|
10151 |
|
10152 | function base64clean (str) {
|
10153 |
|
10154 | str = str.split('=')[0]
|
10155 |
|
10156 | str = str.trim().replace(INVALID_BASE64_RE, '')
|
10157 |
|
10158 | if (str.length < 2) return ''
|
10159 |
|
10160 | while (str.length % 4 !== 0) {
|
10161 | str = str + '='
|
10162 | }
|
10163 | return str
|
10164 | }
|
10165 |
|
10166 | function toHex (n) {
|
10167 | if (n < 16) return '0' + n.toString(16)
|
10168 | return n.toString(16)
|
10169 | }
|
10170 |
|
10171 | function utf8ToBytes (string, units) {
|
10172 | units = units || Infinity
|
10173 | var codePoint
|
10174 | var length = string.length
|
10175 | var leadSurrogate = null
|
10176 | var bytes = []
|
10177 |
|
10178 | for (var i = 0; i < length; ++i) {
|
10179 | codePoint = string.charCodeAt(i)
|
10180 |
|
10181 |
|
10182 | if (codePoint > 0xD7FF && codePoint < 0xE000) {
|
10183 |
|
10184 | if (!leadSurrogate) {
|
10185 |
|
10186 | if (codePoint > 0xDBFF) {
|
10187 |
|
10188 | if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
10189 | continue
|
10190 | } else if (i + 1 === length) {
|
10191 |
|
10192 | if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
10193 | continue
|
10194 | }
|
10195 |
|
10196 |
|
10197 | leadSurrogate = codePoint
|
10198 |
|
10199 | continue
|
10200 | }
|
10201 |
|
10202 |
|
10203 | if (codePoint < 0xDC00) {
|
10204 | if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
10205 | leadSurrogate = codePoint
|
10206 | continue
|
10207 | }
|
10208 |
|
10209 |
|
10210 | codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
|
10211 | } else if (leadSurrogate) {
|
10212 |
|
10213 | if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
10214 | }
|
10215 |
|
10216 | leadSurrogate = null
|
10217 |
|
10218 |
|
10219 | if (codePoint < 0x80) {
|
10220 | if ((units -= 1) < 0) break
|
10221 | bytes.push(codePoint)
|
10222 | } else if (codePoint < 0x800) {
|
10223 | if ((units -= 2) < 0) break
|
10224 | bytes.push(
|
10225 | codePoint >> 0x6 | 0xC0,
|
10226 | codePoint & 0x3F | 0x80
|
10227 | )
|
10228 | } else if (codePoint < 0x10000) {
|
10229 | if ((units -= 3) < 0) break
|
10230 | bytes.push(
|
10231 | codePoint >> 0xC | 0xE0,
|
10232 | codePoint >> 0x6 & 0x3F | 0x80,
|
10233 | codePoint & 0x3F | 0x80
|
10234 | )
|
10235 | } else if (codePoint < 0x110000) {
|
10236 | if ((units -= 4) < 0) break
|
10237 | bytes.push(
|
10238 | codePoint >> 0x12 | 0xF0,
|
10239 | codePoint >> 0xC & 0x3F | 0x80,
|
10240 | codePoint >> 0x6 & 0x3F | 0x80,
|
10241 | codePoint & 0x3F | 0x80
|
10242 | )
|
10243 | } else {
|
10244 | throw new Error('Invalid code point')
|
10245 | }
|
10246 | }
|
10247 |
|
10248 | return bytes
|
10249 | }
|
10250 |
|
10251 | function asciiToBytes (str) {
|
10252 | var byteArray = []
|
10253 | for (var i = 0; i < str.length; ++i) {
|
10254 |
|
10255 | byteArray.push(str.charCodeAt(i) & 0xFF)
|
10256 | }
|
10257 | return byteArray
|
10258 | }
|
10259 |
|
10260 | function utf16leToBytes (str, units) {
|
10261 | var c, hi, lo
|
10262 | var byteArray = []
|
10263 | for (var i = 0; i < str.length; ++i) {
|
10264 | if ((units -= 2) < 0) break
|
10265 |
|
10266 | c = str.charCodeAt(i)
|
10267 | hi = c >> 8
|
10268 | lo = c % 256
|
10269 | byteArray.push(lo)
|
10270 | byteArray.push(hi)
|
10271 | }
|
10272 |
|
10273 | return byteArray
|
10274 | }
|
10275 |
|
10276 | function base64ToBytes (str) {
|
10277 | return base64.toByteArray(base64clean(str))
|
10278 | }
|
10279 |
|
10280 | function blitBuffer (src, dst, offset, length) {
|
10281 | for (var i = 0; i < length; ++i) {
|
10282 | if ((i + offset >= dst.length) || (i >= src.length)) break
|
10283 | dst[i + offset] = src[i]
|
10284 | }
|
10285 | return i
|
10286 | }
|
10287 |
|
10288 |
|
10289 |
|
10290 |
|
10291 | function isInstance (obj, type) {
|
10292 | return obj instanceof type ||
|
10293 | (obj != null && obj.constructor != null && obj.constructor.name != null &&
|
10294 | obj.constructor.name === type.name)
|
10295 | }
|
10296 | function numberIsNaN (obj) {
|
10297 |
|
10298 | return obj !== obj
|
10299 | }
|
10300 |
|
10301 | }).call(this,require("buffer").Buffer)
|
10302 | },{"base64-js":39,"buffer":43,"ieee754":55}],44:[function(require,module,exports){
|
10303 | (function (Buffer){
|
10304 |
|
10305 |
|
10306 |
|
10307 |
|
10308 |
|
10309 |
|
10310 |
|
10311 |
|
10312 |
|
10313 |
|
10314 |
|
10315 |
|
10316 |
|
10317 |
|
10318 |
|
10319 |
|
10320 |
|
10321 |
|
10322 |
|
10323 |
|
10324 |
|
10325 |
|
10326 |
|
10327 |
|
10328 | function isArray(arg) {
|
10329 | if (Array.isArray) {
|
10330 | return Array.isArray(arg);
|
10331 | }
|
10332 | return objectToString(arg) === '[object Array]';
|
10333 | }
|
10334 | exports.isArray = isArray;
|
10335 |
|
10336 | function isBoolean(arg) {
|
10337 | return typeof arg === 'boolean';
|
10338 | }
|
10339 | exports.isBoolean = isBoolean;
|
10340 |
|
10341 | function isNull(arg) {
|
10342 | return arg === null;
|
10343 | }
|
10344 | exports.isNull = isNull;
|
10345 |
|
10346 | function isNullOrUndefined(arg) {
|
10347 | return arg == null;
|
10348 | }
|
10349 | exports.isNullOrUndefined = isNullOrUndefined;
|
10350 |
|
10351 | function isNumber(arg) {
|
10352 | return typeof arg === 'number';
|
10353 | }
|
10354 | exports.isNumber = isNumber;
|
10355 |
|
10356 | function isString(arg) {
|
10357 | return typeof arg === 'string';
|
10358 | }
|
10359 | exports.isString = isString;
|
10360 |
|
10361 | function isSymbol(arg) {
|
10362 | return typeof arg === 'symbol';
|
10363 | }
|
10364 | exports.isSymbol = isSymbol;
|
10365 |
|
10366 | function isUndefined(arg) {
|
10367 | return arg === void 0;
|
10368 | }
|
10369 | exports.isUndefined = isUndefined;
|
10370 |
|
10371 | function isRegExp(re) {
|
10372 | return objectToString(re) === '[object RegExp]';
|
10373 | }
|
10374 | exports.isRegExp = isRegExp;
|
10375 |
|
10376 | function isObject(arg) {
|
10377 | return typeof arg === 'object' && arg !== null;
|
10378 | }
|
10379 | exports.isObject = isObject;
|
10380 |
|
10381 | function isDate(d) {
|
10382 | return objectToString(d) === '[object Date]';
|
10383 | }
|
10384 | exports.isDate = isDate;
|
10385 |
|
10386 | function isError(e) {
|
10387 | return (objectToString(e) === '[object Error]' || e instanceof Error);
|
10388 | }
|
10389 | exports.isError = isError;
|
10390 |
|
10391 | function isFunction(arg) {
|
10392 | return typeof arg === 'function';
|
10393 | }
|
10394 | exports.isFunction = isFunction;
|
10395 |
|
10396 | function isPrimitive(arg) {
|
10397 | return arg === null ||
|
10398 | typeof arg === 'boolean' ||
|
10399 | typeof arg === 'number' ||
|
10400 | typeof arg === 'string' ||
|
10401 | typeof arg === 'symbol' ||
|
10402 | typeof arg === 'undefined';
|
10403 | }
|
10404 | exports.isPrimitive = isPrimitive;
|
10405 |
|
10406 | exports.isBuffer = Buffer.isBuffer;
|
10407 |
|
10408 | function objectToString(o) {
|
10409 | return Object.prototype.toString.call(o);
|
10410 | }
|
10411 |
|
10412 | }).call(this,{"isBuffer":require("../../is-buffer/index.js")})
|
10413 | },{"../../is-buffer/index.js":57}],45:[function(require,module,exports){
|
10414 | (function (process){
|
10415 | "use strict";
|
10416 |
|
10417 | 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); }
|
10418 |
|
10419 |
|
10420 |
|
10421 |
|
10422 |
|
10423 |
|
10424 | exports.log = log;
|
10425 | exports.formatArgs = formatArgs;
|
10426 | exports.save = save;
|
10427 | exports.load = load;
|
10428 | exports.useColors = useColors;
|
10429 | exports.storage = localstorage();
|
10430 |
|
10431 |
|
10432 |
|
10433 |
|
10434 | 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'];
|
10435 |
|
10436 |
|
10437 |
|
10438 |
|
10439 |
|
10440 |
|
10441 |
|
10442 |
|
10443 |
|
10444 | function useColors() {
|
10445 |
|
10446 |
|
10447 |
|
10448 | if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
|
10449 | return true;
|
10450 | }
|
10451 |
|
10452 |
|
10453 | if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
10454 | return false;
|
10455 | }
|
10456 |
|
10457 |
|
10458 |
|
10459 | return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance ||
|
10460 | typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) ||
|
10461 |
|
10462 | typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 ||
|
10463 | typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
|
10464 | }
|
10465 |
|
10466 |
|
10467 |
|
10468 |
|
10469 |
|
10470 |
|
10471 |
|
10472 | function formatArgs(args) {
|
10473 | args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);
|
10474 |
|
10475 | if (!this.useColors) {
|
10476 | return;
|
10477 | }
|
10478 |
|
10479 | var c = 'color: ' + this.color;
|
10480 | args.splice(1, 0, c, 'color: inherit');
|
10481 |
|
10482 |
|
10483 |
|
10484 | var index = 0;
|
10485 | var lastC = 0;
|
10486 | args[0].replace(/%[a-zA-Z%]/g, function (match) {
|
10487 | if (match === '%%') {
|
10488 | return;
|
10489 | }
|
10490 |
|
10491 | index++;
|
10492 |
|
10493 | if (match === '%c') {
|
10494 |
|
10495 |
|
10496 | lastC = index;
|
10497 | }
|
10498 | });
|
10499 | args.splice(lastC, 0, c);
|
10500 | }
|
10501 |
|
10502 |
|
10503 |
|
10504 |
|
10505 |
|
10506 |
|
10507 |
|
10508 |
|
10509 | function log() {
|
10510 | var _console;
|
10511 |
|
10512 |
|
10513 |
|
10514 | return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments);
|
10515 | }
|
10516 |
|
10517 |
|
10518 |
|
10519 |
|
10520 |
|
10521 |
|
10522 |
|
10523 |
|
10524 | function save(namespaces) {
|
10525 | try {
|
10526 | if (namespaces) {
|
10527 | exports.storage.setItem('debug', namespaces);
|
10528 | } else {
|
10529 | exports.storage.removeItem('debug');
|
10530 | }
|
10531 | } catch (error) {
|
10532 |
|
10533 | }
|
10534 | }
|
10535 |
|
10536 |
|
10537 |
|
10538 |
|
10539 |
|
10540 |
|
10541 |
|
10542 |
|
10543 | function load() {
|
10544 | var r;
|
10545 |
|
10546 | try {
|
10547 | r = exports.storage.getItem('debug');
|
10548 | } catch (error) {}
|
10549 |
|
10550 |
|
10551 |
|
10552 |
|
10553 | if (!r && typeof process !== 'undefined' && 'env' in process) {
|
10554 | r = process.env.DEBUG;
|
10555 | }
|
10556 |
|
10557 | return r;
|
10558 | }
|
10559 |
|
10560 |
|
10561 |
|
10562 |
|
10563 |
|
10564 |
|
10565 |
|
10566 |
|
10567 |
|
10568 |
|
10569 |
|
10570 |
|
10571 | function localstorage() {
|
10572 | try {
|
10573 |
|
10574 |
|
10575 | return localStorage;
|
10576 | } catch (error) {
|
10577 |
|
10578 | }
|
10579 | }
|
10580 |
|
10581 | module.exports = require('./common')(exports);
|
10582 | var formatters = module.exports.formatters;
|
10583 |
|
10584 |
|
10585 |
|
10586 |
|
10587 | formatters.j = function (v) {
|
10588 | try {
|
10589 | return JSON.stringify(v);
|
10590 | } catch (error) {
|
10591 | return '[UnexpectedJSONParseError]: ' + error.message;
|
10592 | }
|
10593 | };
|
10594 |
|
10595 |
|
10596 | }).call(this,require('_process'))
|
10597 | },{"./common":46,"_process":69}],46:[function(require,module,exports){
|
10598 | "use strict";
|
10599 |
|
10600 |
|
10601 |
|
10602 |
|
10603 |
|
10604 | function setup(env) {
|
10605 | createDebug.debug = createDebug;
|
10606 | createDebug.default = createDebug;
|
10607 | createDebug.coerce = coerce;
|
10608 | createDebug.disable = disable;
|
10609 | createDebug.enable = enable;
|
10610 | createDebug.enabled = enabled;
|
10611 | createDebug.humanize = require('ms');
|
10612 | Object.keys(env).forEach(function (key) {
|
10613 | createDebug[key] = env[key];
|
10614 | });
|
10615 | |
10616 |
|
10617 |
|
10618 |
|
10619 | createDebug.instances = [];
|
10620 | |
10621 |
|
10622 |
|
10623 |
|
10624 | createDebug.names = [];
|
10625 | createDebug.skips = [];
|
10626 | |
10627 |
|
10628 |
|
10629 |
|
10630 |
|
10631 |
|
10632 | createDebug.formatters = {};
|
10633 | |
10634 |
|
10635 |
|
10636 |
|
10637 |
|
10638 |
|
10639 |
|
10640 | function selectColor(namespace) {
|
10641 | var hash = 0;
|
10642 |
|
10643 | for (var i = 0; i < namespace.length; i++) {
|
10644 | hash = (hash << 5) - hash + namespace.charCodeAt(i);
|
10645 | hash |= 0;
|
10646 | }
|
10647 |
|
10648 | return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
10649 | }
|
10650 |
|
10651 | createDebug.selectColor = selectColor;
|
10652 | |
10653 |
|
10654 |
|
10655 |
|
10656 |
|
10657 |
|
10658 |
|
10659 |
|
10660 | function createDebug(namespace) {
|
10661 | var prevTime;
|
10662 |
|
10663 | function debug() {
|
10664 |
|
10665 | if (!debug.enabled) {
|
10666 | return;
|
10667 | }
|
10668 |
|
10669 | for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
10670 | args[_key] = arguments[_key];
|
10671 | }
|
10672 |
|
10673 | var self = debug;
|
10674 |
|
10675 | var curr = Number(new Date());
|
10676 | var ms = curr - (prevTime || curr);
|
10677 | self.diff = ms;
|
10678 | self.prev = prevTime;
|
10679 | self.curr = curr;
|
10680 | prevTime = curr;
|
10681 | args[0] = createDebug.coerce(args[0]);
|
10682 |
|
10683 | if (typeof args[0] !== 'string') {
|
10684 |
|
10685 | args.unshift('%O');
|
10686 | }
|
10687 |
|
10688 |
|
10689 | var index = 0;
|
10690 | args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {
|
10691 |
|
10692 | if (match === '%%') {
|
10693 | return match;
|
10694 | }
|
10695 |
|
10696 | index++;
|
10697 | var formatter = createDebug.formatters[format];
|
10698 |
|
10699 | if (typeof formatter === 'function') {
|
10700 | var val = args[index];
|
10701 | match = formatter.call(self, val);
|
10702 |
|
10703 | args.splice(index, 1);
|
10704 | index--;
|
10705 | }
|
10706 |
|
10707 | return match;
|
10708 | });
|
10709 |
|
10710 | createDebug.formatArgs.call(self, args);
|
10711 | var logFn = self.log || createDebug.log;
|
10712 | logFn.apply(self, args);
|
10713 | }
|
10714 |
|
10715 | debug.namespace = namespace;
|
10716 | debug.enabled = createDebug.enabled(namespace);
|
10717 | debug.useColors = createDebug.useColors();
|
10718 | debug.color = selectColor(namespace);
|
10719 | debug.destroy = destroy;
|
10720 | debug.extend = extend;
|
10721 |
|
10722 |
|
10723 |
|
10724 | if (typeof createDebug.init === 'function') {
|
10725 | createDebug.init(debug);
|
10726 | }
|
10727 |
|
10728 | createDebug.instances.push(debug);
|
10729 | return debug;
|
10730 | }
|
10731 |
|
10732 | function destroy() {
|
10733 | var index = createDebug.instances.indexOf(this);
|
10734 |
|
10735 | if (index !== -1) {
|
10736 | createDebug.instances.splice(index, 1);
|
10737 | return true;
|
10738 | }
|
10739 |
|
10740 | return false;
|
10741 | }
|
10742 |
|
10743 | function extend(namespace, delimiter) {
|
10744 | return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
|
10745 | }
|
10746 | |
10747 |
|
10748 |
|
10749 |
|
10750 |
|
10751 |
|
10752 |
|
10753 |
|
10754 |
|
10755 | function enable(namespaces) {
|
10756 | createDebug.save(namespaces);
|
10757 | createDebug.names = [];
|
10758 | createDebug.skips = [];
|
10759 | var i;
|
10760 | var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
|
10761 | var len = split.length;
|
10762 |
|
10763 | for (i = 0; i < len; i++) {
|
10764 | if (!split[i]) {
|
10765 |
|
10766 | continue;
|
10767 | }
|
10768 |
|
10769 | namespaces = split[i].replace(/\*/g, '.*?');
|
10770 |
|
10771 | if (namespaces[0] === '-') {
|
10772 | createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
|
10773 | } else {
|
10774 | createDebug.names.push(new RegExp('^' + namespaces + '$'));
|
10775 | }
|
10776 | }
|
10777 |
|
10778 | for (i = 0; i < createDebug.instances.length; i++) {
|
10779 | var instance = createDebug.instances[i];
|
10780 | instance.enabled = createDebug.enabled(instance.namespace);
|
10781 | }
|
10782 | }
|
10783 | |
10784 |
|
10785 |
|
10786 |
|
10787 |
|
10788 |
|
10789 |
|
10790 | function disable() {
|
10791 | createDebug.enable('');
|
10792 | }
|
10793 | |
10794 |
|
10795 |
|
10796 |
|
10797 |
|
10798 |
|
10799 |
|
10800 |
|
10801 |
|
10802 | function enabled(name) {
|
10803 | if (name[name.length - 1] === '*') {
|
10804 | return true;
|
10805 | }
|
10806 |
|
10807 | var i;
|
10808 | var len;
|
10809 |
|
10810 | for (i = 0, len = createDebug.skips.length; i < len; i++) {
|
10811 | if (createDebug.skips[i].test(name)) {
|
10812 | return false;
|
10813 | }
|
10814 | }
|
10815 |
|
10816 | for (i = 0, len = createDebug.names.length; i < len; i++) {
|
10817 | if (createDebug.names[i].test(name)) {
|
10818 | return true;
|
10819 | }
|
10820 | }
|
10821 |
|
10822 | return false;
|
10823 | }
|
10824 | |
10825 |
|
10826 |
|
10827 |
|
10828 |
|
10829 |
|
10830 |
|
10831 |
|
10832 |
|
10833 | function coerce(val) {
|
10834 | if (val instanceof Error) {
|
10835 | return val.stack || val.message;
|
10836 | }
|
10837 |
|
10838 | return val;
|
10839 | }
|
10840 |
|
10841 | createDebug.enable(createDebug.load());
|
10842 | return createDebug;
|
10843 | }
|
10844 |
|
10845 | module.exports = setup;
|
10846 |
|
10847 |
|
10848 | },{"ms":60}],47:[function(require,module,exports){
|
10849 | 'use strict';
|
10850 |
|
10851 | var keys = require('object-keys');
|
10852 | var hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol';
|
10853 |
|
10854 | var toStr = Object.prototype.toString;
|
10855 | var concat = Array.prototype.concat;
|
10856 | var origDefineProperty = Object.defineProperty;
|
10857 |
|
10858 | var isFunction = function (fn) {
|
10859 | return typeof fn === 'function' && toStr.call(fn) === '[object Function]';
|
10860 | };
|
10861 |
|
10862 | var arePropertyDescriptorsSupported = function () {
|
10863 | var obj = {};
|
10864 | try {
|
10865 | origDefineProperty(obj, 'x', { enumerable: false, value: obj });
|
10866 |
|
10867 | for (var _ in obj) {
|
10868 | return false;
|
10869 | }
|
10870 | return obj.x === obj;
|
10871 | } catch (e) {
|
10872 | return false;
|
10873 | }
|
10874 | };
|
10875 | var supportsDescriptors = origDefineProperty && arePropertyDescriptorsSupported();
|
10876 |
|
10877 | var defineProperty = function (object, name, value, predicate) {
|
10878 | if (name in object && (!isFunction(predicate) || !predicate())) {
|
10879 | return;
|
10880 | }
|
10881 | if (supportsDescriptors) {
|
10882 | origDefineProperty(object, name, {
|
10883 | configurable: true,
|
10884 | enumerable: false,
|
10885 | value: value,
|
10886 | writable: true
|
10887 | });
|
10888 | } else {
|
10889 | object[name] = value;
|
10890 | }
|
10891 | };
|
10892 |
|
10893 | var defineProperties = function (object, map) {
|
10894 | var predicates = arguments.length > 2 ? arguments[2] : {};
|
10895 | var props = keys(map);
|
10896 | if (hasSymbols) {
|
10897 | props = concat.call(props, Object.getOwnPropertySymbols(map));
|
10898 | }
|
10899 | for (var i = 0; i < props.length; i += 1) {
|
10900 | defineProperty(object, props[i], map[props[i]], predicates[props[i]]);
|
10901 | }
|
10902 | };
|
10903 |
|
10904 | defineProperties.supportsDescriptors = !!supportsDescriptors;
|
10905 |
|
10906 | module.exports = defineProperties;
|
10907 |
|
10908 | },{"object-keys":62}],48:[function(require,module,exports){
|
10909 |
|
10910 |
|
10911 |
|
10912 |
|
10913 |
|
10914 |
|
10915 |
|
10916 |
|
10917 |
|
10918 |
|
10919 |
|
10920 |
|
10921 |
|
10922 |
|
10923 |
|
10924 |
|
10925 |
|
10926 |
|
10927 |
|
10928 |
|
10929 |
|
10930 |
|
10931 |
|
10932 |
|
10933 |
|
10934 |
|
10935 |
|
10936 |
|
10937 |
|
10938 |
|
10939 |
|
10940 |
|
10941 |
|
10942 |
|
10943 |
|
10944 |
|
10945 |
|
10946 | (function webpackUniversalModuleDefinition(root, factory) {
|
10947 | if(typeof exports === 'object' && typeof module === 'object')
|
10948 | module.exports = factory();
|
10949 | else if(false)
|
10950 | define([], factory);
|
10951 | else if(typeof exports === 'object')
|
10952 | exports["JsDiff"] = factory();
|
10953 | else
|
10954 | root["JsDiff"] = factory();
|
10955 | })(this, function() {
|
10956 | return (function(modules) {
|
10957 |
|
10958 | var installedModules = {};
|
10959 |
|
10960 |
|
10961 | function __webpack_require__(moduleId) {
|
10962 |
|
10963 |
|
10964 | if(installedModules[moduleId])
|
10965 | return installedModules[moduleId].exports;
|
10966 |
|
10967 |
|
10968 | var module = installedModules[moduleId] = {
|
10969 | exports: {},
|
10970 | id: moduleId,
|
10971 | loaded: false
|
10972 | };
|
10973 |
|
10974 |
|
10975 | modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
10976 |
|
10977 |
|
10978 | module.loaded = true;
|
10979 |
|
10980 |
|
10981 | return module.exports;
|
10982 | }
|
10983 |
|
10984 |
|
10985 |
|
10986 | __webpack_require__.m = modules;
|
10987 |
|
10988 |
|
10989 | __webpack_require__.c = installedModules;
|
10990 |
|
10991 |
|
10992 | __webpack_require__.p = "";
|
10993 |
|
10994 |
|
10995 | return __webpack_require__(0);
|
10996 | })
|
10997 |
|
10998 | ([
|
10999 |
|
11000 | (function(module, exports, __webpack_require__) {
|
11001 |
|
11002 | 'use strict';
|
11003 |
|
11004 | exports.__esModule = true;
|
11005 | 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;
|
11006 |
|
11007 | var _base = __webpack_require__(1) ;
|
11008 |
|
11009 | var _base2 = _interopRequireDefault(_base);
|
11010 |
|
11011 | var _character = __webpack_require__(2) ;
|
11012 |
|
11013 | var _word = __webpack_require__(3) ;
|
11014 |
|
11015 | var _line = __webpack_require__(5) ;
|
11016 |
|
11017 | var _sentence = __webpack_require__(6) ;
|
11018 |
|
11019 | var _css = __webpack_require__(7) ;
|
11020 |
|
11021 | var _json = __webpack_require__(8) ;
|
11022 |
|
11023 | var _array = __webpack_require__(9) ;
|
11024 |
|
11025 | var _apply = __webpack_require__(10) ;
|
11026 |
|
11027 | var _parse = __webpack_require__(11) ;
|
11028 |
|
11029 | var _merge = __webpack_require__(13) ;
|
11030 |
|
11031 | var _create = __webpack_require__(14) ;
|
11032 |
|
11033 | var _dmp = __webpack_require__(16) ;
|
11034 |
|
11035 | var _xml = __webpack_require__(17) ;
|
11036 |
|
11037 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
11038 |
|
11039 |
|
11040 |
|
11041 | |
11042 |
|
11043 |
|
11044 |
|
11045 |
|
11046 |
|
11047 |
|
11048 |
|
11049 |
|
11050 |
|
11051 |
|
11052 |
|
11053 |
|
11054 |
|
11055 | exports. Diff = _base2['default'];
|
11056 | exports. diffChars = _character.diffChars;
|
11057 | exports. diffWords = _word.diffWords;
|
11058 | exports. diffWordsWithSpace = _word.diffWordsWithSpace;
|
11059 | exports. diffLines = _line.diffLines;
|
11060 | exports. diffTrimmedLines = _line.diffTrimmedLines;
|
11061 | exports. diffSentences = _sentence.diffSentences;
|
11062 | exports. diffCss = _css.diffCss;
|
11063 | exports. diffJson = _json.diffJson;
|
11064 | exports. diffArrays = _array.diffArrays;
|
11065 | exports. structuredPatch = _create.structuredPatch;
|
11066 | exports. createTwoFilesPatch = _create.createTwoFilesPatch;
|
11067 | exports. createPatch = _create.createPatch;
|
11068 | exports. applyPatch = _apply.applyPatch;
|
11069 | exports. applyPatches = _apply.applyPatches;
|
11070 | exports. parsePatch = _parse.parsePatch;
|
11071 | exports. merge = _merge.merge;
|
11072 | exports. convertChangesToDMP = _dmp.convertChangesToDMP;
|
11073 | exports. convertChangesToXML = _xml.convertChangesToXML;
|
11074 | exports. canonicalize = _json.canonicalize;
|
11075 |
|
11076 |
|
11077 |
|
11078 | }),
|
11079 |
|
11080 | (function(module, exports) {
|
11081 |
|
11082 | 'use strict';
|
11083 |
|
11084 | exports.__esModule = true;
|
11085 | exports['default'] = Diff;
|
11086 | function Diff() {}
|
11087 |
|
11088 | Diff.prototype = {
|
11089 | diff: function diff(oldString, newString) {
|
11090 | var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
11091 |
|
11092 | var callback = options.callback;
|
11093 | if (typeof options === 'function') {
|
11094 | callback = options;
|
11095 | options = {};
|
11096 | }
|
11097 | this.options = options;
|
11098 |
|
11099 | var self = this;
|
11100 |
|
11101 | function done(value) {
|
11102 | if (callback) {
|
11103 | setTimeout(function () {
|
11104 | callback(undefined, value);
|
11105 | }, 0);
|
11106 | return true;
|
11107 | } else {
|
11108 | return value;
|
11109 | }
|
11110 | }
|
11111 |
|
11112 |
|
11113 | oldString = this.castInput(oldString);
|
11114 | newString = this.castInput(newString);
|
11115 |
|
11116 | oldString = this.removeEmpty(this.tokenize(oldString));
|
11117 | newString = this.removeEmpty(this.tokenize(newString));
|
11118 |
|
11119 | var newLen = newString.length,
|
11120 | oldLen = oldString.length;
|
11121 | var editLength = 1;
|
11122 | var maxEditLength = newLen + oldLen;
|
11123 | var bestPath = [{ newPos: -1, components: [] }];
|
11124 |
|
11125 |
|
11126 | var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
|
11127 | if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
|
11128 |
|
11129 | return done([{ value: this.join(newString), count: newString.length }]);
|
11130 | }
|
11131 |
|
11132 |
|
11133 | function execEditLength() {
|
11134 | for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) {
|
11135 | var basePath = void 0 ;
|
11136 | var addPath = bestPath[diagonalPath - 1],
|
11137 | removePath = bestPath[diagonalPath + 1],
|
11138 | _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
|
11139 | if (addPath) {
|
11140 |
|
11141 | bestPath[diagonalPath - 1] = undefined;
|
11142 | }
|
11143 |
|
11144 | var canAdd = addPath && addPath.newPos + 1 < newLen,
|
11145 | canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen;
|
11146 | if (!canAdd && !canRemove) {
|
11147 |
|
11148 | bestPath[diagonalPath] = undefined;
|
11149 | continue;
|
11150 | }
|
11151 |
|
11152 |
|
11153 |
|
11154 |
|
11155 | if (!canAdd || canRemove && addPath.newPos < removePath.newPos) {
|
11156 | basePath = clonePath(removePath);
|
11157 | self.pushComponent(basePath.components, undefined, true);
|
11158 | } else {
|
11159 | basePath = addPath;
|
11160 | basePath.newPos++;
|
11161 | self.pushComponent(basePath.components, true, undefined);
|
11162 | }
|
11163 |
|
11164 | _oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath);
|
11165 |
|
11166 |
|
11167 | if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) {
|
11168 | return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken));
|
11169 | } else {
|
11170 |
|
11171 | bestPath[diagonalPath] = basePath;
|
11172 | }
|
11173 | }
|
11174 |
|
11175 | editLength++;
|
11176 | }
|
11177 |
|
11178 |
|
11179 |
|
11180 |
|
11181 | if (callback) {
|
11182 | (function exec() {
|
11183 | setTimeout(function () {
|
11184 |
|
11185 |
|
11186 | if (editLength > maxEditLength) {
|
11187 | return callback();
|
11188 | }
|
11189 |
|
11190 | if (!execEditLength()) {
|
11191 | exec();
|
11192 | }
|
11193 | }, 0);
|
11194 | })();
|
11195 | } else {
|
11196 | while (editLength <= maxEditLength) {
|
11197 | var ret = execEditLength();
|
11198 | if (ret) {
|
11199 | return ret;
|
11200 | }
|
11201 | }
|
11202 | }
|
11203 | },
|
11204 | pushComponent: function pushComponent(components, added, removed) {
|
11205 | var last = components[components.length - 1];
|
11206 | if (last && last.added === added && last.removed === removed) {
|
11207 |
|
11208 |
|
11209 | components[components.length - 1] = { count: last.count + 1, added: added, removed: removed };
|
11210 | } else {
|
11211 | components.push({ count: 1, added: added, removed: removed });
|
11212 | }
|
11213 | },
|
11214 | extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) {
|
11215 | var newLen = newString.length,
|
11216 | oldLen = oldString.length,
|
11217 | newPos = basePath.newPos,
|
11218 | oldPos = newPos - diagonalPath,
|
11219 | commonCount = 0;
|
11220 | while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
|
11221 | newPos++;
|
11222 | oldPos++;
|
11223 | commonCount++;
|
11224 | }
|
11225 |
|
11226 | if (commonCount) {
|
11227 | basePath.components.push({ count: commonCount });
|
11228 | }
|
11229 |
|
11230 | basePath.newPos = newPos;
|
11231 | return oldPos;
|
11232 | },
|
11233 | equals: function equals(left, right) {
|
11234 | if (this.options.comparator) {
|
11235 | return this.options.comparator(left, right);
|
11236 | } else {
|
11237 | return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase();
|
11238 | }
|
11239 | },
|
11240 | removeEmpty: function removeEmpty(array) {
|
11241 | var ret = [];
|
11242 | for (var i = 0; i < array.length; i++) {
|
11243 | if (array[i]) {
|
11244 | ret.push(array[i]);
|
11245 | }
|
11246 | }
|
11247 | return ret;
|
11248 | },
|
11249 | castInput: function castInput(value) {
|
11250 | return value;
|
11251 | },
|
11252 | tokenize: function tokenize(value) {
|
11253 | return value.split('');
|
11254 | },
|
11255 | join: function join(chars) {
|
11256 | return chars.join('');
|
11257 | }
|
11258 | };
|
11259 |
|
11260 | function buildValues(diff, components, newString, oldString, useLongestToken) {
|
11261 | var componentPos = 0,
|
11262 | componentLen = components.length,
|
11263 | newPos = 0,
|
11264 | oldPos = 0;
|
11265 |
|
11266 | for (; componentPos < componentLen; componentPos++) {
|
11267 | var component = components[componentPos];
|
11268 | if (!component.removed) {
|
11269 | if (!component.added && useLongestToken) {
|
11270 | var value = newString.slice(newPos, newPos + component.count);
|
11271 | value = value.map(function (value, i) {
|
11272 | var oldValue = oldString[oldPos + i];
|
11273 | return oldValue.length > value.length ? oldValue : value;
|
11274 | });
|
11275 |
|
11276 | component.value = diff.join(value);
|
11277 | } else {
|
11278 | component.value = diff.join(newString.slice(newPos, newPos + component.count));
|
11279 | }
|
11280 | newPos += component.count;
|
11281 |
|
11282 |
|
11283 | if (!component.added) {
|
11284 | oldPos += component.count;
|
11285 | }
|
11286 | } else {
|
11287 | component.value = diff.join(oldString.slice(oldPos, oldPos + component.count));
|
11288 | oldPos += component.count;
|
11289 |
|
11290 |
|
11291 |
|
11292 |
|
11293 | if (componentPos && components[componentPos - 1].added) {
|
11294 | var tmp = components[componentPos - 1];
|
11295 | components[componentPos - 1] = components[componentPos];
|
11296 | components[componentPos] = tmp;
|
11297 | }
|
11298 | }
|
11299 | }
|
11300 |
|
11301 |
|
11302 |
|
11303 |
|
11304 | var lastComponent = components[componentLen - 1];
|
11305 | if (componentLen > 1 && typeof lastComponent.value === 'string' && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) {
|
11306 | components[componentLen - 2].value += lastComponent.value;
|
11307 | components.pop();
|
11308 | }
|
11309 |
|
11310 | return components;
|
11311 | }
|
11312 |
|
11313 | function clonePath(path) {
|
11314 | return { newPos: path.newPos, components: path.components.slice(0) };
|
11315 | }
|
11316 |
|
11317 |
|
11318 |
|
11319 | }),
|
11320 |
|
11321 | (function(module, exports, __webpack_require__) {
|
11322 |
|
11323 | 'use strict';
|
11324 |
|
11325 | exports.__esModule = true;
|
11326 | exports.characterDiff = undefined;
|
11327 | exports. diffChars = diffChars;
|
11328 |
|
11329 | var _base = __webpack_require__(1) ;
|
11330 |
|
11331 | var _base2 = _interopRequireDefault(_base);
|
11332 |
|
11333 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
11334 |
|
11335 | var characterDiff = exports. characterDiff = new _base2['default'] ();
|
11336 | function diffChars(oldStr, newStr, options) {
|
11337 | return characterDiff.diff(oldStr, newStr, options);
|
11338 | }
|
11339 |
|
11340 |
|
11341 |
|
11342 | }),
|
11343 |
|
11344 | (function(module, exports, __webpack_require__) {
|
11345 |
|
11346 | 'use strict';
|
11347 |
|
11348 | exports.__esModule = true;
|
11349 | exports.wordDiff = undefined;
|
11350 | exports. diffWords = diffWords;
|
11351 | exports. diffWordsWithSpace = diffWordsWithSpace;
|
11352 |
|
11353 | var _base = __webpack_require__(1) ;
|
11354 |
|
11355 | var _base2 = _interopRequireDefault(_base);
|
11356 |
|
11357 | var _params = __webpack_require__(4) ;
|
11358 |
|
11359 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
11360 |
|
11361 |
|
11362 |
|
11363 |
|
11364 |
|
11365 |
|
11366 |
|
11367 |
|
11368 |
|
11369 |
|
11370 |
|
11371 |
|
11372 |
|
11373 |
|
11374 |
|
11375 |
|
11376 |
|
11377 |
|
11378 |
|
11379 | var extendedWordChars = /^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/;
|
11380 |
|
11381 | var reWhitespace = /\S/;
|
11382 |
|
11383 | var wordDiff = exports. wordDiff = new _base2['default'] ();
|
11384 | wordDiff.equals = function (left, right) {
|
11385 | if (this.options.ignoreCase) {
|
11386 | left = left.toLowerCase();
|
11387 | right = right.toLowerCase();
|
11388 | }
|
11389 | return left === right || this.options.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right);
|
11390 | };
|
11391 | wordDiff.tokenize = function (value) {
|
11392 | var tokens = value.split(/(\s+|\b)/);
|
11393 |
|
11394 |
|
11395 | for (var i = 0; i < tokens.length - 1; i++) {
|
11396 |
|
11397 | if (!tokens[i + 1] && tokens[i + 2] && extendedWordChars.test(tokens[i]) && extendedWordChars.test(tokens[i + 2])) {
|
11398 | tokens[i] += tokens[i + 2];
|
11399 | tokens.splice(i + 1, 2);
|
11400 | i--;
|
11401 | }
|
11402 | }
|
11403 |
|
11404 | return tokens;
|
11405 | };
|
11406 |
|
11407 | function diffWords(oldStr, newStr, options) {
|
11408 | options = (0, _params.generateOptions) (options, { ignoreWhitespace: true });
|
11409 | return wordDiff.diff(oldStr, newStr, options);
|
11410 | }
|
11411 |
|
11412 | function diffWordsWithSpace(oldStr, newStr, options) {
|
11413 | return wordDiff.diff(oldStr, newStr, options);
|
11414 | }
|
11415 |
|
11416 |
|
11417 |
|
11418 | }),
|
11419 |
|
11420 | (function(module, exports) {
|
11421 |
|
11422 | 'use strict';
|
11423 |
|
11424 | exports.__esModule = true;
|
11425 | exports. generateOptions = generateOptions;
|
11426 | function generateOptions(options, defaults) {
|
11427 | if (typeof options === 'function') {
|
11428 | defaults.callback = options;
|
11429 | } else if (options) {
|
11430 | for (var name in options) {
|
11431 |
|
11432 | if (options.hasOwnProperty(name)) {
|
11433 | defaults[name] = options[name];
|
11434 | }
|
11435 | }
|
11436 | }
|
11437 | return defaults;
|
11438 | }
|
11439 |
|
11440 |
|
11441 |
|
11442 | }),
|
11443 |
|
11444 | (function(module, exports, __webpack_require__) {
|
11445 |
|
11446 | 'use strict';
|
11447 |
|
11448 | exports.__esModule = true;
|
11449 | exports.lineDiff = undefined;
|
11450 | exports. diffLines = diffLines;
|
11451 | exports. diffTrimmedLines = diffTrimmedLines;
|
11452 |
|
11453 | var _base = __webpack_require__(1) ;
|
11454 |
|
11455 | var _base2 = _interopRequireDefault(_base);
|
11456 |
|
11457 | var _params = __webpack_require__(4) ;
|
11458 |
|
11459 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
11460 |
|
11461 | var lineDiff = exports. lineDiff = new _base2['default'] ();
|
11462 | lineDiff.tokenize = function (value) {
|
11463 | var retLines = [],
|
11464 | linesAndNewlines = value.split(/(\n|\r\n)/);
|
11465 |
|
11466 |
|
11467 | if (!linesAndNewlines[linesAndNewlines.length - 1]) {
|
11468 | linesAndNewlines.pop();
|
11469 | }
|
11470 |
|
11471 |
|
11472 | for (var i = 0; i < linesAndNewlines.length; i++) {
|
11473 | var line = linesAndNewlines[i];
|
11474 |
|
11475 | if (i % 2 && !this.options.newlineIsToken) {
|
11476 | retLines[retLines.length - 1] += line;
|
11477 | } else {
|
11478 | if (this.options.ignoreWhitespace) {
|
11479 | line = line.trim();
|
11480 | }
|
11481 | retLines.push(line);
|
11482 | }
|
11483 | }
|
11484 |
|
11485 | return retLines;
|
11486 | };
|
11487 |
|
11488 | function diffLines(oldStr, newStr, callback) {
|
11489 | return lineDiff.diff(oldStr, newStr, callback);
|
11490 | }
|
11491 | function diffTrimmedLines(oldStr, newStr, callback) {
|
11492 | var options = (0, _params.generateOptions) (callback, { ignoreWhitespace: true });
|
11493 | return lineDiff.diff(oldStr, newStr, options);
|
11494 | }
|
11495 |
|
11496 |
|
11497 |
|
11498 | }),
|
11499 |
|
11500 | (function(module, exports, __webpack_require__) {
|
11501 |
|
11502 | 'use strict';
|
11503 |
|
11504 | exports.__esModule = true;
|
11505 | exports.sentenceDiff = undefined;
|
11506 | exports. diffSentences = diffSentences;
|
11507 |
|
11508 | var _base = __webpack_require__(1) ;
|
11509 |
|
11510 | var _base2 = _interopRequireDefault(_base);
|
11511 |
|
11512 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
11513 |
|
11514 | var sentenceDiff = exports. sentenceDiff = new _base2['default'] ();
|
11515 | sentenceDiff.tokenize = function (value) {
|
11516 | return value.split(/(\S.+?[.!?])(?=\s+|$)/);
|
11517 | };
|
11518 |
|
11519 | function diffSentences(oldStr, newStr, callback) {
|
11520 | return sentenceDiff.diff(oldStr, newStr, callback);
|
11521 | }
|
11522 |
|
11523 |
|
11524 |
|
11525 | }),
|
11526 |
|
11527 | (function(module, exports, __webpack_require__) {
|
11528 |
|
11529 | 'use strict';
|
11530 |
|
11531 | exports.__esModule = true;
|
11532 | exports.cssDiff = undefined;
|
11533 | exports. diffCss = diffCss;
|
11534 |
|
11535 | var _base = __webpack_require__(1) ;
|
11536 |
|
11537 | var _base2 = _interopRequireDefault(_base);
|
11538 |
|
11539 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
11540 |
|
11541 | var cssDiff = exports. cssDiff = new _base2['default'] ();
|
11542 | cssDiff.tokenize = function (value) {
|
11543 | return value.split(/([{}:;,]|\s+)/);
|
11544 | };
|
11545 |
|
11546 | function diffCss(oldStr, newStr, callback) {
|
11547 | return cssDiff.diff(oldStr, newStr, callback);
|
11548 | }
|
11549 |
|
11550 |
|
11551 |
|
11552 | }),
|
11553 |
|
11554 | (function(module, exports, __webpack_require__) {
|
11555 |
|
11556 | 'use strict';
|
11557 |
|
11558 | exports.__esModule = true;
|
11559 | exports.jsonDiff = undefined;
|
11560 |
|
11561 | 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; };
|
11562 |
|
11563 | exports. diffJson = diffJson;
|
11564 | exports. canonicalize = canonicalize;
|
11565 |
|
11566 | var _base = __webpack_require__(1) ;
|
11567 |
|
11568 | var _base2 = _interopRequireDefault(_base);
|
11569 |
|
11570 | var _line = __webpack_require__(5) ;
|
11571 |
|
11572 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
11573 |
|
11574 | var objectPrototypeToString = Object.prototype.toString;
|
11575 |
|
11576 | var jsonDiff = exports. jsonDiff = new _base2['default'] ();
|
11577 |
|
11578 |
|
11579 | jsonDiff.useLongestToken = true;
|
11580 |
|
11581 | jsonDiff.tokenize = _line.lineDiff .tokenize;
|
11582 | jsonDiff.castInput = function (value) {
|
11583 | var _options = this.options,
|
11584 | undefinedReplacement = _options.undefinedReplacement,
|
11585 | _options$stringifyRep = _options.stringifyReplacer,
|
11586 | stringifyReplacer = _options$stringifyRep === undefined ? function (k, v) /*istanbul ignore start*/{
|
11587 | return (typeof v === 'undefined' ? undefinedReplacement : v
|
11588 | );
|
11589 | } : _options$stringifyRep;
|
11590 |
|
11591 |
|
11592 | return typeof value === 'string' ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, ' ');
|
11593 | };
|
11594 | jsonDiff.equals = function (left, right) {
|
11595 | return (_base2['default'] .prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1'))
|
11596 | );
|
11597 | };
|
11598 |
|
11599 | function diffJson(oldObj, newObj, options) {
|
11600 | return jsonDiff.diff(oldObj, newObj, options);
|
11601 | }
|
11602 |
|
11603 |
|
11604 |
|
11605 | function canonicalize(obj, stack, replacementStack, replacer, key) {
|
11606 | stack = stack || [];
|
11607 | replacementStack = replacementStack || [];
|
11608 |
|
11609 | if (replacer) {
|
11610 | obj = replacer(key, obj);
|
11611 | }
|
11612 |
|
11613 | var i = void 0 ;
|
11614 |
|
11615 | for (i = 0; i < stack.length; i += 1) {
|
11616 | if (stack[i] === obj) {
|
11617 | return replacementStack[i];
|
11618 | }
|
11619 | }
|
11620 |
|
11621 | var canonicalizedObj = void 0 ;
|
11622 |
|
11623 | if ('[object Array]' === objectPrototypeToString.call(obj)) {
|
11624 | stack.push(obj);
|
11625 | canonicalizedObj = new Array(obj.length);
|
11626 | replacementStack.push(canonicalizedObj);
|
11627 | for (i = 0; i < obj.length; i += 1) {
|
11628 | canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, key);
|
11629 | }
|
11630 | stack.pop();
|
11631 | replacementStack.pop();
|
11632 | return canonicalizedObj;
|
11633 | }
|
11634 |
|
11635 | if (obj && obj.toJSON) {
|
11636 | obj = obj.toJSON();
|
11637 | }
|
11638 |
|
11639 | if ( (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object' && obj !== null) {
|
11640 | stack.push(obj);
|
11641 | canonicalizedObj = {};
|
11642 | replacementStack.push(canonicalizedObj);
|
11643 | var sortedKeys = [],
|
11644 | _key = void 0 ;
|
11645 | for (_key in obj) {
|
11646 |
|
11647 | if (obj.hasOwnProperty(_key)) {
|
11648 | sortedKeys.push(_key);
|
11649 | }
|
11650 | }
|
11651 | sortedKeys.sort();
|
11652 | for (i = 0; i < sortedKeys.length; i += 1) {
|
11653 | _key = sortedKeys[i];
|
11654 | canonicalizedObj[_key] = canonicalize(obj[_key], stack, replacementStack, replacer, _key);
|
11655 | }
|
11656 | stack.pop();
|
11657 | replacementStack.pop();
|
11658 | } else {
|
11659 | canonicalizedObj = obj;
|
11660 | }
|
11661 | return canonicalizedObj;
|
11662 | }
|
11663 |
|
11664 |
|
11665 |
|
11666 | }),
|
11667 |
|
11668 | (function(module, exports, __webpack_require__) {
|
11669 |
|
11670 | 'use strict';
|
11671 |
|
11672 | exports.__esModule = true;
|
11673 | exports.arrayDiff = undefined;
|
11674 | exports. diffArrays = diffArrays;
|
11675 |
|
11676 | var _base = __webpack_require__(1) ;
|
11677 |
|
11678 | var _base2 = _interopRequireDefault(_base);
|
11679 |
|
11680 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
11681 |
|
11682 | var arrayDiff = exports. arrayDiff = new _base2['default'] ();
|
11683 | arrayDiff.tokenize = function (value) {
|
11684 | return value.slice();
|
11685 | };
|
11686 | arrayDiff.join = arrayDiff.removeEmpty = function (value) {
|
11687 | return value;
|
11688 | };
|
11689 |
|
11690 | function diffArrays(oldArr, newArr, callback) {
|
11691 | return arrayDiff.diff(oldArr, newArr, callback);
|
11692 | }
|
11693 |
|
11694 |
|
11695 |
|
11696 | }),
|
11697 |
|
11698 | (function(module, exports, __webpack_require__) {
|
11699 |
|
11700 | 'use strict';
|
11701 |
|
11702 | exports.__esModule = true;
|
11703 | exports. applyPatch = applyPatch;
|
11704 | exports. applyPatches = applyPatches;
|
11705 |
|
11706 | var _parse = __webpack_require__(11) ;
|
11707 |
|
11708 | var _distanceIterator = __webpack_require__(12) ;
|
11709 |
|
11710 | var _distanceIterator2 = _interopRequireDefault(_distanceIterator);
|
11711 |
|
11712 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
11713 |
|
11714 | function applyPatch(source, uniDiff) {
|
11715 | var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
11716 |
|
11717 | if (typeof uniDiff === 'string') {
|
11718 | uniDiff = (0, _parse.parsePatch) (uniDiff);
|
11719 | }
|
11720 |
|
11721 | if (Array.isArray(uniDiff)) {
|
11722 | if (uniDiff.length > 1) {
|
11723 | throw new Error('applyPatch only works with a single input.');
|
11724 | }
|
11725 |
|
11726 | uniDiff = uniDiff[0];
|
11727 | }
|
11728 |
|
11729 |
|
11730 | var lines = source.split(/\r\n|[\n\v\f\r\x85]/),
|
11731 | delimiters = source.match(/\r\n|[\n\v\f\r\x85]/g) || [],
|
11732 | hunks = uniDiff.hunks,
|
11733 | compareLine = options.compareLine || function (lineNumber, line, operation, patchContent) /*istanbul ignore start*/{
|
11734 | return (line === patchContent
|
11735 | );
|
11736 | },
|
11737 | errorCount = 0,
|
11738 | fuzzFactor = options.fuzzFactor || 0,
|
11739 | minLine = 0,
|
11740 | offset = 0,
|
11741 | removeEOFNL = void 0 ,
|
11742 | addEOFNL = void 0 ;
|
11743 |
|
11744 | |
11745 |
|
11746 |
|
11747 | function hunkFits(hunk, toPos) {
|
11748 | for (var j = 0; j < hunk.lines.length; j++) {
|
11749 | var line = hunk.lines[j],
|
11750 | operation = line.length > 0 ? line[0] : ' ',
|
11751 | content = line.length > 0 ? line.substr(1) : line;
|
11752 |
|
11753 | if (operation === ' ' || operation === '-') {
|
11754 |
|
11755 | if (!compareLine(toPos + 1, lines[toPos], operation, content)) {
|
11756 | errorCount++;
|
11757 |
|
11758 | if (errorCount > fuzzFactor) {
|
11759 | return false;
|
11760 | }
|
11761 | }
|
11762 | toPos++;
|
11763 | }
|
11764 | }
|
11765 |
|
11766 | return true;
|
11767 | }
|
11768 |
|
11769 |
|
11770 | for (var i = 0; i < hunks.length; i++) {
|
11771 | var hunk = hunks[i],
|
11772 | maxLine = lines.length - hunk.oldLines,
|
11773 | localOffset = 0,
|
11774 | toPos = offset + hunk.oldStart - 1;
|
11775 |
|
11776 | var iterator = (0, _distanceIterator2['default']) (toPos, minLine, maxLine);
|
11777 |
|
11778 | for (; localOffset !== undefined; localOffset = iterator()) {
|
11779 | if (hunkFits(hunk, toPos + localOffset)) {
|
11780 | hunk.offset = offset += localOffset;
|
11781 | break;
|
11782 | }
|
11783 | }
|
11784 |
|
11785 | if (localOffset === undefined) {
|
11786 | return false;
|
11787 | }
|
11788 |
|
11789 |
|
11790 |
|
11791 | minLine = hunk.offset + hunk.oldStart + hunk.oldLines;
|
11792 | }
|
11793 |
|
11794 |
|
11795 | var diffOffset = 0;
|
11796 | for (var _i = 0; _i < hunks.length; _i++) {
|
11797 | var _hunk = hunks[_i],
|
11798 | _toPos = _hunk.oldStart + _hunk.offset + diffOffset - 1;
|
11799 | diffOffset += _hunk.newLines - _hunk.oldLines;
|
11800 |
|
11801 | if (_toPos < 0) {
|
11802 |
|
11803 | _toPos = 0;
|
11804 | }
|
11805 |
|
11806 | for (var j = 0; j < _hunk.lines.length; j++) {
|
11807 | var line = _hunk.lines[j],
|
11808 | operation = line.length > 0 ? line[0] : ' ',
|
11809 | content = line.length > 0 ? line.substr(1) : line,
|
11810 | delimiter = _hunk.linedelimiters[j];
|
11811 |
|
11812 | if (operation === ' ') {
|
11813 | _toPos++;
|
11814 | } else if (operation === '-') {
|
11815 | lines.splice(_toPos, 1);
|
11816 | delimiters.splice(_toPos, 1);
|
11817 |
|
11818 | } else if (operation === '+') {
|
11819 | lines.splice(_toPos, 0, content);
|
11820 | delimiters.splice(_toPos, 0, delimiter);
|
11821 | _toPos++;
|
11822 | } else if (operation === '\\') {
|
11823 | var previousOperation = _hunk.lines[j - 1] ? _hunk.lines[j - 1][0] : null;
|
11824 | if (previousOperation === '+') {
|
11825 | removeEOFNL = true;
|
11826 | } else if (previousOperation === '-') {
|
11827 | addEOFNL = true;
|
11828 | }
|
11829 | }
|
11830 | }
|
11831 | }
|
11832 |
|
11833 |
|
11834 | if (removeEOFNL) {
|
11835 | while (!lines[lines.length - 1]) {
|
11836 | lines.pop();
|
11837 | delimiters.pop();
|
11838 | }
|
11839 | } else if (addEOFNL) {
|
11840 | lines.push('');
|
11841 | delimiters.push('\n');
|
11842 | }
|
11843 | for (var _k = 0; _k < lines.length - 1; _k++) {
|
11844 | lines[_k] = lines[_k] + delimiters[_k];
|
11845 | }
|
11846 | return lines.join('');
|
11847 | }
|
11848 |
|
11849 |
|
11850 | function applyPatches(uniDiff, options) {
|
11851 | if (typeof uniDiff === 'string') {
|
11852 | uniDiff = (0, _parse.parsePatch) (uniDiff);
|
11853 | }
|
11854 |
|
11855 | var currentIndex = 0;
|
11856 | function processIndex() {
|
11857 | var index = uniDiff[currentIndex++];
|
11858 | if (!index) {
|
11859 | return options.complete();
|
11860 | }
|
11861 |
|
11862 | options.loadFile(index, function (err, data) {
|
11863 | if (err) {
|
11864 | return options.complete(err);
|
11865 | }
|
11866 |
|
11867 | var updatedContent = applyPatch(data, index, options);
|
11868 | options.patched(index, updatedContent, function (err) {
|
11869 | if (err) {
|
11870 | return options.complete(err);
|
11871 | }
|
11872 |
|
11873 | processIndex();
|
11874 | });
|
11875 | });
|
11876 | }
|
11877 | processIndex();
|
11878 | }
|
11879 |
|
11880 |
|
11881 |
|
11882 | }),
|
11883 |
|
11884 | (function(module, exports) {
|
11885 |
|
11886 | 'use strict';
|
11887 |
|
11888 | exports.__esModule = true;
|
11889 | exports. parsePatch = parsePatch;
|
11890 | function parsePatch(uniDiff) {
|
11891 | var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
11892 |
|
11893 | var diffstr = uniDiff.split(/\r\n|[\n\v\f\r\x85]/),
|
11894 | delimiters = uniDiff.match(/\r\n|[\n\v\f\r\x85]/g) || [],
|
11895 | list = [],
|
11896 | i = 0;
|
11897 |
|
11898 | function parseIndex() {
|
11899 | var index = {};
|
11900 | list.push(index);
|
11901 |
|
11902 |
|
11903 | while (i < diffstr.length) {
|
11904 | var line = diffstr[i];
|
11905 |
|
11906 |
|
11907 | if (/^(\-\-\-|\+\+\+|@@)\s/.test(line)) {
|
11908 | break;
|
11909 | }
|
11910 |
|
11911 |
|
11912 | var header = /^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(line);
|
11913 | if (header) {
|
11914 | index.index = header[1];
|
11915 | }
|
11916 |
|
11917 | i++;
|
11918 | }
|
11919 |
|
11920 |
|
11921 |
|
11922 | parseFileHeader(index);
|
11923 | parseFileHeader(index);
|
11924 |
|
11925 |
|
11926 | index.hunks = [];
|
11927 |
|
11928 | while (i < diffstr.length) {
|
11929 | var _line = diffstr[i];
|
11930 |
|
11931 | if (/^(Index:|diff|\-\-\-|\+\+\+)\s/.test(_line)) {
|
11932 | break;
|
11933 | } else if (/^@@/.test(_line)) {
|
11934 | index.hunks.push(parseHunk());
|
11935 | } else if (_line && options.strict) {
|
11936 |
|
11937 | throw new Error('Unknown line ' + (i + 1) + ' ' + JSON.stringify(_line));
|
11938 | } else {
|
11939 | i++;
|
11940 | }
|
11941 | }
|
11942 | }
|
11943 |
|
11944 |
|
11945 |
|
11946 | function parseFileHeader(index) {
|
11947 | var fileHeader = /^(---|\+\+\+)\s+(.*)$/.exec(diffstr[i]);
|
11948 | if (fileHeader) {
|
11949 | var keyPrefix = fileHeader[1] === '---' ? 'old' : 'new';
|
11950 | var data = fileHeader[2].split('\t', 2);
|
11951 | var fileName = data[0].replace(/\\\\/g, '\\');
|
11952 | if (/^".*"$/.test(fileName)) {
|
11953 | fileName = fileName.substr(1, fileName.length - 2);
|
11954 | }
|
11955 | index[keyPrefix + 'FileName'] = fileName;
|
11956 | index[keyPrefix + 'Header'] = (data[1] || '').trim();
|
11957 |
|
11958 | i++;
|
11959 | }
|
11960 | }
|
11961 |
|
11962 |
|
11963 |
|
11964 | function parseHunk() {
|
11965 | var chunkHeaderIndex = i,
|
11966 | chunkHeaderLine = diffstr[i++],
|
11967 | chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);
|
11968 |
|
11969 | var hunk = {
|
11970 | oldStart: +chunkHeader[1],
|
11971 | oldLines: +chunkHeader[2] || 1,
|
11972 | newStart: +chunkHeader[3],
|
11973 | newLines: +chunkHeader[4] || 1,
|
11974 | lines: [],
|
11975 | linedelimiters: []
|
11976 | };
|
11977 |
|
11978 | var addCount = 0,
|
11979 | removeCount = 0;
|
11980 | for (; i < diffstr.length; i++) {
|
11981 |
|
11982 |
|
11983 | if (diffstr[i].indexOf('--- ') === 0 && i + 2 < diffstr.length && diffstr[i + 1].indexOf('+++ ') === 0 && diffstr[i + 2].indexOf('@@') === 0) {
|
11984 | break;
|
11985 | }
|
11986 | var operation = diffstr[i].length == 0 && i != diffstr.length - 1 ? ' ' : diffstr[i][0];
|
11987 |
|
11988 | if (operation === '+' || operation === '-' || operation === ' ' || operation === '\\') {
|
11989 | hunk.lines.push(diffstr[i]);
|
11990 | hunk.linedelimiters.push(delimiters[i] || '\n');
|
11991 |
|
11992 | if (operation === '+') {
|
11993 | addCount++;
|
11994 | } else if (operation === '-') {
|
11995 | removeCount++;
|
11996 | } else if (operation === ' ') {
|
11997 | addCount++;
|
11998 | removeCount++;
|
11999 | }
|
12000 | } else {
|
12001 | break;
|
12002 | }
|
12003 | }
|
12004 |
|
12005 |
|
12006 | if (!addCount && hunk.newLines === 1) {
|
12007 | hunk.newLines = 0;
|
12008 | }
|
12009 | if (!removeCount && hunk.oldLines === 1) {
|
12010 | hunk.oldLines = 0;
|
12011 | }
|
12012 |
|
12013 |
|
12014 | if (options.strict) {
|
12015 | if (addCount !== hunk.newLines) {
|
12016 | throw new Error('Added line count did not match for hunk at line ' + (chunkHeaderIndex + 1));
|
12017 | }
|
12018 | if (removeCount !== hunk.oldLines) {
|
12019 | throw new Error('Removed line count did not match for hunk at line ' + (chunkHeaderIndex + 1));
|
12020 | }
|
12021 | }
|
12022 |
|
12023 | return hunk;
|
12024 | }
|
12025 |
|
12026 | while (i < diffstr.length) {
|
12027 | parseIndex();
|
12028 | }
|
12029 |
|
12030 | return list;
|
12031 | }
|
12032 |
|
12033 |
|
12034 |
|
12035 | }),
|
12036 |
|
12037 | (function(module, exports) {
|
12038 |
|
12039 | "use strict";
|
12040 |
|
12041 | exports.__esModule = true;
|
12042 |
|
12043 | exports["default"] = function (start, minLine, maxLine) {
|
12044 | var wantForward = true,
|
12045 | backwardExhausted = false,
|
12046 | forwardExhausted = false,
|
12047 | localOffset = 1;
|
12048 |
|
12049 | return function iterator() {
|
12050 | if (wantForward && !forwardExhausted) {
|
12051 | if (backwardExhausted) {
|
12052 | localOffset++;
|
12053 | } else {
|
12054 | wantForward = false;
|
12055 | }
|
12056 |
|
12057 |
|
12058 |
|
12059 | if (start + localOffset <= maxLine) {
|
12060 | return localOffset;
|
12061 | }
|
12062 |
|
12063 | forwardExhausted = true;
|
12064 | }
|
12065 |
|
12066 | if (!backwardExhausted) {
|
12067 | if (!forwardExhausted) {
|
12068 | wantForward = true;
|
12069 | }
|
12070 |
|
12071 |
|
12072 |
|
12073 | if (minLine <= start - localOffset) {
|
12074 | return -localOffset++;
|
12075 | }
|
12076 |
|
12077 | backwardExhausted = true;
|
12078 | return iterator();
|
12079 | }
|
12080 |
|
12081 |
|
12082 |
|
12083 | };
|
12084 | };
|
12085 |
|
12086 |
|
12087 |
|
12088 | }),
|
12089 |
|
12090 | (function(module, exports, __webpack_require__) {
|
12091 |
|
12092 | 'use strict';
|
12093 |
|
12094 | exports.__esModule = true;
|
12095 | exports. calcLineCount = calcLineCount;
|
12096 | exports. merge = merge;
|
12097 |
|
12098 | var _create = __webpack_require__(14) ;
|
12099 |
|
12100 | var _parse = __webpack_require__(11) ;
|
12101 |
|
12102 | var _array = __webpack_require__(15) ;
|
12103 |
|
12104 | 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); } }
|
12105 |
|
12106 | function calcLineCount(hunk) {
|
12107 | var _calcOldNewLineCount = calcOldNewLineCount(hunk.lines),
|
12108 | oldLines = _calcOldNewLineCount.oldLines,
|
12109 | newLines = _calcOldNewLineCount.newLines;
|
12110 |
|
12111 | if (oldLines !== undefined) {
|
12112 | hunk.oldLines = oldLines;
|
12113 | } else {
|
12114 | delete hunk.oldLines;
|
12115 | }
|
12116 |
|
12117 | if (newLines !== undefined) {
|
12118 | hunk.newLines = newLines;
|
12119 | } else {
|
12120 | delete hunk.newLines;
|
12121 | }
|
12122 | }
|
12123 |
|
12124 | function merge(mine, theirs, base) {
|
12125 | mine = loadPatch(mine, base);
|
12126 | theirs = loadPatch(theirs, base);
|
12127 |
|
12128 | var ret = {};
|
12129 |
|
12130 |
|
12131 |
|
12132 |
|
12133 | if (mine.index || theirs.index) {
|
12134 | ret.index = mine.index || theirs.index;
|
12135 | }
|
12136 |
|
12137 | if (mine.newFileName || theirs.newFileName) {
|
12138 | if (!fileNameChanged(mine)) {
|
12139 |
|
12140 | ret.oldFileName = theirs.oldFileName || mine.oldFileName;
|
12141 | ret.newFileName = theirs.newFileName || mine.newFileName;
|
12142 | ret.oldHeader = theirs.oldHeader || mine.oldHeader;
|
12143 | ret.newHeader = theirs.newHeader || mine.newHeader;
|
12144 | } else if (!fileNameChanged(theirs)) {
|
12145 |
|
12146 | ret.oldFileName = mine.oldFileName;
|
12147 | ret.newFileName = mine.newFileName;
|
12148 | ret.oldHeader = mine.oldHeader;
|
12149 | ret.newHeader = mine.newHeader;
|
12150 | } else {
|
12151 |
|
12152 | ret.oldFileName = selectField(ret, mine.oldFileName, theirs.oldFileName);
|
12153 | ret.newFileName = selectField(ret, mine.newFileName, theirs.newFileName);
|
12154 | ret.oldHeader = selectField(ret, mine.oldHeader, theirs.oldHeader);
|
12155 | ret.newHeader = selectField(ret, mine.newHeader, theirs.newHeader);
|
12156 | }
|
12157 | }
|
12158 |
|
12159 | ret.hunks = [];
|
12160 |
|
12161 | var mineIndex = 0,
|
12162 | theirsIndex = 0,
|
12163 | mineOffset = 0,
|
12164 | theirsOffset = 0;
|
12165 |
|
12166 | while (mineIndex < mine.hunks.length || theirsIndex < theirs.hunks.length) {
|
12167 | var mineCurrent = mine.hunks[mineIndex] || { oldStart: Infinity },
|
12168 | theirsCurrent = theirs.hunks[theirsIndex] || { oldStart: Infinity };
|
12169 |
|
12170 | if (hunkBefore(mineCurrent, theirsCurrent)) {
|
12171 |
|
12172 | ret.hunks.push(cloneHunk(mineCurrent, mineOffset));
|
12173 | mineIndex++;
|
12174 | theirsOffset += mineCurrent.newLines - mineCurrent.oldLines;
|
12175 | } else if (hunkBefore(theirsCurrent, mineCurrent)) {
|
12176 |
|
12177 | ret.hunks.push(cloneHunk(theirsCurrent, theirsOffset));
|
12178 | theirsIndex++;
|
12179 | mineOffset += theirsCurrent.newLines - theirsCurrent.oldLines;
|
12180 | } else {
|
12181 |
|
12182 | var mergedHunk = {
|
12183 | oldStart: Math.min(mineCurrent.oldStart, theirsCurrent.oldStart),
|
12184 | oldLines: 0,
|
12185 | newStart: Math.min(mineCurrent.newStart + mineOffset, theirsCurrent.oldStart + theirsOffset),
|
12186 | newLines: 0,
|
12187 | lines: []
|
12188 | };
|
12189 | mergeLines(mergedHunk, mineCurrent.oldStart, mineCurrent.lines, theirsCurrent.oldStart, theirsCurrent.lines);
|
12190 | theirsIndex++;
|
12191 | mineIndex++;
|
12192 |
|
12193 | ret.hunks.push(mergedHunk);
|
12194 | }
|
12195 | }
|
12196 |
|
12197 | return ret;
|
12198 | }
|
12199 |
|
12200 | function loadPatch(param, base) {
|
12201 | if (typeof param === 'string') {
|
12202 | if (/^@@/m.test(param) || /^Index:/m.test(param)) {
|
12203 | return ((0, _parse.parsePatch) (param)[0]
|
12204 | );
|
12205 | }
|
12206 |
|
12207 | if (!base) {
|
12208 | throw new Error('Must provide a base reference or pass in a patch');
|
12209 | }
|
12210 | return ((0, _create.structuredPatch) (undefined, undefined, base, param)
|
12211 | );
|
12212 | }
|
12213 |
|
12214 | return param;
|
12215 | }
|
12216 |
|
12217 | function fileNameChanged(patch) {
|
12218 | return patch.newFileName && patch.newFileName !== patch.oldFileName;
|
12219 | }
|
12220 |
|
12221 | function selectField(index, mine, theirs) {
|
12222 | if (mine === theirs) {
|
12223 | return mine;
|
12224 | } else {
|
12225 | index.conflict = true;
|
12226 | return { mine: mine, theirs: theirs };
|
12227 | }
|
12228 | }
|
12229 |
|
12230 | function hunkBefore(test, check) {
|
12231 | return test.oldStart < check.oldStart && test.oldStart + test.oldLines < check.oldStart;
|
12232 | }
|
12233 |
|
12234 | function cloneHunk(hunk, offset) {
|
12235 | return {
|
12236 | oldStart: hunk.oldStart, oldLines: hunk.oldLines,
|
12237 | newStart: hunk.newStart + offset, newLines: hunk.newLines,
|
12238 | lines: hunk.lines
|
12239 | };
|
12240 | }
|
12241 |
|
12242 | function mergeLines(hunk, mineOffset, mineLines, theirOffset, theirLines) {
|
12243 |
|
12244 |
|
12245 | var mine = { offset: mineOffset, lines: mineLines, index: 0 },
|
12246 | their = { offset: theirOffset, lines: theirLines, index: 0 };
|
12247 |
|
12248 |
|
12249 | insertLeading(hunk, mine, their);
|
12250 | insertLeading(hunk, their, mine);
|
12251 |
|
12252 |
|
12253 | while (mine.index < mine.lines.length && their.index < their.lines.length) {
|
12254 | var mineCurrent = mine.lines[mine.index],
|
12255 | theirCurrent = their.lines[their.index];
|
12256 |
|
12257 | if ((mineCurrent[0] === '-' || mineCurrent[0] === '+') && (theirCurrent[0] === '-' || theirCurrent[0] === '+')) {
|
12258 |
|
12259 | mutualChange(hunk, mine, their);
|
12260 | } else if (mineCurrent[0] === '+' && theirCurrent[0] === ' ') {
|
12261 | var _hunk$lines;
|
12262 |
|
12263 |
|
12264 | (_hunk$lines = hunk.lines).push. apply ( _hunk$lines , _toConsumableArray( collectChange(mine)));
|
12265 | } else if (theirCurrent[0] === '+' && mineCurrent[0] === ' ') {
|
12266 | var _hunk$lines2;
|
12267 |
|
12268 |
|
12269 | (_hunk$lines2 = hunk.lines).push. apply ( _hunk$lines2 , _toConsumableArray( collectChange(their)));
|
12270 | } else if (mineCurrent[0] === '-' && theirCurrent[0] === ' ') {
|
12271 |
|
12272 | removal(hunk, mine, their);
|
12273 | } else if (theirCurrent[0] === '-' && mineCurrent[0] === ' ') {
|
12274 |
|
12275 | removal(hunk, their, mine, true);
|
12276 | } else if (mineCurrent === theirCurrent) {
|
12277 |
|
12278 | hunk.lines.push(mineCurrent);
|
12279 | mine.index++;
|
12280 | their.index++;
|
12281 | } else {
|
12282 |
|
12283 | conflict(hunk, collectChange(mine), collectChange(their));
|
12284 | }
|
12285 | }
|
12286 |
|
12287 |
|
12288 | insertTrailing(hunk, mine);
|
12289 | insertTrailing(hunk, their);
|
12290 |
|
12291 | calcLineCount(hunk);
|
12292 | }
|
12293 |
|
12294 | function mutualChange(hunk, mine, their) {
|
12295 | var myChanges = collectChange(mine),
|
12296 | theirChanges = collectChange(their);
|
12297 |
|
12298 | if (allRemoves(myChanges) && allRemoves(theirChanges)) {
|
12299 |
|
12300 | if ( (0, _array.arrayStartsWith) (myChanges, theirChanges) && skipRemoveSuperset(their, myChanges, myChanges.length - theirChanges.length)) {
|
12301 | var _hunk$lines3;
|
12302 |
|
12303 | (_hunk$lines3 = hunk.lines).push. apply ( _hunk$lines3 , _toConsumableArray( myChanges));
|
12304 | return;
|
12305 | } else if ( (0, _array.arrayStartsWith) (theirChanges, myChanges) && skipRemoveSuperset(mine, theirChanges, theirChanges.length - myChanges.length)) {
|
12306 | var _hunk$lines4;
|
12307 |
|
12308 | (_hunk$lines4 = hunk.lines).push. apply ( _hunk$lines4 , _toConsumableArray( theirChanges));
|
12309 | return;
|
12310 | }
|
12311 | } else if ( (0, _array.arrayEqual) (myChanges, theirChanges)) {
|
12312 | var _hunk$lines5;
|
12313 |
|
12314 | (_hunk$lines5 = hunk.lines).push. apply ( _hunk$lines5 , _toConsumableArray( myChanges));
|
12315 | return;
|
12316 | }
|
12317 |
|
12318 | conflict(hunk, myChanges, theirChanges);
|
12319 | }
|
12320 |
|
12321 | function removal(hunk, mine, their, swap) {
|
12322 | var myChanges = collectChange(mine),
|
12323 | theirChanges = collectContext(their, myChanges);
|
12324 | if (theirChanges.merged) {
|
12325 | var _hunk$lines6;
|
12326 |
|
12327 | (_hunk$lines6 = hunk.lines).push. apply ( _hunk$lines6 , _toConsumableArray( theirChanges.merged));
|
12328 | } else {
|
12329 | conflict(hunk, swap ? theirChanges : myChanges, swap ? myChanges : theirChanges);
|
12330 | }
|
12331 | }
|
12332 |
|
12333 | function conflict(hunk, mine, their) {
|
12334 | hunk.conflict = true;
|
12335 | hunk.lines.push({
|
12336 | conflict: true,
|
12337 | mine: mine,
|
12338 | theirs: their
|
12339 | });
|
12340 | }
|
12341 |
|
12342 | function insertLeading(hunk, insert, their) {
|
12343 | while (insert.offset < their.offset && insert.index < insert.lines.length) {
|
12344 | var line = insert.lines[insert.index++];
|
12345 | hunk.lines.push(line);
|
12346 | insert.offset++;
|
12347 | }
|
12348 | }
|
12349 | function insertTrailing(hunk, insert) {
|
12350 | while (insert.index < insert.lines.length) {
|
12351 | var line = insert.lines[insert.index++];
|
12352 | hunk.lines.push(line);
|
12353 | }
|
12354 | }
|
12355 |
|
12356 | function collectChange(state) {
|
12357 | var ret = [],
|
12358 | operation = state.lines[state.index][0];
|
12359 | while (state.index < state.lines.length) {
|
12360 | var line = state.lines[state.index];
|
12361 |
|
12362 |
|
12363 | if (operation === '-' && line[0] === '+') {
|
12364 | operation = '+';
|
12365 | }
|
12366 |
|
12367 | if (operation === line[0]) {
|
12368 | ret.push(line);
|
12369 | state.index++;
|
12370 | } else {
|
12371 | break;
|
12372 | }
|
12373 | }
|
12374 |
|
12375 | return ret;
|
12376 | }
|
12377 | function collectContext(state, matchChanges) {
|
12378 | var changes = [],
|
12379 | merged = [],
|
12380 | matchIndex = 0,
|
12381 | contextChanges = false,
|
12382 | conflicted = false;
|
12383 | while (matchIndex < matchChanges.length && state.index < state.lines.length) {
|
12384 | var change = state.lines[state.index],
|
12385 | match = matchChanges[matchIndex];
|
12386 |
|
12387 |
|
12388 | if (match[0] === '+') {
|
12389 | break;
|
12390 | }
|
12391 |
|
12392 | contextChanges = contextChanges || change[0] !== ' ';
|
12393 |
|
12394 | merged.push(match);
|
12395 | matchIndex++;
|
12396 |
|
12397 |
|
12398 |
|
12399 | if (change[0] === '+') {
|
12400 | conflicted = true;
|
12401 |
|
12402 | while (change[0] === '+') {
|
12403 | changes.push(change);
|
12404 | change = state.lines[++state.index];
|
12405 | }
|
12406 | }
|
12407 |
|
12408 | if (match.substr(1) === change.substr(1)) {
|
12409 | changes.push(change);
|
12410 | state.index++;
|
12411 | } else {
|
12412 | conflicted = true;
|
12413 | }
|
12414 | }
|
12415 |
|
12416 | if ((matchChanges[matchIndex] || '')[0] === '+' && contextChanges) {
|
12417 | conflicted = true;
|
12418 | }
|
12419 |
|
12420 | if (conflicted) {
|
12421 | return changes;
|
12422 | }
|
12423 |
|
12424 | while (matchIndex < matchChanges.length) {
|
12425 | merged.push(matchChanges[matchIndex++]);
|
12426 | }
|
12427 |
|
12428 | return {
|
12429 | merged: merged,
|
12430 | changes: changes
|
12431 | };
|
12432 | }
|
12433 |
|
12434 | function allRemoves(changes) {
|
12435 | return changes.reduce(function (prev, change) {
|
12436 | return prev && change[0] === '-';
|
12437 | }, true);
|
12438 | }
|
12439 | function skipRemoveSuperset(state, removeChanges, delta) {
|
12440 | for (var i = 0; i < delta; i++) {
|
12441 | var changeContent = removeChanges[removeChanges.length - delta + i].substr(1);
|
12442 | if (state.lines[state.index + i] !== ' ' + changeContent) {
|
12443 | return false;
|
12444 | }
|
12445 | }
|
12446 |
|
12447 | state.index += delta;
|
12448 | return true;
|
12449 | }
|
12450 |
|
12451 | function calcOldNewLineCount(lines) {
|
12452 | var oldLines = 0;
|
12453 | var newLines = 0;
|
12454 |
|
12455 | lines.forEach(function (line) {
|
12456 | if (typeof line !== 'string') {
|
12457 | var myCount = calcOldNewLineCount(line.mine);
|
12458 | var theirCount = calcOldNewLineCount(line.theirs);
|
12459 |
|
12460 | if (oldLines !== undefined) {
|
12461 | if (myCount.oldLines === theirCount.oldLines) {
|
12462 | oldLines += myCount.oldLines;
|
12463 | } else {
|
12464 | oldLines = undefined;
|
12465 | }
|
12466 | }
|
12467 |
|
12468 | if (newLines !== undefined) {
|
12469 | if (myCount.newLines === theirCount.newLines) {
|
12470 | newLines += myCount.newLines;
|
12471 | } else {
|
12472 | newLines = undefined;
|
12473 | }
|
12474 | }
|
12475 | } else {
|
12476 | if (newLines !== undefined && (line[0] === '+' || line[0] === ' ')) {
|
12477 | newLines++;
|
12478 | }
|
12479 | if (oldLines !== undefined && (line[0] === '-' || line[0] === ' ')) {
|
12480 | oldLines++;
|
12481 | }
|
12482 | }
|
12483 | });
|
12484 |
|
12485 | return { oldLines: oldLines, newLines: newLines };
|
12486 | }
|
12487 |
|
12488 |
|
12489 |
|
12490 | }),
|
12491 |
|
12492 | (function(module, exports, __webpack_require__) {
|
12493 |
|
12494 | 'use strict';
|
12495 |
|
12496 | exports.__esModule = true;
|
12497 | exports. structuredPatch = structuredPatch;
|
12498 | exports. createTwoFilesPatch = createTwoFilesPatch;
|
12499 | exports. createPatch = createPatch;
|
12500 |
|
12501 | var _line = __webpack_require__(5) ;
|
12502 |
|
12503 | 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); } }
|
12504 |
|
12505 | function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
|
12506 | if (!options) {
|
12507 | options = {};
|
12508 | }
|
12509 | if (typeof options.context === 'undefined') {
|
12510 | options.context = 4;
|
12511 | }
|
12512 |
|
12513 | var diff = (0, _line.diffLines) (oldStr, newStr, options);
|
12514 | diff.push({ value: '', lines: [] });
|
12515 |
|
12516 | function contextLines(lines) {
|
12517 | return lines.map(function (entry) {
|
12518 | return ' ' + entry;
|
12519 | });
|
12520 | }
|
12521 |
|
12522 | var hunks = [];
|
12523 | var oldRangeStart = 0,
|
12524 | newRangeStart = 0,
|
12525 | curRange = [],
|
12526 | oldLine = 1,
|
12527 | newLine = 1;
|
12528 |
|
12529 | var _loop = function _loop( /*istanbul ignore end*/i) {
|
12530 | var current = diff[i],
|
12531 | lines = current.lines || current.value.replace(/\n$/, '').split('\n');
|
12532 | current.lines = lines;
|
12533 |
|
12534 | if (current.added || current.removed) {
|
12535 | var _curRange;
|
12536 |
|
12537 |
|
12538 | if (!oldRangeStart) {
|
12539 | var prev = diff[i - 1];
|
12540 | oldRangeStart = oldLine;
|
12541 | newRangeStart = newLine;
|
12542 |
|
12543 | if (prev) {
|
12544 | curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : [];
|
12545 | oldRangeStart -= curRange.length;
|
12546 | newRangeStart -= curRange.length;
|
12547 | }
|
12548 | }
|
12549 |
|
12550 |
|
12551 | (_curRange = curRange).push. apply ( _curRange , _toConsumableArray( lines.map(function (entry) {
|
12552 | return (current.added ? '+' : '-') + entry;
|
12553 | })));
|
12554 |
|
12555 |
|
12556 | if (current.added) {
|
12557 | newLine += lines.length;
|
12558 | } else {
|
12559 | oldLine += lines.length;
|
12560 | }
|
12561 | } else {
|
12562 |
|
12563 | if (oldRangeStart) {
|
12564 |
|
12565 | if (lines.length <= options.context * 2 && i < diff.length - 2) {
|
12566 | var _curRange2;
|
12567 |
|
12568 |
|
12569 | (_curRange2 = curRange).push. apply ( _curRange2 , _toConsumableArray( contextLines(lines)));
|
12570 | } else {
|
12571 | var _curRange3;
|
12572 |
|
12573 |
|
12574 | var contextSize = Math.min(lines.length, options.context);
|
12575 | (_curRange3 = curRange).push. apply ( _curRange3 , _toConsumableArray( contextLines(lines.slice(0, contextSize))));
|
12576 |
|
12577 | var hunk = {
|
12578 | oldStart: oldRangeStart,
|
12579 | oldLines: oldLine - oldRangeStart + contextSize,
|
12580 | newStart: newRangeStart,
|
12581 | newLines: newLine - newRangeStart + contextSize,
|
12582 | lines: curRange
|
12583 | };
|
12584 | if (i >= diff.length - 2 && lines.length <= options.context) {
|
12585 |
|
12586 | var oldEOFNewline = /\n$/.test(oldStr);
|
12587 | var newEOFNewline = /\n$/.test(newStr);
|
12588 | if (lines.length == 0 && !oldEOFNewline) {
|
12589 |
|
12590 | curRange.splice(hunk.oldLines, 0, '\\ No newline at end of file');
|
12591 | } else if (!oldEOFNewline || !newEOFNewline) {
|
12592 | curRange.push('\\ No newline at end of file');
|
12593 | }
|
12594 | }
|
12595 | hunks.push(hunk);
|
12596 |
|
12597 | oldRangeStart = 0;
|
12598 | newRangeStart = 0;
|
12599 | curRange = [];
|
12600 | }
|
12601 | }
|
12602 | oldLine += lines.length;
|
12603 | newLine += lines.length;
|
12604 | }
|
12605 | };
|
12606 |
|
12607 | for (var i = 0; i < diff.length; i++) {
|
12608 | _loop( i);
|
12609 | }
|
12610 |
|
12611 | return {
|
12612 | oldFileName: oldFileName, newFileName: newFileName,
|
12613 | oldHeader: oldHeader, newHeader: newHeader,
|
12614 | hunks: hunks
|
12615 | };
|
12616 | }
|
12617 |
|
12618 | function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
|
12619 | var diff = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options);
|
12620 |
|
12621 | var ret = [];
|
12622 | if (oldFileName == newFileName) {
|
12623 | ret.push('Index: ' + oldFileName);
|
12624 | }
|
12625 | ret.push('===================================================================');
|
12626 | ret.push('--- ' + diff.oldFileName + (typeof diff.oldHeader === 'undefined' ? '' : '\t' + diff.oldHeader));
|
12627 | ret.push('+++ ' + diff.newFileName + (typeof diff.newHeader === 'undefined' ? '' : '\t' + diff.newHeader));
|
12628 |
|
12629 | for (var i = 0; i < diff.hunks.length; i++) {
|
12630 | var hunk = diff.hunks[i];
|
12631 | ret.push('@@ -' + hunk.oldStart + ',' + hunk.oldLines + ' +' + hunk.newStart + ',' + hunk.newLines + ' @@');
|
12632 | ret.push.apply(ret, hunk.lines);
|
12633 | }
|
12634 |
|
12635 | return ret.join('\n') + '\n';
|
12636 | }
|
12637 |
|
12638 | function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) {
|
12639 | return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options);
|
12640 | }
|
12641 |
|
12642 |
|
12643 |
|
12644 | }),
|
12645 |
|
12646 | (function(module, exports) {
|
12647 |
|
12648 | "use strict";
|
12649 |
|
12650 | exports.__esModule = true;
|
12651 | exports. arrayEqual = arrayEqual;
|
12652 | exports. arrayStartsWith = arrayStartsWith;
|
12653 | function arrayEqual(a, b) {
|
12654 | if (a.length !== b.length) {
|
12655 | return false;
|
12656 | }
|
12657 |
|
12658 | return arrayStartsWith(a, b);
|
12659 | }
|
12660 |
|
12661 | function arrayStartsWith(array, start) {
|
12662 | if (start.length > array.length) {
|
12663 | return false;
|
12664 | }
|
12665 |
|
12666 | for (var i = 0; i < start.length; i++) {
|
12667 | if (start[i] !== array[i]) {
|
12668 | return false;
|
12669 | }
|
12670 | }
|
12671 |
|
12672 | return true;
|
12673 | }
|
12674 |
|
12675 |
|
12676 |
|
12677 | }),
|
12678 |
|
12679 | (function(module, exports) {
|
12680 |
|
12681 | "use strict";
|
12682 |
|
12683 | exports.__esModule = true;
|
12684 | exports. convertChangesToDMP = convertChangesToDMP;
|
12685 |
|
12686 | function convertChangesToDMP(changes) {
|
12687 | var ret = [],
|
12688 | change = void 0 ,
|
12689 | operation = void 0 ;
|
12690 | for (var i = 0; i < changes.length; i++) {
|
12691 | change = changes[i];
|
12692 | if (change.added) {
|
12693 | operation = 1;
|
12694 | } else if (change.removed) {
|
12695 | operation = -1;
|
12696 | } else {
|
12697 | operation = 0;
|
12698 | }
|
12699 |
|
12700 | ret.push([operation, change.value]);
|
12701 | }
|
12702 | return ret;
|
12703 | }
|
12704 |
|
12705 |
|
12706 |
|
12707 | }),
|
12708 |
|
12709 | (function(module, exports) {
|
12710 |
|
12711 | 'use strict';
|
12712 |
|
12713 | exports.__esModule = true;
|
12714 | exports. convertChangesToXML = convertChangesToXML;
|
12715 | function convertChangesToXML(changes) {
|
12716 | var ret = [];
|
12717 | for (var i = 0; i < changes.length; i++) {
|
12718 | var change = changes[i];
|
12719 | if (change.added) {
|
12720 | ret.push('<ins>');
|
12721 | } else if (change.removed) {
|
12722 | ret.push('<del>');
|
12723 | }
|
12724 |
|
12725 | ret.push(escapeHTML(change.value));
|
12726 |
|
12727 | if (change.added) {
|
12728 | ret.push('</ins>');
|
12729 | } else if (change.removed) {
|
12730 | ret.push('</del>');
|
12731 | }
|
12732 | }
|
12733 | return ret.join('');
|
12734 | }
|
12735 |
|
12736 | function escapeHTML(s) {
|
12737 | var n = s;
|
12738 | n = n.replace(/&/g, '&');
|
12739 | n = n.replace(/</g, '<');
|
12740 | n = n.replace(/>/g, '>');
|
12741 | n = n.replace(/"/g, '"');
|
12742 |
|
12743 | return n;
|
12744 | }
|
12745 |
|
12746 |
|
12747 |
|
12748 | })
|
12749 | ])
|
12750 | });
|
12751 | ;
|
12752 | },{}],49:[function(require,module,exports){
|
12753 | 'use strict';
|
12754 |
|
12755 | var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
|
12756 |
|
12757 | module.exports = function (str) {
|
12758 | if (typeof str !== 'string') {
|
12759 | throw new TypeError('Expected a string');
|
12760 | }
|
12761 |
|
12762 | return str.replace(matchOperatorsRe, '\\$&');
|
12763 | };
|
12764 |
|
12765 | },{}],50:[function(require,module,exports){
|
12766 |
|
12767 |
|
12768 |
|
12769 |
|
12770 |
|
12771 |
|
12772 |
|
12773 |
|
12774 |
|
12775 |
|
12776 |
|
12777 |
|
12778 |
|
12779 |
|
12780 |
|
12781 |
|
12782 |
|
12783 |
|
12784 |
|
12785 |
|
12786 |
|
12787 | var objectCreate = Object.create || objectCreatePolyfill
|
12788 | var objectKeys = Object.keys || objectKeysPolyfill
|
12789 | var bind = Function.prototype.bind || functionBindPolyfill
|
12790 |
|
12791 | function EventEmitter() {
|
12792 | if (!this._events || !Object.prototype.hasOwnProperty.call(this, '_events')) {
|
12793 | this._events = objectCreate(null);
|
12794 | this._eventsCount = 0;
|
12795 | }
|
12796 |
|
12797 | this._maxListeners = this._maxListeners || undefined;
|
12798 | }
|
12799 | module.exports = EventEmitter;
|
12800 |
|
12801 |
|
12802 | EventEmitter.EventEmitter = EventEmitter;
|
12803 |
|
12804 | EventEmitter.prototype._events = undefined;
|
12805 | EventEmitter.prototype._maxListeners = undefined;
|
12806 |
|
12807 |
|
12808 |
|
12809 | var defaultMaxListeners = 10;
|
12810 |
|
12811 | var hasDefineProperty;
|
12812 | try {
|
12813 | var o = {};
|
12814 | if (Object.defineProperty) Object.defineProperty(o, 'x', { value: 0 });
|
12815 | hasDefineProperty = o.x === 0;
|
12816 | } catch (err) { hasDefineProperty = false }
|
12817 | if (hasDefineProperty) {
|
12818 | Object.defineProperty(EventEmitter, 'defaultMaxListeners', {
|
12819 | enumerable: true,
|
12820 | get: function() {
|
12821 | return defaultMaxListeners;
|
12822 | },
|
12823 | set: function(arg) {
|
12824 |
|
12825 |
|
12826 | if (typeof arg !== 'number' || arg < 0 || arg !== arg)
|
12827 | throw new TypeError('"defaultMaxListeners" must be a positive number');
|
12828 | defaultMaxListeners = arg;
|
12829 | }
|
12830 | });
|
12831 | } else {
|
12832 | EventEmitter.defaultMaxListeners = defaultMaxListeners;
|
12833 | }
|
12834 |
|
12835 |
|
12836 |
|
12837 | EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
|
12838 | if (typeof n !== 'number' || n < 0 || isNaN(n))
|
12839 | throw new TypeError('"n" argument must be a positive number');
|
12840 | this._maxListeners = n;
|
12841 | return this;
|
12842 | };
|
12843 |
|
12844 | function $getMaxListeners(that) {
|
12845 | if (that._maxListeners === undefined)
|
12846 | return EventEmitter.defaultMaxListeners;
|
12847 | return that._maxListeners;
|
12848 | }
|
12849 |
|
12850 | EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
|
12851 | return $getMaxListeners(this);
|
12852 | };
|
12853 |
|
12854 |
|
12855 |
|
12856 |
|
12857 |
|
12858 |
|
12859 | function emitNone(handler, isFn, self) {
|
12860 | if (isFn)
|
12861 | handler.call(self);
|
12862 | else {
|
12863 | var len = handler.length;
|
12864 | var listeners = arrayClone(handler, len);
|
12865 | for (var i = 0; i < len; ++i)
|
12866 | listeners[i].call(self);
|
12867 | }
|
12868 | }
|
12869 | function emitOne(handler, isFn, self, arg1) {
|
12870 | if (isFn)
|
12871 | handler.call(self, arg1);
|
12872 | else {
|
12873 | var len = handler.length;
|
12874 | var listeners = arrayClone(handler, len);
|
12875 | for (var i = 0; i < len; ++i)
|
12876 | listeners[i].call(self, arg1);
|
12877 | }
|
12878 | }
|
12879 | function emitTwo(handler, isFn, self, arg1, arg2) {
|
12880 | if (isFn)
|
12881 | handler.call(self, arg1, arg2);
|
12882 | else {
|
12883 | var len = handler.length;
|
12884 | var listeners = arrayClone(handler, len);
|
12885 | for (var i = 0; i < len; ++i)
|
12886 | listeners[i].call(self, arg1, arg2);
|
12887 | }
|
12888 | }
|
12889 | function emitThree(handler, isFn, self, arg1, arg2, arg3) {
|
12890 | if (isFn)
|
12891 | handler.call(self, arg1, arg2, arg3);
|
12892 | else {
|
12893 | var len = handler.length;
|
12894 | var listeners = arrayClone(handler, len);
|
12895 | for (var i = 0; i < len; ++i)
|
12896 | listeners[i].call(self, arg1, arg2, arg3);
|
12897 | }
|
12898 | }
|
12899 |
|
12900 | function emitMany(handler, isFn, self, args) {
|
12901 | if (isFn)
|
12902 | handler.apply(self, args);
|
12903 | else {
|
12904 | var len = handler.length;
|
12905 | var listeners = arrayClone(handler, len);
|
12906 | for (var i = 0; i < len; ++i)
|
12907 | listeners[i].apply(self, args);
|
12908 | }
|
12909 | }
|
12910 |
|
12911 | EventEmitter.prototype.emit = function emit(type) {
|
12912 | var er, handler, len, args, i, events;
|
12913 | var doError = (type === 'error');
|
12914 |
|
12915 | events = this._events;
|
12916 | if (events)
|
12917 | doError = (doError && events.error == null);
|
12918 | else if (!doError)
|
12919 | return false;
|
12920 |
|
12921 |
|
12922 | if (doError) {
|
12923 | if (arguments.length > 1)
|
12924 | er = arguments[1];
|
12925 | if (er instanceof Error) {
|
12926 | throw er;
|
12927 | } else {
|
12928 |
|
12929 | var err = new Error('Unhandled "error" event. (' + er + ')');
|
12930 | err.context = er;
|
12931 | throw err;
|
12932 | }
|
12933 | return false;
|
12934 | }
|
12935 |
|
12936 | handler = events[type];
|
12937 |
|
12938 | if (!handler)
|
12939 | return false;
|
12940 |
|
12941 | var isFn = typeof handler === 'function';
|
12942 | len = arguments.length;
|
12943 | switch (len) {
|
12944 |
|
12945 | case 1:
|
12946 | emitNone(handler, isFn, this);
|
12947 | break;
|
12948 | case 2:
|
12949 | emitOne(handler, isFn, this, arguments[1]);
|
12950 | break;
|
12951 | case 3:
|
12952 | emitTwo(handler, isFn, this, arguments[1], arguments[2]);
|
12953 | break;
|
12954 | case 4:
|
12955 | emitThree(handler, isFn, this, arguments[1], arguments[2], arguments[3]);
|
12956 | break;
|
12957 |
|
12958 | default:
|
12959 | args = new Array(len - 1);
|
12960 | for (i = 1; i < len; i++)
|
12961 | args[i - 1] = arguments[i];
|
12962 | emitMany(handler, isFn, this, args);
|
12963 | }
|
12964 |
|
12965 | return true;
|
12966 | };
|
12967 |
|
12968 | function _addListener(target, type, listener, prepend) {
|
12969 | var m;
|
12970 | var events;
|
12971 | var existing;
|
12972 |
|
12973 | if (typeof listener !== 'function')
|
12974 | throw new TypeError('"listener" argument must be a function');
|
12975 |
|
12976 | events = target._events;
|
12977 | if (!events) {
|
12978 | events = target._events = objectCreate(null);
|
12979 | target._eventsCount = 0;
|
12980 | } else {
|
12981 |
|
12982 |
|
12983 | if (events.newListener) {
|
12984 | target.emit('newListener', type,
|
12985 | listener.listener ? listener.listener : listener);
|
12986 |
|
12987 |
|
12988 |
|
12989 | events = target._events;
|
12990 | }
|
12991 | existing = events[type];
|
12992 | }
|
12993 |
|
12994 | if (!existing) {
|
12995 |
|
12996 | existing = events[type] = listener;
|
12997 | ++target._eventsCount;
|
12998 | } else {
|
12999 | if (typeof existing === 'function') {
|
13000 |
|
13001 | existing = events[type] =
|
13002 | prepend ? [listener, existing] : [existing, listener];
|
13003 | } else {
|
13004 |
|
13005 | if (prepend) {
|
13006 | existing.unshift(listener);
|
13007 | } else {
|
13008 | existing.push(listener);
|
13009 | }
|
13010 | }
|
13011 |
|
13012 |
|
13013 | if (!existing.warned) {
|
13014 | m = $getMaxListeners(target);
|
13015 | if (m && m > 0 && existing.length > m) {
|
13016 | existing.warned = true;
|
13017 | var w = new Error('Possible EventEmitter memory leak detected. ' +
|
13018 | existing.length + ' "' + String(type) + '" listeners ' +
|
13019 | 'added. Use emitter.setMaxListeners() to ' +
|
13020 | 'increase limit.');
|
13021 | w.name = 'MaxListenersExceededWarning';
|
13022 | w.emitter = target;
|
13023 | w.type = type;
|
13024 | w.count = existing.length;
|
13025 | if (typeof console === 'object' && console.warn) {
|
13026 | console.warn('%s: %s', w.name, w.message);
|
13027 | }
|
13028 | }
|
13029 | }
|
13030 | }
|
13031 |
|
13032 | return target;
|
13033 | }
|
13034 |
|
13035 | EventEmitter.prototype.addListener = function addListener(type, listener) {
|
13036 | return _addListener(this, type, listener, false);
|
13037 | };
|
13038 |
|
13039 | EventEmitter.prototype.on = EventEmitter.prototype.addListener;
|
13040 |
|
13041 | EventEmitter.prototype.prependListener =
|
13042 | function prependListener(type, listener) {
|
13043 | return _addListener(this, type, listener, true);
|
13044 | };
|
13045 |
|
13046 | function onceWrapper() {
|
13047 | if (!this.fired) {
|
13048 | this.target.removeListener(this.type, this.wrapFn);
|
13049 | this.fired = true;
|
13050 | switch (arguments.length) {
|
13051 | case 0:
|
13052 | return this.listener.call(this.target);
|
13053 | case 1:
|
13054 | return this.listener.call(this.target, arguments[0]);
|
13055 | case 2:
|
13056 | return this.listener.call(this.target, arguments[0], arguments[1]);
|
13057 | case 3:
|
13058 | return this.listener.call(this.target, arguments[0], arguments[1],
|
13059 | arguments[2]);
|
13060 | default:
|
13061 | var args = new Array(arguments.length);
|
13062 | for (var i = 0; i < args.length; ++i)
|
13063 | args[i] = arguments[i];
|
13064 | this.listener.apply(this.target, args);
|
13065 | }
|
13066 | }
|
13067 | }
|
13068 |
|
13069 | function _onceWrap(target, type, listener) {
|
13070 | var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };
|
13071 | var wrapped = bind.call(onceWrapper, state);
|
13072 | wrapped.listener = listener;
|
13073 | state.wrapFn = wrapped;
|
13074 | return wrapped;
|
13075 | }
|
13076 |
|
13077 | EventEmitter.prototype.once = function once(type, listener) {
|
13078 | if (typeof listener !== 'function')
|
13079 | throw new TypeError('"listener" argument must be a function');
|
13080 | this.on(type, _onceWrap(this, type, listener));
|
13081 | return this;
|
13082 | };
|
13083 |
|
13084 | EventEmitter.prototype.prependOnceListener =
|
13085 | function prependOnceListener(type, listener) {
|
13086 | if (typeof listener !== 'function')
|
13087 | throw new TypeError('"listener" argument must be a function');
|
13088 | this.prependListener(type, _onceWrap(this, type, listener));
|
13089 | return this;
|
13090 | };
|
13091 |
|
13092 |
|
13093 | EventEmitter.prototype.removeListener =
|
13094 | function removeListener(type, listener) {
|
13095 | var list, events, position, i, originalListener;
|
13096 |
|
13097 | if (typeof listener !== 'function')
|
13098 | throw new TypeError('"listener" argument must be a function');
|
13099 |
|
13100 | events = this._events;
|
13101 | if (!events)
|
13102 | return this;
|
13103 |
|
13104 | list = events[type];
|
13105 | if (!list)
|
13106 | return this;
|
13107 |
|
13108 | if (list === listener || list.listener === listener) {
|
13109 | if (--this._eventsCount === 0)
|
13110 | this._events = objectCreate(null);
|
13111 | else {
|
13112 | delete events[type];
|
13113 | if (events.removeListener)
|
13114 | this.emit('removeListener', type, list.listener || listener);
|
13115 | }
|
13116 | } else if (typeof list !== 'function') {
|
13117 | position = -1;
|
13118 |
|
13119 | for (i = list.length - 1; i >= 0; i--) {
|
13120 | if (list[i] === listener || list[i].listener === listener) {
|
13121 | originalListener = list[i].listener;
|
13122 | position = i;
|
13123 | break;
|
13124 | }
|
13125 | }
|
13126 |
|
13127 | if (position < 0)
|
13128 | return this;
|
13129 |
|
13130 | if (position === 0)
|
13131 | list.shift();
|
13132 | else
|
13133 | spliceOne(list, position);
|
13134 |
|
13135 | if (list.length === 1)
|
13136 | events[type] = list[0];
|
13137 |
|
13138 | if (events.removeListener)
|
13139 | this.emit('removeListener', type, originalListener || listener);
|
13140 | }
|
13141 |
|
13142 | return this;
|
13143 | };
|
13144 |
|
13145 | EventEmitter.prototype.removeAllListeners =
|
13146 | function removeAllListeners(type) {
|
13147 | var listeners, events, i;
|
13148 |
|
13149 | events = this._events;
|
13150 | if (!events)
|
13151 | return this;
|
13152 |
|
13153 |
|
13154 | if (!events.removeListener) {
|
13155 | if (arguments.length === 0) {
|
13156 | this._events = objectCreate(null);
|
13157 | this._eventsCount = 0;
|
13158 | } else if (events[type]) {
|
13159 | if (--this._eventsCount === 0)
|
13160 | this._events = objectCreate(null);
|
13161 | else
|
13162 | delete events[type];
|
13163 | }
|
13164 | return this;
|
13165 | }
|
13166 |
|
13167 |
|
13168 | if (arguments.length === 0) {
|
13169 | var keys = objectKeys(events);
|
13170 | var key;
|
13171 | for (i = 0; i < keys.length; ++i) {
|
13172 | key = keys[i];
|
13173 | if (key === 'removeListener') continue;
|
13174 | this.removeAllListeners(key);
|
13175 | }
|
13176 | this.removeAllListeners('removeListener');
|
13177 | this._events = objectCreate(null);
|
13178 | this._eventsCount = 0;
|
13179 | return this;
|
13180 | }
|
13181 |
|
13182 | listeners = events[type];
|
13183 |
|
13184 | if (typeof listeners === 'function') {
|
13185 | this.removeListener(type, listeners);
|
13186 | } else if (listeners) {
|
13187 |
|
13188 | for (i = listeners.length - 1; i >= 0; i--) {
|
13189 | this.removeListener(type, listeners[i]);
|
13190 | }
|
13191 | }
|
13192 |
|
13193 | return this;
|
13194 | };
|
13195 |
|
13196 | function _listeners(target, type, unwrap) {
|
13197 | var events = target._events;
|
13198 |
|
13199 | if (!events)
|
13200 | return [];
|
13201 |
|
13202 | var evlistener = events[type];
|
13203 | if (!evlistener)
|
13204 | return [];
|
13205 |
|
13206 | if (typeof evlistener === 'function')
|
13207 | return unwrap ? [evlistener.listener || evlistener] : [evlistener];
|
13208 |
|
13209 | return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
|
13210 | }
|
13211 |
|
13212 | EventEmitter.prototype.listeners = function listeners(type) {
|
13213 | return _listeners(this, type, true);
|
13214 | };
|
13215 |
|
13216 | EventEmitter.prototype.rawListeners = function rawListeners(type) {
|
13217 | return _listeners(this, type, false);
|
13218 | };
|
13219 |
|
13220 | EventEmitter.listenerCount = function(emitter, type) {
|
13221 | if (typeof emitter.listenerCount === 'function') {
|
13222 | return emitter.listenerCount(type);
|
13223 | } else {
|
13224 | return listenerCount.call(emitter, type);
|
13225 | }
|
13226 | };
|
13227 |
|
13228 | EventEmitter.prototype.listenerCount = listenerCount;
|
13229 | function listenerCount(type) {
|
13230 | var events = this._events;
|
13231 |
|
13232 | if (events) {
|
13233 | var evlistener = events[type];
|
13234 |
|
13235 | if (typeof evlistener === 'function') {
|
13236 | return 1;
|
13237 | } else if (evlistener) {
|
13238 | return evlistener.length;
|
13239 | }
|
13240 | }
|
13241 |
|
13242 | return 0;
|
13243 | }
|
13244 |
|
13245 | EventEmitter.prototype.eventNames = function eventNames() {
|
13246 | return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : [];
|
13247 | };
|
13248 |
|
13249 |
|
13250 | function spliceOne(list, index) {
|
13251 | for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1)
|
13252 | list[i] = list[k];
|
13253 | list.pop();
|
13254 | }
|
13255 |
|
13256 | function arrayClone(arr, n) {
|
13257 | var copy = new Array(n);
|
13258 | for (var i = 0; i < n; ++i)
|
13259 | copy[i] = arr[i];
|
13260 | return copy;
|
13261 | }
|
13262 |
|
13263 | function unwrapListeners(arr) {
|
13264 | var ret = new Array(arr.length);
|
13265 | for (var i = 0; i < ret.length; ++i) {
|
13266 | ret[i] = arr[i].listener || arr[i];
|
13267 | }
|
13268 | return ret;
|
13269 | }
|
13270 |
|
13271 | function objectCreatePolyfill(proto) {
|
13272 | var F = function() {};
|
13273 | F.prototype = proto;
|
13274 | return new F;
|
13275 | }
|
13276 | function objectKeysPolyfill(obj) {
|
13277 | var keys = [];
|
13278 | for (var k in obj) if (Object.prototype.hasOwnProperty.call(obj, k)) {
|
13279 | keys.push(k);
|
13280 | }
|
13281 | return k;
|
13282 | }
|
13283 | function functionBindPolyfill(context) {
|
13284 | var fn = this;
|
13285 | return function () {
|
13286 | return fn.apply(context, arguments);
|
13287 | };
|
13288 | }
|
13289 |
|
13290 | },{}],51:[function(require,module,exports){
|
13291 | 'use strict';
|
13292 |
|
13293 |
|
13294 |
|
13295 | var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
|
13296 | var slice = Array.prototype.slice;
|
13297 | var toStr = Object.prototype.toString;
|
13298 | var funcType = '[object Function]';
|
13299 |
|
13300 | module.exports = function bind(that) {
|
13301 | var target = this;
|
13302 | if (typeof target !== 'function' || toStr.call(target) !== funcType) {
|
13303 | throw new TypeError(ERROR_MESSAGE + target);
|
13304 | }
|
13305 | var args = slice.call(arguments, 1);
|
13306 |
|
13307 | var bound;
|
13308 | var binder = function () {
|
13309 | if (this instanceof bound) {
|
13310 | var result = target.apply(
|
13311 | this,
|
13312 | args.concat(slice.call(arguments))
|
13313 | );
|
13314 | if (Object(result) === result) {
|
13315 | return result;
|
13316 | }
|
13317 | return this;
|
13318 | } else {
|
13319 | return target.apply(
|
13320 | that,
|
13321 | args.concat(slice.call(arguments))
|
13322 | );
|
13323 | }
|
13324 | };
|
13325 |
|
13326 | var boundLength = Math.max(0, target.length - args.length);
|
13327 | var boundArgs = [];
|
13328 | for (var i = 0; i < boundLength; i++) {
|
13329 | boundArgs.push('$' + i);
|
13330 | }
|
13331 |
|
13332 | bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
|
13333 |
|
13334 | if (target.prototype) {
|
13335 | var Empty = function Empty() {};
|
13336 | Empty.prototype = target.prototype;
|
13337 | bound.prototype = new Empty();
|
13338 | Empty.prototype = null;
|
13339 | }
|
13340 |
|
13341 | return bound;
|
13342 | };
|
13343 |
|
13344 | },{}],52:[function(require,module,exports){
|
13345 | 'use strict';
|
13346 |
|
13347 | var implementation = require('./implementation');
|
13348 |
|
13349 | module.exports = Function.prototype.bind || implementation;
|
13350 |
|
13351 | },{"./implementation":51}],53:[function(require,module,exports){
|
13352 | 'use strict';
|
13353 |
|
13354 |
|
13355 | module.exports = function hasSymbols() {
|
13356 | if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
|
13357 | if (typeof Symbol.iterator === 'symbol') { return true; }
|
13358 |
|
13359 | var obj = {};
|
13360 | var sym = Symbol('test');
|
13361 | var symObj = Object(sym);
|
13362 | if (typeof sym === 'string') { return false; }
|
13363 |
|
13364 | if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
|
13365 | if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
|
13366 |
|
13367 |
|
13368 |
|
13369 |
|
13370 |
|
13371 |
|
13372 |
|
13373 |
|
13374 |
|
13375 | var symVal = 42;
|
13376 | obj[sym] = symVal;
|
13377 | for (sym in obj) { return false; }
|
13378 | if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
|
13379 |
|
13380 | if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
|
13381 |
|
13382 | var syms = Object.getOwnPropertySymbols(obj);
|
13383 | if (syms.length !== 1 || syms[0] !== sym) { return false; }
|
13384 |
|
13385 | if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
|
13386 |
|
13387 | if (typeof Object.getOwnPropertyDescriptor === 'function') {
|
13388 | var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
|
13389 | if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
|
13390 | }
|
13391 |
|
13392 | return true;
|
13393 | };
|
13394 |
|
13395 | },{}],54:[function(require,module,exports){
|
13396 | (function (global){
|
13397 |
|
13398 | ;(function(root) {
|
13399 |
|
13400 |
|
13401 | var freeExports = typeof exports == 'object' && exports;
|
13402 |
|
13403 |
|
13404 | var freeModule = typeof module == 'object' && module &&
|
13405 | module.exports == freeExports && module;
|
13406 |
|
13407 |
|
13408 |
|
13409 | var freeGlobal = typeof global == 'object' && global;
|
13410 | if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {
|
13411 | root = freeGlobal;
|
13412 | }
|
13413 |
|
13414 |
|
13415 |
|
13416 |
|
13417 | var regexAstralSymbols = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
13418 |
|
13419 |
|
13420 |
|
13421 | var regexAsciiWhitelist = /[\x01-\x7F]/g;
|
13422 |
|
13423 |
|
13424 |
|
13425 | var regexBmpWhitelist = /[\x01-\t\x0B\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g;
|
13426 |
|
13427 | 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;
|
13428 | 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'};
|
13429 |
|
13430 | var regexEscape = /["&'<>`]/g;
|
13431 | var escapeMap = {
|
13432 | '"': '"',
|
13433 | '&': '&',
|
13434 | '\'': ''',
|
13435 | '<': '<',
|
13436 |
|
13437 |
|
13438 |
|
13439 |
|
13440 | '>': '>',
|
13441 |
|
13442 |
|
13443 |
|
13444 |
|
13445 | '`': '`'
|
13446 | };
|
13447 |
|
13448 | var regexInvalidEntity = /&#(?:[xX][^a-fA-F0-9]|[^0-9xX])/;
|
13449 | 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]/;
|
13450 | 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;
|
13451 | 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'};
|
13452 | 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'};
|
13453 | 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'};
|
13454 | 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];
|
13455 |
|
13456 |
|
13457 |
|
13458 | var stringFromCharCode = String.fromCharCode;
|
13459 |
|
13460 | var object = {};
|
13461 | var hasOwnProperty = object.hasOwnProperty;
|
13462 | var has = function(object, propertyName) {
|
13463 | return hasOwnProperty.call(object, propertyName);
|
13464 | };
|
13465 |
|
13466 | var contains = function(array, value) {
|
13467 | var index = -1;
|
13468 | var length = array.length;
|
13469 | while (++index < length) {
|
13470 | if (array[index] == value) {
|
13471 | return true;
|
13472 | }
|
13473 | }
|
13474 | return false;
|
13475 | };
|
13476 |
|
13477 | var merge = function(options, defaults) {
|
13478 | if (!options) {
|
13479 | return defaults;
|
13480 | }
|
13481 | var result = {};
|
13482 | var key;
|
13483 | for (key in defaults) {
|
13484 |
|
13485 |
|
13486 | result[key] = has(options, key) ? options[key] : defaults[key];
|
13487 | }
|
13488 | return result;
|
13489 | };
|
13490 |
|
13491 |
|
13492 | var codePointToSymbol = function(codePoint, strict) {
|
13493 | var output = '';
|
13494 | if ((codePoint >= 0xD800 && codePoint <= 0xDFFF) || codePoint > 0x10FFFF) {
|
13495 |
|
13496 |
|
13497 |
|
13498 |
|
13499 | if (strict) {
|
13500 | parseError('character reference outside the permissible Unicode range');
|
13501 | }
|
13502 | return '\uFFFD';
|
13503 | }
|
13504 | if (has(decodeMapNumeric, codePoint)) {
|
13505 | if (strict) {
|
13506 | parseError('disallowed character reference');
|
13507 | }
|
13508 | return decodeMapNumeric[codePoint];
|
13509 | }
|
13510 | if (strict && contains(invalidReferenceCodePoints, codePoint)) {
|
13511 | parseError('disallowed character reference');
|
13512 | }
|
13513 | if (codePoint > 0xFFFF) {
|
13514 | codePoint -= 0x10000;
|
13515 | output += stringFromCharCode(codePoint >>> 10 & 0x3FF | 0xD800);
|
13516 | codePoint = 0xDC00 | codePoint & 0x3FF;
|
13517 | }
|
13518 | output += stringFromCharCode(codePoint);
|
13519 | return output;
|
13520 | };
|
13521 |
|
13522 | var hexEscape = function(codePoint) {
|
13523 | return '&#x' + codePoint.toString(16).toUpperCase() + ';';
|
13524 | };
|
13525 |
|
13526 | var decEscape = function(codePoint) {
|
13527 | return '&#' + codePoint + ';';
|
13528 | };
|
13529 |
|
13530 | var parseError = function(message) {
|
13531 | throw Error('Parse error: ' + message);
|
13532 | };
|
13533 |
|
13534 |
|
13535 |
|
13536 | var encode = function(string, options) {
|
13537 | options = merge(options, encode.options);
|
13538 | var strict = options.strict;
|
13539 | if (strict && regexInvalidRawCodePoint.test(string)) {
|
13540 | parseError('forbidden code point');
|
13541 | }
|
13542 | var encodeEverything = options.encodeEverything;
|
13543 | var useNamedReferences = options.useNamedReferences;
|
13544 | var allowUnsafeSymbols = options.allowUnsafeSymbols;
|
13545 | var escapeCodePoint = options.decimal ? decEscape : hexEscape;
|
13546 |
|
13547 | var escapeBmpSymbol = function(symbol) {
|
13548 | return escapeCodePoint(symbol.charCodeAt(0));
|
13549 | };
|
13550 |
|
13551 | if (encodeEverything) {
|
13552 |
|
13553 | string = string.replace(regexAsciiWhitelist, function(symbol) {
|
13554 |
|
13555 | if (useNamedReferences && has(encodeMap, symbol)) {
|
13556 | return '&' + encodeMap[symbol] + ';';
|
13557 | }
|
13558 | return escapeBmpSymbol(symbol);
|
13559 | });
|
13560 |
|
13561 |
|
13562 | if (useNamedReferences) {
|
13563 | string = string
|
13564 | .replace(/>\u20D2/g, '>⃒')
|
13565 | .replace(/<\u20D2/g, '<⃒')
|
13566 | .replace(/fj/g, 'fj');
|
13567 | }
|
13568 |
|
13569 | if (useNamedReferences) {
|
13570 |
|
13571 | string = string.replace(regexEncodeNonAscii, function(string) {
|
13572 |
|
13573 | return '&' + encodeMap[string] + ';';
|
13574 | });
|
13575 | }
|
13576 |
|
13577 | } else if (useNamedReferences) {
|
13578 |
|
13579 |
|
13580 | if (!allowUnsafeSymbols) {
|
13581 | string = string.replace(regexEscape, function(string) {
|
13582 | return '&' + encodeMap[string] + ';';
|
13583 | });
|
13584 | }
|
13585 |
|
13586 |
|
13587 | string = string
|
13588 | .replace(/>\u20D2/g, '>⃒')
|
13589 | .replace(/<\u20D2/g, '<⃒');
|
13590 |
|
13591 | string = string.replace(regexEncodeNonAscii, function(string) {
|
13592 |
|
13593 | return '&' + encodeMap[string] + ';';
|
13594 | });
|
13595 | } else if (!allowUnsafeSymbols) {
|
13596 |
|
13597 |
|
13598 | string = string.replace(regexEscape, escapeBmpSymbol);
|
13599 | }
|
13600 | return string
|
13601 |
|
13602 | .replace(regexAstralSymbols, function($0) {
|
13603 |
|
13604 | var high = $0.charCodeAt(0);
|
13605 | var low = $0.charCodeAt(1);
|
13606 | var codePoint = (high - 0xD800) * 0x400 + low - 0xDC00 + 0x10000;
|
13607 | return escapeCodePoint(codePoint);
|
13608 | })
|
13609 |
|
13610 |
|
13611 | .replace(regexBmpWhitelist, escapeBmpSymbol);
|
13612 | };
|
13613 |
|
13614 | encode.options = {
|
13615 | 'allowUnsafeSymbols': false,
|
13616 | 'encodeEverything': false,
|
13617 | 'strict': false,
|
13618 | 'useNamedReferences': false,
|
13619 | 'decimal' : false
|
13620 | };
|
13621 |
|
13622 | var decode = function(html, options) {
|
13623 | options = merge(options, decode.options);
|
13624 | var strict = options.strict;
|
13625 | if (strict && regexInvalidEntity.test(html)) {
|
13626 | parseError('malformed character reference');
|
13627 | }
|
13628 | return html.replace(regexDecode, function($0, $1, $2, $3, $4, $5, $6, $7, $8) {
|
13629 | var codePoint;
|
13630 | var semicolon;
|
13631 | var decDigits;
|
13632 | var hexDigits;
|
13633 | var reference;
|
13634 | var next;
|
13635 |
|
13636 | if ($1) {
|
13637 | reference = $1;
|
13638 |
|
13639 | return decodeMap[reference];
|
13640 | }
|
13641 |
|
13642 | if ($2) {
|
13643 |
|
13644 |
|
13645 |
|
13646 | reference = $2;
|
13647 | next = $3;
|
13648 | if (next && options.isAttributeValue) {
|
13649 | if (strict && next == '=') {
|
13650 | parseError('`&` did not start a character reference');
|
13651 | }
|
13652 | return $0;
|
13653 | } else {
|
13654 | if (strict) {
|
13655 | parseError(
|
13656 | 'named character reference was not terminated by a semicolon'
|
13657 | );
|
13658 | }
|
13659 |
|
13660 | return decodeMapLegacy[reference] + (next || '');
|
13661 | }
|
13662 | }
|
13663 |
|
13664 | if ($4) {
|
13665 |
|
13666 | decDigits = $4;
|
13667 | semicolon = $5;
|
13668 | if (strict && !semicolon) {
|
13669 | parseError('character reference was not terminated by a semicolon');
|
13670 | }
|
13671 | codePoint = parseInt(decDigits, 10);
|
13672 | return codePointToSymbol(codePoint, strict);
|
13673 | }
|
13674 |
|
13675 | if ($6) {
|
13676 |
|
13677 | hexDigits = $6;
|
13678 | semicolon = $7;
|
13679 | if (strict && !semicolon) {
|
13680 | parseError('character reference was not terminated by a semicolon');
|
13681 | }
|
13682 | codePoint = parseInt(hexDigits, 16);
|
13683 | return codePointToSymbol(codePoint, strict);
|
13684 | }
|
13685 |
|
13686 |
|
13687 |
|
13688 | if (strict) {
|
13689 | parseError(
|
13690 | 'named character reference was not terminated by a semicolon'
|
13691 | );
|
13692 | }
|
13693 | return $0;
|
13694 | });
|
13695 | };
|
13696 |
|
13697 | decode.options = {
|
13698 | 'isAttributeValue': false,
|
13699 | 'strict': false
|
13700 | };
|
13701 |
|
13702 | var escape = function(string) {
|
13703 | return string.replace(regexEscape, function($0) {
|
13704 |
|
13705 | return escapeMap[$0];
|
13706 | });
|
13707 | };
|
13708 |
|
13709 |
|
13710 |
|
13711 | var he = {
|
13712 | 'version': '1.2.0',
|
13713 | 'encode': encode,
|
13714 | 'decode': decode,
|
13715 | 'escape': escape,
|
13716 | 'unescape': decode
|
13717 | };
|
13718 |
|
13719 |
|
13720 |
|
13721 | if (
|
13722 | false
|
13723 | ) {
|
13724 | define(function() {
|
13725 | return he;
|
13726 | });
|
13727 | } else if (freeExports && !freeExports.nodeType) {
|
13728 | if (freeModule) {
|
13729 | freeModule.exports = he;
|
13730 | } else {
|
13731 | for (var key in he) {
|
13732 | has(he, key) && (freeExports[key] = he[key]);
|
13733 | }
|
13734 | }
|
13735 | } else {
|
13736 | root.he = he;
|
13737 | }
|
13738 |
|
13739 | }(this));
|
13740 |
|
13741 | }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
13742 | },{}],55:[function(require,module,exports){
|
13743 | exports.read = function (buffer, offset, isLE, mLen, nBytes) {
|
13744 | var e, m
|
13745 | var eLen = (nBytes * 8) - mLen - 1
|
13746 | var eMax = (1 << eLen) - 1
|
13747 | var eBias = eMax >> 1
|
13748 | var nBits = -7
|
13749 | var i = isLE ? (nBytes - 1) : 0
|
13750 | var d = isLE ? -1 : 1
|
13751 | var s = buffer[offset + i]
|
13752 |
|
13753 | i += d
|
13754 |
|
13755 | e = s & ((1 << (-nBits)) - 1)
|
13756 | s >>= (-nBits)
|
13757 | nBits += eLen
|
13758 | for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
|
13759 |
|
13760 | m = e & ((1 << (-nBits)) - 1)
|
13761 | e >>= (-nBits)
|
13762 | nBits += mLen
|
13763 | for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
|
13764 |
|
13765 | if (e === 0) {
|
13766 | e = 1 - eBias
|
13767 | } else if (e === eMax) {
|
13768 | return m ? NaN : ((s ? -1 : 1) * Infinity)
|
13769 | } else {
|
13770 | m = m + Math.pow(2, mLen)
|
13771 | e = e - eBias
|
13772 | }
|
13773 | return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
|
13774 | }
|
13775 |
|
13776 | exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
|
13777 | var e, m, c
|
13778 | var eLen = (nBytes * 8) - mLen - 1
|
13779 | var eMax = (1 << eLen) - 1
|
13780 | var eBias = eMax >> 1
|
13781 | var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
|
13782 | var i = isLE ? 0 : (nBytes - 1)
|
13783 | var d = isLE ? 1 : -1
|
13784 | var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
|
13785 |
|
13786 | value = Math.abs(value)
|
13787 |
|
13788 | if (isNaN(value) || value === Infinity) {
|
13789 | m = isNaN(value) ? 1 : 0
|
13790 | e = eMax
|
13791 | } else {
|
13792 | e = Math.floor(Math.log(value) / Math.LN2)
|
13793 | if (value * (c = Math.pow(2, -e)) < 1) {
|
13794 | e--
|
13795 | c *= 2
|
13796 | }
|
13797 | if (e + eBias >= 1) {
|
13798 | value += rt / c
|
13799 | } else {
|
13800 | value += rt * Math.pow(2, 1 - eBias)
|
13801 | }
|
13802 | if (value * c >= 2) {
|
13803 | e++
|
13804 | c /= 2
|
13805 | }
|
13806 |
|
13807 | if (e + eBias >= eMax) {
|
13808 | m = 0
|
13809 | e = eMax
|
13810 | } else if (e + eBias >= 1) {
|
13811 | m = ((value * c) - 1) * Math.pow(2, mLen)
|
13812 | e = e + eBias
|
13813 | } else {
|
13814 | m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
|
13815 | e = 0
|
13816 | }
|
13817 | }
|
13818 |
|
13819 | for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
|
13820 |
|
13821 | e = (e << mLen) | m
|
13822 | eLen += mLen
|
13823 | for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
|
13824 |
|
13825 | buffer[offset + i - d] |= s * 128
|
13826 | }
|
13827 |
|
13828 | },{}],56:[function(require,module,exports){
|
13829 | if (typeof Object.create === 'function') {
|
13830 |
|
13831 | module.exports = function inherits(ctor, superCtor) {
|
13832 | ctor.super_ = superCtor
|
13833 | ctor.prototype = Object.create(superCtor.prototype, {
|
13834 | constructor: {
|
13835 | value: ctor,
|
13836 | enumerable: false,
|
13837 | writable: true,
|
13838 | configurable: true
|
13839 | }
|
13840 | });
|
13841 | };
|
13842 | } else {
|
13843 |
|
13844 | module.exports = function inherits(ctor, superCtor) {
|
13845 | ctor.super_ = superCtor
|
13846 | var TempCtor = function () {}
|
13847 | TempCtor.prototype = superCtor.prototype
|
13848 | ctor.prototype = new TempCtor()
|
13849 | ctor.prototype.constructor = ctor
|
13850 | }
|
13851 | }
|
13852 |
|
13853 | },{}],57:[function(require,module,exports){
|
13854 |
|
13855 |
|
13856 |
|
13857 |
|
13858 |
|
13859 |
|
13860 |
|
13861 |
|
13862 |
|
13863 | module.exports = function (obj) {
|
13864 | return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
|
13865 | }
|
13866 |
|
13867 | function isBuffer (obj) {
|
13868 | return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
|
13869 | }
|
13870 |
|
13871 |
|
13872 | function isSlowBuffer (obj) {
|
13873 | return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
|
13874 | }
|
13875 |
|
13876 | },{}],58:[function(require,module,exports){
|
13877 | var toString = {}.toString;
|
13878 |
|
13879 | module.exports = Array.isArray || function (arr) {
|
13880 | return toString.call(arr) == '[object Array]';
|
13881 | };
|
13882 |
|
13883 | },{}],59:[function(require,module,exports){
|
13884 | (function (process){
|
13885 | var path = require('path');
|
13886 | var fs = require('fs');
|
13887 | var _0777 = parseInt('0777', 8);
|
13888 |
|
13889 | module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP;
|
13890 |
|
13891 | function mkdirP (p, opts, f, made) {
|
13892 | if (typeof opts === 'function') {
|
13893 | f = opts;
|
13894 | opts = {};
|
13895 | }
|
13896 | else if (!opts || typeof opts !== 'object') {
|
13897 | opts = { mode: opts };
|
13898 | }
|
13899 |
|
13900 | var mode = opts.mode;
|
13901 | var xfs = opts.fs || fs;
|
13902 |
|
13903 | if (mode === undefined) {
|
13904 | mode = _0777 & (~process.umask());
|
13905 | }
|
13906 | if (!made) made = null;
|
13907 |
|
13908 | var cb = f || function () {};
|
13909 | p = path.resolve(p);
|
13910 |
|
13911 | xfs.mkdir(p, mode, function (er) {
|
13912 | if (!er) {
|
13913 | made = made || p;
|
13914 | return cb(null, made);
|
13915 | }
|
13916 | switch (er.code) {
|
13917 | case 'ENOENT':
|
13918 | mkdirP(path.dirname(p), opts, function (er, made) {
|
13919 | if (er) cb(er, made);
|
13920 | else mkdirP(p, opts, cb, made);
|
13921 | });
|
13922 | break;
|
13923 |
|
13924 |
|
13925 |
|
13926 |
|
13927 | default:
|
13928 | xfs.stat(p, function (er2, stat) {
|
13929 |
|
13930 |
|
13931 | if (er2 || !stat.isDirectory()) cb(er, made)
|
13932 | else cb(null, made);
|
13933 | });
|
13934 | break;
|
13935 | }
|
13936 | });
|
13937 | }
|
13938 |
|
13939 | mkdirP.sync = function sync (p, opts, made) {
|
13940 | if (!opts || typeof opts !== 'object') {
|
13941 | opts = { mode: opts };
|
13942 | }
|
13943 |
|
13944 | var mode = opts.mode;
|
13945 | var xfs = opts.fs || fs;
|
13946 |
|
13947 | if (mode === undefined) {
|
13948 | mode = _0777 & (~process.umask());
|
13949 | }
|
13950 | if (!made) made = null;
|
13951 |
|
13952 | p = path.resolve(p);
|
13953 |
|
13954 | try {
|
13955 | xfs.mkdirSync(p, mode);
|
13956 | made = made || p;
|
13957 | }
|
13958 | catch (err0) {
|
13959 | switch (err0.code) {
|
13960 | case 'ENOENT' :
|
13961 | made = sync(path.dirname(p), opts, made);
|
13962 | sync(p, opts, made);
|
13963 | break;
|
13964 |
|
13965 |
|
13966 |
|
13967 |
|
13968 | default:
|
13969 | var stat;
|
13970 | try {
|
13971 | stat = xfs.statSync(p);
|
13972 | }
|
13973 | catch (err1) {
|
13974 | throw err0;
|
13975 | }
|
13976 | if (!stat.isDirectory()) throw err0;
|
13977 | break;
|
13978 | }
|
13979 | }
|
13980 |
|
13981 | return made;
|
13982 | };
|
13983 |
|
13984 | }).call(this,require('_process'))
|
13985 | },{"_process":69,"fs":42,"path":42}],60:[function(require,module,exports){
|
13986 |
|
13987 |
|
13988 |
|
13989 |
|
13990 | var s = 1000;
|
13991 | var m = s * 60;
|
13992 | var h = m * 60;
|
13993 | var d = h * 24;
|
13994 | var w = d * 7;
|
13995 | var y = d * 365.25;
|
13996 |
|
13997 |
|
13998 |
|
13999 |
|
14000 |
|
14001 |
|
14002 |
|
14003 |
|
14004 |
|
14005 |
|
14006 |
|
14007 |
|
14008 |
|
14009 |
|
14010 |
|
14011 | module.exports = function(val, options) {
|
14012 | options = options || {};
|
14013 | var type = typeof val;
|
14014 | if (type === 'string' && val.length > 0) {
|
14015 | return parse(val);
|
14016 | } else if (type === 'number' && isNaN(val) === false) {
|
14017 | return options.long ? fmtLong(val) : fmtShort(val);
|
14018 | }
|
14019 | throw new Error(
|
14020 | 'val is not a non-empty string or a valid number. val=' +
|
14021 | JSON.stringify(val)
|
14022 | );
|
14023 | };
|
14024 |
|
14025 |
|
14026 |
|
14027 |
|
14028 |
|
14029 |
|
14030 |
|
14031 |
|
14032 |
|
14033 | function parse(str) {
|
14034 | str = String(str);
|
14035 | if (str.length > 100) {
|
14036 | return;
|
14037 | }
|
14038 | 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(
|
14039 | str
|
14040 | );
|
14041 | if (!match) {
|
14042 | return;
|
14043 | }
|
14044 | var n = parseFloat(match[1]);
|
14045 | var type = (match[2] || 'ms').toLowerCase();
|
14046 | switch (type) {
|
14047 | case 'years':
|
14048 | case 'year':
|
14049 | case 'yrs':
|
14050 | case 'yr':
|
14051 | case 'y':
|
14052 | return n * y;
|
14053 | case 'weeks':
|
14054 | case 'week':
|
14055 | case 'w':
|
14056 | return n * w;
|
14057 | case 'days':
|
14058 | case 'day':
|
14059 | case 'd':
|
14060 | return n * d;
|
14061 | case 'hours':
|
14062 | case 'hour':
|
14063 | case 'hrs':
|
14064 | case 'hr':
|
14065 | case 'h':
|
14066 | return n * h;
|
14067 | case 'minutes':
|
14068 | case 'minute':
|
14069 | case 'mins':
|
14070 | case 'min':
|
14071 | case 'm':
|
14072 | return n * m;
|
14073 | case 'seconds':
|
14074 | case 'second':
|
14075 | case 'secs':
|
14076 | case 'sec':
|
14077 | case 's':
|
14078 | return n * s;
|
14079 | case 'milliseconds':
|
14080 | case 'millisecond':
|
14081 | case 'msecs':
|
14082 | case 'msec':
|
14083 | case 'ms':
|
14084 | return n;
|
14085 | default:
|
14086 | return undefined;
|
14087 | }
|
14088 | }
|
14089 |
|
14090 |
|
14091 |
|
14092 |
|
14093 |
|
14094 |
|
14095 |
|
14096 |
|
14097 |
|
14098 | function fmtShort(ms) {
|
14099 | var msAbs = Math.abs(ms);
|
14100 | if (msAbs >= d) {
|
14101 | return Math.round(ms / d) + 'd';
|
14102 | }
|
14103 | if (msAbs >= h) {
|
14104 | return Math.round(ms / h) + 'h';
|
14105 | }
|
14106 | if (msAbs >= m) {
|
14107 | return Math.round(ms / m) + 'm';
|
14108 | }
|
14109 | if (msAbs >= s) {
|
14110 | return Math.round(ms / s) + 's';
|
14111 | }
|
14112 | return ms + 'ms';
|
14113 | }
|
14114 |
|
14115 |
|
14116 |
|
14117 |
|
14118 |
|
14119 |
|
14120 |
|
14121 |
|
14122 |
|
14123 | function fmtLong(ms) {
|
14124 | var msAbs = Math.abs(ms);
|
14125 | if (msAbs >= d) {
|
14126 | return plural(ms, msAbs, d, 'day');
|
14127 | }
|
14128 | if (msAbs >= h) {
|
14129 | return plural(ms, msAbs, h, 'hour');
|
14130 | }
|
14131 | if (msAbs >= m) {
|
14132 | return plural(ms, msAbs, m, 'minute');
|
14133 | }
|
14134 | if (msAbs >= s) {
|
14135 | return plural(ms, msAbs, s, 'second');
|
14136 | }
|
14137 | return ms + ' ms';
|
14138 | }
|
14139 |
|
14140 |
|
14141 |
|
14142 |
|
14143 |
|
14144 | function plural(ms, msAbs, n, name) {
|
14145 | var isPlural = msAbs >= n * 1.5;
|
14146 | return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
|
14147 | }
|
14148 |
|
14149 | },{}],61:[function(require,module,exports){
|
14150 | 'use strict';
|
14151 |
|
14152 | var keysShim;
|
14153 | if (!Object.keys) {
|
14154 |
|
14155 | var has = Object.prototype.hasOwnProperty;
|
14156 | var toStr = Object.prototype.toString;
|
14157 | var isArgs = require('./isArguments');
|
14158 | var isEnumerable = Object.prototype.propertyIsEnumerable;
|
14159 | var hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString');
|
14160 | var hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype');
|
14161 | var dontEnums = [
|
14162 | 'toString',
|
14163 | 'toLocaleString',
|
14164 | 'valueOf',
|
14165 | 'hasOwnProperty',
|
14166 | 'isPrototypeOf',
|
14167 | 'propertyIsEnumerable',
|
14168 | 'constructor'
|
14169 | ];
|
14170 | var equalsConstructorPrototype = function (o) {
|
14171 | var ctor = o.constructor;
|
14172 | return ctor && ctor.prototype === o;
|
14173 | };
|
14174 | var excludedKeys = {
|
14175 | $applicationCache: true,
|
14176 | $console: true,
|
14177 | $external: true,
|
14178 | $frame: true,
|
14179 | $frameElement: true,
|
14180 | $frames: true,
|
14181 | $innerHeight: true,
|
14182 | $innerWidth: true,
|
14183 | $outerHeight: true,
|
14184 | $outerWidth: true,
|
14185 | $pageXOffset: true,
|
14186 | $pageYOffset: true,
|
14187 | $parent: true,
|
14188 | $scrollLeft: true,
|
14189 | $scrollTop: true,
|
14190 | $scrollX: true,
|
14191 | $scrollY: true,
|
14192 | $self: true,
|
14193 | $webkitIndexedDB: true,
|
14194 | $webkitStorageInfo: true,
|
14195 | $window: true
|
14196 | };
|
14197 | var hasAutomationEqualityBug = (function () {
|
14198 |
|
14199 | if (typeof window === 'undefined') { return false; }
|
14200 | for (var k in window) {
|
14201 | try {
|
14202 | if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') {
|
14203 | try {
|
14204 | equalsConstructorPrototype(window[k]);
|
14205 | } catch (e) {
|
14206 | return true;
|
14207 | }
|
14208 | }
|
14209 | } catch (e) {
|
14210 | return true;
|
14211 | }
|
14212 | }
|
14213 | return false;
|
14214 | }());
|
14215 | var equalsConstructorPrototypeIfNotBuggy = function (o) {
|
14216 |
|
14217 | if (typeof window === 'undefined' || !hasAutomationEqualityBug) {
|
14218 | return equalsConstructorPrototype(o);
|
14219 | }
|
14220 | try {
|
14221 | return equalsConstructorPrototype(o);
|
14222 | } catch (e) {
|
14223 | return false;
|
14224 | }
|
14225 | };
|
14226 |
|
14227 | keysShim = function keys(object) {
|
14228 | var isObject = object !== null && typeof object === 'object';
|
14229 | var isFunction = toStr.call(object) === '[object Function]';
|
14230 | var isArguments = isArgs(object);
|
14231 | var isString = isObject && toStr.call(object) === '[object String]';
|
14232 | var theKeys = [];
|
14233 |
|
14234 | if (!isObject && !isFunction && !isArguments) {
|
14235 | throw new TypeError('Object.keys called on a non-object');
|
14236 | }
|
14237 |
|
14238 | var skipProto = hasProtoEnumBug && isFunction;
|
14239 | if (isString && object.length > 0 && !has.call(object, 0)) {
|
14240 | for (var i = 0; i < object.length; ++i) {
|
14241 | theKeys.push(String(i));
|
14242 | }
|
14243 | }
|
14244 |
|
14245 | if (isArguments && object.length > 0) {
|
14246 | for (var j = 0; j < object.length; ++j) {
|
14247 | theKeys.push(String(j));
|
14248 | }
|
14249 | } else {
|
14250 | for (var name in object) {
|
14251 | if (!(skipProto && name === 'prototype') && has.call(object, name)) {
|
14252 | theKeys.push(String(name));
|
14253 | }
|
14254 | }
|
14255 | }
|
14256 |
|
14257 | if (hasDontEnumBug) {
|
14258 | var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);
|
14259 |
|
14260 | for (var k = 0; k < dontEnums.length; ++k) {
|
14261 | if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) {
|
14262 | theKeys.push(dontEnums[k]);
|
14263 | }
|
14264 | }
|
14265 | }
|
14266 | return theKeys;
|
14267 | };
|
14268 | }
|
14269 | module.exports = keysShim;
|
14270 |
|
14271 | },{"./isArguments":63}],62:[function(require,module,exports){
|
14272 | 'use strict';
|
14273 |
|
14274 | var slice = Array.prototype.slice;
|
14275 | var isArgs = require('./isArguments');
|
14276 |
|
14277 | var origKeys = Object.keys;
|
14278 | var keysShim = origKeys ? function keys(o) { return origKeys(o); } : require('./implementation');
|
14279 |
|
14280 | var originalKeys = Object.keys;
|
14281 |
|
14282 | keysShim.shim = function shimObjectKeys() {
|
14283 | if (Object.keys) {
|
14284 | var keysWorksWithArguments = (function () {
|
14285 |
|
14286 | var args = Object.keys(arguments);
|
14287 | return args && args.length === arguments.length;
|
14288 | }(1, 2));
|
14289 | if (!keysWorksWithArguments) {
|
14290 | Object.keys = function keys(object) {
|
14291 | if (isArgs(object)) {
|
14292 | return originalKeys(slice.call(object));
|
14293 | }
|
14294 | return originalKeys(object);
|
14295 | };
|
14296 | }
|
14297 | } else {
|
14298 | Object.keys = keysShim;
|
14299 | }
|
14300 | return Object.keys || keysShim;
|
14301 | };
|
14302 |
|
14303 | module.exports = keysShim;
|
14304 |
|
14305 | },{"./implementation":61,"./isArguments":63}],63:[function(require,module,exports){
|
14306 | 'use strict';
|
14307 |
|
14308 | var toStr = Object.prototype.toString;
|
14309 |
|
14310 | module.exports = function isArguments(value) {
|
14311 | var str = toStr.call(value);
|
14312 | var isArgs = str === '[object Arguments]';
|
14313 | if (!isArgs) {
|
14314 | isArgs = str !== '[object Array]' &&
|
14315 | value !== null &&
|
14316 | typeof value === 'object' &&
|
14317 | typeof value.length === 'number' &&
|
14318 | value.length >= 0 &&
|
14319 | toStr.call(value.callee) === '[object Function]';
|
14320 | }
|
14321 | return isArgs;
|
14322 | };
|
14323 |
|
14324 | },{}],64:[function(require,module,exports){
|
14325 | 'use strict';
|
14326 |
|
14327 |
|
14328 | var keys = require('object-keys');
|
14329 | var bind = require('function-bind');
|
14330 | var canBeObject = function (obj) {
|
14331 | return typeof obj !== 'undefined' && obj !== null;
|
14332 | };
|
14333 | var hasSymbols = require('has-symbols/shams')();
|
14334 | var toObject = Object;
|
14335 | var push = bind.call(Function.call, Array.prototype.push);
|
14336 | var propIsEnumerable = bind.call(Function.call, Object.prototype.propertyIsEnumerable);
|
14337 | var originalGetSymbols = hasSymbols ? Object.getOwnPropertySymbols : null;
|
14338 |
|
14339 | module.exports = function assign(target, source1) {
|
14340 | if (!canBeObject(target)) { throw new TypeError('target must be an object'); }
|
14341 | var objTarget = toObject(target);
|
14342 | var s, source, i, props, syms, value, key;
|
14343 | for (s = 1; s < arguments.length; ++s) {
|
14344 | source = toObject(arguments[s]);
|
14345 | props = keys(source);
|
14346 | var getSymbols = hasSymbols && (Object.getOwnPropertySymbols || originalGetSymbols);
|
14347 | if (getSymbols) {
|
14348 | syms = getSymbols(source);
|
14349 | for (i = 0; i < syms.length; ++i) {
|
14350 | key = syms[i];
|
14351 | if (propIsEnumerable(source, key)) {
|
14352 | push(props, key);
|
14353 | }
|
14354 | }
|
14355 | }
|
14356 | for (i = 0; i < props.length; ++i) {
|
14357 | key = props[i];
|
14358 | value = source[key];
|
14359 | if (propIsEnumerable(source, key)) {
|
14360 | objTarget[key] = value;
|
14361 | }
|
14362 | }
|
14363 | }
|
14364 | return objTarget;
|
14365 | };
|
14366 |
|
14367 | },{"function-bind":52,"has-symbols/shams":53,"object-keys":62}],65:[function(require,module,exports){
|
14368 | 'use strict';
|
14369 |
|
14370 | var defineProperties = require('define-properties');
|
14371 |
|
14372 | var implementation = require('./implementation');
|
14373 | var getPolyfill = require('./polyfill');
|
14374 | var shim = require('./shim');
|
14375 |
|
14376 | var polyfill = getPolyfill();
|
14377 |
|
14378 | defineProperties(polyfill, {
|
14379 | getPolyfill: getPolyfill,
|
14380 | implementation: implementation,
|
14381 | shim: shim
|
14382 | });
|
14383 |
|
14384 | module.exports = polyfill;
|
14385 |
|
14386 | },{"./implementation":64,"./polyfill":66,"./shim":67,"define-properties":47}],66:[function(require,module,exports){
|
14387 | 'use strict';
|
14388 |
|
14389 | var implementation = require('./implementation');
|
14390 |
|
14391 | var lacksProperEnumerationOrder = function () {
|
14392 | if (!Object.assign) {
|
14393 | return false;
|
14394 | }
|
14395 |
|
14396 |
|
14397 | var str = 'abcdefghijklmnopqrst';
|
14398 | var letters = str.split('');
|
14399 | var map = {};
|
14400 | for (var i = 0; i < letters.length; ++i) {
|
14401 | map[letters[i]] = letters[i];
|
14402 | }
|
14403 | var obj = Object.assign({}, map);
|
14404 | var actual = '';
|
14405 | for (var k in obj) {
|
14406 | actual += k;
|
14407 | }
|
14408 | return str !== actual;
|
14409 | };
|
14410 |
|
14411 | var assignHasPendingExceptions = function () {
|
14412 | if (!Object.assign || !Object.preventExtensions) {
|
14413 | return false;
|
14414 | }
|
14415 |
|
14416 |
|
14417 | var thrower = Object.preventExtensions({ 1: 2 });
|
14418 | try {
|
14419 | Object.assign(thrower, 'xy');
|
14420 | } catch (e) {
|
14421 | return thrower[1] === 'y';
|
14422 | }
|
14423 | return false;
|
14424 | };
|
14425 |
|
14426 | module.exports = function getPolyfill() {
|
14427 | if (!Object.assign) {
|
14428 | return implementation;
|
14429 | }
|
14430 | if (lacksProperEnumerationOrder()) {
|
14431 | return implementation;
|
14432 | }
|
14433 | if (assignHasPendingExceptions()) {
|
14434 | return implementation;
|
14435 | }
|
14436 | return Object.assign;
|
14437 | };
|
14438 |
|
14439 | },{"./implementation":64}],67:[function(require,module,exports){
|
14440 | 'use strict';
|
14441 |
|
14442 | var define = require('define-properties');
|
14443 | var getPolyfill = require('./polyfill');
|
14444 |
|
14445 | module.exports = function shimAssign() {
|
14446 | var polyfill = getPolyfill();
|
14447 | define(
|
14448 | Object,
|
14449 | { assign: polyfill },
|
14450 | { assign: function () { return Object.assign !== polyfill; } }
|
14451 | );
|
14452 | return polyfill;
|
14453 | };
|
14454 |
|
14455 | },{"./polyfill":66,"define-properties":47}],68:[function(require,module,exports){
|
14456 | (function (process){
|
14457 | 'use strict';
|
14458 |
|
14459 | if (!process.version ||
|
14460 | process.version.indexOf('v0.') === 0 ||
|
14461 | process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {
|
14462 | module.exports = { nextTick: nextTick };
|
14463 | } else {
|
14464 | module.exports = process
|
14465 | }
|
14466 |
|
14467 | function nextTick(fn, arg1, arg2, arg3) {
|
14468 | if (typeof fn !== 'function') {
|
14469 | throw new TypeError('"callback" argument must be a function');
|
14470 | }
|
14471 | var len = arguments.length;
|
14472 | var args, i;
|
14473 | switch (len) {
|
14474 | case 0:
|
14475 | case 1:
|
14476 | return process.nextTick(fn);
|
14477 | case 2:
|
14478 | return process.nextTick(function afterTickOne() {
|
14479 | fn.call(null, arg1);
|
14480 | });
|
14481 | case 3:
|
14482 | return process.nextTick(function afterTickTwo() {
|
14483 | fn.call(null, arg1, arg2);
|
14484 | });
|
14485 | case 4:
|
14486 | return process.nextTick(function afterTickThree() {
|
14487 | fn.call(null, arg1, arg2, arg3);
|
14488 | });
|
14489 | default:
|
14490 | args = new Array(len - 1);
|
14491 | i = 0;
|
14492 | while (i < args.length) {
|
14493 | args[i++] = arguments[i];
|
14494 | }
|
14495 | return process.nextTick(function afterTick() {
|
14496 | fn.apply(null, args);
|
14497 | });
|
14498 | }
|
14499 | }
|
14500 |
|
14501 |
|
14502 | }).call(this,require('_process'))
|
14503 | },{"_process":69}],69:[function(require,module,exports){
|
14504 |
|
14505 | var process = module.exports = {};
|
14506 |
|
14507 |
|
14508 |
|
14509 |
|
14510 |
|
14511 |
|
14512 | var cachedSetTimeout;
|
14513 | var cachedClearTimeout;
|
14514 |
|
14515 | function defaultSetTimout() {
|
14516 | throw new Error('setTimeout has not been defined');
|
14517 | }
|
14518 | function defaultClearTimeout () {
|
14519 | throw new Error('clearTimeout has not been defined');
|
14520 | }
|
14521 | (function () {
|
14522 | try {
|
14523 | if (typeof setTimeout === 'function') {
|
14524 | cachedSetTimeout = setTimeout;
|
14525 | } else {
|
14526 | cachedSetTimeout = defaultSetTimout;
|
14527 | }
|
14528 | } catch (e) {
|
14529 | cachedSetTimeout = defaultSetTimout;
|
14530 | }
|
14531 | try {
|
14532 | if (typeof clearTimeout === 'function') {
|
14533 | cachedClearTimeout = clearTimeout;
|
14534 | } else {
|
14535 | cachedClearTimeout = defaultClearTimeout;
|
14536 | }
|
14537 | } catch (e) {
|
14538 | cachedClearTimeout = defaultClearTimeout;
|
14539 | }
|
14540 | } ())
|
14541 | function runTimeout(fun) {
|
14542 | if (cachedSetTimeout === setTimeout) {
|
14543 |
|
14544 | return setTimeout(fun, 0);
|
14545 | }
|
14546 |
|
14547 | if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
14548 | cachedSetTimeout = setTimeout;
|
14549 | return setTimeout(fun, 0);
|
14550 | }
|
14551 | try {
|
14552 |
|
14553 | return cachedSetTimeout(fun, 0);
|
14554 | } catch(e){
|
14555 | try {
|
14556 |
|
14557 | return cachedSetTimeout.call(null, fun, 0);
|
14558 | } catch(e){
|
14559 |
|
14560 | return cachedSetTimeout.call(this, fun, 0);
|
14561 | }
|
14562 | }
|
14563 |
|
14564 |
|
14565 | }
|
14566 | function runClearTimeout(marker) {
|
14567 | if (cachedClearTimeout === clearTimeout) {
|
14568 |
|
14569 | return clearTimeout(marker);
|
14570 | }
|
14571 |
|
14572 | if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
14573 | cachedClearTimeout = clearTimeout;
|
14574 | return clearTimeout(marker);
|
14575 | }
|
14576 | try {
|
14577 |
|
14578 | return cachedClearTimeout(marker);
|
14579 | } catch (e){
|
14580 | try {
|
14581 |
|
14582 | return cachedClearTimeout.call(null, marker);
|
14583 | } catch (e){
|
14584 |
|
14585 |
|
14586 | return cachedClearTimeout.call(this, marker);
|
14587 | }
|
14588 | }
|
14589 |
|
14590 |
|
14591 |
|
14592 | }
|
14593 | var queue = [];
|
14594 | var draining = false;
|
14595 | var currentQueue;
|
14596 | var queueIndex = -1;
|
14597 |
|
14598 | function cleanUpNextTick() {
|
14599 | if (!draining || !currentQueue) {
|
14600 | return;
|
14601 | }
|
14602 | draining = false;
|
14603 | if (currentQueue.length) {
|
14604 | queue = currentQueue.concat(queue);
|
14605 | } else {
|
14606 | queueIndex = -1;
|
14607 | }
|
14608 | if (queue.length) {
|
14609 | drainQueue();
|
14610 | }
|
14611 | }
|
14612 |
|
14613 | function drainQueue() {
|
14614 | if (draining) {
|
14615 | return;
|
14616 | }
|
14617 | var timeout = runTimeout(cleanUpNextTick);
|
14618 | draining = true;
|
14619 |
|
14620 | var len = queue.length;
|
14621 | while(len) {
|
14622 | currentQueue = queue;
|
14623 | queue = [];
|
14624 | while (++queueIndex < len) {
|
14625 | if (currentQueue) {
|
14626 | currentQueue[queueIndex].run();
|
14627 | }
|
14628 | }
|
14629 | queueIndex = -1;
|
14630 | len = queue.length;
|
14631 | }
|
14632 | currentQueue = null;
|
14633 | draining = false;
|
14634 | runClearTimeout(timeout);
|
14635 | }
|
14636 |
|
14637 | process.nextTick = function (fun) {
|
14638 | var args = new Array(arguments.length - 1);
|
14639 | if (arguments.length > 1) {
|
14640 | for (var i = 1; i < arguments.length; i++) {
|
14641 | args[i - 1] = arguments[i];
|
14642 | }
|
14643 | }
|
14644 | queue.push(new Item(fun, args));
|
14645 | if (queue.length === 1 && !draining) {
|
14646 | runTimeout(drainQueue);
|
14647 | }
|
14648 | };
|
14649 |
|
14650 |
|
14651 | function Item(fun, array) {
|
14652 | this.fun = fun;
|
14653 | this.array = array;
|
14654 | }
|
14655 | Item.prototype.run = function () {
|
14656 | this.fun.apply(null, this.array);
|
14657 | };
|
14658 | process.title = 'browser';
|
14659 | process.browser = true;
|
14660 | process.env = {};
|
14661 | process.argv = [];
|
14662 | process.version = '';
|
14663 | process.versions = {};
|
14664 |
|
14665 | function noop() {}
|
14666 |
|
14667 | process.on = noop;
|
14668 | process.addListener = noop;
|
14669 | process.once = noop;
|
14670 | process.off = noop;
|
14671 | process.removeListener = noop;
|
14672 | process.removeAllListeners = noop;
|
14673 | process.emit = noop;
|
14674 | process.prependListener = noop;
|
14675 | process.prependOnceListener = noop;
|
14676 |
|
14677 | process.listeners = function (name) { return [] }
|
14678 |
|
14679 | process.binding = function (name) {
|
14680 | throw new Error('process.binding is not supported');
|
14681 | };
|
14682 |
|
14683 | process.cwd = function () { return '/' };
|
14684 | process.chdir = function (dir) {
|
14685 | throw new Error('process.chdir is not supported');
|
14686 | };
|
14687 | process.umask = function() { return 0; };
|
14688 |
|
14689 | },{}],70:[function(require,module,exports){
|
14690 | module.exports = require('./lib/_stream_duplex.js');
|
14691 |
|
14692 | },{"./lib/_stream_duplex.js":71}],71:[function(require,module,exports){
|
14693 |
|
14694 |
|
14695 |
|
14696 |
|
14697 |
|
14698 |
|
14699 |
|
14700 |
|
14701 |
|
14702 |
|
14703 |
|
14704 |
|
14705 |
|
14706 |
|
14707 |
|
14708 |
|
14709 |
|
14710 |
|
14711 |
|
14712 |
|
14713 |
|
14714 |
|
14715 |
|
14716 |
|
14717 |
|
14718 |
|
14719 | 'use strict';
|
14720 |
|
14721 |
|
14722 |
|
14723 | var pna = require('process-nextick-args');
|
14724 |
|
14725 |
|
14726 |
|
14727 | var objectKeys = Object.keys || function (obj) {
|
14728 | var keys = [];
|
14729 | for (var key in obj) {
|
14730 | keys.push(key);
|
14731 | }return keys;
|
14732 | };
|
14733 |
|
14734 |
|
14735 | module.exports = Duplex;
|
14736 |
|
14737 |
|
14738 | var util = require('core-util-is');
|
14739 | util.inherits = require('inherits');
|
14740 |
|
14741 |
|
14742 | var Readable = require('./_stream_readable');
|
14743 | var Writable = require('./_stream_writable');
|
14744 |
|
14745 | util.inherits(Duplex, Readable);
|
14746 |
|
14747 | {
|
14748 |
|
14749 | var keys = objectKeys(Writable.prototype);
|
14750 | for (var v = 0; v < keys.length; v++) {
|
14751 | var method = keys[v];
|
14752 | if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
|
14753 | }
|
14754 | }
|
14755 |
|
14756 | function Duplex(options) {
|
14757 | if (!(this instanceof Duplex)) return new Duplex(options);
|
14758 |
|
14759 | Readable.call(this, options);
|
14760 | Writable.call(this, options);
|
14761 |
|
14762 | if (options && options.readable === false) this.readable = false;
|
14763 |
|
14764 | if (options && options.writable === false) this.writable = false;
|
14765 |
|
14766 | this.allowHalfOpen = true;
|
14767 | if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
|
14768 |
|
14769 | this.once('end', onend);
|
14770 | }
|
14771 |
|
14772 | Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
|
14773 |
|
14774 |
|
14775 |
|
14776 | enumerable: false,
|
14777 | get: function () {
|
14778 | return this._writableState.highWaterMark;
|
14779 | }
|
14780 | });
|
14781 |
|
14782 |
|
14783 | function onend() {
|
14784 |
|
14785 |
|
14786 | if (this.allowHalfOpen || this._writableState.ended) return;
|
14787 |
|
14788 |
|
14789 |
|
14790 | pna.nextTick(onEndNT, this);
|
14791 | }
|
14792 |
|
14793 | function onEndNT(self) {
|
14794 | self.end();
|
14795 | }
|
14796 |
|
14797 | Object.defineProperty(Duplex.prototype, 'destroyed', {
|
14798 | get: function () {
|
14799 | if (this._readableState === undefined || this._writableState === undefined) {
|
14800 | return false;
|
14801 | }
|
14802 | return this._readableState.destroyed && this._writableState.destroyed;
|
14803 | },
|
14804 | set: function (value) {
|
14805 |
|
14806 |
|
14807 | if (this._readableState === undefined || this._writableState === undefined) {
|
14808 | return;
|
14809 | }
|
14810 |
|
14811 |
|
14812 |
|
14813 | this._readableState.destroyed = value;
|
14814 | this._writableState.destroyed = value;
|
14815 | }
|
14816 | });
|
14817 |
|
14818 | Duplex.prototype._destroy = function (err, cb) {
|
14819 | this.push(null);
|
14820 | this.end();
|
14821 |
|
14822 | pna.nextTick(cb, err);
|
14823 | };
|
14824 | },{"./_stream_readable":73,"./_stream_writable":75,"core-util-is":44,"inherits":56,"process-nextick-args":68}],72:[function(require,module,exports){
|
14825 |
|
14826 |
|
14827 |
|
14828 |
|
14829 |
|
14830 |
|
14831 |
|
14832 |
|
14833 |
|
14834 |
|
14835 |
|
14836 |
|
14837 |
|
14838 |
|
14839 |
|
14840 |
|
14841 |
|
14842 |
|
14843 |
|
14844 |
|
14845 |
|
14846 |
|
14847 |
|
14848 |
|
14849 |
|
14850 | 'use strict';
|
14851 |
|
14852 | module.exports = PassThrough;
|
14853 |
|
14854 | var Transform = require('./_stream_transform');
|
14855 |
|
14856 |
|
14857 | var util = require('core-util-is');
|
14858 | util.inherits = require('inherits');
|
14859 |
|
14860 |
|
14861 | util.inherits(PassThrough, Transform);
|
14862 |
|
14863 | function PassThrough(options) {
|
14864 | if (!(this instanceof PassThrough)) return new PassThrough(options);
|
14865 |
|
14866 | Transform.call(this, options);
|
14867 | }
|
14868 |
|
14869 | PassThrough.prototype._transform = function (chunk, encoding, cb) {
|
14870 | cb(null, chunk);
|
14871 | };
|
14872 | },{"./_stream_transform":74,"core-util-is":44,"inherits":56}],73:[function(require,module,exports){
|
14873 | (function (process,global){
|
14874 |
|
14875 |
|
14876 |
|
14877 |
|
14878 |
|
14879 |
|
14880 |
|
14881 |
|
14882 |
|
14883 |
|
14884 |
|
14885 |
|
14886 |
|
14887 |
|
14888 |
|
14889 |
|
14890 |
|
14891 |
|
14892 |
|
14893 |
|
14894 |
|
14895 | 'use strict';
|
14896 |
|
14897 |
|
14898 |
|
14899 | var pna = require('process-nextick-args');
|
14900 |
|
14901 |
|
14902 | module.exports = Readable;
|
14903 |
|
14904 |
|
14905 | var isArray = require('isarray');
|
14906 |
|
14907 |
|
14908 |
|
14909 | var Duplex;
|
14910 |
|
14911 |
|
14912 | Readable.ReadableState = ReadableState;
|
14913 |
|
14914 |
|
14915 | var EE = require('events').EventEmitter;
|
14916 |
|
14917 | var EElistenerCount = function (emitter, type) {
|
14918 | return emitter.listeners(type).length;
|
14919 | };
|
14920 |
|
14921 |
|
14922 |
|
14923 | var Stream = require('./internal/streams/stream');
|
14924 |
|
14925 |
|
14926 |
|
14927 |
|
14928 | var Buffer = require('safe-buffer').Buffer;
|
14929 | var OurUint8Array = global.Uint8Array || function () {};
|
14930 | function _uint8ArrayToBuffer(chunk) {
|
14931 | return Buffer.from(chunk);
|
14932 | }
|
14933 | function _isUint8Array(obj) {
|
14934 | return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
|
14935 | }
|
14936 |
|
14937 |
|
14938 |
|
14939 |
|
14940 | var util = require('core-util-is');
|
14941 | util.inherits = require('inherits');
|
14942 |
|
14943 |
|
14944 |
|
14945 | var debugUtil = require('util');
|
14946 | var debug = void 0;
|
14947 | if (debugUtil && debugUtil.debuglog) {
|
14948 | debug = debugUtil.debuglog('stream');
|
14949 | } else {
|
14950 | debug = function () {};
|
14951 | }
|
14952 |
|
14953 |
|
14954 | var BufferList = require('./internal/streams/BufferList');
|
14955 | var destroyImpl = require('./internal/streams/destroy');
|
14956 | var StringDecoder;
|
14957 |
|
14958 | util.inherits(Readable, Stream);
|
14959 |
|
14960 | var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];
|
14961 |
|
14962 | function prependListener(emitter, event, fn) {
|
14963 |
|
14964 |
|
14965 | if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn);
|
14966 |
|
14967 |
|
14968 |
|
14969 |
|
14970 |
|
14971 | 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]];
|
14972 | }
|
14973 |
|
14974 | function ReadableState(options, stream) {
|
14975 | Duplex = Duplex || require('./_stream_duplex');
|
14976 |
|
14977 | options = options || {};
|
14978 |
|
14979 |
|
14980 |
|
14981 |
|
14982 |
|
14983 |
|
14984 | var isDuplex = stream instanceof Duplex;
|
14985 |
|
14986 |
|
14987 |
|
14988 | this.objectMode = !!options.objectMode;
|
14989 |
|
14990 | if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
|
14991 |
|
14992 |
|
14993 |
|
14994 | var hwm = options.highWaterMark;
|
14995 | var readableHwm = options.readableHighWaterMark;
|
14996 | var defaultHwm = this.objectMode ? 16 : 16 * 1024;
|
14997 |
|
14998 | if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm;
|
14999 |
|
15000 |
|
15001 | this.highWaterMark = Math.floor(this.highWaterMark);
|
15002 |
|
15003 |
|
15004 |
|
15005 |
|
15006 | this.buffer = new BufferList();
|
15007 | this.length = 0;
|
15008 | this.pipes = null;
|
15009 | this.pipesCount = 0;
|
15010 | this.flowing = null;
|
15011 | this.ended = false;
|
15012 | this.endEmitted = false;
|
15013 | this.reading = false;
|
15014 |
|
15015 |
|
15016 |
|
15017 |
|
15018 |
|
15019 | this.sync = true;
|
15020 |
|
15021 |
|
15022 |
|
15023 | this.needReadable = false;
|
15024 | this.emittedReadable = false;
|
15025 | this.readableListening = false;
|
15026 | this.resumeScheduled = false;
|
15027 |
|
15028 |
|
15029 | this.destroyed = false;
|
15030 |
|
15031 |
|
15032 |
|
15033 |
|
15034 | this.defaultEncoding = options.defaultEncoding || 'utf8';
|
15035 |
|
15036 |
|
15037 | this.awaitDrain = 0;
|
15038 |
|
15039 |
|
15040 | this.readingMore = false;
|
15041 |
|
15042 | this.decoder = null;
|
15043 | this.encoding = null;
|
15044 | if (options.encoding) {
|
15045 | if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
|
15046 | this.decoder = new StringDecoder(options.encoding);
|
15047 | this.encoding = options.encoding;
|
15048 | }
|
15049 | }
|
15050 |
|
15051 | function Readable(options) {
|
15052 | Duplex = Duplex || require('./_stream_duplex');
|
15053 |
|
15054 | if (!(this instanceof Readable)) return new Readable(options);
|
15055 |
|
15056 | this._readableState = new ReadableState(options, this);
|
15057 |
|
15058 |
|
15059 | this.readable = true;
|
15060 |
|
15061 | if (options) {
|
15062 | if (typeof options.read === 'function') this._read = options.read;
|
15063 |
|
15064 | if (typeof options.destroy === 'function') this._destroy = options.destroy;
|
15065 | }
|
15066 |
|
15067 | Stream.call(this);
|
15068 | }
|
15069 |
|
15070 | Object.defineProperty(Readable.prototype, 'destroyed', {
|
15071 | get: function () {
|
15072 | if (this._readableState === undefined) {
|
15073 | return false;
|
15074 | }
|
15075 | return this._readableState.destroyed;
|
15076 | },
|
15077 | set: function (value) {
|
15078 |
|
15079 |
|
15080 | if (!this._readableState) {
|
15081 | return;
|
15082 | }
|
15083 |
|
15084 |
|
15085 |
|
15086 | this._readableState.destroyed = value;
|
15087 | }
|
15088 | });
|
15089 |
|
15090 | Readable.prototype.destroy = destroyImpl.destroy;
|
15091 | Readable.prototype._undestroy = destroyImpl.undestroy;
|
15092 | Readable.prototype._destroy = function (err, cb) {
|
15093 | this.push(null);
|
15094 | cb(err);
|
15095 | };
|
15096 |
|
15097 |
|
15098 |
|
15099 |
|
15100 |
|
15101 | Readable.prototype.push = function (chunk, encoding) {
|
15102 | var state = this._readableState;
|
15103 | var skipChunkCheck;
|
15104 |
|
15105 | if (!state.objectMode) {
|
15106 | if (typeof chunk === 'string') {
|
15107 | encoding = encoding || state.defaultEncoding;
|
15108 | if (encoding !== state.encoding) {
|
15109 | chunk = Buffer.from(chunk, encoding);
|
15110 | encoding = '';
|
15111 | }
|
15112 | skipChunkCheck = true;
|
15113 | }
|
15114 | } else {
|
15115 | skipChunkCheck = true;
|
15116 | }
|
15117 |
|
15118 | return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
|
15119 | };
|
15120 |
|
15121 |
|
15122 | Readable.prototype.unshift = function (chunk) {
|
15123 | return readableAddChunk(this, chunk, null, true, false);
|
15124 | };
|
15125 |
|
15126 | function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
|
15127 | var state = stream._readableState;
|
15128 | if (chunk === null) {
|
15129 | state.reading = false;
|
15130 | onEofChunk(stream, state);
|
15131 | } else {
|
15132 | var er;
|
15133 | if (!skipChunkCheck) er = chunkInvalid(state, chunk);
|
15134 | if (er) {
|
15135 | stream.emit('error', er);
|
15136 | } else if (state.objectMode || chunk && chunk.length > 0) {
|
15137 | if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {
|
15138 | chunk = _uint8ArrayToBuffer(chunk);
|
15139 | }
|
15140 |
|
15141 | if (addToFront) {
|
15142 | if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true);
|
15143 | } else if (state.ended) {
|
15144 | stream.emit('error', new Error('stream.push() after EOF'));
|
15145 | } else {
|
15146 | state.reading = false;
|
15147 | if (state.decoder && !encoding) {
|
15148 | chunk = state.decoder.write(chunk);
|
15149 | if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);
|
15150 | } else {
|
15151 | addChunk(stream, state, chunk, false);
|
15152 | }
|
15153 | }
|
15154 | } else if (!addToFront) {
|
15155 | state.reading = false;
|
15156 | }
|
15157 | }
|
15158 |
|
15159 | return needMoreData(state);
|
15160 | }
|
15161 |
|
15162 | function addChunk(stream, state, chunk, addToFront) {
|
15163 | if (state.flowing && state.length === 0 && !state.sync) {
|
15164 | stream.emit('data', chunk);
|
15165 | stream.read(0);
|
15166 | } else {
|
15167 |
|
15168 | state.length += state.objectMode ? 1 : chunk.length;
|
15169 | if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);
|
15170 |
|
15171 | if (state.needReadable) emitReadable(stream);
|
15172 | }
|
15173 | maybeReadMore(stream, state);
|
15174 | }
|
15175 |
|
15176 | function chunkInvalid(state, chunk) {
|
15177 | var er;
|
15178 | if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
|
15179 | er = new TypeError('Invalid non-string/buffer chunk');
|
15180 | }
|
15181 | return er;
|
15182 | }
|
15183 |
|
15184 |
|
15185 |
|
15186 |
|
15187 |
|
15188 |
|
15189 |
|
15190 |
|
15191 | function needMoreData(state) {
|
15192 | return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
|
15193 | }
|
15194 |
|
15195 | Readable.prototype.isPaused = function () {
|
15196 | return this._readableState.flowing === false;
|
15197 | };
|
15198 |
|
15199 |
|
15200 | Readable.prototype.setEncoding = function (enc) {
|
15201 | if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
|
15202 | this._readableState.decoder = new StringDecoder(enc);
|
15203 | this._readableState.encoding = enc;
|
15204 | return this;
|
15205 | };
|
15206 |
|
15207 |
|
15208 | var MAX_HWM = 0x800000;
|
15209 | function computeNewHighWaterMark(n) {
|
15210 | if (n >= MAX_HWM) {
|
15211 | n = MAX_HWM;
|
15212 | } else {
|
15213 |
|
15214 |
|
15215 | n--;
|
15216 | n |= n >>> 1;
|
15217 | n |= n >>> 2;
|
15218 | n |= n >>> 4;
|
15219 | n |= n >>> 8;
|
15220 | n |= n >>> 16;
|
15221 | n++;
|
15222 | }
|
15223 | return n;
|
15224 | }
|
15225 |
|
15226 |
|
15227 |
|
15228 | function howMuchToRead(n, state) {
|
15229 | if (n <= 0 || state.length === 0 && state.ended) return 0;
|
15230 | if (state.objectMode) return 1;
|
15231 | if (n !== n) {
|
15232 |
|
15233 | if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
|
15234 | }
|
15235 |
|
15236 | if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
|
15237 | if (n <= state.length) return n;
|
15238 |
|
15239 | if (!state.ended) {
|
15240 | state.needReadable = true;
|
15241 | return 0;
|
15242 | }
|
15243 | return state.length;
|
15244 | }
|
15245 |
|
15246 |
|
15247 | Readable.prototype.read = function (n) {
|
15248 | debug('read', n);
|
15249 | n = parseInt(n, 10);
|
15250 | var state = this._readableState;
|
15251 | var nOrig = n;
|
15252 |
|
15253 | if (n !== 0) state.emittedReadable = false;
|
15254 |
|
15255 |
|
15256 |
|
15257 |
|
15258 | if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
|
15259 | debug('read: emitReadable', state.length, state.ended);
|
15260 | if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
|
15261 | return null;
|
15262 | }
|
15263 |
|
15264 | n = howMuchToRead(n, state);
|
15265 |
|
15266 |
|
15267 | if (n === 0 && state.ended) {
|
15268 | if (state.length === 0) endReadable(this);
|
15269 | return null;
|
15270 | }
|
15271 |
|
15272 |
|
15273 |
|
15274 |
|
15275 |
|
15276 |
|
15277 |
|
15278 |
|
15279 |
|
15280 |
|
15281 |
|
15282 |
|
15283 |
|
15284 |
|
15285 |
|
15286 |
|
15287 |
|
15288 |
|
15289 |
|
15290 |
|
15291 |
|
15292 |
|
15293 |
|
15294 |
|
15295 | var doRead = state.needReadable;
|
15296 | debug('need readable', doRead);
|
15297 |
|
15298 |
|
15299 | if (state.length === 0 || state.length - n < state.highWaterMark) {
|
15300 | doRead = true;
|
15301 | debug('length less than watermark', doRead);
|
15302 | }
|
15303 |
|
15304 |
|
15305 |
|
15306 | if (state.ended || state.reading) {
|
15307 | doRead = false;
|
15308 | debug('reading or ended', doRead);
|
15309 | } else if (doRead) {
|
15310 | debug('do read');
|
15311 | state.reading = true;
|
15312 | state.sync = true;
|
15313 |
|
15314 | if (state.length === 0) state.needReadable = true;
|
15315 |
|
15316 | this._read(state.highWaterMark);
|
15317 | state.sync = false;
|
15318 |
|
15319 |
|
15320 | if (!state.reading) n = howMuchToRead(nOrig, state);
|
15321 | }
|
15322 |
|
15323 | var ret;
|
15324 | if (n > 0) ret = fromList(n, state);else ret = null;
|
15325 |
|
15326 | if (ret === null) {
|
15327 | state.needReadable = true;
|
15328 | n = 0;
|
15329 | } else {
|
15330 | state.length -= n;
|
15331 | }
|
15332 |
|
15333 | if (state.length === 0) {
|
15334 |
|
15335 |
|
15336 | if (!state.ended) state.needReadable = true;
|
15337 |
|
15338 |
|
15339 | if (nOrig !== n && state.ended) endReadable(this);
|
15340 | }
|
15341 |
|
15342 | if (ret !== null) this.emit('data', ret);
|
15343 |
|
15344 | return ret;
|
15345 | };
|
15346 |
|
15347 | function onEofChunk(stream, state) {
|
15348 | if (state.ended) return;
|
15349 | if (state.decoder) {
|
15350 | var chunk = state.decoder.end();
|
15351 | if (chunk && chunk.length) {
|
15352 | state.buffer.push(chunk);
|
15353 | state.length += state.objectMode ? 1 : chunk.length;
|
15354 | }
|
15355 | }
|
15356 | state.ended = true;
|
15357 |
|
15358 |
|
15359 | emitReadable(stream);
|
15360 | }
|
15361 |
|
15362 |
|
15363 |
|
15364 |
|
15365 | function emitReadable(stream) {
|
15366 | var state = stream._readableState;
|
15367 | state.needReadable = false;
|
15368 | if (!state.emittedReadable) {
|
15369 | debug('emitReadable', state.flowing);
|
15370 | state.emittedReadable = true;
|
15371 | if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream);
|
15372 | }
|
15373 | }
|
15374 |
|
15375 | function emitReadable_(stream) {
|
15376 | debug('emit readable');
|
15377 | stream.emit('readable');
|
15378 | flow(stream);
|
15379 | }
|
15380 |
|
15381 |
|
15382 |
|
15383 |
|
15384 |
|
15385 |
|
15386 |
|
15387 | function maybeReadMore(stream, state) {
|
15388 | if (!state.readingMore) {
|
15389 | state.readingMore = true;
|
15390 | pna.nextTick(maybeReadMore_, stream, state);
|
15391 | }
|
15392 | }
|
15393 |
|
15394 | function maybeReadMore_(stream, state) {
|
15395 | var len = state.length;
|
15396 | while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
|
15397 | debug('maybeReadMore read 0');
|
15398 | stream.read(0);
|
15399 | if (len === state.length)
|
15400 |
|
15401 | break;else len = state.length;
|
15402 | }
|
15403 | state.readingMore = false;
|
15404 | }
|
15405 |
|
15406 |
|
15407 |
|
15408 |
|
15409 |
|
15410 | Readable.prototype._read = function (n) {
|
15411 | this.emit('error', new Error('_read() is not implemented'));
|
15412 | };
|
15413 |
|
15414 | Readable.prototype.pipe = function (dest, pipeOpts) {
|
15415 | var src = this;
|
15416 | var state = this._readableState;
|
15417 |
|
15418 | switch (state.pipesCount) {
|
15419 | case 0:
|
15420 | state.pipes = dest;
|
15421 | break;
|
15422 | case 1:
|
15423 | state.pipes = [state.pipes, dest];
|
15424 | break;
|
15425 | default:
|
15426 | state.pipes.push(dest);
|
15427 | break;
|
15428 | }
|
15429 | state.pipesCount += 1;
|
15430 | debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
|
15431 |
|
15432 | var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
|
15433 |
|
15434 | var endFn = doEnd ? onend : unpipe;
|
15435 | if (state.endEmitted) pna.nextTick(endFn);else src.once('end', endFn);
|
15436 |
|
15437 | dest.on('unpipe', onunpipe);
|
15438 | function onunpipe(readable, unpipeInfo) {
|
15439 | debug('onunpipe');
|
15440 | if (readable === src) {
|
15441 | if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
|
15442 | unpipeInfo.hasUnpiped = true;
|
15443 | cleanup();
|
15444 | }
|
15445 | }
|
15446 | }
|
15447 |
|
15448 | function onend() {
|
15449 | debug('onend');
|
15450 | dest.end();
|
15451 | }
|
15452 |
|
15453 |
|
15454 |
|
15455 |
|
15456 |
|
15457 | var ondrain = pipeOnDrain(src);
|
15458 | dest.on('drain', ondrain);
|
15459 |
|
15460 | var cleanedUp = false;
|
15461 | function cleanup() {
|
15462 | debug('cleanup');
|
15463 |
|
15464 | dest.removeListener('close', onclose);
|
15465 | dest.removeListener('finish', onfinish);
|
15466 | dest.removeListener('drain', ondrain);
|
15467 | dest.removeListener('error', onerror);
|
15468 | dest.removeListener('unpipe', onunpipe);
|
15469 | src.removeListener('end', onend);
|
15470 | src.removeListener('end', unpipe);
|
15471 | src.removeListener('data', ondata);
|
15472 |
|
15473 | cleanedUp = true;
|
15474 |
|
15475 |
|
15476 |
|
15477 |
|
15478 |
|
15479 |
|
15480 | if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
|
15481 | }
|
15482 |
|
15483 |
|
15484 |
|
15485 |
|
15486 |
|
15487 | var increasedAwaitDrain = false;
|
15488 | src.on('data', ondata);
|
15489 | function ondata(chunk) {
|
15490 | debug('ondata');
|
15491 | increasedAwaitDrain = false;
|
15492 | var ret = dest.write(chunk);
|
15493 | if (false === ret && !increasedAwaitDrain) {
|
15494 |
|
15495 |
|
15496 |
|
15497 |
|
15498 | if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
|
15499 | debug('false write response, pause', src._readableState.awaitDrain);
|
15500 | src._readableState.awaitDrain++;
|
15501 | increasedAwaitDrain = true;
|
15502 | }
|
15503 | src.pause();
|
15504 | }
|
15505 | }
|
15506 |
|
15507 |
|
15508 |
|
15509 | function onerror(er) {
|
15510 | debug('onerror', er);
|
15511 | unpipe();
|
15512 | dest.removeListener('error', onerror);
|
15513 | if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);
|
15514 | }
|
15515 |
|
15516 |
|
15517 | prependListener(dest, 'error', onerror);
|
15518 |
|
15519 |
|
15520 | function onclose() {
|
15521 | dest.removeListener('finish', onfinish);
|
15522 | unpipe();
|
15523 | }
|
15524 | dest.once('close', onclose);
|
15525 | function onfinish() {
|
15526 | debug('onfinish');
|
15527 | dest.removeListener('close', onclose);
|
15528 | unpipe();
|
15529 | }
|
15530 | dest.once('finish', onfinish);
|
15531 |
|
15532 | function unpipe() {
|
15533 | debug('unpipe');
|
15534 | src.unpipe(dest);
|
15535 | }
|
15536 |
|
15537 |
|
15538 | dest.emit('pipe', src);
|
15539 |
|
15540 |
|
15541 | if (!state.flowing) {
|
15542 | debug('pipe resume');
|
15543 | src.resume();
|
15544 | }
|
15545 |
|
15546 | return dest;
|
15547 | };
|
15548 |
|
15549 | function pipeOnDrain(src) {
|
15550 | return function () {
|
15551 | var state = src._readableState;
|
15552 | debug('pipeOnDrain', state.awaitDrain);
|
15553 | if (state.awaitDrain) state.awaitDrain--;
|
15554 | if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
|
15555 | state.flowing = true;
|
15556 | flow(src);
|
15557 | }
|
15558 | };
|
15559 | }
|
15560 |
|
15561 | Readable.prototype.unpipe = function (dest) {
|
15562 | var state = this._readableState;
|
15563 | var unpipeInfo = { hasUnpiped: false };
|
15564 |
|
15565 |
|
15566 | if (state.pipesCount === 0) return this;
|
15567 |
|
15568 |
|
15569 | if (state.pipesCount === 1) {
|
15570 |
|
15571 | if (dest && dest !== state.pipes) return this;
|
15572 |
|
15573 | if (!dest) dest = state.pipes;
|
15574 |
|
15575 |
|
15576 | state.pipes = null;
|
15577 | state.pipesCount = 0;
|
15578 | state.flowing = false;
|
15579 | if (dest) dest.emit('unpipe', this, unpipeInfo);
|
15580 | return this;
|
15581 | }
|
15582 |
|
15583 |
|
15584 |
|
15585 | if (!dest) {
|
15586 |
|
15587 | var dests = state.pipes;
|
15588 | var len = state.pipesCount;
|
15589 | state.pipes = null;
|
15590 | state.pipesCount = 0;
|
15591 | state.flowing = false;
|
15592 |
|
15593 | for (var i = 0; i < len; i++) {
|
15594 | dests[i].emit('unpipe', this, unpipeInfo);
|
15595 | }return this;
|
15596 | }
|
15597 |
|
15598 |
|
15599 | var index = indexOf(state.pipes, dest);
|
15600 | if (index === -1) return this;
|
15601 |
|
15602 | state.pipes.splice(index, 1);
|
15603 | state.pipesCount -= 1;
|
15604 | if (state.pipesCount === 1) state.pipes = state.pipes[0];
|
15605 |
|
15606 | dest.emit('unpipe', this, unpipeInfo);
|
15607 |
|
15608 | return this;
|
15609 | };
|
15610 |
|
15611 |
|
15612 |
|
15613 | Readable.prototype.on = function (ev, fn) {
|
15614 | var res = Stream.prototype.on.call(this, ev, fn);
|
15615 |
|
15616 | if (ev === 'data') {
|
15617 |
|
15618 | if (this._readableState.flowing !== false) this.resume();
|
15619 | } else if (ev === 'readable') {
|
15620 | var state = this._readableState;
|
15621 | if (!state.endEmitted && !state.readableListening) {
|
15622 | state.readableListening = state.needReadable = true;
|
15623 | state.emittedReadable = false;
|
15624 | if (!state.reading) {
|
15625 | pna.nextTick(nReadingNextTick, this);
|
15626 | } else if (state.length) {
|
15627 | emitReadable(this);
|
15628 | }
|
15629 | }
|
15630 | }
|
15631 |
|
15632 | return res;
|
15633 | };
|
15634 | Readable.prototype.addListener = Readable.prototype.on;
|
15635 |
|
15636 | function nReadingNextTick(self) {
|
15637 | debug('readable nexttick read 0');
|
15638 | self.read(0);
|
15639 | }
|
15640 |
|
15641 |
|
15642 |
|
15643 | Readable.prototype.resume = function () {
|
15644 | var state = this._readableState;
|
15645 | if (!state.flowing) {
|
15646 | debug('resume');
|
15647 | state.flowing = true;
|
15648 | resume(this, state);
|
15649 | }
|
15650 | return this;
|
15651 | };
|
15652 |
|
15653 | function resume(stream, state) {
|
15654 | if (!state.resumeScheduled) {
|
15655 | state.resumeScheduled = true;
|
15656 | pna.nextTick(resume_, stream, state);
|
15657 | }
|
15658 | }
|
15659 |
|
15660 | function resume_(stream, state) {
|
15661 | if (!state.reading) {
|
15662 | debug('resume read 0');
|
15663 | stream.read(0);
|
15664 | }
|
15665 |
|
15666 | state.resumeScheduled = false;
|
15667 | state.awaitDrain = 0;
|
15668 | stream.emit('resume');
|
15669 | flow(stream);
|
15670 | if (state.flowing && !state.reading) stream.read(0);
|
15671 | }
|
15672 |
|
15673 | Readable.prototype.pause = function () {
|
15674 | debug('call pause flowing=%j', this._readableState.flowing);
|
15675 | if (false !== this._readableState.flowing) {
|
15676 | debug('pause');
|
15677 | this._readableState.flowing = false;
|
15678 | this.emit('pause');
|
15679 | }
|
15680 | return this;
|
15681 | };
|
15682 |
|
15683 | function flow(stream) {
|
15684 | var state = stream._readableState;
|
15685 | debug('flow', state.flowing);
|
15686 | while (state.flowing && stream.read() !== null) {}
|
15687 | }
|
15688 |
|
15689 |
|
15690 |
|
15691 |
|
15692 | Readable.prototype.wrap = function (stream) {
|
15693 | var _this = this;
|
15694 |
|
15695 | var state = this._readableState;
|
15696 | var paused = false;
|
15697 |
|
15698 | stream.on('end', function () {
|
15699 | debug('wrapped end');
|
15700 | if (state.decoder && !state.ended) {
|
15701 | var chunk = state.decoder.end();
|
15702 | if (chunk && chunk.length) _this.push(chunk);
|
15703 | }
|
15704 |
|
15705 | _this.push(null);
|
15706 | });
|
15707 |
|
15708 | stream.on('data', function (chunk) {
|
15709 | debug('wrapped data');
|
15710 | if (state.decoder) chunk = state.decoder.write(chunk);
|
15711 |
|
15712 |
|
15713 | if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
|
15714 |
|
15715 | var ret = _this.push(chunk);
|
15716 | if (!ret) {
|
15717 | paused = true;
|
15718 | stream.pause();
|
15719 | }
|
15720 | });
|
15721 |
|
15722 |
|
15723 |
|
15724 | for (var i in stream) {
|
15725 | if (this[i] === undefined && typeof stream[i] === 'function') {
|
15726 | this[i] = function (method) {
|
15727 | return function () {
|
15728 | return stream[method].apply(stream, arguments);
|
15729 | };
|
15730 | }(i);
|
15731 | }
|
15732 | }
|
15733 |
|
15734 |
|
15735 | for (var n = 0; n < kProxyEvents.length; n++) {
|
15736 | stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
|
15737 | }
|
15738 |
|
15739 |
|
15740 |
|
15741 | this._read = function (n) {
|
15742 | debug('wrapped _read', n);
|
15743 | if (paused) {
|
15744 | paused = false;
|
15745 | stream.resume();
|
15746 | }
|
15747 | };
|
15748 |
|
15749 | return this;
|
15750 | };
|
15751 |
|
15752 | Object.defineProperty(Readable.prototype, 'readableHighWaterMark', {
|
15753 |
|
15754 |
|
15755 |
|
15756 | enumerable: false,
|
15757 | get: function () {
|
15758 | return this._readableState.highWaterMark;
|
15759 | }
|
15760 | });
|
15761 |
|
15762 |
|
15763 | Readable._fromList = fromList;
|
15764 |
|
15765 |
|
15766 |
|
15767 |
|
15768 |
|
15769 | function fromList(n, state) {
|
15770 |
|
15771 | if (state.length === 0) return null;
|
15772 |
|
15773 | var ret;
|
15774 | if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
|
15775 |
|
15776 | 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);
|
15777 | state.buffer.clear();
|
15778 | } else {
|
15779 |
|
15780 | ret = fromListPartial(n, state.buffer, state.decoder);
|
15781 | }
|
15782 |
|
15783 | return ret;
|
15784 | }
|
15785 |
|
15786 |
|
15787 |
|
15788 |
|
15789 | function fromListPartial(n, list, hasStrings) {
|
15790 | var ret;
|
15791 | if (n < list.head.data.length) {
|
15792 |
|
15793 | ret = list.head.data.slice(0, n);
|
15794 | list.head.data = list.head.data.slice(n);
|
15795 | } else if (n === list.head.data.length) {
|
15796 |
|
15797 | ret = list.shift();
|
15798 | } else {
|
15799 |
|
15800 | ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
|
15801 | }
|
15802 | return ret;
|
15803 | }
|
15804 |
|
15805 |
|
15806 |
|
15807 |
|
15808 |
|
15809 | function copyFromBufferString(n, list) {
|
15810 | var p = list.head;
|
15811 | var c = 1;
|
15812 | var ret = p.data;
|
15813 | n -= ret.length;
|
15814 | while (p = p.next) {
|
15815 | var str = p.data;
|
15816 | var nb = n > str.length ? str.length : n;
|
15817 | if (nb === str.length) ret += str;else ret += str.slice(0, n);
|
15818 | n -= nb;
|
15819 | if (n === 0) {
|
15820 | if (nb === str.length) {
|
15821 | ++c;
|
15822 | if (p.next) list.head = p.next;else list.head = list.tail = null;
|
15823 | } else {
|
15824 | list.head = p;
|
15825 | p.data = str.slice(nb);
|
15826 | }
|
15827 | break;
|
15828 | }
|
15829 | ++c;
|
15830 | }
|
15831 | list.length -= c;
|
15832 | return ret;
|
15833 | }
|
15834 |
|
15835 |
|
15836 |
|
15837 |
|
15838 | function copyFromBuffer(n, list) {
|
15839 | var ret = Buffer.allocUnsafe(n);
|
15840 | var p = list.head;
|
15841 | var c = 1;
|
15842 | p.data.copy(ret);
|
15843 | n -= p.data.length;
|
15844 | while (p = p.next) {
|
15845 | var buf = p.data;
|
15846 | var nb = n > buf.length ? buf.length : n;
|
15847 | buf.copy(ret, ret.length - n, 0, nb);
|
15848 | n -= nb;
|
15849 | if (n === 0) {
|
15850 | if (nb === buf.length) {
|
15851 | ++c;
|
15852 | if (p.next) list.head = p.next;else list.head = list.tail = null;
|
15853 | } else {
|
15854 | list.head = p;
|
15855 | p.data = buf.slice(nb);
|
15856 | }
|
15857 | break;
|
15858 | }
|
15859 | ++c;
|
15860 | }
|
15861 | list.length -= c;
|
15862 | return ret;
|
15863 | }
|
15864 |
|
15865 | function endReadable(stream) {
|
15866 | var state = stream._readableState;
|
15867 |
|
15868 |
|
15869 |
|
15870 | if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream');
|
15871 |
|
15872 | if (!state.endEmitted) {
|
15873 | state.ended = true;
|
15874 | pna.nextTick(endReadableNT, state, stream);
|
15875 | }
|
15876 | }
|
15877 |
|
15878 | function endReadableNT(state, stream) {
|
15879 |
|
15880 | if (!state.endEmitted && state.length === 0) {
|
15881 | state.endEmitted = true;
|
15882 | stream.readable = false;
|
15883 | stream.emit('end');
|
15884 | }
|
15885 | }
|
15886 |
|
15887 | function indexOf(xs, x) {
|
15888 | for (var i = 0, l = xs.length; i < l; i++) {
|
15889 | if (xs[i] === x) return i;
|
15890 | }
|
15891 | return -1;
|
15892 | }
|
15893 | }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
15894 | },{"./_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){
|
15895 |
|
15896 |
|
15897 |
|
15898 |
|
15899 |
|
15900 |
|
15901 |
|
15902 |
|
15903 |
|
15904 |
|
15905 |
|
15906 |
|
15907 |
|
15908 |
|
15909 |
|
15910 |
|
15911 |
|
15912 |
|
15913 |
|
15914 |
|
15915 |
|
15916 |
|
15917 |
|
15918 |
|
15919 |
|
15920 |
|
15921 |
|
15922 |
|
15923 |
|
15924 |
|
15925 |
|
15926 |
|
15927 |
|
15928 |
|
15929 |
|
15930 |
|
15931 |
|
15932 |
|
15933 |
|
15934 |
|
15935 |
|
15936 |
|
15937 |
|
15938 |
|
15939 |
|
15940 |
|
15941 |
|
15942 |
|
15943 |
|
15944 |
|
15945 |
|
15946 |
|
15947 |
|
15948 |
|
15949 |
|
15950 |
|
15951 |
|
15952 |
|
15953 |
|
15954 |
|
15955 |
|
15956 |
|
15957 |
|
15958 | 'use strict';
|
15959 |
|
15960 | module.exports = Transform;
|
15961 |
|
15962 | var Duplex = require('./_stream_duplex');
|
15963 |
|
15964 |
|
15965 | var util = require('core-util-is');
|
15966 | util.inherits = require('inherits');
|
15967 |
|
15968 |
|
15969 | util.inherits(Transform, Duplex);
|
15970 |
|
15971 | function afterTransform(er, data) {
|
15972 | var ts = this._transformState;
|
15973 | ts.transforming = false;
|
15974 |
|
15975 | var cb = ts.writecb;
|
15976 |
|
15977 | if (!cb) {
|
15978 | return this.emit('error', new Error('write callback called multiple times'));
|
15979 | }
|
15980 |
|
15981 | ts.writechunk = null;
|
15982 | ts.writecb = null;
|
15983 |
|
15984 | if (data != null)
|
15985 | this.push(data);
|
15986 |
|
15987 | cb(er);
|
15988 |
|
15989 | var rs = this._readableState;
|
15990 | rs.reading = false;
|
15991 | if (rs.needReadable || rs.length < rs.highWaterMark) {
|
15992 | this._read(rs.highWaterMark);
|
15993 | }
|
15994 | }
|
15995 |
|
15996 | function Transform(options) {
|
15997 | if (!(this instanceof Transform)) return new Transform(options);
|
15998 |
|
15999 | Duplex.call(this, options);
|
16000 |
|
16001 | this._transformState = {
|
16002 | afterTransform: afterTransform.bind(this),
|
16003 | needTransform: false,
|
16004 | transforming: false,
|
16005 | writecb: null,
|
16006 | writechunk: null,
|
16007 | writeencoding: null
|
16008 | };
|
16009 |
|
16010 |
|
16011 | this._readableState.needReadable = true;
|
16012 |
|
16013 |
|
16014 |
|
16015 |
|
16016 | this._readableState.sync = false;
|
16017 |
|
16018 | if (options) {
|
16019 | if (typeof options.transform === 'function') this._transform = options.transform;
|
16020 |
|
16021 | if (typeof options.flush === 'function') this._flush = options.flush;
|
16022 | }
|
16023 |
|
16024 |
|
16025 | this.on('prefinish', prefinish);
|
16026 | }
|
16027 |
|
16028 | function prefinish() {
|
16029 | var _this = this;
|
16030 |
|
16031 | if (typeof this._flush === 'function') {
|
16032 | this._flush(function (er, data) {
|
16033 | done(_this, er, data);
|
16034 | });
|
16035 | } else {
|
16036 | done(this, null, null);
|
16037 | }
|
16038 | }
|
16039 |
|
16040 | Transform.prototype.push = function (chunk, encoding) {
|
16041 | this._transformState.needTransform = false;
|
16042 | return Duplex.prototype.push.call(this, chunk, encoding);
|
16043 | };
|
16044 |
|
16045 |
|
16046 |
|
16047 |
|
16048 |
|
16049 |
|
16050 |
|
16051 |
|
16052 |
|
16053 |
|
16054 |
|
16055 | Transform.prototype._transform = function (chunk, encoding, cb) {
|
16056 | throw new Error('_transform() is not implemented');
|
16057 | };
|
16058 |
|
16059 | Transform.prototype._write = function (chunk, encoding, cb) {
|
16060 | var ts = this._transformState;
|
16061 | ts.writecb = cb;
|
16062 | ts.writechunk = chunk;
|
16063 | ts.writeencoding = encoding;
|
16064 | if (!ts.transforming) {
|
16065 | var rs = this._readableState;
|
16066 | if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
|
16067 | }
|
16068 | };
|
16069 |
|
16070 |
|
16071 |
|
16072 |
|
16073 | Transform.prototype._read = function (n) {
|
16074 | var ts = this._transformState;
|
16075 |
|
16076 | if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
|
16077 | ts.transforming = true;
|
16078 | this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
|
16079 | } else {
|
16080 |
|
16081 |
|
16082 | ts.needTransform = true;
|
16083 | }
|
16084 | };
|
16085 |
|
16086 | Transform.prototype._destroy = function (err, cb) {
|
16087 | var _this2 = this;
|
16088 |
|
16089 | Duplex.prototype._destroy.call(this, err, function (err2) {
|
16090 | cb(err2);
|
16091 | _this2.emit('close');
|
16092 | });
|
16093 | };
|
16094 |
|
16095 | function done(stream, er, data) {
|
16096 | if (er) return stream.emit('error', er);
|
16097 |
|
16098 | if (data != null)
|
16099 | stream.push(data);
|
16100 |
|
16101 |
|
16102 |
|
16103 | if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0');
|
16104 |
|
16105 | if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming');
|
16106 |
|
16107 | return stream.push(null);
|
16108 | }
|
16109 | },{"./_stream_duplex":71,"core-util-is":44,"inherits":56}],75:[function(require,module,exports){
|
16110 | (function (process,global,setImmediate){
|
16111 |
|
16112 |
|
16113 |
|
16114 |
|
16115 |
|
16116 |
|
16117 |
|
16118 |
|
16119 |
|
16120 |
|
16121 |
|
16122 |
|
16123 |
|
16124 |
|
16125 |
|
16126 |
|
16127 |
|
16128 |
|
16129 |
|
16130 |
|
16131 |
|
16132 |
|
16133 |
|
16134 |
|
16135 |
|
16136 | 'use strict';
|
16137 |
|
16138 |
|
16139 |
|
16140 | var pna = require('process-nextick-args');
|
16141 |
|
16142 |
|
16143 | module.exports = Writable;
|
16144 |
|
16145 |
|
16146 | function WriteReq(chunk, encoding, cb) {
|
16147 | this.chunk = chunk;
|
16148 | this.encoding = encoding;
|
16149 | this.callback = cb;
|
16150 | this.next = null;
|
16151 | }
|
16152 |
|
16153 |
|
16154 |
|
16155 | function CorkedRequest(state) {
|
16156 | var _this = this;
|
16157 |
|
16158 | this.next = null;
|
16159 | this.entry = null;
|
16160 | this.finish = function () {
|
16161 | onCorkedFinish(_this, state);
|
16162 | };
|
16163 | }
|
16164 |
|
16165 |
|
16166 |
|
16167 | var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick;
|
16168 |
|
16169 |
|
16170 |
|
16171 | var Duplex;
|
16172 |
|
16173 |
|
16174 | Writable.WritableState = WritableState;
|
16175 |
|
16176 |
|
16177 | var util = require('core-util-is');
|
16178 | util.inherits = require('inherits');
|
16179 |
|
16180 |
|
16181 |
|
16182 | var internalUtil = {
|
16183 | deprecate: require('util-deprecate')
|
16184 | };
|
16185 |
|
16186 |
|
16187 |
|
16188 | var Stream = require('./internal/streams/stream');
|
16189 |
|
16190 |
|
16191 |
|
16192 |
|
16193 | var Buffer = require('safe-buffer').Buffer;
|
16194 | var OurUint8Array = global.Uint8Array || function () {};
|
16195 | function _uint8ArrayToBuffer(chunk) {
|
16196 | return Buffer.from(chunk);
|
16197 | }
|
16198 | function _isUint8Array(obj) {
|
16199 | return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
|
16200 | }
|
16201 |
|
16202 |
|
16203 |
|
16204 | var destroyImpl = require('./internal/streams/destroy');
|
16205 |
|
16206 | util.inherits(Writable, Stream);
|
16207 |
|
16208 | function nop() {}
|
16209 |
|
16210 | function WritableState(options, stream) {
|
16211 | Duplex = Duplex || require('./_stream_duplex');
|
16212 |
|
16213 | options = options || {};
|
16214 |
|
16215 |
|
16216 |
|
16217 |
|
16218 |
|
16219 |
|
16220 | var isDuplex = stream instanceof Duplex;
|
16221 |
|
16222 |
|
16223 |
|
16224 | this.objectMode = !!options.objectMode;
|
16225 |
|
16226 | if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
|
16227 |
|
16228 |
|
16229 |
|
16230 |
|
16231 | var hwm = options.highWaterMark;
|
16232 | var writableHwm = options.writableHighWaterMark;
|
16233 | var defaultHwm = this.objectMode ? 16 : 16 * 1024;
|
16234 |
|
16235 | if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm;
|
16236 |
|
16237 |
|
16238 | this.highWaterMark = Math.floor(this.highWaterMark);
|
16239 |
|
16240 |
|
16241 | this.finalCalled = false;
|
16242 |
|
16243 |
|
16244 | this.needDrain = false;
|
16245 |
|
16246 | this.ending = false;
|
16247 |
|
16248 | this.ended = false;
|
16249 |
|
16250 | this.finished = false;
|
16251 |
|
16252 |
|
16253 | this.destroyed = false;
|
16254 |
|
16255 |
|
16256 |
|
16257 |
|
16258 | var noDecode = options.decodeStrings === false;
|
16259 | this.decodeStrings = !noDecode;
|
16260 |
|
16261 |
|
16262 |
|
16263 |
|
16264 | this.defaultEncoding = options.defaultEncoding || 'utf8';
|
16265 |
|
16266 |
|
16267 |
|
16268 |
|
16269 | this.length = 0;
|
16270 |
|
16271 |
|
16272 | this.writing = false;
|
16273 |
|
16274 |
|
16275 | this.corked = 0;
|
16276 |
|
16277 |
|
16278 |
|
16279 |
|
16280 |
|
16281 | this.sync = true;
|
16282 |
|
16283 |
|
16284 |
|
16285 |
|
16286 | this.bufferProcessing = false;
|
16287 |
|
16288 |
|
16289 | this.onwrite = function (er) {
|
16290 | onwrite(stream, er);
|
16291 | };
|
16292 |
|
16293 |
|
16294 | this.writecb = null;
|
16295 |
|
16296 |
|
16297 | this.writelen = 0;
|
16298 |
|
16299 | this.bufferedRequest = null;
|
16300 | this.lastBufferedRequest = null;
|
16301 |
|
16302 |
|
16303 |
|
16304 | this.pendingcb = 0;
|
16305 |
|
16306 |
|
16307 |
|
16308 | this.prefinished = false;
|
16309 |
|
16310 |
|
16311 | this.errorEmitted = false;
|
16312 |
|
16313 |
|
16314 | this.bufferedRequestCount = 0;
|
16315 |
|
16316 |
|
16317 |
|
16318 | this.corkedRequestsFree = new CorkedRequest(this);
|
16319 | }
|
16320 |
|
16321 | WritableState.prototype.getBuffer = function getBuffer() {
|
16322 | var current = this.bufferedRequest;
|
16323 | var out = [];
|
16324 | while (current) {
|
16325 | out.push(current);
|
16326 | current = current.next;
|
16327 | }
|
16328 | return out;
|
16329 | };
|
16330 |
|
16331 | (function () {
|
16332 | try {
|
16333 | Object.defineProperty(WritableState.prototype, 'buffer', {
|
16334 | get: internalUtil.deprecate(function () {
|
16335 | return this.getBuffer();
|
16336 | }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')
|
16337 | });
|
16338 | } catch (_) {}
|
16339 | })();
|
16340 |
|
16341 |
|
16342 |
|
16343 | var realHasInstance;
|
16344 | if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {
|
16345 | realHasInstance = Function.prototype[Symbol.hasInstance];
|
16346 | Object.defineProperty(Writable, Symbol.hasInstance, {
|
16347 | value: function (object) {
|
16348 | if (realHasInstance.call(this, object)) return true;
|
16349 | if (this !== Writable) return false;
|
16350 |
|
16351 | return object && object._writableState instanceof WritableState;
|
16352 | }
|
16353 | });
|
16354 | } else {
|
16355 | realHasInstance = function (object) {
|
16356 | return object instanceof this;
|
16357 | };
|
16358 | }
|
16359 |
|
16360 | function Writable(options) {
|
16361 | Duplex = Duplex || require('./_stream_duplex');
|
16362 |
|
16363 |
|
16364 |
|
16365 |
|
16366 |
|
16367 |
|
16368 |
|
16369 |
|
16370 | if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
|
16371 | return new Writable(options);
|
16372 | }
|
16373 |
|
16374 | this._writableState = new WritableState(options, this);
|
16375 |
|
16376 |
|
16377 | this.writable = true;
|
16378 |
|
16379 | if (options) {
|
16380 | if (typeof options.write === 'function') this._write = options.write;
|
16381 |
|
16382 | if (typeof options.writev === 'function') this._writev = options.writev;
|
16383 |
|
16384 | if (typeof options.destroy === 'function') this._destroy = options.destroy;
|
16385 |
|
16386 | if (typeof options.final === 'function') this._final = options.final;
|
16387 | }
|
16388 |
|
16389 | Stream.call(this);
|
16390 | }
|
16391 |
|
16392 |
|
16393 | Writable.prototype.pipe = function () {
|
16394 | this.emit('error', new Error('Cannot pipe, not readable'));
|
16395 | };
|
16396 |
|
16397 | function writeAfterEnd(stream, cb) {
|
16398 | var er = new Error('write after end');
|
16399 |
|
16400 | stream.emit('error', er);
|
16401 | pna.nextTick(cb, er);
|
16402 | }
|
16403 |
|
16404 |
|
16405 |
|
16406 |
|
16407 | function validChunk(stream, state, chunk, cb) {
|
16408 | var valid = true;
|
16409 | var er = false;
|
16410 |
|
16411 | if (chunk === null) {
|
16412 | er = new TypeError('May not write null values to stream');
|
16413 | } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
|
16414 | er = new TypeError('Invalid non-string/buffer chunk');
|
16415 | }
|
16416 | if (er) {
|
16417 | stream.emit('error', er);
|
16418 | pna.nextTick(cb, er);
|
16419 | valid = false;
|
16420 | }
|
16421 | return valid;
|
16422 | }
|
16423 |
|
16424 | Writable.prototype.write = function (chunk, encoding, cb) {
|
16425 | var state = this._writableState;
|
16426 | var ret = false;
|
16427 | var isBuf = !state.objectMode && _isUint8Array(chunk);
|
16428 |
|
16429 | if (isBuf && !Buffer.isBuffer(chunk)) {
|
16430 | chunk = _uint8ArrayToBuffer(chunk);
|
16431 | }
|
16432 |
|
16433 | if (typeof encoding === 'function') {
|
16434 | cb = encoding;
|
16435 | encoding = null;
|
16436 | }
|
16437 |
|
16438 | if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
|
16439 |
|
16440 | if (typeof cb !== 'function') cb = nop;
|
16441 |
|
16442 | if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {
|
16443 | state.pendingcb++;
|
16444 | ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
|
16445 | }
|
16446 |
|
16447 | return ret;
|
16448 | };
|
16449 |
|
16450 | Writable.prototype.cork = function () {
|
16451 | var state = this._writableState;
|
16452 |
|
16453 | state.corked++;
|
16454 | };
|
16455 |
|
16456 | Writable.prototype.uncork = function () {
|
16457 | var state = this._writableState;
|
16458 |
|
16459 | if (state.corked) {
|
16460 | state.corked--;
|
16461 |
|
16462 | if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
|
16463 | }
|
16464 | };
|
16465 |
|
16466 | Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
|
16467 |
|
16468 | if (typeof encoding === 'string') encoding = encoding.toLowerCase();
|
16469 | 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);
|
16470 | this._writableState.defaultEncoding = encoding;
|
16471 | return this;
|
16472 | };
|
16473 |
|
16474 | function decodeChunk(state, chunk, encoding) {
|
16475 | if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
|
16476 | chunk = Buffer.from(chunk, encoding);
|
16477 | }
|
16478 | return chunk;
|
16479 | }
|
16480 |
|
16481 | Object.defineProperty(Writable.prototype, 'writableHighWaterMark', {
|
16482 |
|
16483 |
|
16484 |
|
16485 | enumerable: false,
|
16486 | get: function () {
|
16487 | return this._writableState.highWaterMark;
|
16488 | }
|
16489 | });
|
16490 |
|
16491 |
|
16492 |
|
16493 |
|
16494 | function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
|
16495 | if (!isBuf) {
|
16496 | var newChunk = decodeChunk(state, chunk, encoding);
|
16497 | if (chunk !== newChunk) {
|
16498 | isBuf = true;
|
16499 | encoding = 'buffer';
|
16500 | chunk = newChunk;
|
16501 | }
|
16502 | }
|
16503 | var len = state.objectMode ? 1 : chunk.length;
|
16504 |
|
16505 | state.length += len;
|
16506 |
|
16507 | var ret = state.length < state.highWaterMark;
|
16508 |
|
16509 | if (!ret) state.needDrain = true;
|
16510 |
|
16511 | if (state.writing || state.corked) {
|
16512 | var last = state.lastBufferedRequest;
|
16513 | state.lastBufferedRequest = {
|
16514 | chunk: chunk,
|
16515 | encoding: encoding,
|
16516 | isBuf: isBuf,
|
16517 | callback: cb,
|
16518 | next: null
|
16519 | };
|
16520 | if (last) {
|
16521 | last.next = state.lastBufferedRequest;
|
16522 | } else {
|
16523 | state.bufferedRequest = state.lastBufferedRequest;
|
16524 | }
|
16525 | state.bufferedRequestCount += 1;
|
16526 | } else {
|
16527 | doWrite(stream, state, false, len, chunk, encoding, cb);
|
16528 | }
|
16529 |
|
16530 | return ret;
|
16531 | }
|
16532 |
|
16533 | function doWrite(stream, state, writev, len, chunk, encoding, cb) {
|
16534 | state.writelen = len;
|
16535 | state.writecb = cb;
|
16536 | state.writing = true;
|
16537 | state.sync = true;
|
16538 | if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
|
16539 | state.sync = false;
|
16540 | }
|
16541 |
|
16542 | function onwriteError(stream, state, sync, er, cb) {
|
16543 | --state.pendingcb;
|
16544 |
|
16545 | if (sync) {
|
16546 |
|
16547 |
|
16548 | pna.nextTick(cb, er);
|
16549 |
|
16550 |
|
16551 | pna.nextTick(finishMaybe, stream, state);
|
16552 | stream._writableState.errorEmitted = true;
|
16553 | stream.emit('error', er);
|
16554 | } else {
|
16555 |
|
16556 |
|
16557 | cb(er);
|
16558 | stream._writableState.errorEmitted = true;
|
16559 | stream.emit('error', er);
|
16560 |
|
16561 |
|
16562 | finishMaybe(stream, state);
|
16563 | }
|
16564 | }
|
16565 |
|
16566 | function onwriteStateUpdate(state) {
|
16567 | state.writing = false;
|
16568 | state.writecb = null;
|
16569 | state.length -= state.writelen;
|
16570 | state.writelen = 0;
|
16571 | }
|
16572 |
|
16573 | function onwrite(stream, er) {
|
16574 | var state = stream._writableState;
|
16575 | var sync = state.sync;
|
16576 | var cb = state.writecb;
|
16577 |
|
16578 | onwriteStateUpdate(state);
|
16579 |
|
16580 | if (er) onwriteError(stream, state, sync, er, cb);else {
|
16581 |
|
16582 | var finished = needFinish(state);
|
16583 |
|
16584 | if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
|
16585 | clearBuffer(stream, state);
|
16586 | }
|
16587 |
|
16588 | if (sync) {
|
16589 |
|
16590 | asyncWrite(afterWrite, stream, state, finished, cb);
|
16591 |
|
16592 | } else {
|
16593 | afterWrite(stream, state, finished, cb);
|
16594 | }
|
16595 | }
|
16596 | }
|
16597 |
|
16598 | function afterWrite(stream, state, finished, cb) {
|
16599 | if (!finished) onwriteDrain(stream, state);
|
16600 | state.pendingcb--;
|
16601 | cb();
|
16602 | finishMaybe(stream, state);
|
16603 | }
|
16604 |
|
16605 |
|
16606 |
|
16607 |
|
16608 | function onwriteDrain(stream, state) {
|
16609 | if (state.length === 0 && state.needDrain) {
|
16610 | state.needDrain = false;
|
16611 | stream.emit('drain');
|
16612 | }
|
16613 | }
|
16614 |
|
16615 |
|
16616 | function clearBuffer(stream, state) {
|
16617 | state.bufferProcessing = true;
|
16618 | var entry = state.bufferedRequest;
|
16619 |
|
16620 | if (stream._writev && entry && entry.next) {
|
16621 |
|
16622 | var l = state.bufferedRequestCount;
|
16623 | var buffer = new Array(l);
|
16624 | var holder = state.corkedRequestsFree;
|
16625 | holder.entry = entry;
|
16626 |
|
16627 | var count = 0;
|
16628 | var allBuffers = true;
|
16629 | while (entry) {
|
16630 | buffer[count] = entry;
|
16631 | if (!entry.isBuf) allBuffers = false;
|
16632 | entry = entry.next;
|
16633 | count += 1;
|
16634 | }
|
16635 | buffer.allBuffers = allBuffers;
|
16636 |
|
16637 | doWrite(stream, state, true, state.length, buffer, '', holder.finish);
|
16638 |
|
16639 |
|
16640 |
|
16641 | state.pendingcb++;
|
16642 | state.lastBufferedRequest = null;
|
16643 | if (holder.next) {
|
16644 | state.corkedRequestsFree = holder.next;
|
16645 | holder.next = null;
|
16646 | } else {
|
16647 | state.corkedRequestsFree = new CorkedRequest(state);
|
16648 | }
|
16649 | state.bufferedRequestCount = 0;
|
16650 | } else {
|
16651 |
|
16652 | while (entry) {
|
16653 | var chunk = entry.chunk;
|
16654 | var encoding = entry.encoding;
|
16655 | var cb = entry.callback;
|
16656 | var len = state.objectMode ? 1 : chunk.length;
|
16657 |
|
16658 | doWrite(stream, state, false, len, chunk, encoding, cb);
|
16659 | entry = entry.next;
|
16660 | state.bufferedRequestCount--;
|
16661 |
|
16662 |
|
16663 |
|
16664 |
|
16665 | if (state.writing) {
|
16666 | break;
|
16667 | }
|
16668 | }
|
16669 |
|
16670 | if (entry === null) state.lastBufferedRequest = null;
|
16671 | }
|
16672 |
|
16673 | state.bufferedRequest = entry;
|
16674 | state.bufferProcessing = false;
|
16675 | }
|
16676 |
|
16677 | Writable.prototype._write = function (chunk, encoding, cb) {
|
16678 | cb(new Error('_write() is not implemented'));
|
16679 | };
|
16680 |
|
16681 | Writable.prototype._writev = null;
|
16682 |
|
16683 | Writable.prototype.end = function (chunk, encoding, cb) {
|
16684 | var state = this._writableState;
|
16685 |
|
16686 | if (typeof chunk === 'function') {
|
16687 | cb = chunk;
|
16688 | chunk = null;
|
16689 | encoding = null;
|
16690 | } else if (typeof encoding === 'function') {
|
16691 | cb = encoding;
|
16692 | encoding = null;
|
16693 | }
|
16694 |
|
16695 | if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
|
16696 |
|
16697 |
|
16698 | if (state.corked) {
|
16699 | state.corked = 1;
|
16700 | this.uncork();
|
16701 | }
|
16702 |
|
16703 |
|
16704 | if (!state.ending && !state.finished) endWritable(this, state, cb);
|
16705 | };
|
16706 |
|
16707 | function needFinish(state) {
|
16708 | return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
|
16709 | }
|
16710 | function callFinal(stream, state) {
|
16711 | stream._final(function (err) {
|
16712 | state.pendingcb--;
|
16713 | if (err) {
|
16714 | stream.emit('error', err);
|
16715 | }
|
16716 | state.prefinished = true;
|
16717 | stream.emit('prefinish');
|
16718 | finishMaybe(stream, state);
|
16719 | });
|
16720 | }
|
16721 | function prefinish(stream, state) {
|
16722 | if (!state.prefinished && !state.finalCalled) {
|
16723 | if (typeof stream._final === 'function') {
|
16724 | state.pendingcb++;
|
16725 | state.finalCalled = true;
|
16726 | pna.nextTick(callFinal, stream, state);
|
16727 | } else {
|
16728 | state.prefinished = true;
|
16729 | stream.emit('prefinish');
|
16730 | }
|
16731 | }
|
16732 | }
|
16733 |
|
16734 | function finishMaybe(stream, state) {
|
16735 | var need = needFinish(state);
|
16736 | if (need) {
|
16737 | prefinish(stream, state);
|
16738 | if (state.pendingcb === 0) {
|
16739 | state.finished = true;
|
16740 | stream.emit('finish');
|
16741 | }
|
16742 | }
|
16743 | return need;
|
16744 | }
|
16745 |
|
16746 | function endWritable(stream, state, cb) {
|
16747 | state.ending = true;
|
16748 | finishMaybe(stream, state);
|
16749 | if (cb) {
|
16750 | if (state.finished) pna.nextTick(cb);else stream.once('finish', cb);
|
16751 | }
|
16752 | state.ended = true;
|
16753 | stream.writable = false;
|
16754 | }
|
16755 |
|
16756 | function onCorkedFinish(corkReq, state, err) {
|
16757 | var entry = corkReq.entry;
|
16758 | corkReq.entry = null;
|
16759 | while (entry) {
|
16760 | var cb = entry.callback;
|
16761 | state.pendingcb--;
|
16762 | cb(err);
|
16763 | entry = entry.next;
|
16764 | }
|
16765 | if (state.corkedRequestsFree) {
|
16766 | state.corkedRequestsFree.next = corkReq;
|
16767 | } else {
|
16768 | state.corkedRequestsFree = corkReq;
|
16769 | }
|
16770 | }
|
16771 |
|
16772 | Object.defineProperty(Writable.prototype, 'destroyed', {
|
16773 | get: function () {
|
16774 | if (this._writableState === undefined) {
|
16775 | return false;
|
16776 | }
|
16777 | return this._writableState.destroyed;
|
16778 | },
|
16779 | set: function (value) {
|
16780 |
|
16781 |
|
16782 | if (!this._writableState) {
|
16783 | return;
|
16784 | }
|
16785 |
|
16786 |
|
16787 |
|
16788 | this._writableState.destroyed = value;
|
16789 | }
|
16790 | });
|
16791 |
|
16792 | Writable.prototype.destroy = destroyImpl.destroy;
|
16793 | Writable.prototype._undestroy = destroyImpl.undestroy;
|
16794 | Writable.prototype._destroy = function (err, cb) {
|
16795 | this.end();
|
16796 | cb(err);
|
16797 | };
|
16798 | }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("timers").setImmediate)
|
16799 | },{"./_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){
|
16800 | 'use strict';
|
16801 |
|
16802 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
16803 |
|
16804 | var Buffer = require('safe-buffer').Buffer;
|
16805 | var util = require('util');
|
16806 |
|
16807 | function copyBuffer(src, target, offset) {
|
16808 | src.copy(target, offset);
|
16809 | }
|
16810 |
|
16811 | module.exports = function () {
|
16812 | function BufferList() {
|
16813 | _classCallCheck(this, BufferList);
|
16814 |
|
16815 | this.head = null;
|
16816 | this.tail = null;
|
16817 | this.length = 0;
|
16818 | }
|
16819 |
|
16820 | BufferList.prototype.push = function push(v) {
|
16821 | var entry = { data: v, next: null };
|
16822 | if (this.length > 0) this.tail.next = entry;else this.head = entry;
|
16823 | this.tail = entry;
|
16824 | ++this.length;
|
16825 | };
|
16826 |
|
16827 | BufferList.prototype.unshift = function unshift(v) {
|
16828 | var entry = { data: v, next: this.head };
|
16829 | if (this.length === 0) this.tail = entry;
|
16830 | this.head = entry;
|
16831 | ++this.length;
|
16832 | };
|
16833 |
|
16834 | BufferList.prototype.shift = function shift() {
|
16835 | if (this.length === 0) return;
|
16836 | var ret = this.head.data;
|
16837 | if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
|
16838 | --this.length;
|
16839 | return ret;
|
16840 | };
|
16841 |
|
16842 | BufferList.prototype.clear = function clear() {
|
16843 | this.head = this.tail = null;
|
16844 | this.length = 0;
|
16845 | };
|
16846 |
|
16847 | BufferList.prototype.join = function join(s) {
|
16848 | if (this.length === 0) return '';
|
16849 | var p = this.head;
|
16850 | var ret = '' + p.data;
|
16851 | while (p = p.next) {
|
16852 | ret += s + p.data;
|
16853 | }return ret;
|
16854 | };
|
16855 |
|
16856 | BufferList.prototype.concat = function concat(n) {
|
16857 | if (this.length === 0) return Buffer.alloc(0);
|
16858 | if (this.length === 1) return this.head.data;
|
16859 | var ret = Buffer.allocUnsafe(n >>> 0);
|
16860 | var p = this.head;
|
16861 | var i = 0;
|
16862 | while (p) {
|
16863 | copyBuffer(p.data, ret, i);
|
16864 | i += p.data.length;
|
16865 | p = p.next;
|
16866 | }
|
16867 | return ret;
|
16868 | };
|
16869 |
|
16870 | return BufferList;
|
16871 | }();
|
16872 |
|
16873 | if (util && util.inspect && util.inspect.custom) {
|
16874 | module.exports.prototype[util.inspect.custom] = function () {
|
16875 | var obj = util.inspect({ length: this.length });
|
16876 | return this.constructor.name + ' ' + obj;
|
16877 | };
|
16878 | }
|
16879 | },{"safe-buffer":83,"util":40}],77:[function(require,module,exports){
|
16880 | 'use strict';
|
16881 |
|
16882 |
|
16883 |
|
16884 | var pna = require('process-nextick-args');
|
16885 |
|
16886 |
|
16887 |
|
16888 | function destroy(err, cb) {
|
16889 | var _this = this;
|
16890 |
|
16891 | var readableDestroyed = this._readableState && this._readableState.destroyed;
|
16892 | var writableDestroyed = this._writableState && this._writableState.destroyed;
|
16893 |
|
16894 | if (readableDestroyed || writableDestroyed) {
|
16895 | if (cb) {
|
16896 | cb(err);
|
16897 | } else if (err && (!this._writableState || !this._writableState.errorEmitted)) {
|
16898 | pna.nextTick(emitErrorNT, this, err);
|
16899 | }
|
16900 | return this;
|
16901 | }
|
16902 |
|
16903 |
|
16904 |
|
16905 |
|
16906 | if (this._readableState) {
|
16907 | this._readableState.destroyed = true;
|
16908 | }
|
16909 |
|
16910 |
|
16911 | if (this._writableState) {
|
16912 | this._writableState.destroyed = true;
|
16913 | }
|
16914 |
|
16915 | this._destroy(err || null, function (err) {
|
16916 | if (!cb && err) {
|
16917 | pna.nextTick(emitErrorNT, _this, err);
|
16918 | if (_this._writableState) {
|
16919 | _this._writableState.errorEmitted = true;
|
16920 | }
|
16921 | } else if (cb) {
|
16922 | cb(err);
|
16923 | }
|
16924 | });
|
16925 |
|
16926 | return this;
|
16927 | }
|
16928 |
|
16929 | function undestroy() {
|
16930 | if (this._readableState) {
|
16931 | this._readableState.destroyed = false;
|
16932 | this._readableState.reading = false;
|
16933 | this._readableState.ended = false;
|
16934 | this._readableState.endEmitted = false;
|
16935 | }
|
16936 |
|
16937 | if (this._writableState) {
|
16938 | this._writableState.destroyed = false;
|
16939 | this._writableState.ended = false;
|
16940 | this._writableState.ending = false;
|
16941 | this._writableState.finished = false;
|
16942 | this._writableState.errorEmitted = false;
|
16943 | }
|
16944 | }
|
16945 |
|
16946 | function emitErrorNT(self, err) {
|
16947 | self.emit('error', err);
|
16948 | }
|
16949 |
|
16950 | module.exports = {
|
16951 | destroy: destroy,
|
16952 | undestroy: undestroy
|
16953 | };
|
16954 | },{"process-nextick-args":68}],78:[function(require,module,exports){
|
16955 | module.exports = require('events').EventEmitter;
|
16956 |
|
16957 | },{"events":50}],79:[function(require,module,exports){
|
16958 | module.exports = require('./readable').PassThrough
|
16959 |
|
16960 | },{"./readable":80}],80:[function(require,module,exports){
|
16961 | exports = module.exports = require('./lib/_stream_readable.js');
|
16962 | exports.Stream = exports;
|
16963 | exports.Readable = exports;
|
16964 | exports.Writable = require('./lib/_stream_writable.js');
|
16965 | exports.Duplex = require('./lib/_stream_duplex.js');
|
16966 | exports.Transform = require('./lib/_stream_transform.js');
|
16967 | exports.PassThrough = require('./lib/_stream_passthrough.js');
|
16968 |
|
16969 | },{"./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){
|
16970 | module.exports = require('./readable').Transform
|
16971 |
|
16972 | },{"./readable":80}],82:[function(require,module,exports){
|
16973 | module.exports = require('./lib/_stream_writable.js');
|
16974 |
|
16975 | },{"./lib/_stream_writable.js":75}],83:[function(require,module,exports){
|
16976 |
|
16977 | var buffer = require('buffer')
|
16978 | var Buffer = buffer.Buffer
|
16979 |
|
16980 |
|
16981 | function copyProps (src, dst) {
|
16982 | for (var key in src) {
|
16983 | dst[key] = src[key]
|
16984 | }
|
16985 | }
|
16986 | if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
|
16987 | module.exports = buffer
|
16988 | } else {
|
16989 |
|
16990 | copyProps(buffer, exports)
|
16991 | exports.Buffer = SafeBuffer
|
16992 | }
|
16993 |
|
16994 | function SafeBuffer (arg, encodingOrOffset, length) {
|
16995 | return Buffer(arg, encodingOrOffset, length)
|
16996 | }
|
16997 |
|
16998 |
|
16999 | copyProps(Buffer, SafeBuffer)
|
17000 |
|
17001 | SafeBuffer.from = function (arg, encodingOrOffset, length) {
|
17002 | if (typeof arg === 'number') {
|
17003 | throw new TypeError('Argument must not be a number')
|
17004 | }
|
17005 | return Buffer(arg, encodingOrOffset, length)
|
17006 | }
|
17007 |
|
17008 | SafeBuffer.alloc = function (size, fill, encoding) {
|
17009 | if (typeof size !== 'number') {
|
17010 | throw new TypeError('Argument must be a number')
|
17011 | }
|
17012 | var buf = Buffer(size)
|
17013 | if (fill !== undefined) {
|
17014 | if (typeof encoding === 'string') {
|
17015 | buf.fill(fill, encoding)
|
17016 | } else {
|
17017 | buf.fill(fill)
|
17018 | }
|
17019 | } else {
|
17020 | buf.fill(0)
|
17021 | }
|
17022 | return buf
|
17023 | }
|
17024 |
|
17025 | SafeBuffer.allocUnsafe = function (size) {
|
17026 | if (typeof size !== 'number') {
|
17027 | throw new TypeError('Argument must be a number')
|
17028 | }
|
17029 | return Buffer(size)
|
17030 | }
|
17031 |
|
17032 | SafeBuffer.allocUnsafeSlow = function (size) {
|
17033 | if (typeof size !== 'number') {
|
17034 | throw new TypeError('Argument must be a number')
|
17035 | }
|
17036 | return buffer.SlowBuffer(size)
|
17037 | }
|
17038 |
|
17039 | },{"buffer":43}],84:[function(require,module,exports){
|
17040 |
|
17041 |
|
17042 |
|
17043 |
|
17044 |
|
17045 |
|
17046 |
|
17047 |
|
17048 |
|
17049 |
|
17050 |
|
17051 |
|
17052 |
|
17053 |
|
17054 |
|
17055 |
|
17056 |
|
17057 |
|
17058 |
|
17059 |
|
17060 |
|
17061 | module.exports = Stream;
|
17062 |
|
17063 | var EE = require('events').EventEmitter;
|
17064 | var inherits = require('inherits');
|
17065 |
|
17066 | inherits(Stream, EE);
|
17067 | Stream.Readable = require('readable-stream/readable.js');
|
17068 | Stream.Writable = require('readable-stream/writable.js');
|
17069 | Stream.Duplex = require('readable-stream/duplex.js');
|
17070 | Stream.Transform = require('readable-stream/transform.js');
|
17071 | Stream.PassThrough = require('readable-stream/passthrough.js');
|
17072 |
|
17073 |
|
17074 | Stream.Stream = Stream;
|
17075 |
|
17076 |
|
17077 |
|
17078 |
|
17079 |
|
17080 |
|
17081 | function Stream() {
|
17082 | EE.call(this);
|
17083 | }
|
17084 |
|
17085 | Stream.prototype.pipe = function(dest, options) {
|
17086 | var source = this;
|
17087 |
|
17088 | function ondata(chunk) {
|
17089 | if (dest.writable) {
|
17090 | if (false === dest.write(chunk) && source.pause) {
|
17091 | source.pause();
|
17092 | }
|
17093 | }
|
17094 | }
|
17095 |
|
17096 | source.on('data', ondata);
|
17097 |
|
17098 | function ondrain() {
|
17099 | if (source.readable && source.resume) {
|
17100 | source.resume();
|
17101 | }
|
17102 | }
|
17103 |
|
17104 | dest.on('drain', ondrain);
|
17105 |
|
17106 |
|
17107 |
|
17108 | if (!dest._isStdio && (!options || options.end !== false)) {
|
17109 | source.on('end', onend);
|
17110 | source.on('close', onclose);
|
17111 | }
|
17112 |
|
17113 | var didOnEnd = false;
|
17114 | function onend() {
|
17115 | if (didOnEnd) return;
|
17116 | didOnEnd = true;
|
17117 |
|
17118 | dest.end();
|
17119 | }
|
17120 |
|
17121 |
|
17122 | function onclose() {
|
17123 | if (didOnEnd) return;
|
17124 | didOnEnd = true;
|
17125 |
|
17126 | if (typeof dest.destroy === 'function') dest.destroy();
|
17127 | }
|
17128 |
|
17129 |
|
17130 | function onerror(er) {
|
17131 | cleanup();
|
17132 | if (EE.listenerCount(this, 'error') === 0) {
|
17133 | throw er;
|
17134 | }
|
17135 | }
|
17136 |
|
17137 | source.on('error', onerror);
|
17138 | dest.on('error', onerror);
|
17139 |
|
17140 |
|
17141 | function cleanup() {
|
17142 | source.removeListener('data', ondata);
|
17143 | dest.removeListener('drain', ondrain);
|
17144 |
|
17145 | source.removeListener('end', onend);
|
17146 | source.removeListener('close', onclose);
|
17147 |
|
17148 | source.removeListener('error', onerror);
|
17149 | dest.removeListener('error', onerror);
|
17150 |
|
17151 | source.removeListener('end', cleanup);
|
17152 | source.removeListener('close', cleanup);
|
17153 |
|
17154 | dest.removeListener('close', cleanup);
|
17155 | }
|
17156 |
|
17157 | source.on('end', cleanup);
|
17158 | source.on('close', cleanup);
|
17159 |
|
17160 | dest.on('close', cleanup);
|
17161 |
|
17162 | dest.emit('pipe', source);
|
17163 |
|
17164 |
|
17165 | return dest;
|
17166 | };
|
17167 |
|
17168 | },{"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){
|
17169 |
|
17170 |
|
17171 |
|
17172 |
|
17173 |
|
17174 |
|
17175 |
|
17176 |
|
17177 |
|
17178 |
|
17179 |
|
17180 |
|
17181 |
|
17182 |
|
17183 |
|
17184 |
|
17185 |
|
17186 |
|
17187 |
|
17188 |
|
17189 |
|
17190 | 'use strict';
|
17191 |
|
17192 |
|
17193 |
|
17194 | var Buffer = require('safe-buffer').Buffer;
|
17195 |
|
17196 |
|
17197 | var isEncoding = Buffer.isEncoding || function (encoding) {
|
17198 | encoding = '' + encoding;
|
17199 | switch (encoding && encoding.toLowerCase()) {
|
17200 | 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':
|
17201 | return true;
|
17202 | default:
|
17203 | return false;
|
17204 | }
|
17205 | };
|
17206 |
|
17207 | function _normalizeEncoding(enc) {
|
17208 | if (!enc) return 'utf8';
|
17209 | var retried;
|
17210 | while (true) {
|
17211 | switch (enc) {
|
17212 | case 'utf8':
|
17213 | case 'utf-8':
|
17214 | return 'utf8';
|
17215 | case 'ucs2':
|
17216 | case 'ucs-2':
|
17217 | case 'utf16le':
|
17218 | case 'utf-16le':
|
17219 | return 'utf16le';
|
17220 | case 'latin1':
|
17221 | case 'binary':
|
17222 | return 'latin1';
|
17223 | case 'base64':
|
17224 | case 'ascii':
|
17225 | case 'hex':
|
17226 | return enc;
|
17227 | default:
|
17228 | if (retried) return;
|
17229 | enc = ('' + enc).toLowerCase();
|
17230 | retried = true;
|
17231 | }
|
17232 | }
|
17233 | };
|
17234 |
|
17235 |
|
17236 |
|
17237 | function normalizeEncoding(enc) {
|
17238 | var nenc = _normalizeEncoding(enc);
|
17239 | if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);
|
17240 | return nenc || enc;
|
17241 | }
|
17242 |
|
17243 |
|
17244 |
|
17245 |
|
17246 | exports.StringDecoder = StringDecoder;
|
17247 | function StringDecoder(encoding) {
|
17248 | this.encoding = normalizeEncoding(encoding);
|
17249 | var nb;
|
17250 | switch (this.encoding) {
|
17251 | case 'utf16le':
|
17252 | this.text = utf16Text;
|
17253 | this.end = utf16End;
|
17254 | nb = 4;
|
17255 | break;
|
17256 | case 'utf8':
|
17257 | this.fillLast = utf8FillLast;
|
17258 | nb = 4;
|
17259 | break;
|
17260 | case 'base64':
|
17261 | this.text = base64Text;
|
17262 | this.end = base64End;
|
17263 | nb = 3;
|
17264 | break;
|
17265 | default:
|
17266 | this.write = simpleWrite;
|
17267 | this.end = simpleEnd;
|
17268 | return;
|
17269 | }
|
17270 | this.lastNeed = 0;
|
17271 | this.lastTotal = 0;
|
17272 | this.lastChar = Buffer.allocUnsafe(nb);
|
17273 | }
|
17274 |
|
17275 | StringDecoder.prototype.write = function (buf) {
|
17276 | if (buf.length === 0) return '';
|
17277 | var r;
|
17278 | var i;
|
17279 | if (this.lastNeed) {
|
17280 | r = this.fillLast(buf);
|
17281 | if (r === undefined) return '';
|
17282 | i = this.lastNeed;
|
17283 | this.lastNeed = 0;
|
17284 | } else {
|
17285 | i = 0;
|
17286 | }
|
17287 | if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);
|
17288 | return r || '';
|
17289 | };
|
17290 |
|
17291 | StringDecoder.prototype.end = utf8End;
|
17292 |
|
17293 |
|
17294 | StringDecoder.prototype.text = utf8Text;
|
17295 |
|
17296 |
|
17297 | StringDecoder.prototype.fillLast = function (buf) {
|
17298 | if (this.lastNeed <= buf.length) {
|
17299 | buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
|
17300 | return this.lastChar.toString(this.encoding, 0, this.lastTotal);
|
17301 | }
|
17302 | buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
|
17303 | this.lastNeed -= buf.length;
|
17304 | };
|
17305 |
|
17306 |
|
17307 |
|
17308 | function utf8CheckByte(byte) {
|
17309 | 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;
|
17310 | return byte >> 6 === 0x02 ? -1 : -2;
|
17311 | }
|
17312 |
|
17313 |
|
17314 |
|
17315 |
|
17316 | function utf8CheckIncomplete(self, buf, i) {
|
17317 | var j = buf.length - 1;
|
17318 | if (j < i) return 0;
|
17319 | var nb = utf8CheckByte(buf[j]);
|
17320 | if (nb >= 0) {
|
17321 | if (nb > 0) self.lastNeed = nb - 1;
|
17322 | return nb;
|
17323 | }
|
17324 | if (--j < i || nb === -2) return 0;
|
17325 | nb = utf8CheckByte(buf[j]);
|
17326 | if (nb >= 0) {
|
17327 | if (nb > 0) self.lastNeed = nb - 2;
|
17328 | return nb;
|
17329 | }
|
17330 | if (--j < i || nb === -2) return 0;
|
17331 | nb = utf8CheckByte(buf[j]);
|
17332 | if (nb >= 0) {
|
17333 | if (nb > 0) {
|
17334 | if (nb === 2) nb = 0;else self.lastNeed = nb - 3;
|
17335 | }
|
17336 | return nb;
|
17337 | }
|
17338 | return 0;
|
17339 | }
|
17340 |
|
17341 |
|
17342 |
|
17343 |
|
17344 |
|
17345 |
|
17346 |
|
17347 |
|
17348 |
|
17349 | function utf8CheckExtraBytes(self, buf, p) {
|
17350 | if ((buf[0] & 0xC0) !== 0x80) {
|
17351 | self.lastNeed = 0;
|
17352 | return '\ufffd';
|
17353 | }
|
17354 | if (self.lastNeed > 1 && buf.length > 1) {
|
17355 | if ((buf[1] & 0xC0) !== 0x80) {
|
17356 | self.lastNeed = 1;
|
17357 | return '\ufffd';
|
17358 | }
|
17359 | if (self.lastNeed > 2 && buf.length > 2) {
|
17360 | if ((buf[2] & 0xC0) !== 0x80) {
|
17361 | self.lastNeed = 2;
|
17362 | return '\ufffd';
|
17363 | }
|
17364 | }
|
17365 | }
|
17366 | }
|
17367 |
|
17368 |
|
17369 | function utf8FillLast(buf) {
|
17370 | var p = this.lastTotal - this.lastNeed;
|
17371 | var r = utf8CheckExtraBytes(this, buf, p);
|
17372 | if (r !== undefined) return r;
|
17373 | if (this.lastNeed <= buf.length) {
|
17374 | buf.copy(this.lastChar, p, 0, this.lastNeed);
|
17375 | return this.lastChar.toString(this.encoding, 0, this.lastTotal);
|
17376 | }
|
17377 | buf.copy(this.lastChar, p, 0, buf.length);
|
17378 | this.lastNeed -= buf.length;
|
17379 | }
|
17380 |
|
17381 |
|
17382 |
|
17383 |
|
17384 | function utf8Text(buf, i) {
|
17385 | var total = utf8CheckIncomplete(this, buf, i);
|
17386 | if (!this.lastNeed) return buf.toString('utf8', i);
|
17387 | this.lastTotal = total;
|
17388 | var end = buf.length - (total - this.lastNeed);
|
17389 | buf.copy(this.lastChar, 0, end);
|
17390 | return buf.toString('utf8', i, end);
|
17391 | }
|
17392 |
|
17393 |
|
17394 |
|
17395 | function utf8End(buf) {
|
17396 | var r = buf && buf.length ? this.write(buf) : '';
|
17397 | if (this.lastNeed) return r + '\ufffd';
|
17398 | return r;
|
17399 | }
|
17400 |
|
17401 |
|
17402 |
|
17403 |
|
17404 |
|
17405 | function utf16Text(buf, i) {
|
17406 | if ((buf.length - i) % 2 === 0) {
|
17407 | var r = buf.toString('utf16le', i);
|
17408 | if (r) {
|
17409 | var c = r.charCodeAt(r.length - 1);
|
17410 | if (c >= 0xD800 && c <= 0xDBFF) {
|
17411 | this.lastNeed = 2;
|
17412 | this.lastTotal = 4;
|
17413 | this.lastChar[0] = buf[buf.length - 2];
|
17414 | this.lastChar[1] = buf[buf.length - 1];
|
17415 | return r.slice(0, -1);
|
17416 | }
|
17417 | }
|
17418 | return r;
|
17419 | }
|
17420 | this.lastNeed = 1;
|
17421 | this.lastTotal = 2;
|
17422 | this.lastChar[0] = buf[buf.length - 1];
|
17423 | return buf.toString('utf16le', i, buf.length - 1);
|
17424 | }
|
17425 |
|
17426 |
|
17427 |
|
17428 | function utf16End(buf) {
|
17429 | var r = buf && buf.length ? this.write(buf) : '';
|
17430 | if (this.lastNeed) {
|
17431 | var end = this.lastTotal - this.lastNeed;
|
17432 | return r + this.lastChar.toString('utf16le', 0, end);
|
17433 | }
|
17434 | return r;
|
17435 | }
|
17436 |
|
17437 | function base64Text(buf, i) {
|
17438 | var n = (buf.length - i) % 3;
|
17439 | if (n === 0) return buf.toString('base64', i);
|
17440 | this.lastNeed = 3 - n;
|
17441 | this.lastTotal = 3;
|
17442 | if (n === 1) {
|
17443 | this.lastChar[0] = buf[buf.length - 1];
|
17444 | } else {
|
17445 | this.lastChar[0] = buf[buf.length - 2];
|
17446 | this.lastChar[1] = buf[buf.length - 1];
|
17447 | }
|
17448 | return buf.toString('base64', i, buf.length - n);
|
17449 | }
|
17450 |
|
17451 | function base64End(buf) {
|
17452 | var r = buf && buf.length ? this.write(buf) : '';
|
17453 | if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);
|
17454 | return r;
|
17455 | }
|
17456 |
|
17457 |
|
17458 | function simpleWrite(buf) {
|
17459 | return buf.toString(this.encoding);
|
17460 | }
|
17461 |
|
17462 | function simpleEnd(buf) {
|
17463 | return buf && buf.length ? this.write(buf) : '';
|
17464 | }
|
17465 | },{"safe-buffer":83}],86:[function(require,module,exports){
|
17466 | (function (setImmediate,clearImmediate){
|
17467 | var nextTick = require('process/browser.js').nextTick;
|
17468 | var apply = Function.prototype.apply;
|
17469 | var slice = Array.prototype.slice;
|
17470 | var immediateIds = {};
|
17471 | var nextImmediateId = 0;
|
17472 |
|
17473 |
|
17474 |
|
17475 | exports.setTimeout = function() {
|
17476 | return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);
|
17477 | };
|
17478 | exports.setInterval = function() {
|
17479 | return new Timeout(apply.call(setInterval, window, arguments), clearInterval);
|
17480 | };
|
17481 | exports.clearTimeout =
|
17482 | exports.clearInterval = function(timeout) { timeout.close(); };
|
17483 |
|
17484 | function Timeout(id, clearFn) {
|
17485 | this._id = id;
|
17486 | this._clearFn = clearFn;
|
17487 | }
|
17488 | Timeout.prototype.unref = Timeout.prototype.ref = function() {};
|
17489 | Timeout.prototype.close = function() {
|
17490 | this._clearFn.call(window, this._id);
|
17491 | };
|
17492 |
|
17493 |
|
17494 | exports.enroll = function(item, msecs) {
|
17495 | clearTimeout(item._idleTimeoutId);
|
17496 | item._idleTimeout = msecs;
|
17497 | };
|
17498 |
|
17499 | exports.unenroll = function(item) {
|
17500 | clearTimeout(item._idleTimeoutId);
|
17501 | item._idleTimeout = -1;
|
17502 | };
|
17503 |
|
17504 | exports._unrefActive = exports.active = function(item) {
|
17505 | clearTimeout(item._idleTimeoutId);
|
17506 |
|
17507 | var msecs = item._idleTimeout;
|
17508 | if (msecs >= 0) {
|
17509 | item._idleTimeoutId = setTimeout(function onTimeout() {
|
17510 | if (item._onTimeout)
|
17511 | item._onTimeout();
|
17512 | }, msecs);
|
17513 | }
|
17514 | };
|
17515 |
|
17516 |
|
17517 | exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function(fn) {
|
17518 | var id = nextImmediateId++;
|
17519 | var args = arguments.length < 2 ? false : slice.call(arguments, 1);
|
17520 |
|
17521 | immediateIds[id] = true;
|
17522 |
|
17523 | nextTick(function onNextTick() {
|
17524 | if (immediateIds[id]) {
|
17525 |
|
17526 |
|
17527 | if (args) {
|
17528 | fn.apply(null, args);
|
17529 | } else {
|
17530 | fn.call(null);
|
17531 | }
|
17532 |
|
17533 | exports.clearImmediate(id);
|
17534 | }
|
17535 | });
|
17536 |
|
17537 | return id;
|
17538 | };
|
17539 |
|
17540 | exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function(id) {
|
17541 | delete immediateIds[id];
|
17542 | };
|
17543 | }).call(this,require("timers").setImmediate,require("timers").clearImmediate)
|
17544 | },{"process/browser.js":69,"timers":86}],87:[function(require,module,exports){
|
17545 | (function (global){
|
17546 |
|
17547 |
|
17548 |
|
17549 |
|
17550 |
|
17551 | module.exports = deprecate;
|
17552 |
|
17553 |
|
17554 |
|
17555 |
|
17556 |
|
17557 |
|
17558 |
|
17559 |
|
17560 |
|
17561 |
|
17562 |
|
17563 |
|
17564 |
|
17565 |
|
17566 |
|
17567 |
|
17568 |
|
17569 |
|
17570 |
|
17571 | function deprecate (fn, msg) {
|
17572 | if (config('noDeprecation')) {
|
17573 | return fn;
|
17574 | }
|
17575 |
|
17576 | var warned = false;
|
17577 | function deprecated() {
|
17578 | if (!warned) {
|
17579 | if (config('throwDeprecation')) {
|
17580 | throw new Error(msg);
|
17581 | } else if (config('traceDeprecation')) {
|
17582 | console.trace(msg);
|
17583 | } else {
|
17584 | console.warn(msg);
|
17585 | }
|
17586 | warned = true;
|
17587 | }
|
17588 | return fn.apply(this, arguments);
|
17589 | }
|
17590 |
|
17591 | return deprecated;
|
17592 | }
|
17593 |
|
17594 |
|
17595 |
|
17596 |
|
17597 |
|
17598 |
|
17599 |
|
17600 |
|
17601 |
|
17602 | function config (name) {
|
17603 |
|
17604 | try {
|
17605 | if (!global.localStorage) return false;
|
17606 | } catch (_) {
|
17607 | return false;
|
17608 | }
|
17609 | var val = global.localStorage[name];
|
17610 | if (null == val) return false;
|
17611 | return String(val).toLowerCase() === 'true';
|
17612 | }
|
17613 |
|
17614 | }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
17615 | },{}],88:[function(require,module,exports){
|
17616 | module.exports = function isBuffer(arg) {
|
17617 | return arg && typeof arg === 'object'
|
17618 | && typeof arg.copy === 'function'
|
17619 | && typeof arg.fill === 'function'
|
17620 | && typeof arg.readUInt8 === 'function';
|
17621 | }
|
17622 | },{}],89:[function(require,module,exports){
|
17623 | (function (process,global){
|
17624 |
|
17625 |
|
17626 |
|
17627 |
|
17628 |
|
17629 |
|
17630 |
|
17631 |
|
17632 |
|
17633 |
|
17634 |
|
17635 |
|
17636 |
|
17637 |
|
17638 |
|
17639 |
|
17640 |
|
17641 |
|
17642 |
|
17643 |
|
17644 |
|
17645 | var formatRegExp = /%[sdj%]/g;
|
17646 | exports.format = function(f) {
|
17647 | if (!isString(f)) {
|
17648 | var objects = [];
|
17649 | for (var i = 0; i < arguments.length; i++) {
|
17650 | objects.push(inspect(arguments[i]));
|
17651 | }
|
17652 | return objects.join(' ');
|
17653 | }
|
17654 |
|
17655 | var i = 1;
|
17656 | var args = arguments;
|
17657 | var len = args.length;
|
17658 | var str = String(f).replace(formatRegExp, function(x) {
|
17659 | if (x === '%%') return '%';
|
17660 | if (i >= len) return x;
|
17661 | switch (x) {
|
17662 | case '%s': return String(args[i++]);
|
17663 | case '%d': return Number(args[i++]);
|
17664 | case '%j':
|
17665 | try {
|
17666 | return JSON.stringify(args[i++]);
|
17667 | } catch (_) {
|
17668 | return '[Circular]';
|
17669 | }
|
17670 | default:
|
17671 | return x;
|
17672 | }
|
17673 | });
|
17674 | for (var x = args[i]; i < len; x = args[++i]) {
|
17675 | if (isNull(x) || !isObject(x)) {
|
17676 | str += ' ' + x;
|
17677 | } else {
|
17678 | str += ' ' + inspect(x);
|
17679 | }
|
17680 | }
|
17681 | return str;
|
17682 | };
|
17683 |
|
17684 |
|
17685 |
|
17686 |
|
17687 |
|
17688 | exports.deprecate = function(fn, msg) {
|
17689 |
|
17690 | if (isUndefined(global.process)) {
|
17691 | return function() {
|
17692 | return exports.deprecate(fn, msg).apply(this, arguments);
|
17693 | };
|
17694 | }
|
17695 |
|
17696 | if (process.noDeprecation === true) {
|
17697 | return fn;
|
17698 | }
|
17699 |
|
17700 | var warned = false;
|
17701 | function deprecated() {
|
17702 | if (!warned) {
|
17703 | if (process.throwDeprecation) {
|
17704 | throw new Error(msg);
|
17705 | } else if (process.traceDeprecation) {
|
17706 | console.trace(msg);
|
17707 | } else {
|
17708 | console.error(msg);
|
17709 | }
|
17710 | warned = true;
|
17711 | }
|
17712 | return fn.apply(this, arguments);
|
17713 | }
|
17714 |
|
17715 | return deprecated;
|
17716 | };
|
17717 |
|
17718 |
|
17719 | var debugs = {};
|
17720 | var debugEnviron;
|
17721 | exports.debuglog = function(set) {
|
17722 | if (isUndefined(debugEnviron))
|
17723 | debugEnviron = process.env.NODE_DEBUG || '';
|
17724 | set = set.toUpperCase();
|
17725 | if (!debugs[set]) {
|
17726 | if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
|
17727 | var pid = process.pid;
|
17728 | debugs[set] = function() {
|
17729 | var msg = exports.format.apply(exports, arguments);
|
17730 | console.error('%s %d: %s', set, pid, msg);
|
17731 | };
|
17732 | } else {
|
17733 | debugs[set] = function() {};
|
17734 | }
|
17735 | }
|
17736 | return debugs[set];
|
17737 | };
|
17738 |
|
17739 |
|
17740 | /**
|
17741 | * Echos the value of a value. Trys to print the value out
|
17742 | * in the best way possible given the different types.
|
17743 | *
|
17744 | * @param {Object} obj The object to print out.
|
17745 | * @param {Object} opts Optional options object that alters the output.
|
17746 | */
|
17747 |
|
17748 | function inspect(obj, opts) {
|
17749 |
|
17750 | var ctx = {
|
17751 | seen: [],
|
17752 | stylize: stylizeNoColor
|
17753 | };
|
17754 |
|
17755 | if (arguments.length >= 3) ctx.depth = arguments[2];
|
17756 | if (arguments.length >= 4) ctx.colors = arguments[3];
|
17757 | if (isBoolean(opts)) {
|
17758 |
|
17759 | ctx.showHidden = opts;
|
17760 | } else if (opts) {
|
17761 |
|
17762 | exports._extend(ctx, opts);
|
17763 | }
|
17764 |
|
17765 | if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
|
17766 | if (isUndefined(ctx.depth)) ctx.depth = 2;
|
17767 | if (isUndefined(ctx.colors)) ctx.colors = false;
|
17768 | if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
|
17769 | if (ctx.colors) ctx.stylize = stylizeWithColor;
|
17770 | return formatValue(ctx, obj, ctx.depth);
|
17771 | }
|
17772 | exports.inspect = inspect;
|
17773 |
|
17774 |
|
17775 |
|
17776 | inspect.colors = {
|
17777 | 'bold' : [1, 22],
|
17778 | 'italic' : [3, 23],
|
17779 | 'underline' : [4, 24],
|
17780 | 'inverse' : [7, 27],
|
17781 | 'white' : [37, 39],
|
17782 | 'grey' : [90, 39],
|
17783 | 'black' : [30, 39],
|
17784 | 'blue' : [34, 39],
|
17785 | 'cyan' : [36, 39],
|
17786 | 'green' : [32, 39],
|
17787 | 'magenta' : [35, 39],
|
17788 | 'red' : [31, 39],
|
17789 | 'yellow' : [33, 39]
|
17790 | };
|
17791 |
|
17792 |
|
17793 | inspect.styles = {
|
17794 | 'special': 'cyan',
|
17795 | 'number': 'yellow',
|
17796 | 'boolean': 'yellow',
|
17797 | 'undefined': 'grey',
|
17798 | 'null': 'bold',
|
17799 | 'string': 'green',
|
17800 | 'date': 'magenta',
|
17801 |
|
17802 | 'regexp': 'red'
|
17803 | };
|
17804 |
|
17805 |
|
17806 | function stylizeWithColor(str, styleType) {
|
17807 | var style = inspect.styles[styleType];
|
17808 |
|
17809 | if (style) {
|
17810 | return '\u001b[' + inspect.colors[style][0] + 'm' + str +
|
17811 | '\u001b[' + inspect.colors[style][1] + 'm';
|
17812 | } else {
|
17813 | return str;
|
17814 | }
|
17815 | }
|
17816 |
|
17817 |
|
17818 | function stylizeNoColor(str, styleType) {
|
17819 | return str;
|
17820 | }
|
17821 |
|
17822 |
|
17823 | function arrayToHash(array) {
|
17824 | var hash = {};
|
17825 |
|
17826 | array.forEach(function(val, idx) {
|
17827 | hash[val] = true;
|
17828 | });
|
17829 |
|
17830 | return hash;
|
17831 | }
|
17832 |
|
17833 |
|
17834 | function formatValue(ctx, value, recurseTimes) {
|
17835 |
|
17836 |
|
17837 | if (ctx.customInspect &&
|
17838 | value &&
|
17839 | isFunction(value.inspect) &&
|
17840 |
|
17841 | value.inspect !== exports.inspect &&
|
17842 |
|
17843 | !(value.constructor && value.constructor.prototype === value)) {
|
17844 | var ret = value.inspect(recurseTimes, ctx);
|
17845 | if (!isString(ret)) {
|
17846 | ret = formatValue(ctx, ret, recurseTimes);
|
17847 | }
|
17848 | return ret;
|
17849 | }
|
17850 |
|
17851 |
|
17852 | var primitive = formatPrimitive(ctx, value);
|
17853 | if (primitive) {
|
17854 | return primitive;
|
17855 | }
|
17856 |
|
17857 |
|
17858 | var keys = Object.keys(value);
|
17859 | var visibleKeys = arrayToHash(keys);
|
17860 |
|
17861 | if (ctx.showHidden) {
|
17862 | keys = Object.getOwnPropertyNames(value);
|
17863 | }
|
17864 |
|
17865 |
|
17866 |
|
17867 | if (isError(value)
|
17868 | && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
|
17869 | return formatError(value);
|
17870 | }
|
17871 |
|
17872 |
|
17873 | if (keys.length === 0) {
|
17874 | if (isFunction(value)) {
|
17875 | var name = value.name ? ': ' + value.name : '';
|
17876 | return ctx.stylize('[Function' + name + ']', 'special');
|
17877 | }
|
17878 | if (isRegExp(value)) {
|
17879 | return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
|
17880 | }
|
17881 | if (isDate(value)) {
|
17882 | return ctx.stylize(Date.prototype.toString.call(value), 'date');
|
17883 | }
|
17884 | if (isError(value)) {
|
17885 | return formatError(value);
|
17886 | }
|
17887 | }
|
17888 |
|
17889 | var base = '', array = false, braces = ['{', '}'];
|
17890 |
|
17891 |
|
17892 | if (isArray(value)) {
|
17893 | array = true;
|
17894 | braces = ['[', ']'];
|
17895 | }
|
17896 |
|
17897 |
|
17898 | if (isFunction(value)) {
|
17899 | var n = value.name ? ': ' + value.name : '';
|
17900 | base = ' [Function' + n + ']';
|
17901 | }
|
17902 |
|
17903 |
|
17904 | if (isRegExp(value)) {
|
17905 | base = ' ' + RegExp.prototype.toString.call(value);
|
17906 | }
|
17907 |
|
17908 |
|
17909 | if (isDate(value)) {
|
17910 | base = ' ' + Date.prototype.toUTCString.call(value);
|
17911 | }
|
17912 |
|
17913 |
|
17914 | if (isError(value)) {
|
17915 | base = ' ' + formatError(value);
|
17916 | }
|
17917 |
|
17918 | if (keys.length === 0 && (!array || value.length == 0)) {
|
17919 | return braces[0] + base + braces[1];
|
17920 | }
|
17921 |
|
17922 | if (recurseTimes < 0) {
|
17923 | if (isRegExp(value)) {
|
17924 | return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
|
17925 | } else {
|
17926 | return ctx.stylize('[Object]', 'special');
|
17927 | }
|
17928 | }
|
17929 |
|
17930 | ctx.seen.push(value);
|
17931 |
|
17932 | var output;
|
17933 | if (array) {
|
17934 | output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
|
17935 | } else {
|
17936 | output = keys.map(function(key) {
|
17937 | return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
|
17938 | });
|
17939 | }
|
17940 |
|
17941 | ctx.seen.pop();
|
17942 |
|
17943 | return reduceToSingleString(output, base, braces);
|
17944 | }
|
17945 |
|
17946 |
|
17947 | function formatPrimitive(ctx, value) {
|
17948 | if (isUndefined(value))
|
17949 | return ctx.stylize('undefined', 'undefined');
|
17950 | if (isString(value)) {
|
17951 | var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
|
17952 | .replace(/'/g, "\\'")
|
17953 | .replace(/\\"/g, '"') + '\'';
|
17954 | return ctx.stylize(simple, 'string');
|
17955 | }
|
17956 | if (isNumber(value))
|
17957 | return ctx.stylize('' + value, 'number');
|
17958 | if (isBoolean(value))
|
17959 | return ctx.stylize('' + value, 'boolean');
|
17960 |
|
17961 | if (isNull(value))
|
17962 | return ctx.stylize('null', 'null');
|
17963 | }
|
17964 |
|
17965 |
|
17966 | function formatError(value) {
|
17967 | return '[' + Error.prototype.toString.call(value) + ']';
|
17968 | }
|
17969 |
|
17970 |
|
17971 | function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
|
17972 | var output = [];
|
17973 | for (var i = 0, l = value.length; i < l; ++i) {
|
17974 | if (hasOwnProperty(value, String(i))) {
|
17975 | output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
|
17976 | String(i), true));
|
17977 | } else {
|
17978 | output.push('');
|
17979 | }
|
17980 | }
|
17981 | keys.forEach(function(key) {
|
17982 | if (!key.match(/^\d+$/)) {
|
17983 | output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
|
17984 | key, true));
|
17985 | }
|
17986 | });
|
17987 | return output;
|
17988 | }
|
17989 |
|
17990 |
|
17991 | function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
|
17992 | var name, str, desc;
|
17993 | desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
|
17994 | if (desc.get) {
|
17995 | if (desc.set) {
|
17996 | str = ctx.stylize('[Getter/Setter]', 'special');
|
17997 | } else {
|
17998 | str = ctx.stylize('[Getter]', 'special');
|
17999 | }
|
18000 | } else {
|
18001 | if (desc.set) {
|
18002 | str = ctx.stylize('[Setter]', 'special');
|
18003 | }
|
18004 | }
|
18005 | if (!hasOwnProperty(visibleKeys, key)) {
|
18006 | name = '[' + key + ']';
|
18007 | }
|
18008 | if (!str) {
|
18009 | if (ctx.seen.indexOf(desc.value) < 0) {
|
18010 | if (isNull(recurseTimes)) {
|
18011 | str = formatValue(ctx, desc.value, null);
|
18012 | } else {
|
18013 | str = formatValue(ctx, desc.value, recurseTimes - 1);
|
18014 | }
|
18015 | if (str.indexOf('\n') > -1) {
|
18016 | if (array) {
|
18017 | str = str.split('\n').map(function(line) {
|
18018 | return ' ' + line;
|
18019 | }).join('\n').substr(2);
|
18020 | } else {
|
18021 | str = '\n' + str.split('\n').map(function(line) {
|
18022 | return ' ' + line;
|
18023 | }).join('\n');
|
18024 | }
|
18025 | }
|
18026 | } else {
|
18027 | str = ctx.stylize('[Circular]', 'special');
|
18028 | }
|
18029 | }
|
18030 | if (isUndefined(name)) {
|
18031 | if (array && key.match(/^\d+$/)) {
|
18032 | return str;
|
18033 | }
|
18034 | name = JSON.stringify('' + key);
|
18035 | if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
|
18036 | name = name.substr(1, name.length - 2);
|
18037 | name = ctx.stylize(name, 'name');
|
18038 | } else {
|
18039 | name = name.replace(/'/g, "\\'")
|
18040 | .replace(/\\"/g, '"')
|
18041 | .replace(/(^"|"$)/g, "'");
|
18042 | name = ctx.stylize(name, 'string');
|
18043 | }
|
18044 | }
|
18045 |
|
18046 | return name + ': ' + str;
|
18047 | }
|
18048 |
|
18049 |
|
18050 | function reduceToSingleString(output, base, braces) {
|
18051 | var numLinesEst = 0;
|
18052 | var length = output.reduce(function(prev, cur) {
|
18053 | numLinesEst++;
|
18054 | if (cur.indexOf('\n') >= 0) numLinesEst++;
|
18055 | return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
|
18056 | }, 0);
|
18057 |
|
18058 | if (length > 60) {
|
18059 | return braces[0] +
|
18060 | (base === '' ? '' : base + '\n ') +
|
18061 | ' ' +
|
18062 | output.join(',\n ') +
|
18063 | ' ' +
|
18064 | braces[1];
|
18065 | }
|
18066 |
|
18067 | return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
|
18068 | }
|
18069 |
|
18070 |
|
18071 |
|
18072 |
|
18073 | function isArray(ar) {
|
18074 | return Array.isArray(ar);
|
18075 | }
|
18076 | exports.isArray = isArray;
|
18077 |
|
18078 | function isBoolean(arg) {
|
18079 | return typeof arg === 'boolean';
|
18080 | }
|
18081 | exports.isBoolean = isBoolean;
|
18082 |
|
18083 | function isNull(arg) {
|
18084 | return arg === null;
|
18085 | }
|
18086 | exports.isNull = isNull;
|
18087 |
|
18088 | function isNullOrUndefined(arg) {
|
18089 | return arg == null;
|
18090 | }
|
18091 | exports.isNullOrUndefined = isNullOrUndefined;
|
18092 |
|
18093 | function isNumber(arg) {
|
18094 | return typeof arg === 'number';
|
18095 | }
|
18096 | exports.isNumber = isNumber;
|
18097 |
|
18098 | function isString(arg) {
|
18099 | return typeof arg === 'string';
|
18100 | }
|
18101 | exports.isString = isString;
|
18102 |
|
18103 | function isSymbol(arg) {
|
18104 | return typeof arg === 'symbol';
|
18105 | }
|
18106 | exports.isSymbol = isSymbol;
|
18107 |
|
18108 | function isUndefined(arg) {
|
18109 | return arg === void 0;
|
18110 | }
|
18111 | exports.isUndefined = isUndefined;
|
18112 |
|
18113 | function isRegExp(re) {
|
18114 | return isObject(re) && objectToString(re) === '[object RegExp]';
|
18115 | }
|
18116 | exports.isRegExp = isRegExp;
|
18117 |
|
18118 | function isObject(arg) {
|
18119 | return typeof arg === 'object' && arg !== null;
|
18120 | }
|
18121 | exports.isObject = isObject;
|
18122 |
|
18123 | function isDate(d) {
|
18124 | return isObject(d) && objectToString(d) === '[object Date]';
|
18125 | }
|
18126 | exports.isDate = isDate;
|
18127 |
|
18128 | function isError(e) {
|
18129 | return isObject(e) &&
|
18130 | (objectToString(e) === '[object Error]' || e instanceof Error);
|
18131 | }
|
18132 | exports.isError = isError;
|
18133 |
|
18134 | function isFunction(arg) {
|
18135 | return typeof arg === 'function';
|
18136 | }
|
18137 | exports.isFunction = isFunction;
|
18138 |
|
18139 | function isPrimitive(arg) {
|
18140 | return arg === null ||
|
18141 | typeof arg === 'boolean' ||
|
18142 | typeof arg === 'number' ||
|
18143 | typeof arg === 'string' ||
|
18144 | typeof arg === 'symbol' ||
|
18145 | typeof arg === 'undefined';
|
18146 | }
|
18147 | exports.isPrimitive = isPrimitive;
|
18148 |
|
18149 | exports.isBuffer = require('./support/isBuffer');
|
18150 |
|
18151 | function objectToString(o) {
|
18152 | return Object.prototype.toString.call(o);
|
18153 | }
|
18154 |
|
18155 |
|
18156 | function pad(n) {
|
18157 | return n < 10 ? '0' + n.toString(10) : n.toString(10);
|
18158 | }
|
18159 |
|
18160 |
|
18161 | var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
|
18162 | 'Oct', 'Nov', 'Dec'];
|
18163 |
|
18164 |
|
18165 | function timestamp() {
|
18166 | var d = new Date();
|
18167 | var time = [pad(d.getHours()),
|
18168 | pad(d.getMinutes()),
|
18169 | pad(d.getSeconds())].join(':');
|
18170 | return [d.getDate(), months[d.getMonth()], time].join(' ');
|
18171 | }
|
18172 |
|
18173 |
|
18174 |
|
18175 | exports.log = function() {
|
18176 | console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
|
18177 | };
|
18178 |
|
18179 |
|
18180 |
|
18181 |
|
18182 |
|
18183 |
|
18184 |
|
18185 |
|
18186 |
|
18187 |
|
18188 |
|
18189 |
|
18190 |
|
18191 |
|
18192 |
|
18193 | exports.inherits = require('inherits');
|
18194 |
|
18195 | exports._extend = function(origin, add) {
|
18196 |
|
18197 | if (!add || !isObject(add)) return origin;
|
18198 |
|
18199 | var keys = Object.keys(add);
|
18200 | var i = keys.length;
|
18201 | while (i--) {
|
18202 | origin[keys[i]] = add[keys[i]];
|
18203 | }
|
18204 | return origin;
|
18205 | };
|
18206 |
|
18207 | function hasOwnProperty(obj, prop) {
|
18208 | return Object.prototype.hasOwnProperty.call(obj, prop);
|
18209 | }
|
18210 |
|
18211 | }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
18212 | },{"./support/isBuffer":88,"_process":69,"inherits":56}],90:[function(require,module,exports){
|
18213 | module.exports={
|
18214 | "name": "mocha",
|
18215 | "version": "7.0.0-esm1",
|
18216 | "homepage": "https://mochajs.org/",
|
18217 | "notifyLogo": "https://ibin.co/4QuRuGjXvl36.png"
|
18218 | }
|
18219 | },{}]},{},[1]);
|