PageSourceSearch

https://lpmaiusd.web.app/js/exceljs/dist/exceljs.js

js lpmaiusd.web.app collected 2026-10-03 12:29:05 UTC 3,089,805 bytes, 95,475 lines download raw bytes

vendor: 5,142 bytes, lines 1-39
1"use strict";
2
3function _createForOfIteratorHelper2(o) { if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (o = _unsupportedIterableToArray2(o))) { var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e3) { throw _e3; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var it, normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e4) { didErr = true; err = _e4; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
4
5function _toConsumableArray2(arr) { return _arrayWithoutHoles2(arr) || _iterableToArray2(arr) || _unsupportedIterableToArray2(arr) || _nonIterableSpread2(); }
6
7function _nonIterableSpread2() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
8
9function _unsupportedIterableToArray2(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray2(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray2(o, minLen); }
10
11function _iterableToArray2(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
12
13function _arrayWithoutHoles2(arr) { if (Array.isArray(arr)) return _arrayLikeToArray2(arr); }
14
15function _arrayLikeToArray2(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
16
17function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }
18
19function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf2(object); if (object === null) break; } return object; }
20
21function _classCallCheck2(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
22
23function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
24
25function _createClass2(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
26
27function _inherits2(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf2(subClass, superClass); }
28
29function _setPrototypeOf2(o, p) { _setPrototypeOf2 = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf2(o, p); }
30
31function _createSuper2(Derived) { return function () { var Super = _getPrototypeOf2(Derived), result; if (_isNativeReflectConstruct2()) { var NewTarget = _getPrototypeOf2(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn2(this, result); }; }
32
33function _possibleConstructorReturn2(self, call) { if (call && (_typeof2(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized2(self); }
34
35function _assertThisInitialized2(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
36
37function _isNativeReflectConstruct2() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
38
39function _getPrototypeOf2(o) { _getPrototypeOf2 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o
39) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf2(o); }
40
41function _typeof2(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); }
42
43(function (f) {
44  if ((typeof exports === "undefined" ? "undefined" : _typeof2(exports)) === "object" && typeof module !== "undefined") {
45    module.exports = f();
46  } else if (typeof define === "function" && define.amd) {
47    define([], f);
48  } else {
49    var g;
50
51    if (typeof window !== "undefined") {
52      g = window;
53    } else if (typeof global !== "undefined") {
54      g = global;
55    } else if (typeof self !== "undefined") {
56      g = self;
57    } else {
58      g = this;
59    }
60
61    g.ExcelJS = f();
62  }
63})(function () {
64  var define, module, exports;
65  return function () {
66    function r(e, n, t) {
67      function o(i, f) {
68        if (!n[i]) {
69          if (!e[i]) {
70            var c = "function" == typeof require && require;
71            if (!f && c) return c(i, !0);
72            if (u) return u(i, !0);
73            var a = new Error("Cannot find module '" + i + "'");
74            throw a.code = "MODULE_NOT_FOUND", a;
75          }
76
77          var p = n[i] = {
78            exports: {}
79          };
80          e[i][0].call(p.exports, function (r) {
81            var n = e[i][1][r];
82            return o(n || r);
83          }, p, p.exports, r, e, n, t);
84        }
85
86        return n[i].exports;
87      }
88
89      for (var u = "function" == typeof require && require, i = 0; i < t.length; i++) {
90        o(t[i]);
91      }
92
93      return o;
94    }
95
96    return r;
97  }()({
98    1: [function (require, module, exports) {
99      "use strict";
100
101      function _typeof(obj) {
102        "@babel/helpers - typeof";
103
104        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
105          _typeof = function _typeof(obj) {
106            return typeof obj;
107          };
108        } else {
109          _typeof = function _typeof(obj) {
110            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
111          };
112        }
113
114        return _typeof(obj);
115      }
116
117      function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
118        try {
119          var info = gen[key](arg);
120          var value = info.value;
121        } catch (error) {
122          reject(error);
123          return;
124        }
125
126        if (info.done) {
127          resolve(value);
128        } else {
129          Promise.resolve(value).then(_next, _throw);
130        }
131      }
132
133      function _asyncToGenerator(fn) {
134        return function () {
135          var self = this,
136              args = arguments;
137          return new Promise(function (resolve, reject) {
138            var gen = fn.apply(self, args);
139
140            function _next(value) {
141              asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
142            }
143
144            function _throw(err) {
145              asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
146            }
147
148            _next(undefined);
149          });
150        };
151      }
152
153      function _classCallCheck(instance, Constructor) {
154        if (!(instance instanceof Constructor)) {
155          throw new TypeError("Cannot call a class as a function");
156        }
157      }
158
159      function _defineProperties(target, props) {
160        for (var i = 0; i < props.length; i++) {
161          var descriptor = props[i];
162          descriptor.enumerable = descriptor.enumerable || false;
163          descriptor.configurable = true;
164          if ("value" in descriptor) descriptor.writable = true;
165          Object.defineProperty(target, descriptor.key, descriptor);
166        }
167      }
168
169      function _createClass(Constructor, protoProps, staticProps) {
170        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
171        if (staticProps) _defineProperties(Constructor, staticProps);
172        return Constructor;
173      }
174
175      var fs = require('fs');
176
177      var fastCsv = require('fast-csv');
178
179      var customParseFormat = require('dayjs/plugin/customParseFormat');
180
181      var utc = require('dayjs/plugin/utc');
182
183      var dayjs = require('dayjs').extend(customParseFormat).extend(utc);
184
185      var StreamBuf = require('../utils/stream-buf');
186
187      var _require = require('../utils/utils'),
188          exists = _require.fs.exists;
189      /* eslint-disable quote-props */
190
191
192      var SpecialValues = {
193        true: true,
194        false: false,
195        '#N/A': {
196          error: '#N/A'
197        },
198        '#REF!': {
199          error: '#REF!'
200        },
201        '#NAME?': {
202          error: '#NAME?'
203        },
204        '#DIV/0!': {
205          error: '#DIV/0!'
206        },
207        '#NULL!': {
208          error: '#NULL!'
209        },
210        '#VALUE!': {
211          error: '#VALUE!'
212        },
213        '#NUM!': {
214          error: '#NUM!'
215        }
216      };
217      /* eslint-ensable quote-props */
218
219      var CSV = /*#__PURE__*/function () {
220        function CSV(workbook) {
221          _classCallCheck(this, CSV);
222
223          this.workbook = workbook;
224          this.worksheet = null;
225        }
226
227        _createClass(CSV, [{
228          key: "readFile",
229          value: function () {
230            var _readFile = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(filename, options) {
231              var stream, worksheet;
232              return regeneratorRuntime.wrap(function _callee$(_context) {
233                while (1) {
234                  switch (_context.prev = _context.next) {
235                    case 0:
236                      options = options || {};
237                      _context.next = 3;
238                      return exists(filename);
239
240                    case 3:
241                      if (_context.sent) {
242                        _context.next = 5;
243                        break;
244                      }
245
246                      throw new Error("File not found: ".concat(filename));
247
248                    case 5:
249                      stream = fs.createReadStream(filename);
250                      _context.next = 8;
251                      return this.read(stream, options);
252
253                    case 8:
254                      worksheet = _context.sent;
255                      stream.close();
256                      return _context.abrupt("return", worksheet);
257
258                    case 11:
259                    case "end":
260                      return _context.stop();
261                  }
262                }
263              }, _callee, this);
264            }));
265
266            function readFile(_x, _x2) {
267              return _readFile.apply(this, arguments);
268            }
269
270            return readFile;
271          }()
272        }, {
273          key: "read",
274          value: function read(stream, options) {
275            var _this = this;
276
277            options = options || {};
278            return new Promise(function (resolve, reject) {
279              var worksheet = _this.workbook.addWorksheet(options.sheetName);
280
281              var dateFormats = options.dateFormats || ['YYYY-MM-DD[T]HH:mm:ssZ', 'YYYY-MM-DD[T]HH:mm:ss', 'MM-DD-YYYY', 'YYYY-MM-DD'];
282
283              var map = options.map || function (datum) {
284                if (datum === '') {
285                  return null;
286                }
287
288                var datumNumber = Number(datum);
289
290                if (!Number.isNaN(datumNumber) && datumNumber !== Infinity) {
291                  return datumNumber;
292                }
293
294                var dt = dateFormats.reduce(function (matchingDate, currentDateFormat) {
295                  if (matchingDate) {
296                    return matchingDate;
297                  }
298
299                  var dayjsObj = dayjs(datum, currentDateFormat, true);
300
301                  if (dayjsObj.isValid()) {
302                    return dayjsObj;
303                  }
304
305                  return null;
306                }, null);
307
308                if (dt) {
309                  return new Date(dt.valueOf());
310                }
311
312                var special = SpecialValues[datum];
313
314                if (special !== undefined) {
315                  return special;
316                }
317
318                return datum;
319              };
320
321              var csvStream = fastCsv.parse(options.parserOptions).on('data', function (data) {
322                worksheet.addRow(data.map(map));
323              }).on('end', function () {
324                csvStream.emit('worksheet', worksheet);
325              });
326              csvStream.on('worksheet', resolve).on('error', reject);
327              stream.pipe(csvStream);
328            });
329          }
330          /**
331           * @deprecated since version 4.0. You should use `CSV#read` instead. Please follow upgrade instruction: https://github.com/exceljs/exceljs/blob/master/UPGRADE-4.0.md
332           */
333
334        }, {
335          key: "createInputStream",
336          value: function createInputStream() {
337            throw new Error('`CSV#createInputStream` is deprecated. You should use `CSV#read` instead. This method will be removed in version 5.0. Please follow upgrade instruction: https://github.com/exceljs/exceljs/blob/master/UPGRADE-4.0.md');
338          }
339        }, {
340          key: "write",
341          value: function write(stream, options) {
342            var _this2 = this;
343
344            return new Promise(function (resolve, reject) {
345              options = options || {}; // const encoding = options.encoding || 'utf8';
346              // const separator = options.separator || ',';
347              // const quoteChar = options.quoteChar || '\'';
348
349              var worksheet = _this2.workbook.getWorksheet(options.sheetName || options.sheetId);
350
351              var csvStream = fastCsv.format(options.formatterOptions);
352              stream.on('finish', function () {
353                resolve();
354              });
355              csvStream.on('error', reject);
356              csvStream.pipe(stream);
357              var _options = options,
358                  dateFormat = _options.dateFormat,
359                  dateUTC = _options.dateUTC;
360
361              var map = options.map || function (value) {
362                if (value) {
363                  if (value.text || value.hyperlink) {
364                    return value.hyperlink || value.text || '';
365                  }
366
367                  if (value.formula || value.result) {
368                    return value.result || '';
369                  }
370
371                  if (value instanceof Date) {
372                    if (dateFormat) {
373                      return dateUTC ? dayjs.utc(value).format(dateFormat) : dayjs(value).format(dateFormat);
374                    }
375
376                    return dateUTC ? dayjs.utc(value).format() : dayjs(value).format();
377                  }
378
379                  if (value.error) {
380                    return value.error;
381                  }
382
383                  if (_typeof(value) === 'object') {
384                    return JSON.stringify(value);
385                  }
386                }
387
388                return value;
389              };
390
391              var includeEmptyRows = options.includeEmptyRows === undefined || options.includeEmptyRows;
392              var lastRow = 1;
393
394              if (worksheet) {
395                worksheet.eachRow(function (row, rowNumber) {
396                  if (includeEmptyRows) {
397                    while (lastRow++ < rowNumber - 1) {
398                      csvStream.write([]);
399                    }
400                  }
401
402                  var values = row.values;
403                  values.shift();
404                  csvStream.write(values.map(map));
405                  lastRow = rowNumber;
406                });
407              }
408
409              csvStream.end();
410            });
411          }
412        }, {
413          key: "writeFile",
414          value: function writeFile(filename, options) {
415            options = options || {};
416            var streamOptions = {
417              encoding: options.encoding || 'utf8'
418            };
419            var stream = fs.createWriteStream(filename, streamOptions);
420            return this.write(stream, options);
421          }
422        }, {
423          key: "writeBuffer",
424          value: function () {
425            var _writeBuffer = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(options) {
426              var stream;
427              return regeneratorRuntime.wrap(function _callee2$(_context2) {
428                while (1) {
429                  switch (_context2.prev = _context2.next) {
430                    case 0:
431                      stream = new StreamBuf();
432                      _context2.next = 3;
433                      return this.write(stream, options);
434
435                    case 3:
436                      return _context2.abrupt("return", stream.read());
437
438                    case 4:
439                    case "end":
440                      return _context2.stop();
441                  }
442                }
443              }, _callee2, this);
444            }));
445
446            function writeBuffer(_x3) {
447              return _writeBuffer.apply(this, arguments);
448            }
449
450            return writeBuffer;
451          }()
452        }]);
453
454        return CSV;
455      }();
456
457      module.exports = CSV;
458    }, {
459      "../utils/stream-buf": 21,
460      "../utils/utils": 24,
461      "dayjs": 313,
462      "dayjs/plugin/customParseFormat": 314,
463      "dayjs/plugin/utc": 315,
464      "fast-csv": 346,
465      "fs": 213
466    }],
467    2: [function (require, module, exports) {
468      'use strict';
469
470      function _classCallCheck(instance, Constructor) {
471        if (!(instance instanceof Constructor)) {
472          throw new TypeError("Cannot call a class as a function");
473        }
474      }
475
476      function _defineProperties(target, props) {
477        for (var i = 0; i < props.length; i++) {
478          var descriptor = props[i];
479          descriptor.enumerable = descriptor.enumerable || false;
480          descriptor.configurable = true;
481          if ("value" in descriptor) descriptor.writable = true;
482          Object.defineProperty(target, descriptor.key, descriptor);
483        }
484      }
485
486      function _createClass(Constructor, protoProps, staticProps) {
487        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
488        if (staticProps) _defineProperties(Constructor, staticProps);
489        return Constructor;
490      }
491
492      var colCache = require('../utils/col-cache');
493
494      var Anchor = /*#__PURE__*/function () {
495        function Anchor(worksheet, address) {
496          var offset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
497
498          _classCallCheck(this, Anchor);
499
500          if (!address) {
501            this.nativeCol = 0;
502            this.nativeColOff = 0;
503            this.nativeRow = 0;
504            this.nativeRowOff = 0;
505          } else if (typeof address === 'string') {
506            var decoded = colCache.decodeAddress(address);
507            this.nativeCol = decoded.col + offset;
508            this.nativeColOff = 0;
509            this.nativeRow = decoded.row + offset;
510            this.nativeRowOff = 0;
511          } else if (address.nativeCol !== undefined) {
512            this.nativeCol = address.nativeCol || 0;
513            this.nativeColOff = address.nativeColOff || 0;
514            this.nativeRow = address.nativeRow || 0;
515            this.nativeRowOff = address.nativeRowOff || 0;
516          } else if (address.col !== undefined) {
517            this.col = address.col + offset;
518            this.row = address.row + offset;
519          } else {
520            this.nativeCol = 0;
521            this.nativeColOff = 0;
522            this.nativeRow = 0;
523            this.nativeRowOff = 0;
524          }
525
526          this.worksheet = worksheet;
527        }
528
529        _createClass(Anchor, [{
530          key: "col",
531          get: function get() {
532            return this.nativeCol + Math.min(this.colWidth - 1, this.nativeColOff) / this.colWidth;
533          },
534          set: function set(v) {
535            this.nativeCol = Math.floor(v);
536            this.nativeColOff = Math.floor((v - this.nativeCol) * this.colWidth);
537          }
538        }, {
539          key: "row",
540          get: function get() {
541            return this.nativeRow + Math.min(this.rowHeight - 1, this.nativeRowOff) / this.rowHeight;
542          },
543          set: function set(v) {
544            this.nativeRow = Math.floor(v);
545            this.nativeRowOff = Math.floor((v - this.nativeRow) * this.rowHeight);
546          }
547        }, {
548          key: "colWidth",
549          get: function get() {
550            return this.worksheet && this.worksheet.getColumn(this.nativeCol + 1) && this.worksheet.getColumn(this.nativeCol + 1).isCustomWidth ? Math.floor(this.worksheet.getColumn(this.nativeCol + 1).width * 10000) : 640000;
551          }
552        }, {
553          key: "rowHeight",
554          get: function get() {
555            return this.worksheet && this.worksheet.getRow(this.nativeRow + 1) && this.worksheet.getRow(this.nativeRow + 1).height ? Math.floor(this.worksheet.getRow(this.nativeRow + 1).height * 10000) : 180000;
556          }
557        }, {
558          key: "model",
559          get: function get() {
560            return {
561              nativeCol: this.nativeCol,
562              nativeColOff: this.nativeColOff,
563              nativeRow: this.nativeRow,
564              nativeRowOff: this.nativeRowOff
565            };
566          },
567          set: function set(value) {
568            this.nativeCol = value.nativeCol;
569            this.nativeColOff = value.nativeColOff;
570            this.nativeRow = value.nativeRow;
571            this.nativeRowOff = value.nativeRowOff;
572          }
573        }], [{
574          key: "asInstance",
575          value: function asInstance(model) {
576            return model instanceof Anchor || model == null ? model : new Anchor(model);
577          }
578        }]);
579
580        return Anchor;
581      }();
582
583      module.exports = Anchor;
584    }, {
vendor: 49,078 bytes, lines 585-2323
585      "../utils/col-cache": 17
586    }],
587    3: [function (require, module, exports) {
588      "use strict";
589
590      function _classCallCheck(instance, Constructor) {
591        if (!(instance instanceof Constructor)) {
592          throw new TypeError("Cannot call a class as a function");
593        }
594      }
595
596      function _defineProperties(target, props) {
597        for (var i = 0; i < props.length; i++) {
598          var descriptor = props[i];
599          descriptor.enumerable = descriptor.enumerable || false;
600          descriptor.configurable = true;
601          if ("value" in descriptor) descriptor.writable = true;
602          Object.defineProperty(target, descriptor.key, descriptor);
603        }
604      }
605
606      function _createClass(Constructor, protoProps, staticProps) {
607        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
608        if (staticProps) _defineProperties(Constructor, staticProps);
609        return Constructor;
610      }
611      /* eslint-disable max-classes-per-file */
612
613
614      var colCache = require('../utils/col-cache');
615
616      var _ = require('../utils/under-dash');
617
618      var Enums = require('./enums');
619
620      var _require = require('../utils/shared-formula'),
621          slideFormula = _require.slideFormula;
622
623      var Note = require('./note'); // Cell requirements
624      //  Operate inside a worksheet
625      //  Store and retrieve a value with a range of types: text, number, date, hyperlink, reference, formula, etc.
626      //  Manage/use and manipulate cell format either as local to cell or inherited from column or row.
627
628
629      var Cell = /*#__PURE__*/function () {
630        function Cell(row, column, address) {
631          _classCallCheck(this, Cell);
632
633          if (!row || !column) {
634            throw new Error('A Cell needs a Row');
635          }
636
637          this._row = row;
638          this._column = column;
639          colCache.validateAddress(address);
640          this._address = address; // TODO: lazy evaluation of this._value
641
642          this._value = Value.create(Cell.Types.Null, this);
643          this.style = this._mergeStyle(row.style, column.style, {});
644          this._mergeCount = 0;
645        }
646
647        _createClass(Cell, [{
648          key: "destroy",
649          // help GC by removing cyclic (and other) references
650          value: function destroy() {
651            delete this.style;
652            delete this._value;
653            delete this._row;
654            delete this._column;
655            delete this._address;
656          } // =========================================================================
657          // Styles stuff
658
659        }, {
660          key: "_mergeStyle",
661          value: function _mergeStyle(rowStyle, colStyle, style) {
662            var numFmt = rowStyle && rowStyle.numFmt || colStyle && colStyle.numFmt;
663            if (numFmt) style.numFmt = numFmt;
664            var font = rowStyle && rowStyle.font || colStyle && colStyle.font;
665            if (font) style.font = font;
666            var alignment = rowStyle && rowStyle.alignment || colStyle && colStyle.alignment;
667            if (alignment) style.alignment = alignment;
668            var border = rowStyle && rowStyle.border || colStyle && colStyle.border;
669            if (border) style.border = border;
670            var fill = rowStyle && rowStyle.fill || colStyle && colStyle.fill;
671            if (fill) style.fill = fill;
672            var protection = rowStyle && rowStyle.protection || colStyle && colStyle.protection;
673            if (protection) style.protection = protection;
674            return style;
675          } // =========================================================================
676          // return the address for this cell
677
678        }, {
679          key: "toCsvString",
680          value: function toCsvString() {
681            return this._value.toCsvString();
682          } // =========================================================================
683          // Merge stuff
684
685        }, {
686          key: "addMergeRef",
687          value: function addMergeRef() {
688            this._mergeCount++;
689          }
690        }, {
691          key: "releaseMergeRef",
692          value: function releaseMergeRef() {
693            this._mergeCount--;
694          }
695        }, {
696          key: "merge",
697          value: function merge(master, ignoreStyle) {
698            this._value.release();
699
700            this._value = Value.create(Cell.Types.Merge, this, master);
701
702            if (!ignoreStyle) {
703              this.style = master.style;
704            }
705          }
706        }, {
707          key: "unmerge",
708          value: function unmerge() {
709            if (this.type === Cell.Types.Merge) {
710              this._value.release();
711
712              this._value = Value.create(Cell.Types.Null, this);
713              this.style = this._mergeStyle(this._row.style, this._column.style, {});
714            }
715          }
716        }, {
717          key: "isMergedTo",
718          value: function isMergedTo(master) {
719            if (this._value.type !== Cell.Types.Merge) return false;
720            return this._value.isMergedTo(master);
721          }
722        }, {
723          key: "toString",
724          value: function toString() {
725            return this.text;
726          }
727        }, {
728          key: "_upgradeToHyperlink",
729          value: function _upgradeToHyperlink(hyperlink) {
730            // if this cell is a string, turn it into a Hyperlink
731            if (this.type === Cell.Types.String) {
732              this._value = Value.create(Cell.Types.Hyperlink, this, {
733                text: this._value.value,
734                hyperlink: hyperlink
735              });
736            }
737          } // =========================================================================
738          // Formula stuff
739
740        }, {
741          key: "addName",
742          value: function addName(name) {
743            this.workbook.definedNames.addEx(this.fullAddress, name);
744          }
745        }, {
746          key: "removeName",
747          value: function removeName(name) {
748            this.workbook.definedNames.removeEx(this.fullAddress, name);
749          }
750        }, {
751          key: "removeAllNames",
752          value: function removeAllNames() {
753            this.workbook.definedNames.removeAllNames(this.fullAddress);
754          } // =========================================================================
755          // Data Validation stuff
756
757        }, {
758          key: "worksheet",
759          get: function get() {
760            return this._row.worksheet;
761          }
762        }, {
763          key: "workbook",
764          get: function get() {
765            return this._row.worksheet.workbook;
766          }
767        }, {
768          key: "numFmt",
769          get: function get() {
770            return this.style.numFmt;
771          },
772          set: function set(value) {
773            this.style.numFmt = value;
774          }
775        }, {
776          key: "font",
777          get: function get() {
778            return this.style.font;
779          },
780          set: function set(value) {
781            this.style.font = value;
782          }
783        }, {
784          key: "alignment",
785          get: function get() {
786            return this.style.alignment;
787          },
788          set: function set(value) {
789            this.style.alignment = value;
790          }
791        }, {
792          key: "border",
793          get: function get() {
794            return this.style.border;
795          },
796          set: function set(value) {
797            this.style.border = value;
798          }
799        }, {
800          key: "fill",
801          get: function get() {
802            return this.style.fill;
803          },
804          set: function set(value) {
805            this.style.fill = value;
806          }
807        }, {
808          key: "protection",
809          get: function get() {
810            return this.style.protection;
811          },
812          set: function set(value) {
813            this.style.protection = value;
814          }
815        }, {
816          key: "address",
817          get: function get() {
818            return this._address;
819          }
820        }, {
821          key: "row",
822          get: function get() {
823            return this._row.number;
824          }
825        }, {
826          key: "col",
827          get: function get() {
828            return this._column.number;
829          }
830        }, {
831          key: "$col$row",
832          get: function get() {
833            return "$".concat(this._column.letter, "$").concat(this.row);
834          } // =========================================================================
835          // Value stuff
836
837        }, {
838          key: "type",
839          get: function get() {
840            return this._value.type;
841          }
842        }, {
843          key: "effectiveType",
844          get: function get() {
845            return this._value.effectiveType;
846          }
847        }, {
848          key: "isMerged",
849          get: function get() {
850            return this._mergeCount > 0 || this.type === Cell.Types.Merge;
851          }
852        }, {
853          key: "master",
854          get: function get() {
855            if (this.type === Cell.Types.Merge) {
856              return this._value.master;
857            }
858
859            return this; // an unmerged cell is its own master
860          }
861        }, {
862          key: "isHyperlink",
863          get: function get() {
864            return this._value.type === Cell.Types.Hyperlink;
865          }
866        }, {
867          key: "hyperlink",
868          get: function get() {
869            return this._value.hyperlink;
870          } // return the value
871
872        }, {
873          key: "value",
874          get: function get() {
875            return this._value.value;
876          } // set the value - can be number, string or raw
877          ,
878          set: function set(v) {
879            // special case - merge cells set their master's value
880            if (this.type === Cell.Types.Merge) {
881              this._value.master.value = v;
882              return;
883            }
884
885            this._value.release(); // assign value
886
887
888            this._value = Value.create(Value.getType(v), this, v);
889          }
890        }, {
891          key: "note",
892          get: function get() {
893            return this._comment && this._comment.note;
894          },
895          set: function set(note) {
896            this._comment = new Note(note);
897          }
898        }, {
899          key: "text",
900          get: function get() {
901            return this._value.toString();
902          }
903        }, {
904          key: "html",
905          get: function get() {
906            return _.escapeHtml(this.text);
907          }
908        }, {
909          key: "formula",
910          get: function get() {
911            return this._value.formula;
912          }
913        }, {
914          key: "result",
915          get: function get() {
916            return this._value.result;
917          }
918        }, {
919          key: "formulaType",
920          get: function get() {
921            return this._value.formulaType;
922          } // =========================================================================
923          // Name stuff
924
925        }, {
926          key: "fullAddress",
927          get: function get() {
928            var worksheet = this._row.worksheet;
929            return {
930              sheetName: worksheet.name,
931              address: this.address,
932              row: this.row,
933              col: this.col
934            };
935          }
936        }, {
937          key: "name",
938          get: function get() {
939            return this.names[0];
940          },
941          set: function set(value) {
942            this.names = [value];
943          }
944        }, {
945          key: "names",
946          get: function get() {
947            return this.workbook.definedNames.getNamesEx(this.fullAddress);
948          },
949          set: function set(value) {
950            var _this = this;
951
952            var definedNames = this.workbook.definedNames;
953            definedNames.removeAllNames(this.fullAddress);
954            value.forEach(function (name) {
955              definedNames.addEx(_this.fullAddress, name);
956            });
957          }
958        }, {
959          key: "_dataValidations",
960          get: function get() {
961            return this.worksheet.dataValidations;
962          }
963        }, {
964          key: "dataValidation",
965          get: function get() {
966            return this._dataValidations.find(this.address);
967          },
968          set: function set(value) {
969            this._dataValidations.add(this.address, value);
970          } // =========================================================================
971          // Model stuff
972
973        }, {
974          key: "model",
975          get: function get() {
976            var model = this._value.model;
977            model.style = this.style;
978
979            if (this._comment) {
980              model.comment = this._comment.model;
981            }
982
983            return model;
984          },
985          set: function set(value) {
986            this._value.release();
987
988            this._value = Value.create(value.type, this);
989            this._value.model = value;
990
991            if (value.comment) {
992              switch (value.comment.type) {
993                case 'note':
994                  this._comment = Note.fromModel(value.comment);
995                  break;
996              }
997            }
998
999            if (value.style) {
1000              this.style = value.style;
1001            } else {
1002              this.style = {};
1003            }
1004          }
1005        }]);
1006
1007        return Cell;
1008      }();
1009
1010      Cell.Types = Enums.ValueType; // =============================================================================
1011      // Internal Value Types
1012
1013      var NullValue = /*#__PURE__*/function () {
1014        function NullValue(cell) {
1015          _classCallCheck(this, NullValue);
1016
1017          this.model = {
1018            address: cell.address,
1019            type: Cell.Types.Null
1020          };
1021        }
1022
1023        _createClass(NullValue, [{
1024          key: "toCsvString",
1025          value: function toCsvString() {
1026            return '';
1027          }
1028        }, {
1029          key: "release",
1030          value: function release() {}
1031        }, {
1032          key: "toString",
1033          value: function toString() {
1034            return '';
1035          }
1036        }, {
1037          key: "value",
1038          get: function get() {
1039            return null;
1040          },
1041          set: function set(value) {// nothing to do
1042          }
1043        }, {
1044          key: "type",
1045          get: function get() {
1046            return Cell.Types.Null;
1047          }
1048        }, {
1049          key: "effectiveType",
1050          get: function get() {
1051            return Cell.Types.Null;
1052          }
1053        }, {
1054          key: "address",
1055          get: function get() {
1056            return this.model.address;
1057          },
1058          set: function set(value) {
1059            this.model.address = value;
1060          }
1061        }]);
1062
1063        return NullValue;
1064      }();
1065
1066      var NumberValue = /*#__PURE__*/function () {
1067        function NumberValue(cell, value) {
1068          _classCallCheck(this, NumberValue);
1069
1070          this.model = {
1071            address: cell.address,
1072            type: Cell.Types.Number,
1073            value: value
1074          };
1075        }
1076
1077        _createClass(NumberValue, [{
1078          key: "toCsvString",
1079          value: function toCsvString() {
1080            return this.model.value.toString();
1081          }
1082        }, {
1083          key: "release",
1084          value: function release() {}
1085        }, {
1086          key: "toString",
1087          value: function toString() {
1088            return this.model.value.toString();
1089          }
1090        }, {
1091          key: "value",
1092          get: function get() {
1093            return this.model.value;
1094          },
1095          set: function set(value) {
1096            this.model.value = value;
1097          }
1098        }, {
1099          key: "type",
1100          get: function get() {
1101            return Cell.Types.Number;
1102          }
1103        }, {
1104          key: "effectiveType",
1105          get: function get() {
1106            return Cell.Types.Number;
1107          }
1108        }, {
1109          key: "address",
1110          get: function get() {
1111            return this.model.address;
1112          },
1113          set: function set(value) {
1114            this.model.address = value;
1115          }
1116        }]);
1117
1118        return NumberValue;
1119      }();
1120
1121      var StringValue = /*#__PURE__*/function () {
1122        function StringValue(cell, value) {
1123          _classCallCheck(this, StringValue);
1124
1125          this.model = {
1126            address: cell.address,
1127            type: Cell.Types.String,
1128            value: value
1129          };
1130        }
1131
1132        _createClass(StringValue, [{
1133          key: "toCsvString",
1134          value: function toCsvString() {
1135            return "\"".concat(this.model.value.replace(/"/g, '""'), "\"");
1136          }
1137        }, {
1138          key: "release",
1139          value: function release() {}
1140        }, {
1141          key: "toString",
1142          value: function toString() {
1143            return this.model.value;
1144          }
1145        }, {
1146          key: "value",
1147          get: function get() {
1148            return this.model.value;
1149          },
1150          set: function set(value) {
1151            this.model.value = value;
1152          }
1153        }, {
1154          key: "type",
1155          get: function get() {
1156            return Cell.Types.String;
1157          }
1158        }, {
1159          key: "effectiveType",
1160          get: function get() {
1161            return Cell.Types.String;
1162          }
1163        }, {
1164          key: "address",
1165          get: function get() {
1166            return this.model.address;
1167          },
1168          set: function set(value) {
1169            this.model.address = value;
1170          }
1171        }]);
1172
1173        return StringValue;
1174      }();
1175
1176      var RichTextValue = /*#__PURE__*/function () {
1177        function RichTextValue(cell, value) {
1178          _classCallCheck(this, RichTextValue);
1179
1180          this.model = {
1181            address: cell.address,
1182            type: Cell.Types.String,
1183            value: value
1184          };
1185        }
1186
1187        _createClass(RichTextValue, [{
1188          key: "toString",
1189          value: function toString() {
1190            return this.model.value.richText.map(function (t) {
1191              return t.text;
1192            }).join('');
1193          }
1194        }, {
1195          key: "toCsvString",
1196          value: function toCsvString() {
1197            return "\"".concat(this.text.replace(/"/g, '""'), "\"");
1198          }
1199        }, {
1200          key: "release",
1201          value: function release() {}
1202        }, {
1203          key: "value",
1204          get: function get() {
1205            return this.model.value;
1206          },
1207          set: function set(value) {
1208            this.model.value = value;
1209          }
1210        }, {
1211          key: "type",
1212          get: function get() {
1213            return Cell.Types.RichText;
1214          }
1215        }, {
1216          key: "effectiveType",
1217          get: function get() {
1218            return Cell.Types.RichText;
1219          }
1220        }, {
1221          key: "address",
1222          get: function get() {
1223            return this.model.address;
1224          },
1225          set: function set(value) {
1226            this.model.address = value;
1227          }
1228        }]);
1229
1230        return RichTextValue;
1231      }();
1232
1233      var DateValue = /*#__PURE__*/function () {
1234        function DateValue(cell, value) {
1235          _classCallCheck(this, DateValue);
1236
1237          this.model = {
1238            address: cell.address,
1239            type: Cell.Types.Date,
1240            value: value
1241          };
1242        }
1243
1244        _createClass(DateValue, [{
1245          key: "toCsvString",
1246          value: function toCsvString() {
1247            return this.model.value.toISOString();
1248          }
1249        }, {
1250          key: "release",
1251          value: function release() {}
1252        }, {
1253          key: "toString",
1254          value: function toString() {
1255            return this.model.value.toString();
1256          }
1257        }, {
1258          key: "value",
1259          get: function get() {
1260            return this.model.value;
1261          },
1262          set: function set(value) {
1263            this.model.value = value;
1264          }
1265        }, {
1266          key: "type",
1267          get: function get() {
1268            return Cell.Types.Date;
1269          }
1270        }, {
1271          key: "effectiveType",
1272          get: function get() {
1273            return Cell.Types.Date;
1274          }
1275        }, {
1276          key: "address",
1277          get: function get() {
1278            return this.model.address;
1279          },
1280          set: function set(value) {
1281            this.model.address = value;
1282          }
1283        }]);
1284
1285        return DateValue;
1286      }();
1287
1288      var HyperlinkValue = /*#__PURE__*/function () {
1289        function HyperlinkValue(cell, value) {
1290          _classCallCheck(this, HyperlinkValue);
1291
1292          this.model = {
1293            address: cell.address,
1294            type: Cell.Types.Hyperlink,
1295            text: value ? value.text : undefined,
1296            hyperlink: value ? value.hyperlink : undefined
1297          };
1298
1299          if (value && value.tooltip) {
1300            this.model.tooltip = value.tooltip;
1301          }
1302        }
1303
1304        _createClass(HyperlinkValue, [{
1305          key: "toCsvString",
1306          value: function toCsvString() {
1307            return this.model.hyperlink;
1308          }
1309        }, {
1310          key: "release",
1311          value: function release() {}
1312        }, {
1313          key: "toString",
1314          value: function toString() {
1315            return this.model.text;
1316          }
1317        }, {
1318          key: "value",
1319          get: function get() {
1320            var v = {
1321              text: this.model.text,
1322              hyperlink: this.model.hyperlink
1323            };
1324
1325            if (this.model.tooltip) {
1326              v.tooltip = this.model.tooltip;
1327            }
1328
1329            return v;
1330          },
1331          set: function set(value) {
1332            this.model = {
1333              text: value.text,
1334              hyperlink: value.hyperlink
1335            };
1336
1337            if (value.tooltip) {
1338              this.model.tooltip = value.tooltip;
1339            }
1340          }
1341        }, {
1342          key: "text",
1343          get: function get() {
1344            return this.model.text;
1345          },
1346          set: function set(value) {
1347            this.model.text = value;
1348          }
1349          /*
1350          get tooltip() {
1351            return this.model.tooltip;
1352          }
1353            set tooltip(value) {
1354            this.model.tooltip = value;
1355          } */
1356
1357        }, {
1358          key: "hyperlink",
1359          get: function get() {
1360            return this.model.hyperlink;
1361          },
1362          set: function set(value) {
1363            this.model.hyperlink = value;
1364          }
1365        }, {
1366          key: "type",
1367          get: function get() {
1368            return Cell.Types.Hyperlink;
1369          }
1370        }, {
1371          key: "effectiveType",
1372          get: function get() {
1373            return Cell.Types.Hyperlink;
1374          }
1375        }, {
1376          key: "address",
1377          get: function get() {
1378            return this.model.address;
1379          },
1380          set: function set(value) {
1381            this.model.address = value;
1382          }
1383        }]);
1384
1385        return HyperlinkValue;
1386      }();
1387
1388      var MergeValue = /*#__PURE__*/function () {
1389        function MergeValue(cell, master) {
1390          _classCallCheck(this, MergeValue);
1391
1392          this.model = {
1393            address: cell.address,
1394            type: Cell.Types.Merge,
1395            master: master ? master.address : undefined
1396          };
1397          this._master = master;
1398
1399          if (master) {
1400            master.addMergeRef();
1401          }
1402        }
1403
1404        _createClass(MergeValue, [{
1405          key: "isMergedTo",
1406          value: function isMergedTo(master) {
1407            return master === this._master;
1408          }
1409        }, {
1410          key: "toCsvString",
1411          value: function toCsvString() {
1412            return '';
1413          }
1414        }, {
1415          key: "release",
1416          value: function release() {
1417            this._master.releaseMergeRef();
1418          }
1419        }, {
1420          key: "toString",
1421          value: function toString() {
1422            return this.value.toString();
1423          }
1424        }, {
1425          key: "value",
1426          get: function get() {
1427            return this._master.value;
1428          },
1429          set: function set(value) {
1430            if (value instanceof Cell) {
1431              if (this._master) {
1432                this._master.releaseMergeRef();
1433              }
1434
1435              value.addMergeRef();
1436              this._master = value;
1437            } else {
1438              this._master.value = value;
1439            }
1440          }
1441        }, {
1442          key: "master",
1443          get: function get() {
1444            return this._master;
1445          }
1446        }, {
1447          key: "type",
1448          get: function get() {
1449            return Cell.Types.Merge;
1450          }
1451        }, {
1452          key: "effectiveType",
1453          get: function get() {
1454            return this._master.effectiveType;
1455          }
1456        }, {
1457          key: "address",
1458          get: function get() {
1459            return this.model.address;
1460          },
1461          set: function set(value) {
1462            this.model.address = value;
1463          }
1464        }]);
1465
1466        return MergeValue;
1467      }();
1468
1469      var FormulaValue = /*#__PURE__*/function () {
1470        function FormulaValue(cell, value) {
1471          _classCallCheck(this, FormulaValue);
1472
1473          this.cell = cell;
1474          this.model = {
1475            address: cell.address,
1476            type: Cell.Types.Formula,
1477            shareType: value ? value.shareType : undefined,
1478            ref: value ? value.ref : undefined,
1479            formula: value ? value.formula : undefined,
1480            sharedFormula: value ? value.sharedFormula : undefined,
1481            result: value ? value.result : undefined
1482          };
1483        }
1484
1485        _createClass(FormulaValue, [{
1486          key: "_copyModel",
1487          value: function _copyModel(model) {
1488            var copy = {};
1489
1490            var cp = function cp(name) {
1491              var value = model[name];
1492
1493              if (value) {
1494                copy[name] = value;
1495              }
1496            };
1497
1498            cp('formula');
1499            cp('result');
1500            cp('ref');
1501            cp('shareType');
1502            cp('sharedFormula');
1503            return copy;
1504          }
1505        }, {
1506          key: "validate",
1507          value: function validate(value) {
1508            switch (Value.getType(value)) {
1509              case Cell.Types.Null:
1510              case Cell.Types.String:
1511              case Cell.Types.Number:
1512              case Cell.Types.Date:
1513                break;
1514
1515              case Cell.Types.Hyperlink:
1516              case Cell.Types.Formula:
1517              default:
1518                throw new Error('Cannot process that type of result value');
1519            }
1520          }
1521        }, {
1522          key: "_getTranslatedFormula",
1523          value: function _getTranslatedFormula() {
1524            if (!this._translatedFormula && this.model.sharedFormula) {
1525              var worksheet = this.cell.worksheet;
1526              var master = worksheet.findCell(this.model.sharedFormula);
1527              this._translatedFormula = master && slideFormula(master.formula, master.address, this.model.address);
1528            }
1529
1530            return this._translatedFormula;
1531          }
1532        }, {
1533          key: "toCsvString",
1534          value: function toCsvString() {
1535            return "".concat(this.model.result || '');
1536          }
1537        }, {
1538          key: "release",
1539          value: function release() {}
1540        }, {
1541          key: "toString",
1542          value: function toString() {
1543            return this.model.result ? this.model.result.toString() : '';
1544          }
1545        }, {
1546          key: "value",
1547          get: function get() {
1548            return this._copyModel(this.model);
1549          },
1550          set: function set(value) {
1551            this.model = this._copyModel(value);
1552          }
1553        }, {
1554          key: "dependencies",
1555          get: function get() {
1556            // find all the ranges and cells mentioned in the formula
1557            var ranges = this.formula.match(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}:[A-Z]{1,3}\d{1,4}/g);
1558            var cells = this.formula.replace(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}:[A-Z]{1,3}\d{1,4}/g, '').match(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}/g);
1559            return {
1560              ranges: ranges,
1561              cells: cells
1562            };
1563          }
1564        }, {
1565          key: "formula",
1566          get: function get() {
1567            return this.model.formula || this._getTranslatedFormula();
1568          },
1569          set: function set(value) {
1570            this.model.formula = value;
1571          }
1572        }, {
1573          key: "formulaType",
1574          get: function get() {
1575            if (this.model.formula) {
1576              return Enums.FormulaType.Master;
1577            }
1578
1579            if (this.model.sharedFormula) {
1580              return Enums.FormulaType.Shared;
1581            }
1582
1583            return Enums.FormulaType.None;
1584          }
1585        }, {
1586          key: "result",
1587          get: function get() {
1588            return this.model.result;
1589          },
1590          set: function set(value) {
1591            this.model.result = value;
1592          }
1593        }, {
1594          key: "type",
1595          get: function get() {
1596            return Cell.Types.Formula;
1597          }
1598        }, {
1599          key: "effectiveType",
1600          get: function get() {
1601            var v = this.model.result;
1602
1603            if (v === null || v === undefined) {
1604              return Enums.ValueType.Null;
1605            }
1606
1607            if (v instanceof String || typeof v === 'string') {
1608              return Enums.ValueType.String;
1609            }
1610
1611            if (typeof v === 'number') {
1612              return Enums.ValueType.Number;
1613            }
1614
1615            if (v instanceof Date) {
1616              return Enums.ValueType.Date;
1617            }
1618
1619            if (v.text && v.hyperlink) {
1620              return Enums.ValueType.Hyperlink;
1621            }
1622
1623            if (v.formula) {
1624              return Enums.ValueType.Formula;
1625            }
1626
1627            return Enums.ValueType.Null;
1628          }
1629        }, {
1630          key: "address",
1631          get: function get() {
1632            return this.model.address;
1633          },
1634          set: function set(value) {
1635            this.model.address = value;
1636          }
1637        }]);
1638
1639        return FormulaValue;
1640      }();
1641
1642      var SharedStringValue = /*#__PURE__*/function () {
1643        function SharedStringValue(cell, value) {
1644          _classCallCheck(this, SharedStringValue);
1645
1646          this.model = {
1647            address: cell.address,
1648            type: Cell.Types.SharedString,
1649            value: value
1650          };
1651        }
1652
1653        _createClass(SharedStringValue, [{
1654          key: "toCsvString",
1655          value: function toCsvString() {
1656            return this.model.value.toString();
1657          }
1658        }, {
1659          key: "release",
1660          value: function release() {}
1661        }, {
1662          key: "toString",
1663          value: function toString() {
1664            return this.model.value.toString();
1665          }
1666        }, {
1667          key: "value",
1668          get: function get() {
1669            return this.model.value;
1670          },
1671          set: function set(value) {
1672            this.model.value = value;
1673          }
1674        }, {
1675          key: "type",
1676          get: function get() {
1677            return Cell.Types.SharedString;
1678          }
1679        }, {
1680          key: "effectiveType",
1681          get: function get() {
1682            return Cell.Types.SharedString;
1683          }
1684        }, {
1685          key: "address",
1686          get: function get() {
1687            return this.model.address;
1688          },
1689          set: function set(value) {
1690            this.model.address = value;
1691          }
1692        }]);
1693
1694        return SharedStringValue;
1695      }();
1696
1697      var BooleanValue = /*#__PURE__*/function () {
1698        function BooleanValue(cell, value) {
1699          _classCallCheck(this, BooleanValue);
1700
1701          this.model = {
1702            address: cell.address,
1703            type: Cell.Types.Boolean,
1704            value: value
1705          };
1706        }
1707
1708        _createClass(BooleanValue, [{
1709          key: "toCsvString",
1710          value: function toCsvString() {
1711            return this.model.value ? 1 : 0;
1712          }
1713        }, {
1714          key: "release",
1715          value: function release() {}
1716        }, {
1717          key: "toString",
1718          value: function toString() {
1719            return this.model.value.toString();
1720          }
1721        }, {
1722          key: "value",
1723          get: function get() {
1724            return this.model.value;
1725          },
1726          set: function set(value) {
1727            this.model.value = value;
1728          }
1729        }, {
1730          key: "type",
1731          get: function get() {
1732            return Cell.Types.Boolean;
1733          }
1734        }, {
1735          key: "effectiveType",
1736          get: function get() {
1737            return Cell.Types.Boolean;
1738          }
1739        }, {
1740          key: "address",
1741          get: function get() {
1742            return this.model.address;
1743          },
1744          set: function set(value) {
1745            this.model.address = value;
1746          }
1747        }]);
1748
1749        return BooleanValue;
1750      }();
1751
1752      var ErrorValue = /*#__PURE__*/function () {
1753        function ErrorValue(cell, value) {
1754          _classCallCheck(this, ErrorValue);
1755
1756          this.model = {
1757            address: cell.address,
1758            type: Cell.Types.Error,
1759            value: value
1760          };
1761        }
1762
1763        _createClass(ErrorValue, [{
1764          key: "toCsvString",
1765          value: function toCsvString() {
1766            return this.toString();
1767          }
1768        }, {
1769          key: "release",
1770          value: function release() {}
1771        }, {
1772          key: "toString",
1773          value: function toString() {
1774            return this.model.value.error.toString();
1775          }
1776        }, {
1777          key: "value",
1778          get: function get() {
1779            return this.model.value;
1780          },
1781          set: function set(value) {
1782            this.model.value = value;
1783          }
1784        }, {
1785          key: "type",
1786          get: function get() {
1787            return Cell.Types.Error;
1788          }
1789        }, {
1790          key: "effectiveType",
1791          get: function get() {
1792            return Cell.Types.Error;
1793          }
1794        }, {
1795          key: "address",
1796          get: function get() {
1797            return this.model.address;
1798          },
1799          set: function set(value) {
1800            this.model.address = value;
1801          }
1802        }]);
1803
1804        return ErrorValue;
1805      }();
1806
1807      var JSONValue = /*#__PURE__*/function () {
1808        function JSONValue(cell, value) {
1809          _classCallCheck(this, JSONValue);
1810
1811          this.model = {
1812            address: cell.address,
1813            type: Cell.Types.String,
1814            value: JSON.stringify(value),
1815            rawValue: value
1816          };
1817        }
1818
1819        _createClass(JSONValue, [{
1820          key: "toCsvString",
1821          value: function toCsvString() {
1822            return this.model.value;
1823          }
1824        }, {
1825          key: "release",
1826          value: function release() {}
1827        }, {
1828          key: "toString",
1829          value: function toString() {
1830            return this.model.value;
1831          }
1832        }, {
1833          key: "value",
1834          get: function get() {
1835            return this.model.rawValue;
1836          },
1837          set: function set(value) {
1838            this.model.rawValue = value;
1839            this.model.value = JSON.stringify(value);
1840          }
1841        }, {
1842          key: "type",
1843          get: function get() {
1844            return Cell.Types.String;
1845          }
1846        }, {
1847          key: "effectiveType",
1848          get: function get() {
1849            return Cell.Types.String;
1850          }
1851        }, {
1852          key: "address",
1853          get: function get() {
1854            return this.model.address;
1855          },
1856          set: function set(value) {
1857            this.model.address = value;
1858          }
1859        }]);
1860
1861        return JSONValue;
1862      }(); // Value is a place to hold common static Value type functions
1863
1864
1865      var Value = {
1866        getType: function getType(value) {
1867          if (value === null || value === undefined) {
1868            return Cell.Types.Null;
1869          }
1870
1871          if (value instanceof String || typeof value === 'string') {
1872            return Cell.Types.String;
1873          }
1874
1875          if (typeof value === 'number') {
1876            return Cell.Types.Number;
1877          }
1878
1879          if (typeof value === 'boolean') {
1880            return Cell.Types.Boolean;
1881          }
1882
1883          if (value instanceof Date) {
1884            return Cell.Types.Date;
1885          }
1886
1887          if (value.text && value.hyperlink) {
1888            return Cell.Types.Hyperlink;
1889          }
1890
1891          if (value.formula || value.sharedFormula) {
1892            return Cell.Types.Formula;
1893          }
1894
1895          if (value.richText) {
1896            return Cell.Types.RichText;
1897          }
1898
1899          if (value.sharedString) {
1900            return Cell.Types.SharedString;
1901          }
1902
1903          if (value.error) {
1904            return Cell.Types.Error;
1905          }
1906
1907          return Cell.Types.JSON;
1908        },
1909        // map valueType to constructor
1910        types: [{
1911          t: Cell.Types.Null,
1912          f: NullValue
1913        }, {
1914          t: Cell.Types.Number,
1915          f: NumberValue
1916        }, {
1917          t: Cell.Types.String,
1918          f: StringValue
1919        }, {
1920          t: Cell.Types.Date,
1921          f: DateValue
1922        }, {
1923          t: Cell.Types.Hyperlink,
1924          f: HyperlinkValue
1925        }, {
1926          t: Cell.Types.Formula,
1927          f: FormulaValue
1928        }, {
1929          t: Cell.Types.Merge,
1930          f: MergeValue
1931        }, {
1932          t: Cell.Types.JSON,
1933          f: JSONValue
1934        }, {
1935          t: Cell.Types.SharedString,
1936          f: SharedStringValue
1937        }, {
1938          t: Cell.Types.RichText,
1939          f: RichTextValue
1940        }, {
1941          t: Cell.Types.Boolean,
1942          f: BooleanValue
1943        }, {
1944          t: Cell.Types.Error,
1945          f: ErrorValue
1946        }].reduce(function (p, t) {
1947          p[t.t] = t.f;
1948          return p;
1949        }, []),
1950        create: function create(type, cell, value) {
1951          var T = this.types[type];
1952
1953          if (!T) {
1954            throw new Error("Could not create Value of type ".concat(type));
1955          }
1956
1957          return new T(cell, value);
1958        }
1959      };
1960      module.exports = Cell;
1961    }, {
1962      "../utils/col-cache": 17,
1963      "../utils/shared-formula": 20,
1964      "../utils/under-dash": 23,
1965      "./enums": 7,
1966      "./note": 9
1967    }],
1968    4: [function (require, module, exports) {
1969      'use strict';
1970
1971      function _classCallCheck(instance, Constructor) {
1972        if (!(instance instanceof Constructor)) {
1973          throw new TypeError("Cannot call a class as a function");
1974        }
1975      }
1976
1977      function _defineProperties(target, props) {
1978        for (var i = 0; i < props.length; i++) {
1979          var descriptor = props[i];
1980          descriptor.enumerable = descriptor.enumerable || false;
1981          descriptor.configurable = true;
1982          if ("value" in descriptor) descriptor.writable = true;
1983          Object.defineProperty(target, descriptor.key, descriptor);
1984        }
1985      }
1986
1987      function _createClass(Constructor, protoProps, staticProps) {
1988        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
1989        if (staticProps) _defineProperties(Constructor, staticProps);
1990        return Constructor;
1991      }
1992
1993      var _ = require('../utils/under-dash');
1994
1995      var Enums = require('./enums');
1996
1997      var colCache = require('../utils/col-cache');
1998
1999      var DEFAULT_COLUMN_WIDTH = 9; // Column defines the column properties for 1 column.
2000      // This includes header rows, widths, key, (style), etc.
2001      // Worksheet will condense the columns as appropriate during serialization
2002
2003      var Column = /*#__PURE__*/function () {
2004        function Column(worksheet, number, defn) {
2005          _classCallCheck(this, Column);
2006
2007          this._worksheet = worksheet;
2008          this._number = number;
2009
2010          if (defn !== false) {
2011            // sometimes defn will follow
2012            this.defn = defn;
2013          }
2014        }
2015
2016        _createClass(Column, [{
2017          key: "toString",
2018          value: function toString() {
2019            return JSON.stringify({
2020              key: this.key,
2021              width: this.width,
2022              headers: this.headers.length ? this.headers : undefined
2023            });
2024          }
2025        }, {
2026          key: "equivalentTo",
2027          value: function equivalentTo(other) {
2028            return this.width === other.width && this.hidden === other.hidden && this.outlineLevel === other.outlineLevel && _.isEqual(this.style, other.style);
2029          }
2030        }, {
2031          key: "eachCell",
2032          value: function eachCell(options, iteratee) {
2033            var colNumber = this.number;
2034
2035            if (!iteratee) {
2036              iteratee = options;
2037              options = null;
2038            }
2039
2040            this._worksheet.eachRow(options, function (row, rowNumber) {
2041              iteratee(row.getCell(colNumber), rowNumber);
2042            });
2043          }
2044        }, {
2045          key: "_applyStyle",
2046          // =========================================================================
2047          // styles
2048          value: function _applyStyle(name, value) {
2049            this.style[name] = value;
2050            this.eachCell(function (cell) {
2051              cell[name] = value;
2052            });
2053            return value;
2054          }
2055        }, {
2056          key: "number",
2057          get: function get() {
2058            return this._number;
2059          }
2060        }, {
2061          key: "worksheet",
2062          get: function get() {
2063            return this._worksheet;
2064          }
2065        }, {
2066          key: "letter",
2067          get: function get() {
2068            return colCache.n2l(this._number);
2069          }
2070        }, {
2071          key: "isCustomWidth",
2072          get: function get() {
2073            return this.width !== undefined && this.width !== DEFAULT_COLUMN_WIDTH;
2074          }
2075        }, {
2076          key: "defn",
2077          get: function get() {
2078            return {
2079              header: this._header,
2080              key: this.key,
2081              width: this.width,
2082              style: this.style,
2083              hidden: this.hidden,
2084              outlineLevel: this.outlineLevel
2085            };
2086          },
2087          set: function set(value) {
2088            if (value) {
2089              this.key = value.key;
2090              this.width = value.width !== undefined ? value.width : DEFAULT_COLUMN_WIDTH;
2091              this.outlineLevel = value.outlineLevel;
2092
2093              if (value.style) {
2094                this.style = value.style;
2095              } else {
2096                this.style = {};
2097              } // headers must be set after style
2098
2099
2100              this.header = value.header;
2101              this._hidden = !!value.hidden;
2102            } else {
2103              delete this._header;
2104              delete this._key;
2105              delete this.width;
2106              this.style = {};
2107              this.outlineLevel = 0;
2108            }
2109          }
2110        }, {
2111          key: "headers",
2112          get: function get() {
2113            return this._header && this._header instanceof Array ? this._header : [this._header];
2114          }
2115        }, {
2116          key: "header",
2117          get: function get() {
2118            return this._header;
2119          },
2120          set: function set(value) {
2121            var _this = this;
2122
2123            if (value !== undefined) {
2124              this._header = value;
2125              this.headers.forEach(function (text, index) {
2126                _this._worksheet.getCell(index + 1, _this.number).value = text;
2127              });
2128            } else {
2129              this._header = undefined;
2130            }
2131          }
2132        }, {
2133          key: "key",
2134          get: function get() {
2135            return this._key;
2136          },
2137          set: function set(value) {
2138            var column = this._key && this._worksheet.getColumnKey(this._key);
2139
2140            if (column === this) {
2141              this._worksheet.deleteColumnKey(this._key);
2142            }
2143
2144            this._key = value;
2145
2146            if (value) {
2147              this._worksheet.setColumnKey(this._key, this);
2148            }
2149          }
2150        }, {
2151          key: "hidden",
2152          get: function get() {
2153            return !!this._hidden;
2154          },
2155          set: function set(value) {
2156            this._hidden = value;
2157          }
2158        }, {
2159          key: "outlineLevel",
2160          get: function get() {
2161            return this._outlineLevel || 0;
2162          },
2163          set: function set(value) {
2164            this._outlineLevel = value;
2165          }
2166        }, {
2167          key: "collapsed",
2168          get: function get() {
2169            return !!(this._outlineLevel && this._outlineLevel >= this._worksheet.properties.outlineLevelCol);
2170          }
2171        }, {
2172          key: "isDefault",
2173          get: function get() {
2174            if (this.isCustomWidth) {
2175              return false;
2176            }
2177
2178            if (this.hidden) {
2179              return false;
2180            }
2181
2182            if (this.outlineLevel) {
2183              return false;
2184            }
2185
2186            var s = this.style;
2187
2188            if (s && (s.font || s.numFmt || s.alignment || s.border || s.fill || s.protection)) {
2189              return false;
2190            }
2191
2192            return true;
2193          }
2194        }, {
2195          key: "headerCount",
2196          get: function get() {
2197            return this.headers.length;
2198          }
2199        }, {
2200          key: "values",
2201          get: function get() {
2202            var v = [];
2203            this.eachCell(function (cell, rowNumber) {
2204              if (cell && cell.type !== Enums.ValueType.Null) {
2205                v[rowNumber] = cell.value;
2206              }
2207            });
2208            return v;
2209          },
2210          set: function set(v) {
2211            var _this2 = this;
2212
2213            if (!v) {
2214              return;
2215            }
2216
2217            var colNumber = this.number;
2218            var offset = 0;
2219
2220            if (v.hasOwnProperty('0')) {
2221              // assume contiguous array, start at row 1
2222              offset = 1;
2223            }
2224
2225            v.forEach(function (value, index) {
2226              _this2._worksheet.getCell(index + offset, colNumber).value = value;
2227            });
2228          }
2229        }, {
2230          key: "numFmt",
2231          get: function get() {
2232            return this.style.numFmt;
2233          },
2234          set: function set(value) {
2235            this._applyStyle('numFmt', value);
2236          }
2237        }, {
2238          key: "font",
2239          get: function get() {
2240            return this.style.font;
2241          },
2242          set: function set(value) {
2243            this._applyStyle('font', value);
2244          }
2245        }, {
2246          key: "alignment",
2247          get: function get() {
2248            return this.style.alignment;
2249          },
2250          set: function set(value) {
2251            this._applyStyle('alignment', value);
2252          }
2253        }, {
2254          key: "protection",
2255          get: function get() {
2256            return this.style.protection;
2257          },
2258          set: function set(value) {
2259            this._applyStyle('protection', value);
2260          }
2261        }, {
2262          key: "border",
2263          get: function get() {
2264            return this.style.border;
2265          },
2266          set: function set(value) {
2267            this._applyStyle('border', value);
2268          }
2269        }, {
2270          key: "fill",
2271          get: function get() {
2272            return this.style.fill;
2273          },
2274          set: function set(value) {
2275            this._applyStyle('fill', value);
2276          } // =============================================================================
2277          // static functions
2278
2279        }], [{
2280          key: "toModel",
2281          value: function toModel(columns) {
2282            // Convert array of Column into compressed list cols
2283            var cols = [];
2284            var col = null;
2285
2286            if (columns) {
2287              columns.forEach(function (column, index) {
2288                if (column.isDefault) {
2289                  if (col) {
2290                    col = null;
2291                  }
2292                } else if (!col || !column.equivalentTo(col)) {
2293                  col = {
2294                    min: index + 1,
2295                    max: index + 1,
2296                    width: column.width !== undefined ? column.width : DEFAULT_COLUMN_WIDTH,
2297                    style: column.style,
2298                    isCustomWidth: column.isCustomWidth,
2299                    hidden: column.hidden,
2300                    outlineLevel: column.outlineLevel,
2301                    collapsed: column.collapsed
2302                  };
2303                  cols.push(col);
2304                } else {
2305                  col.max = index + 1;
2306                }
2307              });
2308            }
2309
2310            return cols.length ? cols : undefined;
2311          }
2312        }, {
2313          key: "fromModel",
2314          value: function fromModel(worksheet, cols) {
2315            cols = cols || [];
2316            var columns = [];
2317            var count = 1;
2318            var index = 0;
2319
2320            while (index < cols.length) {
2321              var col = cols[index++];
2322
2323              while (count < col.min) {
2324                columns.push(new Column(worksheet, count++));
2325              }
2326
2327              while (count <= col.max) {
2328                columns.push(new Column(worksheet, count++, col));
2329              }
2330            }
2331
2332            return columns.length ? columns : null;
2333          }
2334        }]);
2335
2336        return Column;
2337      }();
2338
2339      module.exports = Column;
2340    }, {
2341      "../utils/col-cache": 17,
2342      "../utils/under-dash": 23,
2343      "./enums": 7
2344    }],
2345    5: [function (require, module, exports) {
2346      "use strict";
2347
2348      function _classCallCheck(instance, Constructor) {
2349        if (!(instance instanceof Constructor)) {
2350          throw new TypeError("Cannot call a class as a function");
2351        }
2352      }
2353
2354      function _defineProperties(target, props) {
2355        for (var i = 0; i < props.length; i++) {
2356          var descriptor = props[i];
2357          descriptor.enumerable = descriptor.enumerable || false;
2358          descriptor.configurable = true;
2359          if ("value" in descriptor) descriptor.writable = true;
2360          Object.defineProperty(target, descriptor.key, descriptor);
2361        }
2362      }
2363
2364      function _createClass(Constructor, protoProps, staticProps) {
2365        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
2366        if (staticProps) _defineProperties(Constructor, staticProps);
2367        return Constructor;
2368      }
2369
2370      var DataValidations = /*#__PURE__*/function () {
2371        function DataValidations(model) {
2372          _classCallCheck(this, DataValidations);
2373
2374          this.model = model || {};
2375        }
2376
2377        _createClass(DataValidations, [{
2378          key: "add",
2379          value: function add(address, validation) {
2380            return this.model[address] = validation;
2381          }
2382        }, {
2383          key: "find",
2384          value: function find(address) {
2385            return this.model[address];
2386          }
2387        }, {
2388          key: "remove",
2389          value: function remove(address) {
2390            this.model[address] = undefined;
2391          }
2392        }]);
2393
2394        return DataValidations;
2395      }();
2396
2397      module.exports = DataValidations;
2398    }, {}],
2399    6: [function (require, module, exports) {
2400      'use strict';
2401
2402      function _classCallCheck(instance, Constructor) {
2403        if (!(instance instanceof Constructor)) {
2404          throw new TypeError("Cannot call a class as a function");
2405        }
2406      }
2407
2408      function _defineProperties(target, props) {
2409        for (var i = 0; i < props.length; i++) {
2410          var descriptor = props[i];
2411          descriptor.enumerable = descriptor.enumerable || false;
2412          descriptor.configurable = true;
2413          if ("value" in descriptor) descriptor.writable = true;
2414          Object.defineProperty(target, descriptor.key, descriptor);
2415        }
2416      }
2417
2418      function _createClass(Constructor, protoProps, staticProps) {
2419        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
2420        if (staticProps) _defineProperties(Constructor, staticProps);
2421        return Constructor;
2422      }
2423
2424      var _ = require('../utils/under-dash');
2425
2426      var colCache = require('../utils/col-cache');
2427
2428      var CellMatrix = require('../utils/cell-matrix');
2429
2430      var Range = require('./range');
2431
2432      var rangeRegexp = /[$](\w+)[$](\d+)(:[$](\w+)[$](\d+))?/;
2433
2434      var DefinedNames = /*#__PURE__*/function () {
2435        function DefinedNames() {
2436          _classCallCheck(this, DefinedNames);
2437
2438          this.matrixMap = {};
2439        }
2440
2441        _createClass(DefinedNames, [{
2442          key: "getMatrix",
2443          value: function getMatrix(name) {
2444            var matrix = this.matrixMap[name] || (this.matrixMap[name] = new CellMatrix());
2445            return matrix;
2446          } // add a name to a cell. locStr in the form SheetName!$col$row or SheetName!$c1$r1:$c2:$r2
2447
2448        }, {
2449          key: "add",
2450          value: function add(locStr, name) {
2451            var location = colCache.decodeEx(locStr);
2452            this.addEx(location, name);
2453          }
2454        }, {
2455          key: "addEx",
2456          value: function addEx(location, name) {
2457            var matrix = this.getMatrix(name);
2458
2459            if (location.top) {
2460              for (var col = location.left; col <= location.right; col++) {
2461                for (var row = location.top; row <= location.bottom; row++) {
2462                  var address = {
2463                    sheetName: location.sheetName,
2464                    address: colCache.n2l(col) + row,
2465                    row: row,
2466                    col: col
2467                  };
2468                  matrix.addCellEx(address);
2469                }
2470              }
2471            } else {
2472              matrix.addCellEx(location);
2473            }
2474          }
2475        }, {
2476          key: "remove",
2477          value: function remove(locStr, name) {
2478            var location = colCache.decodeEx(locStr);
2479            this.removeEx(location, name);
2480          }
2481        }, {
2482          key: "removeEx",
2483          value: function removeEx(location, name) {
2484            var matrix = this.getMatrix(name);
2485            matrix.removeCellEx(location);
2486          }
2487        }, {
2488          key: "removeAllNames",
2489          value: function removeAllNames(location) {
2490            _.each(this.matrixMap, function (matrix) {
2491              matrix.removeCellEx(location);
2492            });
2493          }
2494        }, {
2495          key: "forEach",
2496          value: function forEach(callback) {
2497            _.each(this.matrixMap, function (matrix, name) {
vendor: 9,521 bytes, lines 2498-2818
2498              matrix.forEach(function (cell) {
2499                callback(name, cell);
2500              });
2501            });
2502          } // get all the names of a cell
2503
2504        }, {
2505          key: "getNames",
2506          value: function getNames(addressStr) {
2507            return this.getNamesEx(colCache.decodeEx(addressStr));
2508          }
2509        }, {
2510          key: "getNamesEx",
2511          value: function getNamesEx(address) {
2512            return _.map(this.matrixMap, function (matrix, name) {
2513              return matrix.findCellEx(address) && name;
2514            }).filter(Boolean);
2515          }
2516        }, {
2517          key: "_explore",
2518          value: function _explore(matrix, cell) {
2519            cell.mark = false;
2520            var sheetName = cell.sheetName;
2521            var range = new Range(cell.row, cell.col, cell.row, cell.col, sheetName);
2522            var x;
2523            var y; // grow vertical - only one col to worry about
2524
2525            function vGrow(yy, edge) {
2526              var c = matrix.findCellAt(sheetName, yy, cell.col);
2527
2528              if (!c || !c.mark) {
2529                return false;
2530              }
2531
2532              range[edge] = yy;
2533              c.mark = false;
2534              return true;
2535            }
2536
2537            for (y = cell.row - 1; vGrow(y, 'top'); y--) {
2538              ;
2539            }
2540
2541            for (y = cell.row + 1; vGrow(y, 'bottom'); y++) {
2542              ;
2543            } // grow horizontal - ensure all rows can grow
2544
2545
2546            function hGrow(xx, edge) {
2547              var cells = [];
2548
2549              for (y = range.top; y <= range.bottom; y++) {
2550                var c = matrix.findCellAt(sheetName, y, xx);
2551
2552                if (c && c.mark) {
2553                  cells.push(c);
2554                } else {
2555                  return false;
2556                }
2557              }
2558
2559              range[edge] = xx;
2560
2561              for (var i = 0; i < cells.length; i++) {
2562                cells[i].mark = false;
2563              }
2564
2565              return true;
2566            }
2567
2568            for (x = cell.col - 1; hGrow(x, 'left'); x--) {
2569              ;
2570            }
2571
2572            for (x = cell.col + 1; hGrow(x, 'right'); x++) {
2573              ;
2574            }
2575
2576            return range;
2577          }
2578        }, {
2579          key: "getRanges",
2580          value: function getRanges(name, matrix) {
2581            var _this = this;
2582
2583            matrix = matrix || this.matrixMap[name];
2584
2585            if (!matrix) {
2586              return {
2587                name: name,
2588                ranges: []
2589              };
2590            } // mark and sweep!
2591
2592
2593            matrix.forEach(function (cell) {
2594              cell.mark = true;
2595            });
2596            var ranges = matrix.map(function (cell) {
2597              return cell.mark && _this._explore(matrix, cell);
2598            }).filter(Boolean).map(function (range) {
2599              return range.$shortRange;
2600            });
2601            return {
2602              name: name,
2603              ranges: ranges
2604            };
2605          }
2606        }, {
2607          key: "normaliseMatrix",
2608          value: function normaliseMatrix(matrix, sheetName) {
2609            // some of the cells might have shifted on specified sheet
2610            // need to reassign rows, cols
2611            matrix.forEachInSheet(sheetName, function (cell, row, col) {
2612              if (cell) {
2613                if (cell.row !== row || cell.col !== col) {
2614                  cell.row = row;
2615                  cell.col = col;
2616                  cell.address = colCache.n2l(col) + row;
2617                }
2618              }
2619            });
2620          }
2621        }, {
2622          key: "spliceRows",
2623          value: function spliceRows(sheetName, start, numDelete, numInsert) {
2624            var _this2 = this;
2625
2626            _.each(this.matrixMap, function (matrix) {
2627              matrix.spliceRows(sheetName, start, numDelete, numInsert);
2628
2629              _this2.normaliseMatrix(matrix, sheetName);
2630            });
2631          }
2632        }, {
2633          key: "spliceColumns",
2634          value: function spliceColumns(sheetName, start, numDelete, numInsert) {
2635            var _this3 = this;
2636
2637            _.each(this.matrixMap, function (matrix) {
2638              matrix.spliceColumns(sheetName, start, numDelete, numInsert);
2639
2640              _this3.normaliseMatrix(matrix, sheetName);
2641            });
2642          }
2643        }, {
2644          key: "model",
2645          get: function get() {
2646            var _this4 = this; // To get names per cell - just iterate over all names finding cells if they exist
2647
2648
2649            return _.map(this.matrixMap, function (matrix, name) {
2650              return _this4.getRanges(name, matrix);
2651            }).filter(function (definedName) {
2652              return definedName.ranges.length;
2653            });
2654          },
2655          set: function set(value) {
2656            // value is [ { name, ranges }, ... ]
2657            var matrixMap = this.matrixMap = {};
2658            value.forEach(function (definedName) {
2659              var matrix = matrixMap[definedName.name] = new CellMatrix();
2660              definedName.ranges.forEach(function (rangeStr) {
2661                if (rangeRegexp.test(rangeStr.split('!').pop() || '')) {
2662                  matrix.addCell(rangeStr);
2663                }
2664              });
2665            });
2666          }
2667        }]);
2668
2669        return DefinedNames;
2670      }();
2671
2672      module.exports = DefinedNames;
2673    }, {
2674      "../utils/cell-matrix": 16,
2675      "../utils/col-cache": 17,
2676      "../utils/under-dash": 23,
2677      "./range": 10
2678    }],
2679    7: [function (require, module, exports) {
2680      'use strict';
2681
2682      module.exports = {
2683        ValueType: {
2684          Null: 0,
2685          Merge: 1,
2686          Number: 2,
2687          String: 3,
2688          Date: 4,
2689          Hyperlink: 5,
2690          Formula: 6,
2691          SharedString: 7,
2692          RichText: 8,
2693          Boolean: 9,
2694          Error: 10
2695        },
2696        FormulaType: {
2697          None: 0,
2698          Master: 1,
2699          Shared: 2
2700        },
2701        RelationshipType: {
2702          None: 0,
2703          OfficeDocument: 1,
2704          Worksheet: 2,
2705          CalcChain: 3,
2706          SharedStrings: 4,
2707          Styles: 5,
2708          Theme: 6,
2709          Hyperlink: 7
2710        },
2711        DocumentType: {
2712          Xlsx: 1
2713        },
2714        ReadingOrder: {
2715          LeftToRight: 1,
2716          RightToLeft: 2
2717        },
2718        ErrorValue: {
2719          NotApplicable: '#N/A',
2720          Ref: '#REF!',
2721          Name: '#NAME?',
2722          DivZero: '#DIV/0!',
2723          Null: '#NULL!',
2724          Value: '#VALUE!',
2725          Num: '#NUM!'
2726        }
2727      };
2728    }, {}],
2729    8: [function (require, module, exports) {
2730      "use strict";
2731
2732      function _classCallCheck(instance, Constructor) {
2733        if (!(instance instanceof Constructor)) {
2734          throw new TypeError("Cannot call a class as a function");
2735        }
2736      }
2737
2738      function _defineProperties(target, props) {
2739        for (var i = 0; i < props.length; i++) {
2740          var descriptor = props[i];
2741          descriptor.enumerable = descriptor.enumerable || false;
2742          descriptor.configurable = true;
2743          if ("value" in descriptor) descriptor.writable = true;
2744          Object.defineProperty(target, descriptor.key, descriptor);
2745        }
2746      }
2747
2748      function _createClass(Constructor, protoProps, staticProps) {
2749        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
2750        if (staticProps) _defineProperties(Constructor, staticProps);
2751        return Constructor;
2752      }
2753
2754      var colCache = require('../utils/col-cache');
2755
2756      var Anchor = require('./anchor');
2757
2758      var Image = /*#__PURE__*/function () {
2759        function Image(worksheet, model) {
2760          _classCallCheck(this, Image);
2761
2762          this.worksheet = worksheet;
2763          this.model = model;
2764        }
2765
2766        _createClass(Image, [{
2767          key: "model",
2768          get: function get() {
2769            switch (this.type) {
2770              case 'background':
2771                return {
2772                  type: this.type,
2773                  imageId: this.imageId
2774                };
2775
2776              case 'image':
2777                return {
2778                  type: this.type,
2779                  imageId: this.imageId,
2780                  hyperlinks: this.range.hyperlinks,
2781                  range: {
2782                    tl: this.range.tl.model,
2783                    br: this.range.br && this.range.br.model,
2784                    ext: this.range.ext,
2785                    editAs: this.range.editAs
2786                  }
2787                };
2788
2789              default:
2790                throw new Error('Invalid Image Type');
2791            }
2792          },
2793          set: function set(_ref) {
2794            var type = _ref.type,
2795                imageId = _ref.imageId,
2796                range = _ref.range,
2797                hyperlinks = _ref.hyperlinks;
2798            this.type = type;
2799            this.imageId = imageId;
2800
2801            if (type === 'image') {
2802              if (typeof range === 'string') {
2803                var decoded = colCache.decode(range);
2804                this.range = {
2805                  tl: new Anchor(this.worksheet, {
2806                    col: decoded.left,
2807                    row: decoded.top
2808                  }, -1),
2809                  br: new Anchor(this.worksheet, {
2810                    col: decoded.right,
2811                    row: decoded.bottom
2812                  }, 0),
2813                  editAs: 'oneCell'
2814                };
2815              } else {
2816                this.range = {
2817                  tl: new Anchor(this.worksheet, range.tl, 0),
2818                  br: range.br && new Anchor(this.worksheet, range.br, 
28180),
2819                  ext: range.ext,
2820                  editAs: range.editAs,
2821                  hyperlinks: hyperlinks || range.hyperlinks
2822                };
2823              }
2824            }
2825          }
2826        }]);
2827
2828        return Image;
2829      }();
2830
2831      module.exports = Image;
2832    }, {
2833      "../utils/col-cache": 17,
2834      "./anchor": 2
2835    }],
2836    9: [function (require, module, exports) {
2837      "use strict";
2838
2839      function _typeof(obj) {
2840        "@babel/helpers - typeof";
2841
2842        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
2843          _typeof = function _typeof(obj) {
2844            return typeof obj;
2845          };
2846        } else {
2847          _typeof = function _typeof(obj) {
2848            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
2849          };
2850        }
2851
2852        return _typeof(obj);
2853      }
2854
2855      function _classCallCheck(instance, Constructor) {
2856        if (!(instance instanceof Constructor)) {
2857          throw new TypeError("Cannot call a class as a function");
2858        }
2859      }
2860
2861      function _defineProperties(target, props) {
2862        for (var i = 0; i < props.length; i++) {
2863          var descriptor = props[i];
2864          descriptor.enumerable = descriptor.enumerable || false;
2865          descriptor.configurable = true;
2866          if ("value" in descriptor) descriptor.writable = true;
2867          Object.defineProperty(target, descriptor.key, descriptor);
2868        }
2869      }
2870
2871      function _createClass(Constructor, protoProps, staticProps) {
2872        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
2873        if (staticProps) _defineProperties(Constructor, staticProps);
2874        return Constructor;
2875      }
2876
2877      var _ = require('../utils/under-dash');
2878
2879      var Note = /*#__PURE__*/function () {
2880        function Note(note) {
2881          _classCallCheck(this, Note);
2882
2883          this.note = note;
2884        }
2885
2886        _createClass(Note, [{
2887          key: "model",
2888          get: function get() {
2889            var value = null;
2890
2891            switch (_typeof(this.note)) {
2892              case 'string':
2893                value = {
2894                  type: 'note',
2895                  note: {
2896                    texts: [{
2897                      text: this.note
2898                    }]
2899                  }
2900                };
2901                break;
2902
2903              default:
2904                value = {
2905                  type: 'note',
2906                  note: this.note
2907                };
2908                break;
2909            } // Suitable for all cell comments
2910
2911
2912            return _.deepMerge({}, Note.DEFAULT_CONFIGS, value);
2913          },
2914          set: function set(value) {
2915            var note = value.note;
2916            var texts = note.texts;
2917
2918            if (texts.length === 1 && Object.keys(texts[0]).length === 1) {
2919              this.note = texts[0].text;
2920            } else {
2921              this.note = note;
2922            }
2923          }
2924        }], [{
2925          key: "fromModel",
2926          value: function fromModel(model) {
2927            var note = new Note();
2928            note.model = model;
2929            return note;
2930          }
2931        }]);
2932
2933        return Note;
2934      }();
2935
2936      Note.DEFAULT_CONFIGS = {
2937        note: {
2938          margins: {
2939            insetmode: 'auto',
2940            inset: [0.13, 0.13, 0.25, 0.25]
2941          },
2942          protection: {
2943            locked: 'True',
2944            lockText: 'True'
2945          },
2946          editAs: 'absolute'
2947        }
2948      };
2949      module.exports = Note;
2950    }, {
2951      "../utils/under-dash": 23
2952    }],
2953    10: [function (require, module, exports) {
2954      "use strict";
2955
2956      function _classCallCheck(instance, Constructor) {
2957        if (!(instance instanceof Constructor)) {
2958          throw new TypeError("Cannot call a class as a function");
2959        }
2960      }
2961
2962      function _defineProperties(target, props) {
2963        for (var i = 0; i < props.length; i++) {
2964          var descriptor = props[i];
2965          descriptor.enumerable = descriptor.enumerable || false;
2966          descriptor.configurable = true;
2967          if ("value" in descriptor) descriptor.writable = true;
2968          Object.defineProperty(target, descriptor.key, descriptor);
2969        }
2970      }
2971
2972      function _createClass(Constructor, protoProps, staticProps) {
2973        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
2974        if (staticProps) _defineProperties(Constructor, staticProps);
2975        return Constructor;
2976      }
2977
2978      var colCache = require('./../utils/col-cache');
vendor: 43,776 bytes, lines 2978-4353
2978 // used by worksheet to calculate sheet dimensions
2979
2980
2981      var Range = /*#__PURE__*/function () {
2982        function Range() {
2983          _classCallCheck(this, Range);
2984
2985          this.decode(arguments);
2986        }
2987
2988        _createClass(Range, [{
2989          key: "setTLBR",
2990          value: function setTLBR(t, l, b, r, s) {
2991            if (arguments.length < 4) {
2992              // setTLBR(tl, br, s)
2993              var tl = colCache.decodeAddress(t);
2994              var br = colCache.decodeAddress(l);
2995              this.model = {
2996                top: Math.min(tl.row, br.row),
2997                left: Math.min(tl.col, br.col),
2998                bottom: Math.max(tl.row, br.row),
2999                right: Math.max(tl.col, br.col),
3000                sheetName: b
3001              };
3002              this.setTLBR(tl.row, tl.col, br.row, br.col, s);
3003            } else {
3004              // setTLBR(t, l, b, r, s)
3005              this.model = {
3006                top: Math.min(t, b),
3007                left: Math.min(l, r),
3008                bottom: Math.max(t, b),
3009                right: Math.max(l, r),
3010                sheetName: s
3011              };
3012            }
3013          }
3014        }, {
3015          key: "decode",
3016          value: function decode(argv) {
3017            switch (argv.length) {
3018              case 5:
3019                // [t,l,b,r,s]
3020                this.setTLBR(argv[0], argv[1], argv[2], argv[3], argv[4]);
3021                break;
3022
3023              case 4:
3024                // [t,l,b,r]
3025                this.setTLBR(argv[0], argv[1], argv[2], argv[3]);
3026                break;
3027
3028              case 3:
3029                // [tl,br,s]
3030                this.setTLBR(argv[0], argv[1], argv[2]);
3031                break;
3032
3033              case 2:
3034                // [tl,br]
3035                this.setTLBR(argv[0], argv[1]);
3036                break;
3037
3038              case 1:
3039                {
3040                  var value = argv[0];
3041
3042                  if (value instanceof Range) {
3043                    // copy constructor
3044                    this.model = {
3045                      top: value.model.top,
3046                      left: value.model.left,
3047                      bottom: value.model.bottom,
3048                      right: value.model.right,
3049                      sheetName: value.sheetName
3050                    };
3051                  } else if (value instanceof Array) {
3052                    // an arguments array
3053                    this.decode(value);
3054                  } else if (value.top && value.left && value.bottom && value.right) {
3055                    // a model
3056                    this.model = {
3057                      top: value.top,
3058                      left: value.left,
3059                      bottom: value.bottom,
3060                      right: value.right,
3061                      sheetName: value.sheetName
3062                    };
3063                  } else {
3064                    // [sheetName!]tl:br
3065                    var tlbr = colCache.decodeEx(value);
3066
3067                    if (tlbr.top) {
3068                      this.model = {
3069                        top: tlbr.top,
3070                        left: tlbr.left,
3071                        bottom: tlbr.bottom,
3072                        right: tlbr.right,
3073                        sheetName: tlbr.sheetName
3074                      };
3075                    } else {
3076                      this.model = {
3077                        top: tlbr.row,
3078                        left: tlbr.col,
3079                        bottom: tlbr.row,
3080                        right: tlbr.col,
3081                        sheetName: tlbr.sheetName
3082                      };
3083                    }
3084                  }
3085
3086                  break;
3087                }
3088
3089              case 0:
3090                this.model = {
3091                  top: 0,
3092                  left: 0,
3093                  bottom: 0,
3094                  right: 0
3095                };
3096                break;
3097
3098              default:
3099                throw new Error("Invalid number of arguments to _getDimensions() - ".concat(argv.length));
3100            }
3101          }
3102        }, {
3103          key: "expand",
3104          value: function expand(top, left, bottom, right) {
3105            if (!this.model.top || top < this.top) this.top = top;
3106            if (!this.model.left || left < this.left) this.left = left;
3107            if (!this.model.bottom || bottom > this.bottom) this.bottom = bottom;
3108            if (!this.model.right || right > this.right) this.right = right;
3109          }
3110        }, {
3111          key: "expandRow",
3112          value: function expandRow(row) {
3113            if (row) {
3114              var dimensions = row.dimensions,
3115                  number = row.number;
3116
3117              if (dimensions) {
3118                this.expand(number, dimensions.min, number, dimensions.max);
3119              }
3120            }
3121          }
3122        }, {
3123          key: "expandToAddress",
3124          value: function expandToAddress(addressStr) {
3125            var address = colCache.decodeEx(addressStr);
3126            this.expand(address.row, address.col, address.row, address.col);
3127          }
3128        }, {
3129          key: "toString",
3130          value: function toString() {
3131            return this.range;
3132          }
3133        }, {
3134          key: "intersects",
3135          value: function intersects(other) {
3136            if (other.sheetName && this.sheetName && other.sheetName !== this.sheetName) return false;
3137            if (other.bottom < this.top) return false;
3138            if (other.top > this.bottom) return false;
3139            if (other.right < this.left) return false;
3140            if (other.left > this.right) return false;
3141            return true;
3142          }
3143        }, {
3144          key: "contains",
3145          value: function contains(addressStr) {
3146            var address = colCache.decodeEx(addressStr);
3147            return this.containsEx(address);
3148          }
3149        }, {
3150          key: "containsEx",
3151          value: function containsEx(address) {
3152            if (address.sheetName && this.sheetName && address.sheetName !== this.sheetName) return false;
3153            return address.row >= this.top && address.row <= this.bottom && address.col >= this.left && address.col <= this.right;
3154          }
3155        }, {
3156          key: "forEachAddress",
3157          value: function forEachAddress(cb) {
3158            for (var col = this.left; col <= this.right; col++) {
3159              for (var row = this.top; row <= this.bottom; row++) {
3160                cb(colCache.encodeAddress(row, col), row, col);
3161              }
3162            }
3163          }
3164        }, {
3165          key: "top",
3166          get: function get() {
3167            return this.model.top || 1;
3168          },
3169          set: function set(value) {
3170            this.model.top = value;
3171          }
3172        }, {
3173          key: "left",
3174          get: function get() {
3175            return this.model.left || 1;
3176          },
3177          set: function set(value) {
3178            this.model.left = value;
3179          }
3180        }, {
3181          key: "bottom",
3182          get: function get() {
3183            return this.model.bottom || 1;
3184          },
3185          set: function set(value) {
3186            this.model.bottom = value;
3187          }
3188        }, {
3189          key: "right",
3190          get: function get() {
3191            return this.model.right || 1;
3192          },
3193          set: function set(value) {
3194            this.model.right = value;
3195          }
3196        }, {
3197          key: "sheetName",
3198          get: function get() {
3199            return this.model.sheetName;
3200          },
3201          set: function set(value) {
3202            this.model.sheetName = value;
3203          }
3204        }, {
3205          key: "_serialisedSheetName",
3206          get: function get() {
3207            var sheetName = this.model.sheetName;
3208
3209            if (sheetName) {
3210              if (/^[a-zA-Z0-9]*$/.test(sheetName)) {
3211                return "".concat(sheetName, "!");
3212              }
3213
3214              return "'".concat(sheetName, "'!");
3215            }
3216
3217            return '';
3218          }
3219        }, {
3220          key: "tl",
3221          get: function get() {
3222            return colCache.n2l(this.left) + this.top;
3223          }
3224        }, {
3225          key: "$t$l",
3226          get: function get() {
3227            return "$".concat(colCache.n2l(this.left), "$").concat(this.top);
3228          }
3229        }, {
3230          key: "br",
3231          get: function get() {
3232            return colCache.n2l(this.right) + this.bottom;
3233          }
3234        }, {
3235          key: "$b$r",
3236          get: function get() {
3237            return "$".concat(colCache.n2l(this.right), "$").concat(this.bottom);
3238          }
3239        }, {
3240          key: "range",
3241          get: function get() {
3242            return "".concat(this._serialisedSheetName + this.tl, ":").concat(this.br);
3243          }
3244        }, {
3245          key: "$range",
3246          get: function get() {
3247            return "".concat(this._serialisedSheetName + this.$t$l, ":").concat(this.$b$r);
3248          }
3249        }, {
3250          key: "shortRange",
3251          get: function get() {
3252            return this.count > 1 ? this.range : this._serialisedSheetName + this.tl;
3253          }
3254        }, {
3255          key: "$shortRange",
3256          get: function get() {
3257            return this.count > 1 ? this.$range : this._serialisedSheetName + this.$t$l;
3258          }
3259        }, {
3260          key: "count",
3261          get: function get() {
3262            return (1 + this.bottom - this.top) * (1 + this.right - this.left);
3263          }
3264        }]);
3265
3266        return Range;
3267      }();
3268
3269      module.exports = Range;
3270    }, {
3271      "./../utils/col-cache": 17
3272    }],
3273    11: [function (require, module, exports) {
3274      'use strict';
3275
3276      function _classCallCheck(instance, Constructor) {
3277        if (!(instance instanceof Constructor)) {
3278          throw new TypeError("Cannot call a class as a function");
3279        }
3280      }
3281
3282      function _defineProperties(target, props) {
3283        for (var i = 0; i < props.length; i++) {
3284          var descriptor = props[i];
3285          descriptor.enumerable = descriptor.enumerable || false;
3286          descriptor.configurable = true;
3287          if ("value" in descriptor) descriptor.writable = true;
3288          Object.defineProperty(target, descriptor.key, descriptor);
3289        }
3290      }
3291
3292      function _createClass(Constructor, protoProps, staticProps) {
3293        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
3294        if (staticProps) _defineProperties(Constructor, staticProps);
3295        return Constructor;
3296      }
3297
3298      var _ = require('../utils/under-dash');
3299
3300      var Enums = require('./enums');
3301
3302      var colCache = require('../utils/col-cache');
3303
3304      var Cell = require('./cell');
3305
3306      var Row = /*#__PURE__*/function () {
3307        function Row(worksheet, number) {
3308          _classCallCheck(this, Row);
3309
3310          this._worksheet = worksheet;
3311          this._number = number;
3312          this._cells = [];
3313          this.style = {};
3314          this.outlineLevel = 0;
3315        } // return the row number
3316
3317
3318        _createClass(Row, [{
3319          key: "commit",
3320          // Inform Streaming Writer that this row (and all rows before it) are complete
3321          // and ready to write. Has no effect on Worksheet document
3322          value: function commit() {
3323            this._worksheet._commitRow(this); // eslint-disable-line no-underscore-dangle
3324
3325          } // helps GC by breaking cyclic references
3326
3327        }, {
3328          key: "destroy",
3329          value: function destroy() {
3330            delete this._worksheet;
3331            delete this._cells;
3332            delete this.style;
3333          }
3334        }, {
3335          key: "findCell",
3336          value: function findCell(colNumber) {
3337            return this._cells[colNumber - 1];
3338          } // given {address, row, col}, find or create new cell
3339
3340        }, {
3341          key: "getCellEx",
3342          value: function getCellEx(address) {
3343            var cell = this._cells[address.col - 1];
3344
3345            if (!cell) {
3346              var column = this._worksheet.getColumn(address.col);
3347
3348              cell = new Cell(this, column, address.address);
3349              this._cells[address.col - 1] = cell;
3350            }
3351
3352            return cell;
3353          } // get cell by key, letter or column number
3354
3355        }, {
3356          key: "getCell",
3357          value: function getCell(col) {
3358            if (typeof col === 'string') {
3359              // is it a key?
3360              var column = this._worksheet.getColumnKey(col);
3361
3362              if (column) {
3363                col = column.number;
3364              } else {
3365                col = colCache.l2n(col);
3366              }
3367            }
3368
3369            return this._cells[col - 1] || this.getCellEx({
3370              address: colCache.encodeAddress(this._number, col),
3371              row: this._number,
3372              col: col
3373            });
3374          } // remove cell(s) and shift all higher cells down by count
3375
3376        }, {
3377          key: "splice",
3378          value: function splice(start, count) {
3379            var nKeep = start + count;
3380
3381            for (var _len = arguments.length, inserts = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
3382              inserts[_key - 2] = arguments[_key];
3383            }
3384
3385            var nExpand = inserts.length - count;
3386            var nEnd = this._cells.length;
3387            var i;
3388            var cSrc;
3389            var cDst;
3390
3391            if (nExpand < 0) {
3392              // remove cells
3393              for (i = start + inserts.length; i <= nEnd; i++) {
3394                cDst = this._cells[i - 1];
3395                cSrc = this._cells[i - nExpand - 1];
3396
3397                if (cSrc) {
3398                  cDst = this.getCell(i);
3399                  cDst.value = cSrc.value;
3400                  cDst.style = cSrc.style; // eslint-disable-next-line no-underscore-dangle
3401
3402                  cDst._comment = cSrc._comment;
3403                } else if (cDst) {
3404                  cDst.value = null;
3405                  cDst.style = {}; // eslint-disable-next-line no-underscore-dangle
3406
3407                  cDst._comment = undefined;
3408                }
3409              }
3410            } else if (nExpand > 0) {
3411              // insert new cells
3412              for (i = nEnd; i >= nKeep; i--) {
3413                cSrc = this._cells[i - 1];
3414
3415                if (cSrc) {
3416                  cDst = this.getCell(i + nExpand);
3417                  cDst.value = cSrc.value;
3418                  cDst.style = cSrc.style; // eslint-disable-next-line no-underscore-dangle
3419
3420                  cDst._comment = cSrc._comment;
3421                } else {
3422                  this._cells[i + nExpand - 1] = undefined;
3423                }
3424              }
3425            } // now add the new values
3426
3427
3428            for (i = 0; i < inserts.length; i++) {
3429              cDst = this.getCell(start + i);
3430              cDst.value = inserts[i];
3431              cDst.style = {}; // eslint-disable-next-line no-underscore-dangle
3432
3433              cDst._comment = undefined;
3434            }
3435          } // Iterate over all non-null cells in this row
3436
3437        }, {
3438          key: "eachCell",
3439          value: function eachCell(options, iteratee) {
3440            if (!iteratee) {
3441              iteratee = options;
3442              options = null;
3443            }
3444
3445            if (options && options.includeEmpty) {
3446              var n = this._cells.length;
3447
3448              for (var i = 1; i <= n; i++) {
3449                iteratee(this.getCell(i), i);
3450              }
3451            } else {
3452              this._cells.forEach(function (cell, index) {
3453                if (cell && cell.type !== Enums.ValueType.Null) {
3454                  iteratee(cell, index + 1);
3455                }
3456              });
3457            }
3458          } // ===========================================================================
3459          // Page Breaks
3460
3461        }, {
3462          key: "addPageBreak",
3463          value: function addPageBreak(lft, rght) {
3464            var ws = this._worksheet;
3465            var left = Math.max(0, lft - 1) || 0;
3466            var right = Math.max(0, rght - 1) || 16838;
3467            var pb = {
3468              id: this._number,
3469              max: right,
3470              man: 1
3471            };
3472            if (left) pb.min = left;
3473            ws.rowBreaks.push(pb);
3474          } // return a sparse array of cell values
3475
3476        }, {
3477          key: "_applyStyle",
3478          // =========================================================================
3479          // styles
3480          value: function _applyStyle(name, value) {
3481            this.style[name] = value;
3482
3483            this._cells.forEach(function (cell) {
3484              if (cell) {
3485                cell[name] = value;
3486              }
3487            });
3488
3489            return value;
3490          }
3491        }, {
3492          key: "number",
3493          get: function get() {
3494            return this._number;
3495          }
3496        }, {
3497          key: "worksheet",
3498          get: function get() {
3499            return this._worksheet;
3500          }
3501        }, {
3502          key: "values",
3503          get: function get() {
3504            var values = [];
3505
3506            this._cells.forEach(function (cell) {
3507              if (cell && cell.type !== Enums.ValueType.Null) {
3508                values[cell.col] = cell.value;
3509              }
3510            });
3511
3512            return values;
3513          } // set the values by contiguous or sparse array, or by key'd object literal
3514          ,
3515          set: function set(value) {
3516            var _this = this; // this operation is not additive - any prior cells are removed
3517
3518
3519            this._cells = [];
3520
3521            if (!value) {// empty row
3522            } else if (value instanceof Array) {
3523              var offset = 0;
3524
3525              if (value.hasOwnProperty('0')) {
3526                // contiguous array - start at column 1
3527                offset = 1;
3528              }
3529
3530              value.forEach(function (item, index) {
3531                if (item !== undefined) {
3532                  _this.getCellEx({
3533                    address: colCache.encodeAddress(_this._number, index + offset),
3534                    row: _this._number,
3535                    col: index + offset
3536                  }).value = item;
3537                }
3538              });
3539            } else {
3540              // assume object with column keys
3541              this._worksheet.eachColumnKey(function (column, key) {
3542                if (value[key] !== undefined) {
3543                  _this.getCellEx({
3544                    address: colCache.encodeAddress(_this._number, column.number),
3545                    row: _this._number,
3546                    col: column.number
3547                  }).value = value[key];
3548                }
3549              });
3550            }
3551          } // returns true if the row includes at least one cell with a value
3552
3553        }, {
3554          key: "hasValues",
3555          get: function get() {
3556            return _.some(this._cells, function (cell) {
3557              return cell && cell.type !== Enums.ValueType.Null;
3558            });
3559          }
3560        }, {
3561          key: "cellCount",
3562          get: function get() {
3563            return this._cells.length;
3564          }
3565        }, {
3566          key: "actualCellCount",
3567          get: function get() {
3568            var count = 0;
3569            this.eachCell(function () {
3570              count++;
3571            });
3572            return count;
3573          } // get the min and max column number for the non-null cells in this row or null
3574
3575        }, {
3576          key: "dimensions",
3577          get: function get() {
3578            var min = 0;
3579            var max = 0;
3580
3581            this._cells.forEach(function (cell) {
3582              if (cell && cell.type !== Enums.ValueType.Null) {
3583                if (!min || min > cell.col) {
3584                  min = cell.col;
3585                }
3586
3587                if (max < cell.col) {
3588                  max = cell.col;
3589                }
3590              }
3591            });
3592
3593            return min > 0 ? {
3594              min: min,
3595              max: max
3596            } : null;
3597          }
3598        }, {
3599          key: "numFmt",
3600          get: function get() {
3601            return this.style.numFmt;
3602          },
3603          set: function set(value) {
3604            this._applyStyle('numFmt', value);
3605          }
3606        }, {
3607          key: "font",
3608          get: function get() {
3609            return this.style.font;
3610          },
3611          set: function set(value) {
3612            this._applyStyle('font', value);
3613          }
3614        }, {
3615          key: "alignment",
3616          get: function get() {
3617            return this.style.alignment;
3618          },
3619          set: function set(value) {
3620            this._applyStyle('alignment', value);
3621          }
3622        }, {
3623          key: "protection",
3624          get: function get() {
3625            return this.style.protection;
3626          },
3627          set: function set(value) {
3628            this._applyStyle('protection', value);
3629          }
3630        }, {
3631          key: "border",
3632          get: function get() {
3633            return this.style.border;
3634          },
3635          set: function set(value) {
3636            this._applyStyle('border', value);
3637          }
3638        }, {
3639          key: "fill",
3640          get: function get() {
3641            return this.style.fill;
3642          },
3643          set: function set(value) {
3644            this._applyStyle('fill', value);
3645          }
3646        }, {
3647          key: "hidden",
3648          get: function get() {
3649            return !!this._hidden;
3650          },
3651          set: function set(value) {
3652            this._hidden = value;
3653          }
3654        }, {
3655          key: "outlineLevel",
3656          get: function get() {
3657            return this._outlineLevel || 0;
3658          },
3659          set: function set(value) {
3660            this._outlineLevel = value;
3661          }
3662        }, {
3663          key: "collapsed",
3664          get: function get() {
3665            return !!(this._outlineLevel && this._outlineLevel >= this._worksheet.properties.outlineLevelRow);
3666          } // =========================================================================
3667
3668        }, {
3669          key: "model",
3670          get: function get() {
3671            var cells = [];
3672            var min = 0;
3673            var max = 0;
3674
3675            this._cells.forEach(function (cell) {
3676              if (cell) {
3677                var cellModel = cell.model;
3678
3679                if (cellModel) {
3680                  if (!min || min > cell.col) {
3681                    min = cell.col;
3682                  }
3683
3684                  if (max < cell.col) {
3685                    max = cell.col;
3686                  }
3687
3688                  cells.push(cellModel);
3689                }
3690              }
3691            });
3692
3693            return this.height || cells.length ? {
3694              cells: cells,
3695              number: this.number,
3696              min: min,
3697              max: max,
3698              height: this.height,
3699              style: this.style,
3700              hidden: this.hidden,
3701              outlineLevel: this.outlineLevel,
3702              collapsed: this.collapsed
3703            } : null;
3704          },
3705          set: function set(value) {
3706            var _this2 = this;
3707
3708            if (value.number !== this._number) {
3709              throw new Error('Invalid row number in model');
3710            }
3711
3712            this._cells = [];
3713            var previousAddress;
3714            value.cells.forEach(function (cellModel) {
3715              switch (cellModel.type) {
3716                case Cell.Types.Merge:
3717                  // special case - don't add this types
3718                  break;
3719
3720                default:
3721                  {
3722                    var address;
3723
3724                    if (cellModel.address) {
3725                      address = colCache.decodeAddress(cellModel.address);
3726                    } else if (previousAddress) {
3727                      // This is a <c> element without an r attribute
3728                      // Assume that it's the cell for the next column
3729                      var _previousAddress = previousAddress,
3730                          row = _previousAddress.row;
3731                      var col = previousAddress.col + 1;
3732                      address = {
3733                        row: row,
3734                        col: col,
3735                        address: colCache.encodeAddress(row, col),
3736                        $col$row: "$".concat(colCache.n2l(col), "$").concat(row)
3737                      };
3738                    }
3739
3740                    previousAddress = address;
3741
3742                    var cell = _this2.getCellEx(address);
3743
3744                    cell.model = cellModel;
3745                    break;
3746                  }
3747              }
3748            });
3749
3750            if (value.height) {
3751              this.height = value.height;
3752            } else {
3753              delete this.height;
3754            }
3755
3756            this.hidden = value.hidden;
3757            this.outlineLevel = value.outlineLevel || 0;
3758            this.style = value.style && JSON.parse(JSON.stringify(value.style)) || {};
3759          }
3760        }]);
3761
3762        return Row;
3763      }();
3764
3765      module.exports = Row;
3766    }, {
3767      "../utils/col-cache": 17,
3768      "../utils/under-dash": 23,
3769      "./cell": 3,
3770      "./enums": 7
3771    }],
3772    12: [function (require, module, exports) {
3773      "use strict";
3774
3775      function _classCallCheck(instance, Constructor) {
3776        if (!(instance instanceof Constructor)) {
3777          throw new TypeError("Cannot call a class as a function");
3778        }
3779      }
3780
3781      function _defineProperties(target, props) {
3782        for (var i = 0; i < props.length; i++) {
3783          var descriptor = props[i];
3784          descriptor.enumerable = descriptor.enumerable || false;
3785          descriptor.configurable = true;
3786          if ("value" in descriptor) descriptor.writable = true;
3787          Object.defineProperty(target, descriptor.key, descriptor);
3788        }
3789      }
3790
3791      function _createClass(Constructor, protoProps, staticProps) {
3792        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
3793        if (staticProps) _defineProperties(Constructor, staticProps);
3794        return Constructor;
3795      }
3796      /* eslint-disable max-classes-per-file */
3797
3798
3799      var colCache = require('./../utils/col-cache');
3800
3801      var Column = /*#__PURE__*/function () {
3802        // wrapper around column model, allowing access and manipulation
3803        function Column(table, column, index) {
3804          _classCallCheck(this, Column);
3805
3806          this.table = table;
3807          this.column = column;
3808          this.index = index;
3809        }
3810
3811        _createClass(Column, [{
3812          key: "_set",
3813          value: function _set(name, value) {
3814            this.table.cacheState();
3815            this.column[name] = value;
3816          }
3817          /* eslint-disable lines-between-class-members */
3818
3819        }, {
3820          key: "name",
3821          get: function get() {
3822            return this.column.name;
3823          },
3824          set: function set(value) {
3825            this._set('name', value);
3826          }
3827        }, {
3828          key: "filterButton",
3829          get: function get() {
3830            return this.column.filterButton;
3831          },
3832          set: function set(value) {
3833            this.column.filterButton = value;
3834          }
3835        }, {
3836          key: "style",
3837          get: function get() {
3838            return this.column.style;
3839          },
3840          set: function set(value) {
3841            this.column.style = value;
3842          }
3843        }, {
3844          key: "totalsRowLabel",
3845          get: function get() {
3846            return this.column.totalsRowLabel;
3847          },
3848          set: function set(value) {
3849            this._set('totalsRowLabel', value);
3850          }
3851        }, {
3852          key: "totalsRowFunction",
3853          get: function get() {
3854            return this.column.totalsRowFunction;
3855          },
3856          set: function set(value) {
3857            this._set('totalsRowFunction', value);
3858          }
3859        }, {
3860          key: "totalsRowResult",
3861          get: function get() {
3862            return this.column.totalsRowResult;
3863          },
3864          set: function set(value) {
3865            this._set('totalsRowResult', value);
3866          }
3867        }, {
3868          key: "totalsRowFormula",
3869          get: function get() {
3870            return this.column.totalsRowFormula;
3871          },
3872          set: function set(value) {
3873            this._set('totalsRowFormula', value);
3874          }
3875          /* eslint-enable lines-between-class-members */
3876
3877        }]);
3878
3879        return Column;
3880      }();
3881
3882      var Table = /*#__PURE__*/function () {
3883        function Table(worksheet, table) {
3884          _classCallCheck(this, Table);
3885
3886          this.worksheet = worksheet;
3887
3888          if (table) {
3889            this.table = table; // check things are ok first
3890
3891            this.validate();
3892            this.store();
3893          }
3894        }
3895
3896        _createClass(Table, [{
3897          key: "getFormula",
3898          value: function getFormula(column) {
3899            // get the correct formula to apply to the totals row
3900            switch (column.totalsRowFunction) {
3901              case 'none':
3902                return null;
3903
3904              case 'average':
3905                return "SUBTOTAL(101,".concat(this.table.name, "[").concat(column.name, "])");
3906
3907              case 'countNums':
3908                return "SUBTOTAL(102,".concat(this.table.name, "[").concat(column.name, "])");
3909
3910              case 'count':
3911                return "SUBTOTAL(103,".concat(this.table.name, "[").concat(column.name, "])");
3912
3913              case 'max':
3914                return "SUBTOTAL(104,".concat(this.table.name, "[").concat(column.name, "])");
3915
3916              case 'min':
3917                return "SUBTOTAL(105,".concat(this.table.name, "[").concat(column.name, "])");
3918
3919              case 'stdDev':
3920                return "SUBTOTAL(106,".concat(this.table.name, "[").concat(column.name, "])");
3921
3922              case 'var':
3923                return "SUBTOTAL(107,".concat(this.table.name, "[").concat(column.name, "])");
3924
3925              case 'sum':
3926                return "SUBTOTAL(109,".concat(this.table.name, "[").concat(column.name, "])");
3927
3928              case 'custom':
3929                return column.totalsRowFormula;
3930
3931              default:
3932                throw new Error("Invalid Totals Row Function: ".concat(column.totalsRowFunction));
3933            }
3934          }
3935        }, {
3936          key: "validate",
3937          value: function validate() {
3938            var _this = this;
3939
3940            var table = this.table; // set defaults and check is valid
3941
3942            var assign = function assign(o, name, dflt) {
3943              if (o[name] === undefined) {
3944                o[name] = dflt;
3945              }
3946            };
3947
3948            assign(table, 'headerRow', true);
3949            assign(table, 'totalsRow', false);
3950            assign(table, 'style', {});
3951            assign(table.style, 'theme', 'TableStyleMedium2');
3952            assign(table.style, 'showFirstColumn', false);
3953            assign(table.style, 'showLastColumn', false);
3954            assign(table.style, 'showRowStripes', false);
3955            assign(table.style, 'showColumnStripes', false);
3956
3957            var assert = function assert(test, message) {
3958              if (!test) {
3959                throw new Error(message);
3960              }
3961            };
3962
3963            assert(table.ref, 'Table must have ref');
3964            assert(table.columns, 'Table must have column definitions');
3965            assert(table.rows, 'Table must have row definitions');
3966            table.tl = colCache.decodeAddress(table.ref);
3967            var _table$tl = table.tl,
3968                row = _table$tl.row,
3969                col = _table$tl.col;
3970            assert(row > 0, 'Table must be on valid row');
3971            assert(col > 0, 'Table must be on valid col');
3972            var width = this.width,
3973                filterHeight = this.filterHeight,
3974                tableHeight = this.tableHeight; // autoFilterRef is a range that includes optional headers only
3975
3976            table.autoFilterRef = colCache.encode(row, col, row + filterHeight - 1, col + width - 1); // tableRef is a range that includes optional headers and totals
3977
3978            table.tableRef = colCache.encode(row, col, row + tableHeight - 1, col + width - 1);
3979            table.columns.forEach(function (column, i) {
3980              assert(column.name, "Column ".concat(i, " must have a name"));
3981
3982              if (i === 0) {
3983                assign(column, 'totalsRowLabel', 'Total');
3984              } else {
3985                assign(column, 'totalsRowFunction', 'none');
3986                column.totalsRowFormula = _this.getFormula(column);
3987              }
3988            });
3989          }
3990        }, {
3991          key: "store",
3992          value: function store() {
3993            var _this2 = this; // where the table needs to store table data, headers, footers in
3994            // the sheet...
3995
3996
3997            var assignStyle = function assignStyle(cell, style) {
3998              if (style) {
3999                Object.keys(style).forEach(function (key) {
4000                  cell[key] = style[key];
4001                });
4002              }
4003            };
4004
4005            var worksheet = this.worksheet,
4006                table = this.table;
4007            var _table$tl2 = table.tl,
4008                row = _table$tl2.row,
4009                col = _table$tl2.col;
4010            var count = 0;
4011
4012            if (table.headerRow) {
4013              var r = worksheet.getRow(row + count++);
4014              table.columns.forEach(function (column, j) {
4015                var style = column.style,
4016                    name = column.name;
4017                var cell = r.getCell(col + j);
4018                cell.value = name;
4019                assignStyle(cell, style);
4020              });
4021            }
4022
4023            table.rows.forEach(function (data) {
4024              var r = worksheet.getRow(row + count++);
4025              data.forEach(function (value, j) {
4026                var cell = r.getCell(col + j);
4027                cell.value = value;
4028                assignStyle(cell, table.columns[j].style);
4029              });
4030            });
4031
4032            if (table.totalsRow) {
4033              var _r = worksheet.getRow(row + count++);
4034
4035              table.columns.forEach(function (column, j) {
4036                var cell = _r.getCell(col + j);
4037
4038                if (j === 0) {
4039                  cell.value = column.totalsRowLabel;
4040                } else {
4041                  var formula = _this2.getFormula(column);
4042
4043                  if (formula) {
4044                    cell.value = {
4045                      formula: column.totalsRowFormula,
4046                      result: column.totalsRowResult
4047                    };
4048                  } else {
4049                    cell.value = null;
4050                  }
4051                }
4052
4053                assignStyle(cell, column.style);
4054              });
4055            }
4056          }
4057        }, {
4058          key: "load",
4059          value: function load(worksheet) {
4060            var _this3 = this; // where the table will read necessary features from a loaded sheet
4061
4062
4063            var table = this.table;
4064            var _table$tl3 = table.tl,
4065                row = _table$tl3.row,
4066                col = _table$tl3.col;
4067            var count = 0;
4068
4069            if (table.headerRow) {
4070              var r = worksheet.getRow(row + count++);
4071              table.columns.forEach(function (column, j) {
4072                var cell = r.getCell(col + j);
4073                cell.value = column.name;
4074              });
4075            }
4076
4077            table.rows.forEach(function (data) {
4078              var r = worksheet.getRow(row + count++);
4079              data.forEach(function (value, j) {
4080                var cell = r.getCell(col + j);
4081                cell.value = value;
4082              });
4083            });
4084
4085            if (table.totalsRow) {
4086              var _r2 = worksheet.getRow(row + count++);
4087
4088              table.columns.forEach(function (column, j) {
4089                var cell = _r2.getCell(col + j);
4090
4091                if (j === 0) {
4092                  cell.value = column.totalsRowLabel;
4093                } else {
4094                  var formula = _this3.getFormula(column);
4095
4096                  if (formula) {
4097                    cell.value = {
4098                      formula: column.totalsRowFormula,
4099                      result: column.totalsRowResult
4100                    };
4101                  }
4102                }
4103              });
4104            }
4105          }
4106        }, {
4107          key: "cacheState",
4108          // ================================================================
4109          // TODO: Mutating methods
4110          value: function cacheState() {
4111            if (!this._cache) {
4112              this._cache = {
4113                ref: this.ref,
4114                width: this.width,
4115                tableHeight: this.tableHeight
4116              };
4117            }
4118          }
4119        }, {
4120          key: "commit",
4121          value: function commit() {
4122            // changes may have been made that might have on-sheet effects
4123            if (!this._cache) {
4124              return;
4125            } // check things are ok first
4126
4127
4128            this.validate();
4129            var ref = colCache.decodeAddress(this._cache.ref);
4130
4131            if (this.ref !== this._cache.ref) {
4132              // wipe out whole table footprint at previous location
4133              for (var i = 0; i < this._cache.tableHeight; i++) {
4134                var row = this.worksheet.getRow(ref.row + i);
4135
4136                for (var j = 0; j < this._cache.width; j++) {
4137                  var cell = row.getCell(ref.col + j);
4138                  cell.value = null;
4139                }
4140              }
4141            } else {
4142              // clear out below table if it has shrunk
4143              for (var _i = this.tableHeight; _i < this._cache.tableHeight; _i++) {
4144                var _row = this.worksheet.getRow(ref.row + _i);
4145
4146                for (var _j = 0; _j < this._cache.width; _j++) {
4147                  var _cell = _row.getCell(ref.col + _j);
4148
4149                  _cell.value = null;
4150                }
4151              } // clear out to right of table if it has lost columns
4152
4153
4154              for (var _i2 = 0; _i2 < this.tableHeight; _i2++) {
4155                var _row2 = this.worksheet.getRow(ref.row + _i2);
4156
4157                for (var _j2 = this.width; _j2 < this._cache.width; _j2++) {
4158                  var _cell2 = _row2.getCell(ref.col + _j2);
4159
4160                  _cell2.value = null;
4161                }
4162              }
4163            }
4164
4165            this.store();
4166          }
4167        }, {
4168          key: "addRow",
4169          value: function addRow(values, rowNumber) {
4170            // Add a row of data, either insert at rowNumber or append
4171            this.cacheState();
4172
4173            if (rowNumber === undefined) {
4174              this.table.rows.push(values);
4175            } else {
4176              this.table.rows.splice(rowNumber, 0, values);
4177            }
4178          }
4179        }, {
4180          key: "removeRows",
4181          value: function removeRows(rowIndex) {
4182            var count = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; // Remove a rows of data
4183
4184            this.cacheState();
4185            this.table.rows.splice(rowIndex, count);
4186          }
4187        }, {
4188          key: "getColumn",
4189          value: function getColumn(colIndex) {
4190            var column = this.table.columns[colIndex];
4191            return new Column(this, column, colIndex);
4192          }
4193        }, {
4194          key: "addColumn",
4195          value: function addColumn(column, values, colIndex) {
4196            // Add a new column, including column defn and values
4197            // Inserts at colNumber or adds to the right
4198            this.cacheState();
4199
4200            if (colIndex === undefined) {
4201              this.table.columns.push(column);
4202              this.table.rows.forEach(function (row, i) {
4203                row.push(values[i]);
4204              });
4205            } else {
4206              this.table.columns.splice(colIndex, 0, column);
4207              this.table.rows.forEach(function (row, i) {
4208                row.splice(colIndex, 0, values[i]);
4209              });
4210            }
4211          }
4212        }, {
4213          key: "removeColumns",
4214          value: function removeColumns(colIndex) {
4215            var count = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; // Remove a column with data
4216
4217            this.cacheState();
4218            this.table.columns.splice(colIndex, count);
4219            this.table.rows.forEach(function (row) {
4220              row.splice(colIndex, count);
4221            });
4222          }
4223        }, {
4224          key: "_assign",
4225          value: function _assign(target, prop, value) {
4226            this.cacheState();
4227            target[prop] = value;
4228          }
4229          /* eslint-disable lines-between-class-members */
4230
4231        }, {
4232          key: "width",
4233          get: function get() {
4234            // width of the table
4235            return this.table.columns.length;
4236          }
4237        }, {
4238          key: "height",
4239          get: function get() {
4240            // height of the table data
4241            return this.table.rows.length;
4242          }
4243        }, {
4244          key: "filterHeight",
4245          get: function get() {
4246            // height of the table data plus optional header row
4247            return this.height + (this.table.headerRow ? 1 : 0);
4248          }
4249        }, {
4250          key: "tableHeight",
4251          get: function get() {
4252            // full height of the table on the sheet
4253            return this.filterHeight + (this.table.totalsRow ? 1 : 0);
4254          }
4255        }, {
4256          key: "model",
4257          get: function get() {
4258            return this.table;
4259          },
4260          set: function set(value) {
4261            this.table = value;
4262          }
4263        }, {
4264          key: "ref",
4265          get: function get() {
4266            return this.table.ref;
4267          },
4268          set: function set(value) {
4269            this._assign(this.table, 'ref', value);
4270          }
4271        }, {
4272          key: "name",
4273          get: function get() {
4274            return this.table.name;
4275          },
4276          set: function set(value) {
4277            this.table.name = value;
4278          }
4279        }, {
4280          key: "displayName",
4281          get: function get() {
4282            return this.table.displyName || this.table.name;
4283          }
4284        }, {
4285          key: "displayNamename",
4286          set: function set(value) {
4287            this.table.displayName = value;
4288          }
4289        }, {
4290          key: "headerRow",
4291          get: function get() {
4292            return this.table.headerRow;
4293          },
4294          set: function set(value) {
4295            this._assign(this.table, 'headerRow', value);
4296          }
4297        }, {
4298          key: "totalsRow",
4299          get: function get() {
4300            return this.table.totalsRow;
4301          },
4302          set: function set(value) {
4303            this._assign(this.table, 'totalsRow', value);
4304          }
4305        }, {
4306          key: "theme",
4307          get: function get() {
4308            return this.table.style.name;
4309          },
4310          set: function set(value) {
4311            this.table.style.name = value;
4312          }
4313        }, {
4314          key: "showFirstColumn",
4315          get: function get() {
4316            return this.table.style.showFirstColumn;
4317          },
4318          set: function set(value) {
4319            this.table.style.showFirstColumn = value;
4320          }
4321        }, {
4322          key: "showLastColumn",
4323          get: function get() {
4324            return this.table.style.showLastColumn;
4325          },
4326          set: function set(value) {
4327            this.table.style.showLastColumn = value;
4328          }
4329        }, {
4330          key: "showRowStripes",
4331          get: function get() {
4332            return this.table.style.showRowStripes;
4333          },
4334          set: function set(value) {
4335            this.table.style.showRowStripes = value;
4336          }
4337        }, {
4338          key: "showColumnStripes",
4339          get: function get() {
4340            return this.table.style.showColumnStripes;
4341          },
4342          set: function set(value) {
4343            this.table.style.showColumnStripes = value;
4344          }
4345          /* eslint-enable lines-between-class-members */
4346
4347        }]);
4348
4349        return Table;
4350      }();
4351
4352      module.exports = Table;
4353    }, {
4354      "./../utils/col-cache": 17
4355    }],
4356    13: [function (require, module, exports) {
4357      'use strict';
4358
4359      function _classCallCheck(instance, Constructor) {
4360        if (!(instance instanceof Constructor)) {
4361          throw new TypeError("Cannot call a class as a function");
4362        }
4363      }
4364
4365      function _defineProperties(target, props) {
4366        for (var i = 0; i < props.length; i++) {
4367          var descriptor = props[i];
4368          descriptor.enumerable = descriptor.enumerable || false;
4369          descriptor.configurable = true;
4370          if ("value" in descriptor) descriptor.writable = true;
4371          Object.defineProperty(target, descriptor.key, descriptor);
4372        }
4373      }
4374
4375      function _createClass(Constructor, protoProps, staticProps) {
4376        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
4377        if (staticProps) _defineProperties(Constructor, staticProps);
4378        return Constructor;
4379      }
4380
4381      var Worksheet = require('./worksheet');
4382
4383      var DefinedNames = require('./defined-names');
4384
4385      var XLSX = require('../xlsx/xlsx');
4386
4387      var CSV = require('../csv/csv'); // Workbook requirements
4388      //  Load and Save from file and stream
4389      //  Access/Add/Delete individual worksheets
4390      //  Manage String table, Hyperlink table, etc.
4391      //  Manage scaffolding for contained objects to write to/read from
4392
4393
4394      var Workbook = /*#__PURE__*/function () {
4395        function Workbook() {
4396          _classCallCheck(this, Workbook);
4397
4398          this.created = new Date();
4399          this.modified = this.created;
4400          this.properties = {};
4401          this.calcProperties = {};
4402          this._worksheets = [];
4403          this.views = [];
4404          this.media = [];
4405          this._definedNames = new DefinedNames();
4406        }
4407
4408        _createClass(Workbook, [{
4409          key: "addWorksheet",
4410          value: function addWorksheet(name, options) {
4411            var id = this.nextId;
4412
4413            if (name && name.length > 31) {
4414              // eslint-disable-next-line no-console
4415              console.warn("Worksheet name ".concat(name, " exceeds 31 chars. This will be truncated"));
4416            }
4417
4418            name = (name || "sheet".concat(id)).substring(0, 31);
4419
4420            if (this._worksheets.find(function (ws) {
4421              return ws && ws.name.toLowerCase() === name.toLowerCase();
4422            })) {
4423              throw new Error("Worksheet name already exists: ".concat(name));
4424            } // if options is a color, call it tabColor (and signal deprecated message)
4425
4426
4427            if (options) {
4428              if (typeof options === 'string') {
4429                // eslint-disable-next-line no-console
4430                console.trace('tabColor argument is now deprecated. Please use workbook.addWorksheet(name, {properties: { tabColor: { argb: "rbg value" } }');
4431                options = {
4432                  properties: {
4433                    tabColor: {
4434                      argb: options
4435                    }
4436                  }
4437                };
4438              } else if (options.argb || options.theme || options.indexed) {
4439                // eslint-disable-next-line no-console
4440                console.trace('tabColor argument is now deprecated. Please use workbook.addWorksheet(name, {properties: { tabColor: { ... } }');
4441                options = {
4442                  properties: {
4443                    tabColor: options
4444                  }
4445                };
4446              }
4447            }
4448
4449            var lastOrderNo = this._worksheets.reduce(function (acc, ws) {
4450              return (ws && ws.orderNo) > acc ? ws.orderNo : acc;
4451            }, 0);
4452
4453            var worksheetOptions = Object.assign({}, options, {
4454              id: id,
4455              name: name,
4456              orderNo: lastOrderNo + 1,
4457              workbook: this
4458            });
4459            var worksheet = new Worksheet(worksheetOptions);
4460            this._worksheets[id] = worksheet;
4461            return worksheet;
4462          }
4463        }, {
4464          key: "removeWorksheetEx",
4465          value: function removeWorksheetEx(worksheet) {
4466            delete this._worksheets[worksheet.id];
4467          }
4468        }, {
4469          key: "removeWorksheet",
4470          value: function removeWorksheet(id) {
4471            var worksheet = this.getWorksheet(id);
4472
4473            if (worksheet) {
4474              worksheet.destroy();
4475            }
4476          }
4477        }, {
4478          key: "getWorksheet",
4479          value: function getWorksheet(id) {
4480            if (id === undefined) {
4481              return this._worksheets.find(Boolean);
4482            }
4483
4484            if (typeof id === 'number') {
4485              return this._worksheets[id];
4486            }
4487
4488            if (typeof id === 'string') {
4489              return this._worksheets.find(function (worksheet) {
4490                return worksheet && worksheet.name === id;
4491              });
4492            }
4493
4494            return undefined;
4495          }
4496        }, {
4497          key: "eachSheet",
4498          value: function eachSheet(iteratee) {
vendor: 4,904 bytes, lines 4499-4642
4499            this.worksheets.forEach(function (sheet) {
4500              iteratee(sheet, sheet.id);
4501            });
4502          }
4503        }, {
4504          key: "clearThemes",
4505          value: function clearThemes() {
4506            // Note: themes are not an exposed feature, meddle at your peril!
4507            this._themes = undefined;
4508          }
4509        }, {
4510          key: "addImage",
4511          value: function addImage(image) {
4512            // TODO:  validation?
4513            var id = this.media.length;
4514            this.media.push(Object.assign({}, image, {
4515              type: 'image'
4516            }));
4517            return id;
4518          }
4519        }, {
4520          key: "getImage",
4521          value: function getImage(id) {
4522            return this.media[id];
4523          }
4524        }, {
4525          key: "xlsx",
4526          get: function get() {
4527            if (!this._xlsx) this._xlsx = new XLSX(this);
4528            return this._xlsx;
4529          }
4530        }, {
4531          key: "csv",
4532          get: function get() {
4533            if (!this._csv) this._csv = new CSV(this);
4534            return this._csv;
4535          }
4536        }, {
4537          key: "nextId",
4538          get: function get() {
4539            // find the next unique spot to add worksheet
4540            for (var i = 1; i < this._worksheets.length; i++) {
4541              if (!this._worksheets[i]) {
4542                return i;
4543              }
4544            }
4545
4546            return this._worksheets.length || 1;
4547          }
4548        }, {
4549          key: "worksheets",
4550          get: function get() {
4551            // return a clone of _worksheets
4552            return this._worksheets.slice(1).sort(function (a, b) {
4553              return a.orderNo - b.orderNo;
4554            }).filter(Boolean);
4555          }
4556        }, {
4557          key: "definedNames",
4558          get: function get() {
4559            return this._definedNames;
4560          }
4561        }, {
4562          key: "model",
4563          get: function get() {
4564            return {
4565              creator: this.creator || 'Unknown',
4566              lastModifiedBy: this.lastModifiedBy || 'Unknown',
4567              lastPrinted: this.lastPrinted,
4568              created: this.created,
4569              modified: this.modified,
4570              properties: this.properties,
4571              worksheets: this.worksheets.map(function (worksheet) {
4572                return worksheet.model;
4573              }),
4574              sheets: this.worksheets.map(function (ws) {
4575                return ws.model;
4576              }).filter(Boolean),
4577              definedNames: this._definedNames.model,
4578              views: this.views,
4579              company: this.company,
4580              manager: this.manager,
4581              title: this.title,
4582              subject: this.subject,
4583              keywords: this.keywords,
4584              category: this.category,
4585              description: this.description,
4586              language: this.language,
4587              revision: this.revision,
4588              contentStatus: this.contentStatus,
4589              themes: this._themes,
4590              media: this.media,
4591              calcProperties: this.calcProperties
4592            };
4593          },
4594          set: function set(value) {
4595            var _this = this;
4596
4597            this.creator = value.creator;
4598            this.lastModifiedBy = value.lastModifiedBy;
4599            this.lastPrinted = value.lastPrinted;
4600            this.created = value.created;
4601            this.modified = value.modified;
4602            this.company = value.company;
4603            this.manager = value.manager;
4604            this.title = value.title;
4605            this.subject = value.subject;
4606            this.keywords = value.keywords;
4607            this.category = value.category;
4608            this.description = value.description;
4609            this.language = value.language;
4610            this.revision = value.revision;
4611            this.contentStatus = value.contentStatus;
4612            this.properties = value.properties;
4613            this.calcProperties = value.calcProperties;
4614            this._worksheets = [];
4615            value.worksheets.forEach(function (worksheetModel) {
4616              var id = worksheetModel.id,
4617                  name = worksheetModel.name,
4618                  state = worksheetModel.state;
4619              var orderNo = value.sheets && value.sheets.findIndex(function (ws) {
4620                return ws.id === id;
4621              });
4622              var worksheet = _this._worksheets[id] = new Worksheet({
4623                id: id,
4624                name: name,
4625                orderNo: orderNo,
4626                state: state,
4627                workbook: _this
4628              });
4629              worksheet.model = worksheetModel;
4630            });
4631            this._definedNames.model = value.definedNames;
4632            this.views = value.views;
4633            this._themes = value.themes;
4634            this.media = value.media || [];
4635          }
4636        }]);
4637
4638        return Workbook;
4639      }();
4640
4641      module.exports = Workbook;
4642    }, {
4643      "../csv/csv": 1,
4644      "../xlsx/xlsx": 139,
4645      "./defined-names": 6,
4646      "./worksheet": 14
4647    }],
4648    14: [function (require, module, exports) {
4649      "use strict";
4650
4651      function ownKeys(object, enumerableOnly) {
4652        var keys = Object.keys(object);
4653
4654        if (Object.getOwnPropertySymbols) {
4655          var symbols = Object.getOwnPropertySymbols(object);
4656          if (enumerableOnly) symbols = symbols.filter(function (sym) {
4657            return Object.getOwnPropertyDescriptor(object, sym).enumerable;
4658          });
4659          keys.push.apply(keys, symbols);
4660        }
4661
4662        return keys;
4663      }
4664
4665      function _objectSpread(target) {
4666        for (var i = 1; i < arguments.length; i++) {
4667          var source = arguments[i] != null ? arguments[i] : {};
4668
4669          if (i % 2) {
4670            ownKeys(Object(source), true).forEach(function (key) {
4671              _defineProperty(target, key, source[key]);
4672            });
4673          } else if (Object.getOwnPropertyDescriptors) {
4674            Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
4675          } else {
4676            ownKeys(Object(source)).forEach(function (key) {
4677              Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
4678            });
4679          }
4680        }
4681
4682        return target;
4683      }
4684
4685      function _defineProperty(obj, key, value) {
4686        if (key in obj) {
4687          Object.defineProperty(obj, key, {
4688            value: value,
4689            enumerable: true,
4690            configurable: true,
4691            writable: true
4692          });
4693        } else {
4694          obj[key] = value;
4695        }
4696
4697        return obj;
4698      }
4699
4700      function _toConsumableArray(arr) {
4701        return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
4702      }
4703
4704      function _nonIterableSpread() {
4705        throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
4706      }
4707
4708      function _unsupportedIterableToArray(o, minLen) {
4709        if (!o) return;
4710        if (typeof o === "string") return _arrayLikeToArray(o, minLen);
4711        var n = Object.prototype.toString.call(o).slice(8, -1);
4712        if (n === "Object" && o.constructor) n = o.constructor.name;
4713        if (n === "Map" || n === "Set") return Array.from(n);
4714        if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
4715      }
4716
4717      function _iterableToArray(iter) {
4718        if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
4719      }
4720
4721      function _arrayWithoutHoles(arr) {
4722        if (Array.isArray(arr)) return _arrayLikeToArray(arr);
4723      }
4724
4725      function _arrayLikeToArray(arr, len) {
4726        if (len == null || len > arr.length) len = arr.length;
4727
4728        for (var i = 0, arr2 = new Array(len); i < len; i++) {
4729          arr2[i] = arr[i];
4730        }
4731
4732        return arr2;
4733      }
4734
4735      function _classCallCheck(instance, Constructor) {
4736        if (!(instance instanceof Constructor)) {
4737          throw new TypeError("Cannot call a class as a function");
4738        }
4739      }
4740
4741      function _defineProperties(target, props) {
4742        for (var i = 0; i < props.length; i++) {
4743          var descriptor = props[i];
4744          descriptor.enumerable = descriptor.enumerable || false;
4745          descriptor.configurable = true;
4746          if ("value" in descriptor) descriptor.writable = true;
4747          Object.defineProperty(target, descriptor.key, descriptor);
4748        }
4749      }
4750
4751      function _createClass(Constructor, protoProps, staticProps) {
4752        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
4753        if (staticProps) _defineProperties(Constructor, staticProps);
4754        return Constructor;
4755      }
4756
4757      var _ = require('../utils/under-dash');
4758
4759      var colCache = require('../utils/col-cache');
4760
4761      var Range = require('./range');
4762
4763      var Row = require('./row');
4764
4765      var Column = require('./column');
4766
4767      var Enums = require('./enums');
4768
4769      var Image = require('./image');
4770
4771      var Table = require('./table');
4772
4773      var DataValidations = require('./data-validations');
4774
4775      var Encryptor = require('../utils/encryptor'); // Worksheet requirements
4776      //  Operate as sheet inside workbook or standalone
4777      //  Load and Save from file and stream
4778      //  Access/Add/Delete individual cells
4779      //  Manage column widths and row heights
4780
4781
4782      var Worksheet = /*#__PURE__*/function () {
4783        function Worksheet(options) {
4784          _classCallCheck(this, Worksheet);
4785
4786          options = options || {}; // in a workbook, each sheet will have a number
4787
4788          this.id = options.id;
4789          this.orderNo = options.orderNo; // and a name
4790
vendor: 8,914 bytes, lines 4791-5048
4791          this.name = options.name || "Sheet".concat(this.id); // add a state
4792
4793          this.state = options.state || 'visible'; // rows allows access organised by row. Sparse array of arrays indexed by row-1, col
4794          // Note: _rows is zero based. Must subtract 1 to go from cell.row to index
4795
4796          this._rows = []; // column definitions
4797
4798          this._columns = null; // column keys (addRow convenience): key ==> this._collumns index
4799
4800          this._keys = {}; // keep record of all merges
4801
4802          this._merges = {}; // record of all row and column pageBreaks
4803
4804          this.rowBreaks = [];
4805          this._workbook = options.workbook; // for tabColor, default row height, outline levels, etc
4806
4807          this.properties = Object.assign({}, {
4808            defaultRowHeight: 15,
4809            dyDescent: 55,
4810            outlineLevelCol: 0,
4811            outlineLevelRow: 0
4812          }, options.properties); // for all things printing
4813
4814          this.pageSetup = Object.assign({}, {
4815            margins: {
4816              left: 0.7,
4817              right: 0.7,
4818              top: 0.75,
4819              bottom: 0.75,
4820              header: 0.3,
4821              footer: 0.3
4822            },
4823            orientation: 'portrait',
4824            horizontalDpi: 4294967295,
4825            verticalDpi: 4294967295,
4826            fitToPage: !!(options.pageSetup && (options.pageSetup.fitToWidth || options.pageSetup.fitToHeight) && !options.pageSetup.scale),
4827            pageOrder: 'downThenOver',
4828            blackAndWhite: false,
4829            draft: false,
4830            cellComments: 'None',
4831            errors: 'displayed',
4832            scale: 100,
4833            fitToWidth: 1,
4834            fitToHeight: 1,
4835            paperSize: undefined,
4836            showRowColHeaders: false,
4837            showGridLines: false,
4838            firstPageNumber: undefined,
4839            horizontalCentered: false,
4840            verticalCentered: false,
4841            rowBreaks: null,
4842            colBreaks: null
4843          }, options.pageSetup);
4844          this.headerFooter = Object.assign({}, {
4845            differentFirst: false,
4846            differentOddEven: false,
4847            oddHeader: null,
4848            oddFooter: null,
4849            evenHeader: null,
4850            evenFooter: null,
4851            firstHeader: null,
4852            firstFooter: null
4853          }, options.headerFooter);
4854          this.dataValidations = new DataValidations(); // for freezepanes, split, zoom, gridlines, etc
4855
4856          this.views = options.views || [];
4857          this.autoFilter = options.autoFilter || null; // for images, etc
4858
4859          this._media = []; // worksheet protection
4860
4861          this.sheetProtection = null; // for tables
4862
4863          this.tables = {};
4864          this.conditionalFormattings = [];
4865        }
4866
4867        _createClass(Worksheet, [{
4868          key: "destroy",
4869          // when you're done with this worksheet, call this to remove from workbook
4870          value: function destroy() {
4871            this._workbook.removeWorksheetEx(this);
4872          } // Get the bounding range of the cells in this worksheet
4873
4874        }, {
4875          key: "getColumnKey",
4876          value: function getColumnKey(key) {
4877            return this._keys[key];
4878          }
4879        }, {
4880          key: "setColumnKey",
4881          value: function setColumnKey(key, value) {
4882            this._keys[key] = value;
4883          }
4884        }, {
4885          key: "deleteColumnKey",
4886          value: function deleteColumnKey(key) {
4887            delete this._keys[key];
4888          }
4889        }, {
4890          key: "eachColumnKey",
4891          value: function eachColumnKey(f) {
4892            _.each(this._keys, f);
4893          } // get a single column by col number. If it doesn't exist, create it and any gaps before it
4894
4895        }, {
4896          key: "getColumn",
4897          value: function getColumn(c) {
4898            if (typeof c === 'string') {
4899              // if it matches a key'd column, return that
4900              var col = this._keys[c];
4901              if (col) return col; // otherwise, assume letter
4902
4903              c = colCache.l2n(c);
4904            }
4905
4906            if (!this._columns) {
4907              this._columns = [];
4908            }
4909
4910            if (c > this._columns.length) {
4911              var n = this._columns.length + 1;
4912
4913              while (n <= c) {
4914                this._columns.push(new Column(this, n++));
4915              }
4916            }
4917
4918            return this._columns[c - 1];
4919          }
4920        }, {
4921          key: "spliceColumns",
4922          value: function spliceColumns(start, count) {
4923            var _this = this;
4924
4925            var rows = this._rows;
4926            var nRows = rows.length;
4927
4928            for (var _len = arguments.length, inserts = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
4929              inserts[_key - 2] = arguments[_key];
4930            }
4931
4932            if (inserts.length > 0) {
4933              var _loop = function _loop(i) {
4934                var rowArguments = [start, count]; // eslint-disable-next-line no-loop-func
4935
4936                inserts.forEach(function (insert) {
4937                  rowArguments.push(insert[i] || null);
4938                });
4939
4940                var row = _this.getRow(i + 1); // eslint-disable-next-line prefer-spread
4941
4942
4943                row.splice.apply(row, rowArguments);
4944              }; // must iterate over all rows whether they exist yet or not
4945
4946
4947              for (var i = 0; i < nRows; i++) {
4948                _loop(i);
4949              }
4950            } else {
4951              // nothing to insert, so just splice all rows
4952              this._rows.forEach(function (r) {
4953                if (r) {
4954                  r.splice(start, count);
4955                }
4956              });
4957            } // splice column definitions
4958
4959
4960            var nExpand = inserts.length - count;
4961            var nKeep = start + count;
4962            var nEnd = this._columns.length;
4963
4964            if (nExpand < 0) {
4965              for (var _i = start + inserts.length; _i <= nEnd; _i++) {
4966                this.getColumn(_i).defn = this.getColumn(_i - nExpand).defn;
4967              }
4968            } else if (nExpand > 0) {
4969              for (var _i2 = nEnd; _i2 >= nKeep; _i2--) {
4970                this.getColumn(_i2 + nExpand).defn = this.getColumn(_i2).defn;
4971              }
4972            }
4973
4974            for (var _i3 = start; _i3 < start + inserts.length; _i3++) {
4975              this.getColumn(_i3).defn = null;
4976            } // account for defined names
4977
4978
4979            this.workbook.definedNames.spliceColumns(this.name, start, count, inserts.length);
4980          }
4981        }, {
4982          key: "_commitRow",
4983          // =========================================================================
4984          // Rows
4985          value: function _commitRow() {// nop - allows streaming reader to fill a document
4986          }
4987        }, {
4988          key: "findRow",
4989          // find a row (if exists) by row number
4990          value: function findRow(r) {
4991            return this._rows[r - 1];
4992          }
4993        }, {
4994          key: "getRow",
4995          // get a row by row number.
4996          value: function getRow(r) {
4997            var row = this._rows[r - 1];
4998
4999            if (!row) {
5000              row = this._rows[r - 1] = new Row(this, r);
5001            }
5002
5003            return row;
5004          }
5005        }, {
5006          key: "addRow",
5007          value: function addRow(value) {
5008            var styleOption = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'n';
5009            var rowNo = this._nextRow;
5010            var row = this.getRow(rowNo);
5011            row.values = value;
5012
5013            this._setStyleOption(rowNo, styleOption === 'i' ? styleOption : 'n');
5014
5015            return row;
5016          }
5017        }, {
5018          key: "addRows",
5019          value: function addRows(value) {
5020            var _this2 = this;
5021
5022            var styleOption = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'n';
5023            value.forEach(function (row) {
5024              _this2.addRow(row, styleOption);
5025            });
5026          }
5027        }, {
5028          key: "insertRow",
5029          value: function insertRow(pos, value) {
5030            var styleOption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'n';
5031            this.spliceRows(pos, 0, value);
5032
5033            this._setStyleOption(pos, styleOption);
5034
5035            return this.getRow(pos);
5036          }
5037        }, {
5038          key: "insertRows",
5039          value: function insertRows(pos, values) {
5040            var styleOption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'n';
5041            this.spliceRows.apply(this, [pos, 0].concat(_toConsumableArray(values)));
5042
5043            if (styleOption !== 'n') {
5044              // copy over the styles
5045              for (var i = 0; i < values.length; i++) {
5046                if (styleOption === 'o' && this.findRow(values.length + pos + i) !== undefined) {
5047                  this._copyStyle(values.length + pos + i, pos + i);
5048                }
5048 else if (styleOption === 'i' && this.findRow(pos - 1) !== undefined) {
5049                  this._copyStyle(pos - 1, pos + i);
5050                }
5051              }
5052            }
5053          } // set row at position to same style as of either pervious row (option 'i') or next row (option 'o')
5054
5055        }, {
5056          key: "_setStyleOption",
5057          value: function _setStyleOption(pos) {
5058            var styleOption = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'n';
5059
5060            if (styleOption === 'o' && this.findRow(pos + 1) !== undefined) {
5061              this._copyStyle(pos + 1, pos);
5062            } else if (styleOption === 'i' && this.findRow(pos - 1) !== undefined) {
5063              this._copyStyle(pos - 1, pos);
5064            }
5065          }
5066        }, {
5067          key: "_copyStyle",
5068          value: function _copyStyle(src, dest) {
5069            var rSrc = this.getRow(src);
5070            var rDst = this.getRow(dest);
5071            rDst.style = Object.freeze(_objectSpread({}, rSrc.style)); // eslint-disable-next-line no-loop-func
5072
5073            rSrc.eachCell({
5074              includeEmpty: true
5075            }, function (cell, colNumber) {
5076              rDst.getCell(colNumber).style = Object.freeze(_objectSpread({}, cell.style));
5077            });
5078            rDst.height = rSrc.height;
5079          }
5080        }, {
5081          key: "duplicateRow",
5082          value: function duplicateRow(rowNum, count) {
5083            var _this3 = this;
5084
5085            var insert = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; // create count duplicates of rowNum
5086            // either inserting new or overwriting existing rows
5087
5088            var rSrc = this._rows[rowNum - 1];
5089            var inserts = new Array(count).fill(rSrc.values);
5090            this.spliceRows.apply(this, [rowNum + 1, insert ? 0 : count].concat(_toConsumableArray(inserts))); // now copy styles...
5091
5092            var _loop2 = function _loop2(i) {
5093              var rDst = _this3._rows[rowNum + i];
5094              rDst.style = rSrc.style;
5095              rDst.height = rSrc.height; // eslint-disable-next-line no-loop-func
5096
5097              rSrc.eachCell({
5098                includeEmpty: true
5099              }, function (cell, colNumber) {
5100                rDst.getCell(colNumber).style = cell.style;
5101              });
5102            };
5103
5104            for (var i = 0; i < count; i++) {
5105              _loop2(i);
5106            }
5107          }
5108        }, {
5109          key: "spliceRows",
5110          value: function spliceRows(start, count) {
5111            var _this4 = this; // same problem as row.splice, except worse.
5112
5113
5114            var nKeep = start + count;
5115
5116            for (var _len2 = arguments.length, inserts = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
5117              inserts[_key2 - 2] = arguments[_key2];
5118            }
5119
5120            var nExpand = inserts.length - count;
5121            var nEnd = this._rows.length;
5122            var i;
5123            var rSrc;
5124
5125            if (nExpand < 0) {
5126              // remove rows
5127              for (i = nKeep; i <= nEnd; i++) {
5128                rSrc = this._rows[i - 1];
5129
5130                if (rSrc) {
5131                  (function () {
5132                    var rDst = _this4.getRow(i + nExpand);
5133
5134                    rDst.values = rSrc.values;
5135                    rDst.style = rSrc.style;
5136                    rDst.height = rSrc.height; // eslint-disable-next-line no-loop-func
5137
5138                    rSrc.eachCell({
5139                      includeEmpty: true
5140                    }, function (cell, colNumber) {
5141                      rDst.getCell(colNumber).style = cell.style;
5142                    });
5143                    _this4._rows[i - 1] = undefined;
5144                  })();
5145                } else {
5146                  this._rows[i + nExpand - 1] = undefined;
5147                }
5148              }
5149            } else if (nExpand > 0) {
5150              // insert new cells
5151              for (i = nEnd; i >= nKeep; i--) {
5152                rSrc = this._rows[i - 1];
5153
5154                if (rSrc) {
5155                  (function () {
5156                    var rDst = _this4.getRow(i + nExpand);
5157
5158                    rDst.values = rSrc.values;
5159                    rDst.style = rSrc.style;
5160                    rDst.height = rSrc.height; // eslint-disable-next-line no-loop-func
5161
5162                    rSrc.eachCell({
5163                      includeEmpty: true
5164                    }, function (cell, colNumber) {
5165                      rDst.getCell(colNumber).style = cell.style;
5166                    });
5167                  })();
5168                } else {
5169                  this._rows[i + nExpand - 1] = undefined;
5170                }
5171              }
5172            } // now copy over the new values
5173
5174
5175            for (i = 0; i < inserts.length; i++) {
5176              var rDst = this.getRow(start + i);
5177              rDst.style = {};
5178              rDst.values = inserts[i];
5179            } // account for defined names
5180
5181
5182            this.workbook.definedNames.spliceRows(this.name, start, count, inserts.length);
5183          } // iterate over every row in the worksheet, including maybe empty rows
5184
5185        }, {
5186          key: "eachRow",
5187          value: function eachRow(options, iteratee) {
5188            if (!iteratee) {
5189              iteratee = options;
5190              options = undefined;
5191            }
5192
5193            if (options && options.includeEmpty) {
5194              var n = this._rows.length;
5195
5196              for (var i = 1; i <= n; i++) {
5197                iteratee(this.getRow(i), i);
5198              }
5199            } else {
5200              this._rows.forEach(function (row) {
5201                if (row && row.hasValues) {
5202                  iteratee(row, row.number);
5203                }
5204              });
5205            }
5206          } // return all rows as sparse array
5207
5208        }, {
5209          key: "getSheetValues",
5210          value: function getSheetValues() {
5211            var rows = [];
5212
5213            this._rows.forEach(function (row) {
5214              if (row) {
5215                rows[row.number] = row.values;
5216              }
5217            });
5218
5219            return rows;
5220          } // =========================================================================
5221          // Cells
5222          // returns the cell at [r,c] or address given by r. If not found, return undefined
5223
5224        }, {
5225          key: "findCell",
5226          value: function findCell(r, c) {
5227            var address = colCache.getAddress(r, c);
5228            var row = this._rows[address.row - 1];
5229            return row ? row.findCell(address.col) : undefined;
5230          } // return the cell at [r,c] or address given by r. If not found, create a new one.
5231
5232        }, {
5233          key: "getCell",
5234          value: function getCell(r, c) {
5235            var address = colCache.getAddress(r, c);
5236            var row = this.getRow(address.row);
5237            return row.getCellEx(address);
5238          } // =========================================================================
5239          // Merge
5240          // convert the range defined by ['tl:br'], [tl,br] or [t,l,b,r] into a single 'merged' cell
5241
5242        }, {
5243          key: "mergeCells",
5244          value: function mergeCells() {
5245            for (var _len3 = arguments.length, cells = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
5246              cells[_key3] = arguments[_key3];
5247            }
5248
5249            var dimensions = new Range(cells);
5250
5251            this._mergeCellsInternal(dimensions);
5252          }
5253        }, {
5254          key: "mergeCellsWithoutStyle",
5255          value: function mergeCellsWithoutStyle() {
5256            for (var _len4 = arguments.length, cells = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
vendor: 17,541 bytes, lines 5257-5762
5257              cells[_key4] = arguments[_key4];
5258            }
5259
5260            var dimensions = new Range(cells);
5261
5262            this._mergeCellsInternal(dimensions, true);
5263          }
5264        }, {
5265          key: "_mergeCellsInternal",
5266          value: function _mergeCellsInternal(dimensions, ignoreStyle) {
5267            // check cells aren't already merged
5268            _.each(this._merges, function (merge) {
5269              if (merge.intersects(dimensions)) {
5270                throw new Error('Cannot merge already merged cells');
5271              }
5272            }); // apply merge
5273
5274
5275            var master = this.getCell(dimensions.top, dimensions.left);
5276
5277            for (var i = dimensions.top; i <= dimensions.bottom; i++) {
5278              for (var j = dimensions.left; j <= dimensions.right; j++) {
5279                // merge all but the master cell
5280                if (i > dimensions.top || j > dimensions.left) {
5281                  this.getCell(i, j).merge(master, ignoreStyle);
5282                }
5283              }
5284            } // index merge
5285
5286
5287            this._merges[master.address] = dimensions;
5288          }
5289        }, {
5290          key: "_unMergeMaster",
5291          value: function _unMergeMaster(master) {
5292            // master is always top left of a rectangle
5293            var merge = this._merges[master.address];
5294
5295            if (merge) {
5296              for (var i = merge.top; i <= merge.bottom; i++) {
5297                for (var j = merge.left; j <= merge.right; j++) {
5298                  this.getCell(i, j).unmerge();
5299                }
5300              }
5301
5302              delete this._merges[master.address];
5303            }
5304          }
5305        }, {
5306          key: "unMergeCells",
5307          // scan the range defined by ['tl:br'], [tl,br] or [t,l,b,r] and if any cell is part of a merge,
5308          // un-merge the group. Note this function can affect multiple merges and merge-blocks are
5309          // atomic - either they're all merged or all un-merged.
5310          value: function unMergeCells() {
5311            for (var _len5 = arguments.length, cells = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
5312              cells[_key5] = arguments[_key5];
5313            }
5314
5315            var dimensions = new Range(cells); // find any cells in that range and unmerge them
5316
5317            for (var i = dimensions.top; i <= dimensions.bottom; i++) {
5318              for (var j = dimensions.left; j <= dimensions.right; j++) {
5319                var cell = this.findCell(i, j);
5320
5321                if (cell) {
5322                  if (cell.type === Enums.ValueType.Merge) {
5323                    // this cell merges to another master
5324                    this._unMergeMaster(cell.master);
5325                  } else if (this._merges[cell.address]) {
5326                    // this cell is a master
5327                    this._unMergeMaster(cell);
5328                  }
5329                }
5330              }
5331            }
5332          } // ===========================================================================
5333          // Shared/Array Formula
5334
5335        }, {
5336          key: "fillFormula",
5337          value: function fillFormula(range, formula, results) {
5338            var shareType = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'shared'; // Define formula for top-left cell and share to rest
5339
5340            var decoded = colCache.decode(range);
5341            var top = decoded.top,
5342                left = decoded.left,
5343                bottom = decoded.bottom,
5344                right = decoded.right;
5345            var width = right - left + 1;
5346            var masterAddress = colCache.encodeAddress(top, left);
5347            var isShared = shareType === 'shared'; // work out result accessor
5348
5349            var getResult;
5350
5351            if (typeof results === 'function') {
5352              getResult = results;
5353            } else if (Array.isArray(results)) {
5354              if (Array.isArray(results[0])) {
5355                getResult = function getResult(row, col) {
5356                  return results[row - top][col - left];
5357                };
5358              } else {
5359                // eslint-disable-next-line no-mixed-operators
5360                getResult = function getResult(row, col) {
5361                  return results[(row - top) * width + (col - left)];
5362                };
5363              }
5364            } else {
5365              getResult = function getResult() {
5366                return undefined;
5367              };
5368            }
5369
5370            var first = true;
5371
5372            for (var r = top; r <= bottom; r++) {
5373              for (var c = left; c <= right; c++) {
5374                if (first) {
5375                  this.getCell(r, c).value = {
5376                    shareType: shareType,
5377                    formula: formula,
5378                    ref: range,
5379                    result: getResult(r, c)
5380                  };
5381                  first = false;
5382                } else {
5383                  this.getCell(r, c).value = isShared ? {
5384                    sharedFormula: masterAddress,
5385                    result: getResult(r, c)
5386                  } : getResult(r, c);
5387                }
5388              }
5389            }
5390          } // =========================================================================
5391          // Images
5392
5393        }, {
5394          key: "addImage",
5395          value: function addImage(imageId, range) {
5396            var model = {
5397              type: 'image',
5398              imageId: imageId,
5399              range: range
5400            };
5401
5402            this._media.push(new Image(this, model));
5403          }
5404        }, {
5405          key: "getImages",
5406          value: function getImages() {
5407            return this._media.filter(function (m) {
5408              return m.type === 'image';
5409            });
5410          }
5411        }, {
5412          key: "addBackgroundImage",
5413          value: function addBackgroundImage(imageId) {
5414            var model = {
5415              type: 'background',
5416              imageId: imageId
5417            };
5418
5419            this._media.push(new Image(this, model));
5420          }
5421        }, {
5422          key: "getBackgroundImageId",
5423          value: function getBackgroundImageId() {
5424            var image = this._media.find(function (m) {
5425              return m.type === 'background';
5426            });
5427
5428            return image && image.imageId;
5429          } // =========================================================================
5430          // Worksheet Protection
5431
5432        }, {
5433          key: "protect",
5434          value: function protect(password, options) {
5435            var _this5 = this; // TODO: make this function truly async
5436            // perhaps marshal to worker thread or something
5437
5438
5439            return new Promise(function (resolve) {
5440              _this5.sheetProtection = {
5441                sheet: true
5442              };
5443
5444              if (options && 'spinCount' in options) {
5445                // force spinCount to be integer >= 0
5446                options.spinCount = Number.isFinite(options.spinCount) ? Math.round(Math.max(0, options.spinCount)) : 100000;
5447              }
5448
5449              if (password) {
5450                _this5.sheetProtection.algorithmName = 'SHA-512';
5451                _this5.sheetProtection.saltValue = Encryptor.randomBytes(16).toString('base64');
5452                _this5.sheetProtection.spinCount = options && 'spinCount' in options ? options.spinCount : 100000; // allow user specified spinCount
5453
5454                _this5.sheetProtection.hashValue = Encryptor.convertPasswordToHash(password, 'SHA512', _this5.sheetProtection.saltValue, _this5.sheetProtection.spinCount);
5455              }
5456
5457              if (options) {
5458                _this5.sheetProtection = Object.assign(_this5.sheetProtection, options);
5459
5460                if (!password && 'spinCount' in options) {
5461                  delete _this5.sheetProtection.spinCount;
5462                }
5463              }
5464
5465              resolve();
5466            });
5467          }
5468        }, {
5469          key: "unprotect",
5470          value: function unprotect() {
5471            this.sheetProtection = null;
5472          } // =========================================================================
5473          // Tables
5474
5475        }, {
5476          key: "addTable",
5477          value: function addTable(model) {
5478            var table = new Table(this, model);
5479            this.tables[model.name] = table;
5480            return table;
5481          }
5482        }, {
5483          key: "getTable",
5484          value: function getTable(name) {
5485            return this.tables[name];
5486          }
5487        }, {
5488          key: "removeTable",
5489          value: function removeTable(name) {
5490            delete this.tables[name];
5491          }
5492        }, {
5493          key: "getTables",
5494          value: function getTables() {
5495            return Object.values(this.tables);
5496          } // ===========================================================================
5497          // Conditional Formatting
5498
5499        }, {
5500          key: "addConditionalFormatting",
5501          value: function addConditionalFormatting(cf) {
5502            this.conditionalFormattings.push(cf);
5503          }
5504        }, {
5505          key: "removeConditionalFormatting",
5506          value: function removeConditionalFormatting(filter) {
5507            if (typeof filter === 'number') {
5508              this.conditionalFormattings.splice(filter, 1);
5509            } else if (filter instanceof Function) {
5510              this.conditionalFormattings = this.conditionalFormattings.filter(filter);
5511            } else {
5512              this.conditionalFormattings = [];
5513            }
5514          } // ===========================================================================
5515          // Deprecated
5516
5517        }, {
5518          key: "_parseRows",
5519          value: function _parseRows(model) {
5520            var _this6 = this;
5521
5522            this._rows = [];
5523            model.rows.forEach(function (rowModel) {
5524              var row = new Row(_this6, rowModel.number);
5525              _this6._rows[row.number - 1] = row;
5526              row.model = rowModel;
5527            });
5528          }
5529        }, {
5530          key: "_parseMergeCells",
5531          value: function _parseMergeCells(model) {
5532            var _this7 = this;
5533
5534            _.each(model.mergeCells, function (merge) {
5535              // Do not merge styles when importing an Excel file
5536              // since each cell may have different styles intentionally.
5537              _this7.mergeCellsWithoutStyle(merge);
5538            });
5539          }
5540        }, {
5541          key: "workbook",
5542          get: function get() {
5543            return this._workbook;
5544          }
5545        }, {
5546          key: "dimensions",
5547          get: function get() {
5548            var dimensions = new Range();
5549
5550            this._rows.forEach(function (row) {
5551              if (row) {
5552                var rowDims = row.dimensions;
5553
5554                if (rowDims) {
5555                  dimensions.expand(row.number, rowDims.min, row.number, rowDims.max);
5556                }
5557              }
5558            });
5559
5560            return dimensions;
5561          } // =========================================================================
5562          // Columns
5563          // get the current columns array.
5564
5565        }, {
5566          key: "columns",
5567          get: function get() {
5568            return this._columns;
5569          } // set the columns from an array of column definitions.
5570          // Note: any headers defined will overwrite existing values.
5571          ,
5572          set: function set(value) {
5573            var _this8 = this; // calculate max header row count
5574
5575
5576            this._headerRowCount = value.reduce(function (pv, cv) {
5577              var headerCount = cv.header && 1 || cv.headers && cv.headers.length || 0;
5578              return Math.max(pv, headerCount);
5579            }, 0); // construct Column objects
5580
5581            var count = 1;
5582            var columns = this._columns = [];
5583            value.forEach(function (defn) {
5584              var column = new Column(_this8, count++, false);
5585              columns.push(column);
5586              column.defn = defn;
5587            });
5588          }
5589        }, {
5590          key: "columnCount",
5591          get: function get() {
5592            var maxCount = 0;
5593            this.eachRow(function (row) {
5594              maxCount = Math.max(maxCount, row.cellCount);
5595            });
5596            return maxCount;
5597          }
5598        }, {
5599          key: "actualColumnCount",
5600          get: function get() {
5601            // performance nightmare - for each row, counts all the columns used
5602            var counts = [];
5603            var count = 0;
5604            this.eachRow(function (row) {
5605              row.eachCell(function (_ref) {
5606                var col = _ref.col;
5607
5608                if (!counts[col]) {
5609                  counts[col] = true;
5610                  count++;
5611                }
5612              });
5613            });
5614            return count;
5615          }
5616        }, {
5617          key: "_lastRowNumber",
5618          get: function get() {
5619            // need to cope with results of splice
5620            var rows = this._rows;
5621            var n = rows.length;
5622
5623            while (n > 0 && rows[n - 1] === undefined) {
5624              n--;
5625            }
5626
5627            return n;
5628          }
5629        }, {
5630          key: "_nextRow",
5631          get: function get() {
5632            return this._lastRowNumber + 1;
5633          }
5634        }, {
5635          key: "lastRow",
5636          get: function get() {
5637            if (this._rows.length) {
5638              return this._rows[this._rows.length - 1];
5639            }
5640
5641            return undefined;
5642          }
5643        }, {
5644          key: "rowCount",
5645          get: function get() {
5646            return this._lastRowNumber;
5647          }
5648        }, {
5649          key: "actualRowCount",
5650          get: function get() {
5651            // counts actual rows that have actual data
5652            var count = 0;
5653            this.eachRow(function () {
5654              count++;
5655            });
5656            return count;
5657          }
5658        }, {
5659          key: "hasMerges",
5660          get: function get() {
5661            // return true if this._merges has a merge object
5662            return _.some(this._merges, Boolean);
5663          }
5664        }, {
5665          key: "tabColor",
5666          get: function get() {
5667            // eslint-disable-next-line no-console
5668            console.trace('worksheet.tabColor property is now deprecated. Please use worksheet.properties.tabColor');
5669            return this.properties.tabColor;
5670          },
5671          set: function set(value) {
5672            // eslint-disable-next-line no-console
5673            console.trace('worksheet.tabColor property is now deprecated. Please use worksheet.properties.tabColor');
5674            this.properties.tabColor = value;
5675          } // ===========================================================================
5676          // Model
5677
5678        }, {
5679          key: "model",
5680          get: function get() {
5681            var model = {
5682              id: this.id,
5683              name: this.name,
5684              dataValidations: this.dataValidations.model,
5685              properties: this.properties,
5686              state: this.state,
5687              pageSetup: this.pageSetup,
5688              headerFooter: this.headerFooter,
5689              rowBreaks: this.rowBreaks,
5690              views: this.views,
5691              autoFilter: this.autoFilter,
5692              media: this._media.map(function (medium) {
5693                return medium.model;
5694              }),
5695              sheetProtection: this.sheetProtection,
5696              tables: Object.values(this.tables).map(function (table) {
5697                return table.model;
5698              }),
5699              conditionalFormattings: this.conditionalFormattings
5700            }; // =================================================
5701            // columns
5702
5703            model.cols = Column.toModel(this.columns); // ==========================================================
5704            // Rows
5705
5706            var rows = model.rows = [];
5707            var dimensions = model.dimensions = new Range();
5708
5709            this._rows.forEach(function (row) {
5710              var rowModel = row && row.model;
5711
5712              if (rowModel) {
5713                dimensions.expand(rowModel.number, rowModel.min, rowModel.number, rowModel.max);
5714                rows.push(rowModel);
5715              }
5716            }); // ==========================================================
5717            // Merges
5718
5719
5720            model.merges = [];
5721
5722            _.each(this._merges, function (merge) {
5723              model.merges.push(merge.range);
5724            });
5725
5726            return model;
5727          },
5728          set: function set(value) {
5729            var _this9 = this;
5730
5731            this.name = value.name;
5732            this._columns = Column.fromModel(this, value.cols);
5733
5734            this._parseRows(value);
5735
5736            this._parseMergeCells(value);
5737
5738            this.dataValidations = new DataValidations(value.dataValidations);
5739            this.properties = value.properties;
5740            this.pageSetup = value.pageSetup;
5741            this.headerFooter = value.headerFooter;
5742            this.views = value.views;
5743            this.autoFilter = value.autoFilter;
5744            this._media = value.media.map(function (medium) {
5745              return new Image(_this9, medium);
5746            });
5747            this.sheetProtection = value.sheetProtection;
5748            this.tables = value.tables.reduce(function (tables, table) {
5749              var t = new Table();
5750              t.model = table;
5751              tables[table.name] = t;
5752              return tables;
5753            }, {});
5754            this.conditionalFormattings = value.conditionalFormattings;
5755          }
5756        }]);
5757
5758        return Worksheet;
5759      }();
5760
5761      module.exports = Worksheet;
5762    }, {
vendor: 7,020 bytes, lines 5763-5992
5763      "../utils/col-cache": 17,
5764      "../utils/encryptor": 18,
5765      "../utils/under-dash": 23,
5766      "./column": 4,
5767      "./data-validations": 5,
5768      "./enums": 7,
5769      "./image": 8,
5770      "./range": 10,
5771      "./row": 11,
5772      "./table": 12
5773    }],
5774    15: [function (require, module, exports) {
5775      "use strict";
5776      /* eslint-disable import/no-extraneous-dependencies,node/no-unpublished-require */
5777
5778      require('core-js/modules/es.promise');
5779
5780      require('core-js/modules/es.object.assign');
5781
5782      require('core-js/modules/es.object.keys');
5783
5784      require('core-js/modules/es.symbol');
5785
5786      require('core-js/modules/es.symbol.async-iterator');
5787
5788      require('regenerator-runtime/runtime');
5789
5790      var ExcelJS = {
5791        Workbook: require('./doc/workbook')
5792      }; // Object.assign mono-fill
5793
5794      var Enums = require('./doc/enums');
5795
5796      Object.keys(Enums).forEach(function (key) {
5797        ExcelJS[key] = Enums[key];
5798      });
5799      module.exports = ExcelJS;
5800    }, {
5801      "./doc/enums": 7,
5802      "./doc/workbook": 13,
5803      "core-js/modules/es.object.assign": 300,
5804      "core-js/modules/es.object.keys": 301,
5805      "core-js/modules/es.promise": 302,
5806      "core-js/modules/es.symbol": 304,
5807      "core-js/modules/es.symbol.async-iterator": 303,
5808      "regenerator-runtime/runtime": 468
5809    }],
5810    16: [function (require, module, exports) {
5811      "use strict";
5812
5813      function _classCallCheck(instance, Constructor) {
5814        if (!(instance instanceof Constructor)) {
5815          throw new TypeError("Cannot call a class as a function");
5816        }
5817      }
5818
5819      function _defineProperties(target, props) {
5820        for (var i = 0; i < props.length; i++) {
5821          var descriptor = props[i];
5822          descriptor.enumerable = descriptor.enumerable || false;
5823          descriptor.configurable = true;
5824          if ("value" in descriptor) descriptor.writable = true;
5825          Object.defineProperty(target, descriptor.key, descriptor);
5826        }
5827      }
5828
5829      function _createClass(Constructor, protoProps, staticProps) {
5830        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
5831        if (staticProps) _defineProperties(Constructor, staticProps);
5832        return Constructor;
5833      }
5834
5835      var _ = require('./under-dash');
5836
5837      var colCache = require('./col-cache');
5838
5839      var CellMatrix = /*#__PURE__*/function () {
5840        function CellMatrix(template) {
5841          _classCallCheck(this, CellMatrix);
5842
5843          this.template = template;
5844          this.sheets = {};
5845        }
5846
5847        _createClass(CellMatrix, [{
5848          key: "addCell",
5849          value: function addCell(addressStr) {
5850            this.addCellEx(colCache.decodeEx(addressStr));
5851          }
5852        }, {
5853          key: "getCell",
5854          value: function getCell(addressStr) {
5855            return this.findCellEx(colCache.decodeEx(addressStr), true);
5856          }
5857        }, {
5858          key: "findCell",
5859          value: function findCell(addressStr) {
5860            return this.findCellEx(colCache.decodeEx(addressStr), false);
5861          }
5862        }, {
5863          key: "findCellAt",
5864          value: function findCellAt(sheetName, rowNumber, colNumber) {
5865            var sheet = this.sheets[sheetName];
5866            var row = sheet && sheet[rowNumber];
5867            return row && row[colNumber];
5868          }
5869        }, {
5870          key: "addCellEx",
5871          value: function addCellEx(address) {
5872            if (address.top) {
5873              for (var row = address.top; row <= address.bottom; row++) {
5874                for (var col = address.left; col <= address.right; col++) {
5875                  this.getCellAt(address.sheetName, row, col);
5876                }
5877              }
5878            } else {
5879              this.findCellEx(address, true);
5880            }
5881          }
5882        }, {
5883          key: "getCellEx",
5884          value: function getCellEx(address) {
5885            return this.findCellEx(address, true);
5886          }
5887        }, {
5888          key: "findCellEx",
5889          value: function findCellEx(address, create) {
5890            var sheet = this.findSheet(address, create);
5891            var row = this.findSheetRow(sheet, address, create);
5892            return this.findRowCell(row, address, create);
5893          }
5894        }, {
5895          key: "getCellAt",
5896          value: function getCellAt(sheetName, rowNumber, colNumber) {
5897            var sheet = this.sheets[sheetName] || (this.sheets[sheetName] = []);
5898            var row = sheet[rowNumber] || (sheet[rowNumber] = []);
5899            var cell = row[colNumber] || (row[colNumber] = {
5900              sheetName: sheetName,
5901              address: colCache.n2l(colNumber) + rowNumber,
5902              row: rowNumber,
5903              col: colNumber
5904            });
5905            return cell;
5906          }
5907        }, {
5908          key: "removeCellEx",
5909          value: function removeCellEx(address) {
5910            var sheet = this.findSheet(address);
5911
5912            if (!sheet) {
5913              return;
5914            }
5915
5916            var row = this.findSheetRow(sheet, address);
5917
5918            if (!row) {
5919              return;
5920            }
5921
5922            delete row[address.col];
5923          }
5924        }, {
5925          key: "forEachInSheet",
5926          value: function forEachInSheet(sheetName, callback) {
5927            var sheet = this.sheets[sheetName];
5928
5929            if (sheet) {
5930              sheet.forEach(function (row, rowNumber) {
5931                if (row) {
5932                  row.forEach(function (cell, colNumber) {
5933                    if (cell) {
5934                      callback(cell, rowNumber, colNumber);
5935                    }
5936                  });
5937                }
5938              });
5939            }
5940          }
5941        }, {
5942          key: "forEach",
5943          value: function forEach(callback) {
5944            var _this = this;
5945
5946            _.each(this.sheets, function (sheet, sheetName) {
5947              _this.forEachInSheet(sheetName, callback);
5948            });
5949          }
5950        }, {
5951          key: "map",
5952          value: function map(callback) {
5953            var results = [];
5954            this.forEach(function (cell) {
5955              results.push(callback(cell));
5956            });
5957            return results;
5958          }
5959        }, {
5960          key: "findSheet",
5961          value: function findSheet(address, create) {
5962            var name = address.sheetName;
5963
5964            if (this.sheets[name]) {
5965              return this.sheets[name];
5966            }
5967
5968            if (create) {
5969              return this.sheets[name] = [];
5970            }
5971
5972            return undefined;
5973          }
5974        }, {
5975          key: "findSheetRow",
5976          value: function findSheetRow(sheet, address, create) {
5977            var row = address.row;
5978
5979            if (sheet && sheet[row]) {
5980              return sheet[row];
5981            }
5982
5983            if (create) {
5984              return sheet[row] = [];
5985            }
5986
5987            return undefined;
5988          }
5989        }, {
5990          key: "findRowCell",
5991          value: function findRowCell(row, address, create) {
5992            var col = address.col;
5993
5994            if (row && row[col]) {
5995              return row[col];
5996            }
5997
5998            if (create) {
5999              return row[col] = this.template ? Object.assign(address, JSON.parse(JSON.stringify(this.template))) : address;
6000            }
6001
6002            return undefined;
6003          }
6004        }, {
6005          key: "spliceRows",
6006          value: function spliceRows(sheetName, start, numDelete, numInsert) {
6007            var sheet = this.sheets[sheetName];
6008
6009            if (sheet) {
6010              var inserts = [];
6011
6012              for (var i = 0; i < numInsert; i++) {
6013                inserts.push([]);
6014              }
6015
6016              sheet.splice.apply(sheet, [start, numDelete].concat(inserts));
6017            }
6018          }
6019        }, {
6020          key: "spliceColumns",
6021          value: function spliceColumns(sheetName, start, numDelete, numInsert) {
6022            var sheet = this.sheets[sheetName];
6023
6024            if (sheet) {
6025              var inserts = [];
6026
6027              for (var i = 0; i < numInsert; i++) {
6028                inserts.push(null);
6029              }
6030
6031              _.each(sheet, function (row) {
6032                row.splice.apply(row, [start, numDelete].concat(inserts));
6033              });
6034            }
6035          }
6036        }]);
6037
6038        return CellMatrix;
6039      }();
6040
6041      module.exports = CellMatrix;
6042    }, {
6043      "./col-cache": 17,
6044      "./under-dash": 23
6045    }],
6046    17: [function (require, module, exports) {
6047      "use strict";
6048
6049      function _slicedToArray(arr, i) {
6050        return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
6051      }
6052
6053      function _nonIterableRest() {
6054        throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
6055      }
6056
6057      function _unsupportedIterableToArray(o, minLen) {
6058        if (!o) return;
6059        if (typeof o === "string") return _arrayLikeToArray(o, minLen);
6060        var n = Object.prototype.toString.call(o).slice(8, -1);
6061        if (n === "Object" && o.constructor) n = o.constructor.name;
6062        if (n === "Map" || n === "Set") return Array.from(n);
6063        if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
6064      }
6065
6066      function _arrayLikeToArray(arr, len) {
6067        if (len == null || len > arr.length) len = arr.length;
6068
6069        for (var i = 0, arr2 = new Array(len); i < len; i++) {
6070          arr2[i] = arr[i];
6071        }
6072
6073        return arr2;
6074      }
6075
6076      function _iterableToArrayLimit(arr, i) {
6077        if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
6078        var _arr = [];
6079        var _n = true;
6080        var _d = false;
6081        var _e = undefined;
6082
6083        try {
6084          for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
6085            _arr.push(_s.value);
6086
6087            if (i && _arr.length === i) break;
6088          }
6089        } catch (err) {
6090          _d = true;
6091          _e = err;
6092        } finally {
6093          try {
6094            if (!_n && _i["return"] != null) _i["return"]();
6095          } finally {
6096            if (_d) throw _e;
6097          }
6098        }
6099
6100        return _arr;
6101      }
6102
6103      function _arrayWithHoles(arr) {
6104        if (Array.isArray(arr)) return arr;
6105      }
6106
6107      function ownKeys(object, enumerableOnly) {
6108        var keys = Object.keys(object);
6109
6110        if (Object.getOwnPropertySymbols) {
6111          var symbols = Object.getOwnPropertySymbols(object);
6112          if (enumerableOnly) symbols = symbols.filter(function (sym) {
6113            return Object.getOwnPropertyDescriptor(object, sym).enumerable;
6114          });
6115          keys.push.apply(keys, symbols);
6116        }
6117
6118        return keys;
6119      }
6120
6121      function _objectSpread(target) {
6122        for (var i = 1; i < arguments.length; i++) {
6123          var source = arguments[i] != null ? arguments[i] : {};
6124
6125          if (i % 2) {
6126            ownKeys(Object(source), true).forEach(function (key) {
6127              _defineProperty(target, key, source[key]);
6128            });
6129          } else if (Object.getOwnPropertyDescriptors) {
6130            Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
6131          } else {
6132            ownKeys(Object(source)).forEach(function (key) {
6133              Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
6134            });
6135          }
6136        }
6137
6138        return target;
6139      }
6140
6141      function _defineProperty(obj, key, value) {
6142        if (key in obj) {
6143          Object.defineProperty(obj, key, {
6144            value: value,
6145            enumerable: true,
6146            configurable: true,
6147            writable: true
6148          });
6149        } else {
6150          obj[key] = value;
6151        }
6152
6153        return obj;
6154      } // =========================================================================
6155      // Column Letter to Number conversion
6156
6157
6158      var colCache = {
6159        _dictionary: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'],
6160        _l2n: {},
6161        _n2l: [],
6162        _level: function _level(n) {
6163          if (n <= 26) {
6164            return 1;
6165          }
6166
6167          if (n <= 26 * 26) {
6168            return 2;
6169          }
6170
6171          return 3;
6172        },
6173        _fill: function _fill(level) {
6174          var c;
6175          var v;
6176          var l1;
6177          var l2;
6178          var l3;
6179          var n = 1;
6180
6181          if (level >= 1) {
6182            while (n <= 26) {
6183              c = this._dictionary[n - 1];
6184              this._n2l[n] = c;
6185              this._l2n[c] = n;
6186              n++;
6187            }
6188          }
6189
6190          if (level >= 2) {
6191            while (n <= 26 + 26 * 26) {
6192              v = n - (26 + 1);
6193              l1 = v % 26;
6194              l2 = Math.floor(v / 26);
6195              c = this._dictionary[l2] + this._dictionary[l1];
6196              this._n2l[n] = c;
6197              this._l2n[c] = n;
6198              n++;
6199            }
6200          }
6201
6202          if (level >= 3) {
6203            while (n <= 16384) {
6204              v = n - (26 * 26 + 26 + 1);
6205              l1 = v % 26;
6206              l2 = Math.floor(v / 26) % 26;
6207              l3 = Math.floor(v / (26 * 26));
6208              c = this._dictionary[l3] + this._dictionary[l2] + this._dictionary[l1];
6209              this._n2l[n] = c;
6210              this._l2n[c] = n;
6211              n++;
6212            }
6213          }
6214        },
6215        l2n: function l2n(l) {
6216          if (!this._l2n[l]) {
6217            this._fill(l.length);
6218          }
6219
6220          if (!this._l2n[l]) {
6221            throw new Error("Out of bounds. Invalid column letter: ".concat(l));
6222          }
6223
6224          return this._l2n[l];
6225        },
6226        n2l: function n2l(n) {
6227          if (n < 1 || n > 16384) {
6228            throw new Error("".concat(n, " is out of bounds. Excel supports columns from 1 to 16384"));
6229          }
6230
6231          if (!this._n2l[n]) {
6232            this._fill(this._level(n));
6233          }
6234
6235          return this._n2l[n];
6236        },
6237        // =========================================================================
6238        // Address processing
6239        _hash: {},
6240        // check if value looks like an address
6241        validateAddress: function validateAddress(value) {
6242          if (!value.match(/^[A-Z]+\d+$/)) {
6243            throw new Error("Invalid Address: ".concat(value));
6244          }
6245
6246          return true;
6247        },
6248        // convert address string into structure
6249        decodeAddress: function decodeAddress(value) {
6250          var addr = this._hash[value];
6251
6252          if (addr) {
6253            return addr;
6254          }
6255
6256          var matchCol = value.match(/[A-Z]+/);
6257          var col;
6258          var colNumber;
6259
6260          if (matchCol) {
6261            col = matchCol[0];
6262            colNumber = this.l2n(col);
6263          }
6264
6265          var matchRow = value.match(/\d+/);
6266          var row;
6267          var rowNumber;
6268
6269          if (matchRow) {
6270            row = matchRow[0];
6271            rowNumber = parseInt(row, 10);
6272          } // in case $row$col
6273
6274
6275          value = (col || '') + (row || '');
6276          var address = {
6277            address: value,
6278            col: colNumber,
6279            row: rowNumber,
6280            $col$row: "$".concat(col || '', "$").concat(row || '')
6281          };
vendor: 4,543 bytes, lines 6281-6409
6281 // mem fix - cache only the tl 100x100 square
6282
6283          if (colNumber <= 100 && rowNumber <= 100) {
6284            this._hash[value] = address;
6285            this._hash[address.$col$row] = address;
6286          }
6287
6288          return address;
6289        },
6290        // convert r,c into structure (if only 1 arg, assume r is address string)
6291        getAddress: function getAddress(r, c) {
6292          if (c) {
6293            var address = this.n2l(c) + r;
6294            return this.decodeAddress(address);
6295          }
6296
6297          return this.decodeAddress(r);
6298        },
6299        // convert [address], [tl:br] into address structures
6300        decode: function decode(value) {
6301          var parts = value.split(':');
6302
6303          if (parts.length === 2) {
6304            var tl = this.decodeAddress(parts[0]);
6305            var br = this.decodeAddress(parts[1]);
6306            var result = {
6307              top: Math.min(tl.row, br.row),
6308              left: Math.min(tl.col, br.col),
6309              bottom: Math.max(tl.row, br.row),
6310              right: Math.max(tl.col, br.col)
6311            }; // reconstruct tl, br and dimensions
6312
6313            result.tl = this.n2l(result.left) + result.top;
6314            result.br = this.n2l(result.right) + result.bottom;
6315            result.dimensions = "".concat(result.tl, ":").concat(result.br);
6316            return result;
6317          }
6318
6319          return this.decodeAddress(value);
6320        },
6321        // convert [sheetName!][$]col[$]row[[$]col[$]row] into address or range structures
6322        decodeEx: function decodeEx(value) {
6323          var groups = value.match(/(?:(?:(?:'((?:[^']|'')*)')|([^'^ !]*))!)?(.*)/);
6324          var sheetName = groups[1] || groups[2]; // Qouted and unqouted groups
6325
6326          var reference = groups[3]; // Remaining address
6327
6328          var parts = reference.split(':');
6329
6330          if (parts.length > 1) {
6331            var tl = this.decodeAddress(parts[0]);
6332            var br = this.decodeAddress(parts[1]);
6333            var top = Math.min(tl.row, br.row);
6334            var left = Math.min(tl.col, br.col);
6335            var bottom = Math.max(tl.row, br.row);
6336            var right = Math.max(tl.col, br.col);
6337            tl = this.n2l(left) + top;
6338            br = this.n2l(right) + bottom;
6339            return {
6340              top: top,
6341              left: left,
6342              bottom: bottom,
6343              right: right,
6344              sheetName: sheetName,
6345              tl: {
6346                address: tl,
6347                col: left,
6348                row: top,
6349                $col$row: "$".concat(this.n2l(left), "$").concat(top),
6350                sheetName: sheetName
6351              },
6352              br: {
6353                address: br,
6354                col: right,
6355                row: bottom,
6356                $col$row: "$".concat(this.n2l(right), "$").concat(bottom),
6357                sheetName: sheetName
6358              },
6359              dimensions: "".concat(tl, ":").concat(br)
6360            };
6361          }
6362
6363          if (reference.startsWith('#')) {
6364            return sheetName ? {
6365              sheetName: sheetName,
6366              error: reference
6367            } : {
6368              error: reference
6369            };
6370          }
6371
6372          var address = this.decodeAddress(reference);
6373          return sheetName ? _objectSpread({
6374            sheetName: sheetName
6375          }, address) : address;
6376        },
6377        // convert row,col into address string
6378        encodeAddress: function encodeAddress(row, col) {
6379          return colCache.n2l(col) + row;
6380        },
6381        // convert row,col into string address or t,l,b,r into range
6382        encode: function encode() {
6383          switch (arguments.length) {
6384            case 2:
6385              return colCache.encodeAddress(arguments[0], arguments[1]);
6386
6387            case 4:
6388              return "".concat(colCache.encodeAddress(arguments[0], arguments[1]), ":").concat(colCache.encodeAddress(arguments[2], arguments[3]));
6389
6390            default:
6391              throw new Error('Can only encode with 2 or 4 arguments');
6392          }
6393        },
6394        // return true if address is contained within range
6395        inRange: function inRange(range, address) {
6396          var _range = _slicedToArray(range, 5),
6397              left = _range[0],
6398              top = _range[1],
6399              right = _range[3],
6400              bottom = _range[4];
6401
6402          var _address = _slicedToArray(address, 2),
6403              col = _address[0],
6404              row = _address[1];
6405
6406          return col >= left && col <= right && row >= top && row <= bottom;
6407        }
6408      };
6409      module.exports = colCache;
6410    }, {}],
6411    18: [function (require, module, exports) {
6412      (function (Buffer) {
6413        'use strict';
6414
6415        var crypto = require('crypto');
6416
6417        var Encryptor = {
6418          /**
6419           * Calculate a hash of the concatenated buffers with the given algorithm.
6420           * @param {string} algorithm - The hash algorithm.
6421           * @returns {Buffer} The hash
6422           */
6423          hash: function hash(algorithm) {
6424            var hash = crypto.createHash(algorithm);
6425
6426            for (var _len = arguments.length, buffers = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
6427              buffers[_key - 1] = arguments[_key];
6428            }
6429
6430            hash.update(Buffer.concat(buffers));
6431            return hash.digest();
6432          },
6433
6434          /**
6435           * Convert a password into an encryption key
6436           * @param {string} password - The password
6437           * @param {string} hashAlgorithm - The hash algoritm
6438           * @param {string} saltValue - The salt value
6439           * @param {number} spinCount - The spin count
6440           * @param {number} keyBits - The length of the key in bits
6441           * @param {Buffer} blockKey - The block key
6442           * @returns {Buffer} The encryption key
6443           */
6444          convertPasswordToHash: function convertPasswordToHash(password, hashAlgorithm, saltValue, spinCount) {
6445            hashAlgorithm = hashAlgorithm.toLowerCase();
6446            var hashes = crypto.getHashes();
6447
6448            if (hashes.indexOf(hashAlgorithm) < 0) {
6449              throw new Error("Hash algorithm '".concat(hashAlgorithm, "' not supported!"));
6450            } // Password must be in unicode buffer
6451
6452
6453            var passwordBuffer = Buffer.from(password, 'utf16le'); // Generate the initial hash
6454
6455            var key = this.hash(hashAlgorithm, Buffer.from(saltValue, 'base64'), passwordBuffer); // Now regenerate until spin count
6456
6457            for (var i = 0; i < spinCount; i++) {
6458              var iterator = Buffer.alloc(4); // this is the 'special' element of Excel password hashing
6459              // that stops us from using crypto.pbkdf2()
6460
6461              iterator.writeUInt32LE(i, 0);
6462              key = this.hash(hashAlgorithm, key, iterator);
6463            }
6464
6465            return key.toString('base64');
6466          },
6467
6468          /**
6469           * Generates cryptographically strong pseudo-random data.
6470           * @param size The size argument is a number indicating the number of bytes to generate.
6471           */
6472          randomBytes: function randomBytes(size) {
6473            return crypto.randomBytes(size);
6474          }
6475        };
6476        module.exports = Encryptor;
6477      }).call(this, require("buffer").Buffer);
6478    }, {
6479      "buffer": 214,
6480      "crypto": 312
6481    }],
6482    19: [function (require, module, exports) {
6483      "use strict";
6484
6485      function _awaitAsyncGenerator(value) {
6486        return new _AwaitValue(value);
6487      }
6488
6489      function _wrapAsyncGenerator(fn) {
6490        return function () {
6491          return new _AsyncGenerator(fn.apply(this, arguments));
6492        };
6493      }
6494
6495      function _AsyncGenerator(gen) {
6496        var front, back;
6497
6498        function send(key, arg) {
6499          return new Promise(function (resolve, reject) {
6500            var request = {
6501              key: key,
6502              arg: arg,
6503              resolve: resolve,
6504              reject: reject,
6505              next: null
6506            };
6507
6508            if (back) {
6509              back = back.next = request;
6510            } else {
6511              front = back = request;
6512              resume(key, arg);
6513            }
6514          });
6515        }
6516
6517        function resume(key, arg) {
6518          try {
6519            var result = gen[key](arg);
6520            var value = result.value;
6521            var wrappedAwait = value instanceof _AwaitValue;
6522            Promise.resolve(wrappedAwait ? value.wrapped : value).then(function (arg) {
6523              if (wrappedAwait) {
6524                resume(key === "return" ? "return" : "next", arg);
6525                return;
6526              }
6527
6528              settle(result.done ? "return" : "normal", arg);
6529            }, function (err) {
6530              resume("throw", err);
6531            });
6532          } catch (err) {
6533            settle("throw", err);
6534          }
6535        }
6536
6537        function settle(type, value) {
6538          switch (type) {
6539            case "return":
6540              front.resolve({
6541                value: value,
6542                done: true
6543              });
6544              break;
6545
6546            case "throw":
6547              front.reject(value);
6548              break;
6549
6550            default:
6551              front.resolve({
6552                value: value,
6553                done: false
6554              });
6555              break;
6556          }
6557
6558          front = front.next;
6559
6560          if (front) {
6561            resume(front.key, front.arg);
6562          } else {
6563            back = null;
6564          }
6565        }
6566
6567        this._invoke = send;
6568
6569        if (typeof gen.return !== "function") {
6570          this.return = undefined;
6571        }
6572      }
6573
6574      if (typeof Symbol === "function" && Symbol.asyncIterator) {
6575        _AsyncGenerator.prototype[Symbol.asyncIterator] = function () {
6576          return this;
6577        };
6578      }
6579
6580      _AsyncGenerator.prototype.next = function (arg) {
6581        return this._invoke("next", arg);
6582      };
6583
6584      _AsyncGenerator.prototype.throw = function (arg) {
6585        return this._invoke("throw", arg);
6586      };
6587
6588      _AsyncGenerator.prototype.return = function (arg) {
6589        return this._invoke("return", arg);
6590      };
6591
6592      function _AwaitValue(value) {
6593        this.wrapped = value;
6594      }
6595
6596      function _asyncIterator(iterable) {
6597        var method;
6598
6599        if (typeof Symbol !== "undefined") {
6600          if (Symbol.asyncIterator) {
6601            method = iterable[Symbol.asyncIterator];
6602            if (method != null) return method.call(iterable);
6603          }
6604
6605          if (Symbol.iterator) {
6606            method = iterable[Symbol.iterator];
6607            if (method != null) return method.call(iterable);
6608          }
6609        }
6610
6611        throw new TypeError("Object is not async iterable");
6612      }
6613
6614      var _require = require('saxes'),
6615          SaxesParser = _require.SaxesParser;
6616
6617      var _require2 = require('readable-stream'),
6618          PassThrough = _require2.PassThrough;
6619
6620      module.exports = /*#__PURE__*/function () {
6621        var _ref = _wrapAsyncGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(iterable) {
6622          var saxesParser, error, events, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, chunk;
6623
6624          return regeneratorRuntime.wrap(function _callee$(_context) {
6625            while (1) {
6626              switch (_context.prev = _context.next) {
6627                case 0:
6628                  // TODO: Remove once node v8 is deprecated
6629                  // Detect and upgrade old streams
6630                  if (iterable.pipe && !iterable[Symbol.asyncIterator]) {
6631                    iterable = iterable.pipe(new PassThrough());
6632                  }
6633
6634                  saxesParser = new SaxesParser();
6635                  saxesParser.on('error', function (err) {
6636                    error = err;
6637                  });
6638                  events = [];
6639                  saxesParser.on('opentag', function (value) {
6640                    return events.push({
6641                      eventType: 'opentag',
6642                      value: value
6643                    });
6644                  });
6645                  saxesParser.on('text', function (value) {
6646                    return events.push({
6647                      eventType: 'text',
6648                      value: value
6649                    });
6650                  });
6651                  saxesParser.on('closetag', function (value) {
6652                    return events.push({
6653                      eventType: 'closetag',
6654                      value: value
6655                    });
6656                  });
6657                  _iteratorNormalCompletion = true;
6658                  _didIteratorError = false;
6659                  _context.prev = 9;
6660                  _iterator = _asyncIterator(iterable);
6661
6662                case 11:
6663                  _context.next = 13;
6664                  return _awaitAsyncGenerator(_iterator.next());
6665
6666                case 13:
6667                  _step = _context.sent;
6668                  _iteratorNormalCompletion = _step.done;
6669                  _context.next = 17;
6670                  return _awaitAsyncGenerator(_step.value);
6671
6672                case 17:
6673                  _value = _context.sent;
6674
6675                  if (_iteratorNormalCompletion) {
6676                    _context.next = 29;
6677                    break;
6678                  }
6679
6680                  chunk = _value;
6681                  saxesParser.write(chunk.toString()); // saxesParser.write and saxesParser.on() are synchronous,
6682                  // so we can only reach the below line once all events have been emitted
6683
6684                  if (!error) {
6685                    _context.next = 23;
6686                    break;
6687                  }
6688
6689                  throw error;
6690
6691                case 23:
6692                  _context.next = 25;
6693                  return events;
6694
6695                case 25:
6696                  events = [];
6697
6698                case 26:
6699                  _iteratorNormalCompletion = true;
6700                  _context.next = 11;
6701                  break;
6702
6703                case 29:
6704                  _context.next = 35;
6705                  break;
6706
6707                case 31:
6708                  _context.prev = 31;
6709                  _context.t0 = _context["catch"](9);
6710                  _didIteratorError = true;
6711                  _iteratorError = _context.t0;
6712
6713                case 35:
6714                  _context.prev = 35;
6715                  _context.prev = 36;
6716
6717                  if (!(!_iteratorNormalCompletion && _iterator.return != null)) {
6718                    _context.next = 40;
6719                    break;
6720                  }
6721
6722                  _context.next = 40;
6723                  return _awaitAsyncGenerator(_iterator.return());
6724
6725                case 40:
6726                  _context.prev = 40;
6727
6728                  if (!_didIteratorError) {
6729                    _context.next = 43;
6730                    break;
6731                  }
6732
6733                  throw _iteratorError;
6734
6735                case 43:
6736                  return _context.finish(40);
6737
6738                case 44:
6739                  return _context.finish(35);
6740
6741                case 45:
6742                case "end":
6743                  return _context.stop();
6744              }
6745            }
6746          }, _callee, null, [[9, 31, 35, 45], [36,, 40, 44]]);
6747        }));
6748
6749        return function (_x) {
6750          return _ref.apply(this, arguments);
6751        };
6752      }();
6753    }, {
6754      "readable-stream": 467,
6755      "saxes": 471
6756    }],
6757    20: [function (require, module, exports) {
6758      "use strict";
6759
6760      var colCache = require('./col-cache'); // const cellRefRegex = /(([a-z_\-0-9]*)!)?[$]?([a-z]+)[$]?([1-9][0-9]*)/i;
6761
6762
6763      var replacementCandidateRx = /(([a-z_\-0-9]*)!)?([a-z0-9_$]{2,})([(])?/gi;
6764      var CRrx = /^([$])?([a-z]+)([$])?([1-9][0-9]*)$/i;
6765
6766      function slideFormula(formula, fromCell, toCell) {
6767        var offset = colCache.decode(fromCell);
6768        var to = colCache.decode(toCell);
6769        return formula.replace(replacementCandidateRx, function (refMatch, sheet, sheetMaybe, addrPart, trailingParen) {
6770          if (trailingParen) {
6771            return refMatch;
6772          }
6773
6774          var match = CRrx.exec(addrPart);
6775
6776          if (match) {
6777            var colDollar = match[1];
6778            var colStr = match[2].toUpperCase();
6779            var rowDollar = match[3];
6780            var rowStr = match[4];
6781
6782            if (colStr.length > 3 || colStr.length === 3 && colStr > 'XFD') {
6783              // > XFD is the highest col number in excel 2007 and beyond, so this is a named range
6784              return refMatch;
6785            }
6786
6787            var col = colCache.l2n(colStr);
6788            var row = parseInt(rowStr, 10);
6789
6790            if (!colDollar) {
6791              col += to.col - offset.col;
6792            }
6793
6794            if (!rowDollar) {
6795              row += to.row - offset.row;
6796            }
6797
6798            var res = (sheet || '') + (colDollar || '') + colCache.n2l(col) + (rowDollar || '') + row;
6799            return res;
6800          }
6801
6802          return refMatch;
6803        });
6804      }
6805
6806      module.exports = {
6807        slideFormula: slideFormula
6808      };
6809    }, {
6810      "./col-cache": 17
6811    }],
6812    21: [function (require, module, exports) {
6813      (function (process, Buffer) {
6814        "use strict";
6815
6816        function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
6817          try {
6818            var info = gen[key](arg);
6819            var value = info.value;
6820          } catch (error) {
6821            reject(error);
6822            return;
6823          }
6824
6825          if (info.done) {
6826            resolve(value);
6827          } else {
6828            Promise.resolve(value).then(_next, _throw);
6829          }
6830        }
6831
6832        function _asyncToGenerator(fn) {
6833          return function () {
6834            var self = this,
6835                args = arguments;
6836            return new Promise(function (resolve, reject) {
6837              var gen = fn.apply(self, args);
6838
6839              function _next(value) {
6840                asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
6841              }
6842
6843              function _throw(err) {
6844                asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
6845              }
6846
6847              _next(undefined);
6848            });
6849          };
6850        }
6851
6852        function _classCallCheck(instance, Constructor) {
6853          if (!(instance instanceof Constructor)) {
6854            throw new TypeError("Cannot call a class as a function");
6855          }
6856        }
6857
6858        function _defineProperties(target, props) {
6859          for (var i = 0; i < props.length; i++) {
6860            var descriptor = props[i];
6861            descriptor.enumerable = descriptor.enumerable || false;
6862            descriptor.configurable = true;
6863            if ("value" in descriptor) descriptor.writable = true;
6864            Object.defineProperty(target, descriptor.key, descriptor);
6865          }
6866        }
6867
6868        function _createClass(Constructor, protoProps, staticProps) {
6869          if (protoProps) _defineProperties(Constructor.prototype, protoProps);
6870          if (staticProps) _defineProperties(Constructor, staticProps);
6871          return Constructor;
6872        }
6873        /* eslint-disable max-classes-per-file */
6874
6875
6876        var Stream = require('readable-stream');
6877
6878        var utils = require('./utils');
6879
6880        var StringBuf = require('./string-buf'); // =============================================================================
6881        // data chunks - encapsulating incoming data
6882
6883
6884        var StringChunk = /*#__PURE__*/function () {
6885          function StringChunk(data, encoding) {
6886            _classCallCheck(this, StringChunk);
6887
6888            this._data = data;
6889            this._encoding = encoding;
6890          }
6891
6892          _createClass(StringChunk, [{
6893            key: "copy",
6894            // copy to target buffer
6895            value: function copy(target, targetOffset, offset, length) {
6896              return this.toBuffer().copy(target, targetOffset, offset, length);
6897            }
6898          }, {
6899            key: "toBuffer",
6900            value: function toBuffer() {
6901              if (!this._buffer) {
6902                this._buffer = Buffer.from(this._data, this._encoding);
6903              }
6904
6905              return this._buffer;
6906            }
6907          }, {
6908            key: "length",
6909            get: function get() {
6910              return this.toBuffer().length;
6911            }
6912          }]);
6913
6914          return StringChunk;
6915        }();
6916
6917        var StringBufChunk = /*#__PURE__*/function () {
6918          function StringBufChunk(data) {
6919            _classCallCheck(this, StringBufChunk);
6920
6921            this._data = data;
6922          }
6923
6924          _createClass(StringBufChunk, [{
6925            key: "copy",
6926            // copy to target buffer
6927            value: function copy(target, targetOffset, offset, length) {
6928              // eslint-disable-next-line no-underscore-dangle
6929              return this._data._buf.copy(target, targetOffset, offset, length);
6930            }
6931          }, {
6932            key: "toBuffer",
6933            value: function toBuffer() {
6934              return this._data.toBuffer();
6935            }
6936          }, {
6937            key: "length",
6938            get: function get() {
6939              return this._data.length;
6940            }
6941          }]);
6942
6943          return StringBufChunk;
6944        }();
6945
6946        var BufferChunk = /*#__PURE__*/function () {
6947          function BufferChunk(data) {
6948            _classCallCheck(this, BufferChunk);
6949
6950            this._data = data;
6951          }
6952
6953          _createClass(BufferChunk, [{
6954            key: "copy",
6955            // copy to target buffer
6956            value: function copy(target, targetOffset, offset, length) {
6957              this._data.copy(target, targetOffset, offset, length);
6958            }
6959          }, {
6960            key: "toBuffer",
6961            value: function toBuffer() {
6962              return this._data;
6963            }
6964          }, {
6965            key: "length",
6966            get: function get() {
6967              return this._data.length;
6968            }
6969          }]);
6970
6971          return BufferChunk;
6972        }(); // =============================================================================
6973        // ReadWriteBuf - a single buffer supporting simple read-write
6974
6975
6976        var ReadWriteBuf = /*#__PURE__*/function () {
6977          function ReadWriteBuf(size) {
6978            _classCallCheck(this, ReadWriteBuf);
6979
6980            this.size = size; // the buffer
6981
6982            this.buffer = Buffer.alloc(size); // read index
6983
6984            this.iRead = 0; // write index
6985
6986            this.iWrite = 0;
6987          }
6988
6989          _createClass(ReadWriteBuf, [{
6990            key: "toBuffer",
6991            value: function toBuffer() {
6992              if (this.iRead === 0 && this.iWrite === this.size) {
6993                return this.buffer;
6994              }
6995
6996              var buf = Buffer.alloc(this.iWrite - this.iRead);
6997              this.buffer.copy(buf, 0, this.iRead, this.iWrite);
6998              return buf;
6999            }
7000          }, {
7001            key: "read",
7002            value: function read(size) {
7003              var buf; // read size bytes from buffer and return buffer
7004
7005              if (size === 0) {
7006                // special case - return null if no data requested
7007                return null;
7008              }
7009
7010              if (size === undefined || size >= this.length) {
7011                // if no size specified or size is at least what we have then return all of the bytes
7012                buf = this.toBuffer();
7013                this.iRead = this.iWrite;
7014                return buf;
7015              } // otherwise return a chunk
7016
7017
7018              buf = Buffer.alloc(size);
7019              this.buffer.copy(buf, 0, this.iRead, size);
7020              this.iRead += size;
7021              return buf;
7022            }
7023          }, {
7024            key: "write",
7025            value: function write(chunk, offset, length) {
7026              // write as many bytes from data from optional source offset
7027              // and return number of bytes written
7028              var size = Math.min(length, this.size - this.iWrite);
7029              chunk.copy(this.buffer, this.iWrite, offset, offset + size);
7030              this.iWrite += size;
7031              return size;
7032            }
7033          }, {
7034            key: "length",
7035            get: function get() {
7036              return this.iWrite - this.iRead;
7037            }
7038          }, {
7039            key: "eod",
7040            get: function get() {
7041              return this.iRead === this.iWrite;
7042            }
7043          }, {
7044            key: "full",
7045            get: function get() {
7046              return this.iWrite === this.size;
7047            }
7048          }]);
7049
7050          return ReadWriteBuf;
7051        }(); // =============================================================================
7052        // StreamBuf - a multi-purpose read-write stream
7053        //  As MemBuf - write as much data as you like. Then call toBuffer() to consolidate
7054        //  As StreamHub - pipe to multiple writables
7055        //  As readable stream - feed data into the writable part and have some other code read from it.
7056        // Note: Not sure why but StreamBuf does not like JS "class" sugar. It fails the
7057        // integration tests
7058
7059
7060        var StreamBuf = function StreamBuf(options) {
7061          options = options || {};
7062          this.bufSize = options.bufSize || 1024 * 1024;
7063          this.buffers = []; // batch mode fills a buffer completely before passing the data on
7064          // to pipes or 'readable' event listeners
7065
7066          this.batch = options.batch || false;
7067          this.corked = false; // where in the current writable buffer we're up to
7068
7069          this.inPos = 0; // where in the current readable buffer we've read up to
7070
7071          this.outPos = 0; // consuming pipe streams go here
7072
7073          this.pipes = []; // controls emit('data')
7074
7075          this.paused = false;
7076          this.encoding = null;
7077        };
7078
7079        utils.inherits(StreamBuf, Stream.Duplex, {
7080          toBuffer: function toBuffer() {
7081            switch (this.buffers.length) {
7082              case 0:
7083                return null;
7084
7085              case 1:
7086                return this.buffers[0].toBuffer();
7087
7088              default:
7089                return Buffer.concat(this.buffers.map(function (rwBuf) {
7090                  return rwBuf.toBuffer();
7091                }));
7092            }
7093          },
7094          // writable
7095          // event drain - if write returns false (which it won't), indicates when safe to write again.
7096          // finish - end() has been called
7097          // pipe(src) - pipe() has been called on readable
7098          // unpipe(src) - unpipe() has been called on readable
7099          // error - duh
7100          _getWritableBuffer: function _getWritableBuffer() {
7101            if (this.buffers.length) {
7102              var last = this.buffers[this.buffers.length - 1];
7103
7104              if (!last.full) {
7105                return last;
7106              }
7107            }
7108
7109            var buf = new ReadWriteBuf(this.bufSize);
7110            this.buffers.push(buf);
7111            return buf;
7112          },
7113          _pipe: function _pipe(chunk) {
7114            var _this = this;
7115
7116            return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
7117              var write;
7118              return regeneratorRuntime.wrap(function _callee$(_context) {
7119                while (1) {
7120                  switch (_context.prev = _context.next) {
7121                    case 0:
7122                      write = function write(pipe) {
7123                        return new Promise(function (resolve) {
7124                          pipe.write(chunk.toBuffer(), function () {
7125                            resolve();
7126                          });
7127                        });
7128                      };
7129
7130                      _context.next = 3;
7131                      return Promise.all(_this.pipes.map(write));
7132
7133                    case 3:
7134                    case "end":
7135                      return _context.stop();
7136                  }
7137                }
7138              }, _callee);
7139            }))();
7140          },
7141          _writeToBuffers: function _writeToBuffers(chunk) {
7142            var inPos = 0;
7143            var inLen = chunk.length;
7144
7145            while (inPos < inLen) {
7146              // find writable buffer
7147              var buffer = this._getWritableBuffer(); // write some data
7148
7149
7150              inPos += buffer.write(chunk, inPos, inLen - inPos);
7151            }
7152          },
7153          write: function write(data, encoding, callback) {
7154            var _this2 = this;
7155
7156            return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
7157              var chunk;
7158              return regeneratorRuntime.wrap(function _callee2$(_context2) {
7159                while (1) {
7160                  switch (_context2.prev = _context2.next) {
7161                    case 0:
7162                      if (encoding instanceof Function) {
7163                        callback = encoding;
7164                        encoding = 'utf8';
7165                      }
7166
7167                      callback = callback || utils.nop; // encapsulate data into a chunk
7168
7169                      if (!(data instanceof StringBuf)) {
7170                        _context2.next = 6;
7171                        break;
7172                      }
7173
7174                      chunk = new StringBufChunk(data);
7175                      _context2.next = 15;
7176                      break;
7177
7178                    case 6:
7179                      if (!(data instanceof Buffer)) {
7180                        _context2.next = 10;
7181                        break;
7182                      }
7183
7184                      chunk = new BufferChunk(data);
7185                      _context2.next = 15;
7186                      break;
7187
7188                    case 10:
7189                      if (!(typeof data === 'string' || data instanceof String || data instanceof ArrayBuffer)) {
7190                        _context2.next = 14;
7191                        break;
7192                      }
7193
7194                      chunk = new StringChunk(data, encoding);
7195                      _context2.next = 15;
7196                      break;
7197
7198                    case 14:
7199                      throw new Error('Chunk must be one of type Str
7199ing, Buffer or StringBuf.');
7200
7201                    case 15:
7202                      if (!_this2.pipes.length) {
7203                        _context2.next = 31;
7204                        break;
7205                      }
7206
7207                      if (!_this2.batch) {
7208                        _context2.next = 21;
7209                        break;
7210                      }
7211
7212                      _this2._writeToBuffers(chunk);
7213
7214                      while (!_this2.corked && _this2.buffers.length > 1) {
7215                        _this2._pipe(_this2.buffers.shift());
7216                      }
7217
7218                      _context2.next = 29;
7219                      break;
7220
7221                    case 21:
7222                      if (_this2.corked) {
7223                        _context2.next = 27;
7224                        break;
7225                      }
7226
7227                      _context2.next = 24;
7228                      return _this2._pipe(chunk);
7229
7230                    case 24:
7231                      callback();
7232                      _context2.next = 29;
7233                      break;
7234
7235                    case 27:
7236                      _this2._writeToBuffers(chunk);
7237
7238                      process.nextTick(callback);
7239
7240                    case 29:
7241                      _context2.next = 34;
7242                      break;
7243
7244                    case 31:
7245                      if (!_this2.paused) {
7246                        _this2.emit('data', chunk.toBuffer());
7247                      }
7248
7249                      _this2._writeToBuffers(chunk);
7250
7251                      _this2.emit('readable');
7252
7253                    case 34:
7254                      return _context2.abrupt("return", true);
7255
7256                    case 35:
7257                    case "end":
7258                      return _context2.stop();
7259                  }
7260                }
7261              }, _callee2);
7262            }))();
7263          },
7264          cork: function cork() {
7265            this.corked = true;
7266          },
7267          _flush: function _flush()
7268          /* destination */
7269          {
vendor: 7,840 bytes, lines 7270-7517
7270            // if we have comsumers...
7271            if (this.pipes.length) {
7272              // and there's stuff not written
7273              while (this.buffers.length) {
7274                this._pipe(this.buffers.shift());
7275              }
7276            }
7277          },
7278          uncork: function uncork() {
7279            this.corked = false;
7280
7281            this._flush();
7282          },
7283          end: function end(chunk, encoding, callback) {
7284            var _this3 = this;
7285
7286            var writeComplete = function writeComplete(error) {
7287              if (error) {
7288                callback(error);
7289              } else {
7290                _this3._flush();
7291
7292                _this3.pipes.forEach(function (pipe) {
7293                  pipe.end();
7294                });
7295
7296                _this3.emit('finish');
7297              }
7298            };
7299
7300            if (chunk) {
7301              this.write(chunk, encoding, writeComplete);
7302            } else {
7303              writeComplete();
7304            }
7305          },
7306          // readable
7307          // event readable - some data is now available
7308          // event data - switch to flowing mode - feeds chunks to handler
7309          // event end - no more data
7310          // event close - optional, indicates upstream close
7311          // event error - duh
7312          read: function read(size) {
7313            var buffers; // read min(buffer, size || infinity)
7314
7315            if (size) {
7316              buffers = [];
7317
7318              while (size && this.buffers.length && !this.buffers[0].eod) {
7319                var first = this.buffers[0];
7320                var buffer = first.read(size);
7321                size -= buffer.length;
7322                buffers.push(buffer);
7323
7324                if (first.eod && first.full) {
7325                  this.buffers.shift();
7326                }
7327              }
7328
7329              return Buffer.concat(buffers);
7330            }
7331
7332            buffers = this.buffers.map(function (buf) {
7333              return buf.toBuffer();
7334            }).filter(Boolean);
7335            this.buffers = [];
7336            return Buffer.concat(buffers);
7337          },
7338          setEncoding: function setEncoding(encoding) {
7339            // causes stream.read or stream.on('data) to return strings of encoding instead of Buffer objects
7340            this.encoding = encoding;
7341          },
7342          pause: function pause() {
7343            this.paused = true;
7344          },
7345          resume: function resume() {
7346            this.paused = false;
7347          },
7348          isPaused: function isPaused() {
7349            return !!this.paused;
7350          },
7351          pipe: function pipe(destination) {
7352            // add destination to pipe list & write current buffer
7353            this.pipes.push(destination);
7354
7355            if (!this.paused && this.buffers.length) {
7356              this.end();
7357            }
7358          },
7359          unpipe: function unpipe(destination) {
7360            // remove destination from pipe list
7361            this.pipes = this.pipes.filter(function (pipe) {
7362              return pipe !== destination;
7363            });
7364          },
7365          unshift: function unshift()
7366          /* chunk */
7367          {
7368            // some numpty has read some data that's not for them and they want to put it back!
7369            // Might implement this some day
7370            throw new Error('Not Implemented');
7371          },
7372          wrap: function wrap()
7373          /* stream */
7374          {
7375            // not implemented
7376            throw new Error('Not Implemented');
7377          }
7378        });
7379        module.exports = StreamBuf;
7380      }).call(this, require('_process'), require("buffer").Buffer);
7381    }, {
7382      "./string-buf": 22,
7383      "./utils": 24,
7384      "_process": 443,
7385      "buffer": 214,
7386      "readable-stream": 467
7387    }],
7388    22: [function (require, module, exports) {
7389      (function (Buffer) {
7390        "use strict";
7391
7392        function _classCallCheck(instance, Constructor) {
7393          if (!(instance instanceof Constructor)) {
7394            throw new TypeError("Cannot call a class as a function");
7395          }
7396        }
7397
7398        function _defineProperties(target, props) {
7399          for (var i = 0; i < props.length; i++) {
7400            var descriptor = props[i];
7401            descriptor.enumerable = descriptor.enumerable || false;
7402            descriptor.configurable = true;
7403            if ("value" in descriptor) descriptor.writable = true;
7404            Object.defineProperty(target, descriptor.key, descriptor);
7405          }
7406        }
7407
7408        function _createClass(Constructor, protoProps, staticProps) {
7409          if (protoProps) _defineProperties(Constructor.prototype, protoProps);
7410          if (staticProps) _defineProperties(Constructor, staticProps);
7411          return Constructor;
7412        } // StringBuf - a way to keep string memory operations to a minimum
7413        // while building the strings for the xml files
7414
7415
7416        var StringBuf = /*#__PURE__*/function () {
7417          function StringBuf(options) {
7418            _classCallCheck(this, StringBuf);
7419
7420            this._buf = Buffer.alloc(options && options.size || 16384);
7421            this._encoding = options && options.encoding || 'utf8'; // where in the buffer we are at
7422
7423            this._inPos = 0; // for use by toBuffer()
7424
7425            this._buffer = undefined;
7426          }
7427
7428          _createClass(StringBuf, [{
7429            key: "toBuffer",
7430            value: function toBuffer() {
7431              // return the current data as a single enclosing buffer
7432              if (!this._buffer) {
7433                this._buffer = Buffer.alloc(this.length);
7434
7435                this._buf.copy(this._buffer, 0, 0, this.length);
7436              }
7437
7438              return this._buffer;
7439            }
7440          }, {
7441            key: "reset",
7442            value: function reset(position) {
7443              position = position || 0;
7444              this._buffer = undefined;
7445              this._inPos = position;
7446            }
7447          }, {
7448            key: "_grow",
7449            value: function _grow(min) {
7450              var size = this._buf.length * 2;
7451
7452              while (size < min) {
7453                size *= 2;
7454              }
7455
7456              var buf = Buffer.alloc(size);
7457
7458              this._buf.copy(buf, 0);
7459
7460              this._buf = buf;
7461            }
7462          }, {
7463            key: "addText",
7464            value: function addText(text) {
7465              this._buffer = undefined;
7466
7467              var inPos = this._inPos + this._buf.write(text, this._inPos, this._encoding); // if we've hit (or nearing capacity), grow the buf
7468
7469
7470              while (inPos >= this._buf.length - 4) {
7471                this._grow(this._inPos + text.length); // keep trying to write until we've completely written the text
7472
7473
7474                inPos = this._inPos + this._buf.write(text, this._inPos, this._encoding);
7475              }
7476
7477              this._inPos = inPos;
7478            }
7479          }, {
7480            key: "addStringBuf",
7481            value: function addStringBuf(inBuf) {
7482              if (inBuf.length) {
7483                this._buffer = undefined;
7484
7485                if (this.length + inBuf.length > this.capacity) {
7486                  this._grow(this.length + inBuf.length);
7487                } // eslint-disable-next-line no-underscore-dangle
7488
7489
7490                inBuf._buf.copy(this._buf, this._inPos, 0, inBuf.length);
7491
7492                this._inPos += inBuf.length;
7493              }
7494            }
7495          }, {
7496            key: "length",
7497            get: function get() {
7498              return this._inPos;
7499            }
7500          }, {
7501            key: "capacity",
7502            get: function get() {
7503              return this._buf.length;
7504            }
7505          }, {
7506            key: "buffer",
7507            get: function get() {
7508              return this._buf;
7509            }
7510          }]);
7511
7512          return StringBuf;
7513        }();
7514
7515        module.exports = StringBuf;
7516      }).call(this, require("buffer").Buffer);
7517    }, {
7518      "buffer": 214
7519    }],
7520    23: [function (require, module, exports) {
7521      "use strict";
7522
7523      function _typeof(obj) {
7524        "@babel/helpers - typeof";
7525
7526        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
7527          _typeof = function _typeof(obj) {
7528            return typeof obj;
7529          };
7530        } else {
7531          _typeof = function _typeof(obj) {
7532            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
7533          };
7534        }
7535
7536        return _typeof(obj);
7537      }
7538
7539      var toString = Object.prototype.toString;
7540      var _ = {
7541        each: function each(obj, cb) {
7542          if (obj) {
7543            if (Array.isArray(obj)) {
7544              obj.forEach(cb);
7545            } else {
7546              Object.keys(obj).forEach(function (key) {
7547                cb(obj[key], key);
7548              });
7549            }
7550          }
7551        },
7552        some: function some(obj, cb) {
7553          if (obj) {
7554            if (Array.isArray(obj)) {
7555              return obj.some(cb);
7556            }
7557
7558            return Object.keys(obj).some(function (key) {
7559              return cb(obj[key], key);
7560            });
7561          }
7562
7563          return false;
7564        },
7565        every: function every(obj, cb) {
7566          if (obj) {
7567            if (Array.isArray(obj)) {
7568              return obj.every(cb);
7569            }
7570
7571            return Object.keys(obj).every(function (key) {
7572              return cb(obj[key], key);
7573            });
7574          }
7575
7576          return true;
7577        },
7578        map: function map(obj, cb) {
7579          if (obj) {
7580            if (Array.isArray(obj)) {
7581              return obj.map(cb);
7582            }
7583
7584            return Object.keys(obj).map(function (key) {
7585              return cb(obj[key], key);
7586            });
7587          }
7588
7589          return [];
7590        },
7591        keyBy: function keyBy(a, p) {
7592          return a.reduce(function (o, v) {
7593            o[v[p]] = v;
7594            return o;
7595          }, {});
7596        },
7597        isEqual: function isEqual(a, b) {
7598          var aType = _typeof(a);
7599
7600          var bType = _typeof(b);
7601
7602          var aArray = Array.isArray(a);
7603          var bArray = Array.isArray(b);
7604
7605          if (aType !== bType) {
7606            return false;
7607          }
7608
7609          switch (_typeof(a)) {
7610            case 'object':
7611              if (aArray || bArray) {
7612                if (aArray && bArray) {
7613                  return a.length === b.length && a.every(function (aValue, index) {
7614                    var bValue = b[index];
7615                    return _.isEqual(aValue, bValue);
7616                  });
7617                }
7618
7619                return false;
7620              }
7621
7622              return _.every(a, function (aValue, key) {
7623                var bValue = b[key];
7624                return _.isEqual(aValue, bValue);
7625              });
7626
7627            default:
7628              return a === b;
7629          }
7630        },
7631        escapeHtml: function escapeHtml(html) {
7632          return html.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#039;');
7633        },
7634        strcmp: function strcmp(a, b) {
7635          if (a < b) return -1;
7636          if (a > b) return 1;
7637          return 0;
7638        },
7639        isUndefined: function isUndefined(val) {
7640          return toString.call(val) === '[object Undefined]';
7641        },
7642        isObject: function isObject(val) {
7643          return toString.call(val) === '[object Object]';
7644        },
7645        deepMerge: function deepMerge() {
7646          var target = arguments[0] || {};
7647          var length = arguments.length; // eslint-disable-next-line one-var
7648
7649          var src, clone, copyIsArray;
7650
7651          function assignValue(val, key) {
7652            src = target[key];
7653            copyIsArray = Array.isArray(val);
7654
7655            if (_.isObject(val) || copyIsArray) {
7656              if (copyIsArray) {
7657                copyIsArray = false;
7658                clone = src && Array.isArray(src) ? src : [];
7659              } else {
7660                clone = src && _.isObject(src) ? src : {};
7661              }
7662
7663              target[key] = _.deepMerge(clone, val);
7664            } else if (!_.isUndefined(val)) {
7665              target[key] = val;
7666            }
7667          }
7668
7669          for (var i = 0; i < length; i++) {
7670            _.each(arguments[i], assignValue);
7671          }
7672
7673          return target;
7674        }
7675      };
7676      module.exports = _;
7677    }, {}],
vendor: 4,868 bytes, lines 7678-7831
7678    24: [function (require, module, exports) {
7679      (function (global, setImmediate) {
7680        "use strict";
7681
7682        var fs = require('fs'); // useful stuff
7683
7684
7685        var inherits = function inherits(cls, superCtor, statics, prototype) {
7686          // eslint-disable-next-line no-underscore-dangle
7687          cls.super_ = superCtor;
7688
7689          if (!prototype) {
7690            prototype = statics;
7691            statics = null;
7692          }
7693
7694          if (statics) {
7695            Object.keys(statics).forEach(function (i) {
7696              Object.defineProperty(cls, i, Object.getOwnPropertyDescriptor(statics, i));
7697            });
7698          }
7699
7700          var properties = {
7701            constructor: {
7702              value: cls,
7703              enumerable: false,
7704              writable: false,
7705              configurable: true
7706            }
7707          };
7708
7709          if (prototype) {
7710            Object.keys(prototype).forEach(function (i) {
7711              properties[i] = Object.getOwnPropertyDescriptor(prototype, i);
7712            });
7713          }
7714
7715          cls.prototype = Object.create(superCtor.prototype, properties);
7716        };
7717
7718        var utils = {
7719          nop: function nop() {},
7720          promiseImmediate: function promiseImmediate(value) {
7721            return new Promise(function (resolve) {
7722              if (global.setImmediate) {
7723                setImmediate(function () {
7724                  resolve(value);
7725                });
7726              } else {
7727                // poorman's setImmediate - must wait at least 1ms
7728                setTimeout(function () {
7729                  resolve(value);
7730                }, 1);
7731              }
7732            });
7733          },
7734          inherits: inherits,
7735          dateToExcel: function dateToExcel(d, date1904) {
7736            return 25569 + d.getTime() / (24 * 3600 * 1000) - (date1904 ? 1462 : 0);
7737          },
7738          excelToDate: function excelToDate(v, date1904) {
7739            var millisecondSinceEpoch = Math.round((v - 25569 + (date1904 ? 1462 : 0)) * 24 * 3600 * 1000);
7740            return new Date(millisecondSinceEpoch);
7741          },
7742          parsePath: function parsePath(filepath) {
7743            var last = filepath.lastIndexOf('/');
7744            return {
7745              path: filepath.substring(0, last),
7746              name: filepath.substring(last + 1)
7747            };
7748          },
7749          getRelsPath: function getRelsPath(filepath) {
7750            var path = utils.parsePath(filepath);
7751            return "".concat(path.path, "/_rels/").concat(path.name, ".rels");
7752          },
7753          xmlEncode: function xmlEncode(text) {
7754            // eslint-disable-next-line no-control-regex
7755            return text.replace(/[<>&'"\x7F\x00-\x08\x0B-\x0C\x0E-\x1F]/g, function (c) {
7756              switch (c) {
7757                case '<':
7758                  return '&lt;';
7759
7760                case '>':
7761                  return '&gt;';
7762
7763                case '&':
7764                  return '&amp;';
7765
7766                case '\'':
7767                  return '&apos;';
7768
7769                case '"':
7770                  return '&quot;';
7771
7772                default:
7773                  return '';
7774              }
7775            });
7776          },
7777          xmlDecode: function xmlDecode(text) {
7778            return text.replace(/&([a-z]*);/, function (c) {
7779              switch (c) {
7780                case '&lt;':
7781                  return '<';
7782
7783                case '&gt;':
7784                  return '>';
7785
7786                case '&amp;':
7787                  return '&';
7788
7789                case '&apos;':
7790                  return '\'';
7791
7792                case '&quot;':
7793                  return '"';
7794
7795                default:
7796                  return c;
7797              }
7798            });
7799          },
7800          validInt: function validInt(value) {
7801            var i = parseInt(value, 10);
7802            return !Number.isNaN(i) ? i : 0;
7803          },
7804          isDateFmt: function isDateFmt(fmt) {
7805            if (!fmt) {
7806              return false;
7807            } // must remove all chars inside quotes and []
7808
7809
7810            fmt = fmt.replace(/\[[^\]]*]/g, '');
7811            fmt = fmt.replace(/"[^"]*"/g, ''); // then check for date formatting chars
7812
7813            var result = fmt.match(/[ymdhMsb]+/) !== null;
7814            return result;
7815          },
7816          fs: {
7817            exists: function exists(path) {
7818              return new Promise(function (resolve) {
7819                fs.access(path, fs.constants.F_OK, function (err) {
7820                  resolve(!err);
7821                });
7822              });
7823            }
7824          },
7825          toIsoDateString: function toIsoDateString(dt) {
7826            return dt.toIsoString().subsstr(0, 10);
7827          }
7828        };
7829        module.exports = utils;
7830      }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}, require("timers").setImmediate);
7831    }, {
7832      "fs": 213,
7833      "timers": 496
7834    }],
7835    25: [function (require, module, exports) {
7836      "use strict";
7837
7838      function _classCallCheck(instance, Constructor) {
7839        if (!(instance instanceof Constructor)) {
7840          throw new TypeError("Cannot call a class as a function");
7841        }
7842      }
7843
7844      function _defineProperties(target, props) {
7845        for (var i = 0; i < props.length; i++) {
7846          var descriptor = props[i];
7847          descriptor.enumerable = descriptor.enumerable || false;
7848          descriptor.configurable = true;
7849          if ("value" in descriptor) descriptor.writable = true;
7850          Object.defineProperty(target, descriptor.key, descriptor);
7851        }
7852      }
7853
7854      function _createClass(Constructor, protoProps, staticProps) {
7855        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
7856        if (staticProps) _defineProperties(Constructor, staticProps);
7857        return Constructor;
7858      }
7859
7860      var _ = require('./under-dash');
7861
7862      var utils = require('./utils'); // constants
7863
7864
7865      var OPEN_ANGLE = '<';
7866      var CLOSE_ANGLE = '>';
7867      var OPEN_ANGLE_SLASH = '</';
7868      var CLOSE_SLASH_ANGLE = '/>';
7869      var EQUALS_QUOTE = '="';
7870      var QUOTE = '"';
7871      var SPACE = ' ';
7872
7873      function pushAttribute(xml, name, value) {
7874        xml.push(SPACE);
7875        xml.push(name);
7876        xml.push(EQUALS_QUOTE);
7877        xml.push(utils.xmlEncode(value.toString()));
7878        xml.push(QUOTE);
7879      }
7880
7881      function pushAttributes(xml, attributes) {
7882        if (attributes) {
7883          _.each(attributes, function (value, name) {
7884            if (value !== undefined) {
7885              pushAttribute(xml, name, value);
7886            }
7887          });
7888        }
7889      }
7890
7891      var XmlStream = /*#__PURE__*/function () {
7892        function XmlStream() {
7893          _classCallCheck(this, XmlStream);
7894
7895          this._xml = [];
7896          this._stack = [];
7897          this._rollbacks = [];
7898        }
7899
7900        _createClass(XmlStream, [{
7901          key: "openXml",
7902          value: function openXml(docAttributes) {
7903            var xml = this._xml; // <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
7904
7905            xml.push('<?xml');
7906            pushAttributes(xml, docAttributes);
7907            xml.push('?>\n');
7908          }
7909        }, {
7910          key: "openNode",
7911          value: function openNode(name, attributes) {
7912            var parent = this.tos;
7913            var xml = this._xml;
7914
7915            if (parent && this.open) {
7916              xml.push(CLOSE_ANGLE);
7917            }
7918
7919            this._stack.push(name); // start streaming node
7920
7921
7922            xml.push(OPEN_ANGLE);
7923            xml.push(name);
7924            pushAttributes(xml, attributes);
7925            this.leaf = true;
7926            this.open = true;
7927          }
7928        }, {
7929          key: "addAttribute",
7930          value: function addAttribute(name, value) {
7931            if (!this.open) {
7932              throw new Error('Cannot write attributes to node if it is not open');
7933            }
7934
7935            if (value !== undefined) {
7936              pushAttribute(this._xml, name, value);
7937            }
7938          }
7939        }, {
7940          key: "addAttributes",
7941          value: function addAttributes(attrs) {
7942            if (!this.open) {
7943              throw new Error('Cannot write attributes to node if it is not open');
7944            }
7945
7946            pushAttributes(this._xml, attrs);
7947          }
7948        }, {
7949          key: "writeText",
7950          value: function writeText(text) {
7951            var xml = this._xml;
7952
7953            if (this.open) {
7954              xml.push(CLOSE_ANGLE);
7955              this.open = false;
7956            }
7957
7958            this.leaf = false;
7959            xml.push(utils.xmlEncode(text.toString()));
7960          }
7961        }, {
7962          key: "writeXml",
7963          value: function writeXml(xml) {
7964            if (this.open) {
7965              this._xml.push(CLOSE_ANGLE);
7966
7967              this.open = false;
7968            }
7969
7970            this.leaf = false;
7971
7972            this._xml.push(xml);
7973          }
7974        }, {
7975          key: "closeNode",
7976          value: function closeNode() {
7977            var node = this._stack.pop();
7978
7979            var xml = this._xml;
7980
7981            if (this.leaf) {
7982              xml.push(CLOSE_SLASH_ANGLE);
7983            } else {
7984              xml.push(OPEN_ANGLE_SLASH);
7985              xml.push(node);
7986              xml.push(CLOSE_ANGLE);
7987            }
7988
7989            this.open = false;
7990            this.leaf = false;
7991          }
7992        }, {
7993          key: "leafNode",
7994          value: function leafNode(name, attributes, text) {
7995            this.openNode(name, attributes);
7996
7997            if (text !== undefined) {
7998              // zeros need to be written
7999              this.writeText(text);
8000            }
8001
8002            this.closeNode();
8003          }
8004        }, {
8005          key: "closeAll",
8006          value: function closeAll() {
8007            while (this._stack.length) {
8008              this.closeNode();
8009            }
8010          }
8011        }, {
8012          key: "addRollback",
8013          value: function addRollback() {
8014            this._rollbacks.push({
8015              xml: this._xml.length,
8016              stack: this._stack.length,
8017              leaf: this.leaf,
8018              open: this.open
8019            });
8020
8021            return this.cursor;
8022          }
8023        }, {
8024          key: "commit",
8025          value: function commit() {
8026            this._rollbacks.pop();
8027          }
8028        }, {
8029          key: "rollback",
8030          value: function rollback() {
8031            var r = this._rollbacks.pop();
8032
8033            if (this._xml.length > r.xml) {
8034              this._xml.splice(r.xml, this._xml.length - r.xml);
8035            }
8036
8037            if (this._stack.length > r.stack) {
8038              this._stack.splice(r.stack, this._stack.length - r.stack);
8039            }
8040
8041            this.leaf = r.leaf;
8042            this.open = r.open;
8043          }
8044        }, {
8045          key: "tos",
8046          get: function get() {
8047            return this._stack.length ? this._stack[this._stack.length - 1] : undefined;
8048          }
8049        }, {
8050          key: "cursor",
8051          get: function get() {
8052            // handy way to track whether anything has been added
8053            return this._xml.length;
8054          }
8055        }, {
8056          key: "xml",
8057          get: function get() {
8058            this.closeAll();
8059            return this._xml.join('');
8060          }
8061        }]);
8062
8063        return XmlStream;
8064      }();
8065
8066      XmlStream.StdDocAttributes = {
8067        version: '1.0',
8068        encoding: 'UTF-8',
8069        standalone: 'yes'
8070      };
8071      module.exports = XmlStream;
8072    }, {
8073      "./under-dash": 23,
8074      "./utils": 24
8075    }],
8076    26: [function (require, module, exports) {
8077      "use strict";
8078
8079      function _typeof(obj) {
8080        "@babel/helpers - typeof";
8081
8082        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
8083          _typeof = function _typeof(obj) {
8084            return typeof obj;
8085          };
8086        } else {
8087          _typeof = function _typeof(obj) {
8088            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
8089          };
8090        }
8091
8092        return _typeof(obj);
8093      }
8094
8095      function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
8096        try {
8097          var info = gen[key](arg);
8098          var value = info.value;
8099        } catch (error) {
8100          reject(error);
8101          return;
8102        }
8103
8104        if (info.done) {
8105          resolve(value);
8106        } else {
8107          Promise.resolve(value).then(_next, _throw);
8108        }
8109      }
8110
8111      function _asyncToGenerator(fn) {
8112        return function () {
8113          var self = this,
8114              args = arguments;
8115          return new Promise(function (resolve, reject) {
8116            var gen = fn.apply(self, args);
8117
8118            function _next(value) {
8119              asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
8120            }
8121
8122            function _throw(err) {
8123              asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
8124            }
8125
8126            _next(undefined);
8127          });
8128        };
8129      }
8130
8131      function _classCallCheck(instance, Constructor) {
8132        if (!(instance instanceof Constructor)) {
8133          throw new TypeError("Cannot call a class as a function");
8134        }
8135      }
8136
8137      function _defineProperties(target, props) {
8138        for (var i = 0; i < props.length; i++) {
8139          var descriptor = props[i];
8140          descriptor.enumerable = descriptor.enumerable || false;
8141          descriptor.configurable = true;
8142          if ("value" in descriptor) descriptor.writable = true;
8143          Object.defineProperty(target, descriptor.key, descriptor);
8144        }
8145      }
8146
8147      function _createClass(Constructor, protoProps, staticProps) {
8148        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
8149        if (staticProps) _defineProperties(Constructor, staticProps);
8150        return Constructor;
8151      }
8152
8153      function _inherits(subClass, superClass) {
8154        if (typeof superClass !== "function" && superClass !== null) {
8155          throw new TypeError("Super expression must either be null or a function");
8156        }
8157
8158        subClass.prototype = Object.create(superClass && superClass.prototype, {
8159          constructor: {
8160            value: subClass,
8161            writable: true,
8162            configurable: true
8163          }
8164        });
8165        if (superClass) _setPrototypeOf(subClass, superClass);
8166      }
8167
8168      function _setPrototypeOf(o, p) {
8169        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
8170          o.__proto__ = p;
8171          return o;
8172        };
8173
8174        return _setPrototypeOf(o, p);
8175      }
8176
8177      function _createSuper(Derived) {
8178        return function () {
8179          var Super = _getPrototypeOf(Derived),
8180              result;
8181
8182          if (_isNativeReflectConstruct()) {
8183            var NewTarget = _getPrototypeOf(this).constructor;
8184
8185            result = Reflect.construct(Super, arguments, NewTarget);
8186          } else {
8187            result = Super.apply(this, arguments);
8188          }
8189
8190          return _possibleConstructorReturn(this, result);
8191        };
8192      }
8193
8194      function _possibleConstructorReturn(self, call) {
8195        if (call && (_typeof(call) === "object" || typeof call === "function")) {
8196          return call;
8197        }
8198
8199        return _assertThisInitialized(self);
8200      }
8201
8202      function _assertThisInitialized(self) {
8203        if (self === void 0) {
8204          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
8205        }
8206
8207        return self;
8208      }
8209
8210      function _isNativeReflectConstruct() {
8211        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
8212        if (Reflect.construct.sham) return false;
8213        if (typeof Proxy === "function") return true;
8214
8215        try {
8216          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
8217          return true;
8218        } catch (e) {
8219          return false;
8220        }
8221      }
8222
8223      function _getPrototypeOf(o) {
8224        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
8225          return o.__proto__ || Object.getPrototypeOf(o);
8226        };
8227        return _getPrototypeOf(o);
8228      }
8229
8230      var events = require('events');
8231
8232      var JSZip = require('jszip');
8233
8234      var StreamBuf = require('./stream-buf'); // =============================================================================
8235      // The ZipWriter class
8236      // Packs streamed data into an output zip stream
8237
8238
8239      var ZipWriter = /*#__PURE__*/function (_events$EventEmitter) {
8240        _inherits(ZipWriter, _events$EventEmitter);
8241
8242        var _super = _createSuper(ZipWriter);
8243
8244        function ZipWriter(options) {
8245          var _this;
8246
8247          _classCallCheck(this, ZipWriter);
8248
8249          _this = _super.call(this);
8250          _this.options = Object.assign({
8251            type: 'nodebuffer',
8252            compression: 'DEFLATE'
8253          }, options);
8254          _this.zip = new JSZip();
8255          _this.stream = new StreamBuf();
8256          return _this;
8257        }
8258
8259        _createClass(ZipWriter, [{
8260          key: "append",
8261          value: function append(data, options) {
8262            if (options.hasOwnProperty('base64') && options.base64) {
8263              this.zip.file(options.name, data, {
8264                base64: true
8265              });
8266            } else {
8267              this.zip.file(options.name, data);
8268            }
8269          }
8270        }, {
8271          key: "finalize",
8272          value: function () {
8273            var _finalize = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
8274              var content;
8275              return regeneratorRuntime.wrap(function _callee$(_context) {
8276                while (1) {
8277                  switch (_context.prev = _context.next) {
8278                    case 0:
8279                      _context.next = 2;
8280                      return this.zip.generateAsync(this.options);
8281
8282                    case 2:
8283                      content = _context.sent;
8284                      this.stream.end(content);
8285                      this.emit('finish');
8286
8287                    case 5:
8288                    case "end":
8289                      return _context.stop();
8290                  }
8291                }
8292              }, _callee, this);
8293            }));
8294
8295            function finalize() {
8296              return _finalize.apply(this, arguments);
8297            }
8298
8299            return finalize;
8300          }() // ==========================================================================
8301          // Stream.Readable interface
8302
8303        }, {
8304          key: "read",
8305          value: function read(size) {
8306            return this.stream.read(size);
8307          }
8308        }, {
8309          key: "setEncoding",
8310          value: function setEncoding(encoding) {
8311            return this.stream.setEncoding(encoding);
8312          }
8313        }, {
8314          key: "pause",
8315          value: function pause() {
8316            return this.stream.pause();
8317          }
8318        }, {
8319          key: "resume",
8320          value: function resume() {
8321            return this.stream.resume();
8322          }
8323        }, {
8324          key: "isPaused",
8325          value: function isPaused() {
8326            return this.stream.isPaused();
8327          }
8328        }, {
8329          key: "pipe",
8330          value: function pipe(destination, options) {
8331            return this.stream.pipe(destination, options);
8332          }
8333        }, {
8334          key: "unpipe",
8335          value: function unpipe(destination) {
8336            return this.stream.unpipe(destination);
8337          }
8338        }, {
8339          key: "unshift",
8340          value: function unshift(chunk) {
8341            return this.stream.unshift(chunk);
8342          }
8343        }, {
8344          key: "wrap",
8345          value: function wrap(stream) {
8346            return this.stream.wrap(stream);
8347          }
8348        }]);
8349
8350        return ZipWriter;
8351      }(events.EventEmitter); // =============================================================================
8352
8353
8354      module.exports = {
8355        ZipWriter: ZipWriter
8356      };
8357    }, {
8358      "./stream-buf": 21,
8359      "events": 344,
8360      "jszip": 376
8361    }],
8362    27: [function (require, module, exports) {
8363      "use strict";
8364
8365      module.exports = {
8366        0: {
8367          f: 'General'
8368        },
8369        1: {
8370          f: '0'
8371        },
8372        2: {
8373          f: '0.00'
8374        },
8375        3: {
8376          f: '#,##0'
8377        },
8378        4: {
8379          f: '#,##0.00'
8380        },
8381        9: {
8382          f: '0%'
8383        },
8384        10: {
8385          f: '0.00%'
8386        },
8387        11: {
8388          f: '0.00E+00'
8389        },
8390        12: {
8391          f: '# ?/?'
8392        },
8393        13: {
8394          f: '# ??/??'
8395        },
8396        14: {
8397          f: 'mm-dd-yy'
8398        },
8399        15: {
8400          f: 'd-mmm-yy'
8401        },
8402        16: {
8403          f: 'd-mmm'
8404        },
8405        17: {
8406          f: 'mmm-yy'
8407        },
8408        18: {
8409          f: 'h:mm AM/PM'
8410        },
8411        19: {
8412          f: 'h:mm:ss AM/PM'
8413        },
8414        20: {
8415          f: 'h:mm'
8416        },
8417        21: {
8418          f: 'h:mm:ss'
8419        },
8420        22: {
8421          f: 'm/d/yy "h":mm'
8422        },
8423        27: {
8424          'zh-tw': '[$-404]e/m/d',
8425          'zh-cn': 'yyyy"年"m"月"',
8426          'ja-jp': '[$-411]ge.m.d',
8427          'ko-kr': 'yyyy"年" mm"月" dd"日"'
8428        },
8429        28: {
8430          'zh-tw': '[$-404]e"年"m"月"d"日"',
8431          'zh-cn': 'm"月"d"日"',
8432          'ja-jp': '[$-411]ggge"年"m"月"d"日"',
8433          'ko-kr': 'mm-dd'
8434        },
8435        29: {
8436          'zh-tw': '[$-404]e"年"m"月"d"日"',
8437          'zh-cn': 'm"月"d"日"',
8438          'ja-jp': '[$-411]ggge"年"m"月"d"日"',
8439          'ko-kr': 'mm-dd'
8440        },
8441        30: {
8442          'zh-tw': 'm/d/yy ',
8443          'zh-cn': 'm-d-yy',
8444          'ja-jp': 'm/d/yy',
8445          'ko-kr': 'mm-dd-yy'
8446        },
8447        31: {
8448          'zh-tw': 'yyyy"年"m"月"d"日"',
8449          'zh-cn': 'yyyy"年"m"月"d"日"',
8450          'ja-jp': 'yyyy"年"m"月"d"日"',
8451          'ko-kr': 'yyyy"년" mm"월" dd"일"'
8452        },
8453        32: {
8454          'zh-tw': 'hh"時"mm"分"',
8455          'zh-cn': 'h"时"mm"分"',
8456          'ja-jp': 'h"時"mm"分"',
8457          'ko-kr': 'h"시" mm"분"'
8458        },
8459        33: {
8460          'zh-tw': 'hh"時"mm"分"ss"秒"',
8461          'zh-cn': 'h"时"mm"分"ss"秒"',
8462          'ja-jp': 'h"時"mm"分"ss"秒"',
8463          'ko-kr': 'h"시" mm"분" ss"초"'
8464        },
8465        34: {
8466          'zh-tw': '上午/下午 hh"時"mm"分"',
8467          'zh-cn': '上午/下午 h"时"mm"分"',
8468          'ja-jp': 'yyyy"年"m"月"',
8469          'ko-kr': 'yyyy-mm-dd'
8470        },
8471        35: {
8472          'zh-tw': '上午/下午 hh"時"mm"分"ss"秒"',
8473          'zh-cn': '上午/下午 h"时"mm"分"ss"秒"',
8474          'ja-jp': 'm"月"d"日"',
8475          'ko-kr': 'yyyy-mm-dd'
8476        },
8477        36: {
8478          'zh-tw': '[$-404]e/m/d',
8479          'zh-cn': 'yyyy"年"m"月"',
8480          'ja-jp': '[$-411]ge.m.d',
8481          'ko-kr': 'yyyy"年" mm"月" dd"日"'
8482        },
8483        37: {
8484          f: '#,##0 ;(#,##0)'
8485        },
8486        38: {
8487          f: '#,##0 ;[Red](#,##0)'
8488        },
8489        39: {
8490          f: '#,##0.00 ;(#,##0.00)'
8491        },
8492        40: {
8493          f: '#,##0.00 ;[Red](#,##0.00)'
8494        },
8495        45: {
8496          f: 'mm:ss'
8497        },
8498        46: {
8499          f: '[h]:mm:ss'
8500        },
8501        47: {
8502          f: 'mmss.0'
8503        },
8504        48: {
8505          f: '##0.0E+0'
8506        },
8507        49: {
8508          f: '@'
8509        },
8510        50: {
8511          'zh-tw': '[$-404]e/m/d',
8512          'zh-cn': 'yyyy"年"m"月"',
8513          'ja-jp': '[$-411]ge.m.d',
8514          'ko-kr': 'yyyy"年" mm"月" dd"日"'
8515        },
8516        51: {
8517          'zh-tw': '[$-404]e"年"m"月"d"日"',
8518          'zh-cn': 'm"月"d"日"',
8519          'ja-jp': '[$-411]ggge"年"m"月"d"日"',
8520          'ko-kr': 'mm-dd'
8521        },
8522        52: {
8523          'zh-tw': '上午/下午 hh"時"mm"分"',
8524          'zh-cn': 'yyyy"年"m"月"',
8525          'ja-jp': 'yyyy"年"m"月"',
8526          'ko-kr': 'yyyy-mm-dd'
8527        },
8528        53: {
8529          'zh-tw': '上午/下午 hh"時"mm"分"ss"秒"',
8530          'zh-cn': 'm"月"d"日"',
8531          'ja-jp': 'm"月"d"日"',
8532          'ko-kr': 'yyyy-mm-dd'
8533        },
8534        54: {
8535          'zh-tw': '[$-404]e"年"m"月"d"日"',
8536          'zh-cn': 'm"月"d"日"',
8537          'ja-jp': '[$-411]ggge"年"m"月"d"日"',
8538          'ko-kr': 'mm-dd'
8539        },
8540        55: {
8541          'zh-tw': '上午/下午 hh"時"mm"分"',
8542          'zh-cn': '上午/下午 h"时"mm"分"',
8543          'ja-jp': 'yyyy"年"m"月"',
8544          'ko-kr': 'yyyy-mm-dd'
8545        },
8546        56: {
8547          'zh-tw': '上午/下午 hh"時"mm"分"ss"秒"',
8548          'zh-cn': '上午/下午 h"时"mm"分"ss"秒"',
8549          'ja-jp': 'm"月"d"日"',
8550          'ko-kr': 'yyyy-mm-dd'
8551        },
8552        57: {
8553          'zh-tw': '[$-404]e/m/d',
8554          'zh-cn': 'yyyy"年"m"月"',
8555          'ja-jp': '[$-411]ge.m.d',
8556          'ko-kr': 'yyyy"年" mm"月" dd"日"'
8557        },
8558        58: {
8559          'zh-tw': '[$-404]e"年"m"月"d"日"',
8560          'zh-cn': 'm"月"d"日"',
8561          'ja-jp': '[$-411]ggge"年"m"月"d"日"',
8562          'ko-kr': 'mm-dd'
8563        },
8564        59: {
8565          'th-th': 't0'
8566        },
8567        60: {
8568          'th-th': 't0.00'
8569        },
8570        61: {
8571          'th-th': 't#,##0'
8572        },
8573        62: {
8574          'th-th': 't#,##0.00'
8575        },
8576        67: {
8577          'th-th': 't0%'
8578        },
8579        68: {
8580          'th-th': 't0.00%'
8581        },
8582        69: {
8583          'th-th': 't# ?/?'
8584        },
8585        70: {
8586          'th-th': 't# ??/??'
8587        },
8588        81: {
8589          'th-th': 'd/m/bb'
8590        }
8591      };
8592    }, {}],
8593    28: [function (require, module, exports) {
8594      'use strict';
8595
8596      module.exports = {
8597        OfficeDocument: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument',
8598        Worksheet: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet',
8599        CalcChain: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/calcChain',
8600        SharedStrings: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings',
8601        Styles: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles',
8602        Theme: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme',
8603        Hyperlink: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink',
8604        Image: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image',
8605        CoreProperties: 'http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties',
8606        ExtenderProperties: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties',
8607        Comments: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments',
8608        VmlDrawing: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing',
8609        Table: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/table'
8610      };
8611    }, {}],
8612    29: [function (require, module, exports) {
8613      "use strict";
8614
8615      function _createForOfIteratorHelper(o) {
8616        if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
8617          if (Array.isArray(o) || (o = _unsupportedIterableToArray(o))) {
8618            var i = 0;
8619
8620            var F = function F() {};
8621
8622            return {
8623              s: F,
8624              n: function n() {
8625                if (i >= o.length) return {
8626                  done: true
8627                };
8628                return {
8629                  done: false,
8630                  value: o[i++]
8631                };
8632              },
8633              e: function e(_e) {
8634                throw _e;
8635              },
8636              f: F
8637            };
8638          }
8639
8640          throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
8641        }
8642
8643        var it,
8644            normalCompletion = true,
8645            didErr = false,
8646            err;
8647        return {
8648          s: function s() {
8649            it = o[Symbol.iterator]();
8650          },
8651          n: function n() {
8652            var step = it.next();
8653            normalCompletion = step.done;
8654            return step;
8655          },
8656          e: function e(_e2) {
8657            didErr = true;
8658            err = _e2;
8659          },
8660          f: function f() {
8661            try {
8662              if (!normalCompletion && it.return != null) it.return();
8663            } finally {
8664              if (didErr) throw err;
8665            }
8666          }
8667        };
8668      }
8669
8670      function _unsupportedIterableToArray(o, minLen) {
8671        if (!o) return;
8672        if (typeof o === "string") return _arrayLikeToArray(o, minLen);
8673        var n = Object.prototype.toString.call(o).slice(8, -1);
8674        if (n === "Object" && o.constructor) n = o.constructor.name;
8675        if (n === "Map" || n === "Set") return Array.from(n);
8676        if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
8677      }
8678
8679      function _arrayLikeToArray(arr, len) {
8680        if (len == null || len > arr.length) len = arr.length;
8681
8682        for (var i = 0, arr2 = new Array(len); i < len; i++) {
8683          arr2[i] = arr[i];
8684        }
8685
8686        return arr2;
8687      }
8688
8689      function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
8690        try {
8691          var info = gen[key](arg);
8692          var value = info.value;
8693        } catch (error) {
8694          reject(error);
8695          return;
8696        }
8697
8698        if (info.done) {
8699          resolve(value);
8700        } else {
8701          Promise.resolve(value).then(_next, _throw);
8702        }
8703      }
8704
8705      function _asyncToGenerator(fn) {
8706        return function () {
8707          var self = this,
8708              args = arguments;
8709          return new Promise(function (resolve, reject) {
8710            var gen = fn.apply(self, args);
8711
8712            function _next(value) {
8713              asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
8714            }
8715
8716            function _throw(err) {
8717              asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
8718            }
8719
8720            _next(undefined);
8721          });
8722        };
8723      }
8724
8725      function _classCallCheck(instance, Constructor) {
8726        if (!(instance instanceof Constructor)) {
8727          throw new TypeError("Cannot call a class as a function");
8728        }
8729      }
8730
8731      function _defineProperties(target, props) {
8732        for (var i = 0; i < props.length; i++) {
8733          var descriptor = props[i];
8734          descriptor.enumerable = descriptor.enumerable || false;
8735          descriptor.configurable = true;
8736          if ("value" in descriptor) descriptor.writable = true;
8737          Object.defineProperty(target, descriptor.key, descriptor);
8738        }
8739      }
8740
8741      function _createClass(Constructor, protoProps, staticProps) {
8742        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
8743        if (staticProps) _defineProperties(Constructor, staticProps);
8744        return Constructor;
8745      }
8746
8747      function _asyncIterator(iterable) {
8748        var method;
8749
8750        if (typeof Symbol !== "undefined") {
8751          if (Symbol.asyncIterator) {
8752            method = iterable[Symbol.asyncIterator];
8753            if (method != null) return method.call(iterable);
8754          }
8755
8756          if (Symbol.iterator) {
8757            method = iterable[Symbol.iterator];
8758            if (method != null) return method.call(iterable);
8759          }
8760        }
8761
8762        throw new TypeError("Object is not async iterable");
8763      }
8764
8765      var parseSax = require('../../utils/parse-sax');
8766
8767      var XmlStream = require('../../utils/xml-stream');
8768      /* 'virtual' methods used as a form of documentation */
8769
8770      /* eslint-disable class-methods-use-this */
8771      // Base class for Xforms
8772
8773
8774      var BaseXform = /*#__PURE__*/function () {
8775        function BaseXform() {
8776          _classCallCheck(this, BaseXform);
8777        }
8778
8779        _createClass(BaseXform, [{
8780          key: "prepare",
8781          // constructor(/* model, name */) {}
8782          // ============================================================
8783          // Virtual Interface
8784          value: function prepare()
8785          /* model, options */
8786          {// optional preparation (mutation) of model so it is ready for write
8787          }
8788        }, {
8789          key: "render",
8790          value: function render()
8791          /* xmlStream, model */
8792          {// convert model to xml
8793          }
8794        }, {
8795          key: "parseOpen",
8796          value: function parseOpen(node) {// XML node opened
8797          }
8798        }, {
8799          key: "parseText",
8800          value: function parseText(text) {// chunk of text encountered for current node
8801          }
8802        }, {
8803          key: "parseClose",
8804          value: function parseClose(name) {// XML node closed
8805          }
8806        }, {
8807          key: "reconcile",
8808          value: function reconcile(model, options) {} // optional post-parse step (opposite to prepare)
8809          // ============================================================
8810
8811        }, {
8812          key: "reset",
8813          value: function reset() {
8814            // to make sure parses don't bleed to next iteration
8815            this.model = null; // if we have a map - reset them too
8816
8817            if (this.map) {
8818              Object.values(this.map).forEach(function (xform) {
8819                if (xform instanceof BaseXform) {
8820                  xform.reset();
8821                } else if (xform.xform) {
8822                  xform.xform.reset();
8823                }
8824              });
8825            }
8826          }
8827        }, {
8828          key: "mergeModel",
8829          value: function mergeModel(obj) {
8830            // set obj's props to this.model
8831            this.model = Object.assign(this.model || {}, obj);
8832          }
8833        }, {
8834          key: "parse",
8835          value: function () {
8836            var _parse = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(saxParser) {
8837              var _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, events, _iterator2, _step2, _step2$value, eventType, value;
8838
8839              return regeneratorRuntime.wrap(function _callee$(_context) {
8840                while (1) {
8841                  switch (_context.prev = _context.next) {
8842                    case 0:
8843                      _iteratorNormalCompletion = true;
8844                      _didIteratorError = false;
8845                      _context.prev = 2;
8846                      _iterator = _asyncIterator(saxParser);
8847
8848                    case 4:
8849                      _context.next = 6;
8850                      return _iterator.next();
8851
8852                    case 6:
8853                      _step = _context.sent;
8854                      _iteratorNormalCompletion = _step.done;
8855                      _context.next = 10;
8856                      return _step.value;
8857
8858                    case 10:
8859                      _value = _context.sent;
8860
8861                      if (_iteratorNormalCompletion) {
8862                        _context.next = 42;
8863                        break;
8864                      }
8865
8866                      events = _value;
8867                      _iterator2 = _createForOfIteratorHelper(events);
8868                      _context.prev = 14;
8869
8870                      _iterator2.s();
8871
8872                    case 16:
8873                      if ((_step2 = _iterator2.n()).done) {
8874                        _context.next = 31;
8875                        break;
8876                      }
8877
8878                      _step2$value = _step2.value, eventType = _step2$value.eventType, value = _step2$value.value;
8879
8880                      if (!(eventType === 'opentag')) {
8881                        _context.next = 22;
8882                        break;
8883                      }
8884
8885                      this.parseOpen(value);
8886                      _context.next = 29;
8887                      break;
8888
8889                    case 22:
8890                      if (!(eventType === 'text')) {
8891                        _context.next = 26;
8892                        break;
8893                      }
8894
8895                      this.parseText(value);
8896                      _context.next = 29;
8897                      break;
8898
8899                    case 26:
8900                      if (!(eventType === 'closetag')) {
8901                        _context.next = 29;
8902                        break;
8903                      }
8904
8905                      if (this.parseClose(value.name)) {
8906                        _context.next = 29;
8907                        break;
8908                      }
8909
8910                      return _context.abrupt("return", this.model);
8911
8912                    case 29:
8913                      _context.next = 16;
8914                      break;
8915
8916                    case 31:
8917                      _context.next = 36;
8918                      break;
8919
8920                    case 33:
8921                      _context.prev = 33;
8922                      _context.t0 = _context["catch"](14);
8923
8924                      _iterator2.e(_context.t0);
8925
8926                    case 36:
8927                      _context.prev = 36;
8928
8929                      _iterator2.f();
8930
8931                      return _context.finish(36);
8932
8933                    case 39:
8934                      _iteratorNormalCompletion = true;
8935                      _context.next = 4;
8936                      break;
8937
8938                    case 42:
8939                      _context.next = 48;
8940                      break;
8941
8942                    case 44:
8943                      _context.prev = 44;
8944                      _context.t1 = _context["catch"](2);
8945                      _didIteratorError = true;
8946                      _iteratorError = _context.t1;
8947
8948                    case 48:
8949                      _context.prev = 48;
8950                      _context.prev = 49;
8951
8952                      if (!(!_iteratorNormalCompletion && _iterator.return != null)) {
8953                        _context.next = 53;
8954                        break;
8955                      }
8956
8957                      _context.next = 53;
8958                      return _iterator.return();
8959
8960                    case 53:
8961                      _context.prev = 53;
8962
8963                      if (!_didIteratorError) {
8964                        _context.next = 56;
8965                        break;
8966                      }
8967
8968                      throw _iteratorError;
8969
8970                    case 56:
8971                      return _context.finish(53);
8972
8973                    case 57:
8974                      return _context.finish(48);
8975
8976                    case 58:
8977                      return _context.abrupt("return", this.model);
8978
8979                    case 59:
8980                    case "end":
8981                      return _context.stop();
8982                  }
8983                }
8984              }, _callee, this, [[2, 44, 48, 58], [14, 33, 36, 39], [49,, 53, 57]]);
8985            }));
8986
8987            function parse(_x) {
8988              return _parse.apply(this, arguments);
8989            }
8990
8991            return parse;
8992          }()
8993        }, {
8994          key: "parseStream",
8995          value: function () {
8996            var _parseStream = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(stream) {
8997              return regeneratorRuntime.wrap(function _callee2$(_context2) {
8998                while (1) {
8999                  switch (_context2.prev = _context2.next) {
9000                    case 0:
9001                      return _context2.abrupt("return", this.parse(parseSax(stream)));
9002
9003                    case 1:
9004                    case "end":
9005                      return _context2.stop();
9006                  }
9007                }
9008              }, _callee2, this);
9009            }));
9010
9011            function parseStream(_x2) {
9012              return _parseStream.apply(this, arguments);
9013            }
9014
9015            return parseStream;
9016          }()
9017        }, {
9018          key: "toXml",
9019          value: function toXml(model) {
9020            var xmlStream = new XmlStream();
9021            this.render(xmlStream, model);
9022            return xmlStream.xml;
9023          } // ============================================================
9024          // Useful Utilities
9025
9026        }, {
9027          key: "xml",
9028          get: function get() {
9029            // convenience function to get the xml of this.model
9030            // useful for manager types that are built during the prepare phase
9031            return this.toXml(this.model);
9032          }
9033        }], [{
9034          key: "toAttribute",
9035          value: function toAttribute(value, dflt) {
9036            var always = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
9037
9038            if (value === undefined) {
9039              if (always) {
9040                return dflt;
9041              }
9042            } else if (always || value !== dflt) {
9043              return value.toString();
9044            }
9045
9046            return undefined;
9047          }
9048        }, {
9049          key: "toStringAttribute",
9050          value: function toStringAttribute(value, dflt) {
9051            var always = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
9052            return BaseXform.toAttribute(value, dflt, always);
9053          }
9054        }, {
9055          key: "toStringValue",
9056          value: function toStringValue(attr, dflt) {
9057            return attr === undefined ? dflt : attr;
9058          }
9059        }, {
9060          key: "toBoolAttribute",
9061          value: function toBoolAttribute(value, dflt) {
9062            var always = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
9063
9064            if (value === undefined) {
9065              if (always) {
9066                return dflt;
9067              }
9068            } else if (always || value !== dflt) {
9069              return value ? '1' : '0';
9070            }
9071
9072            return undefined;
9073          }
9074        }, {
9075          key: "toBoolValue",
9076          value: function toBoolValue(attr, dflt) {
9077            return attr === undefined ? dflt : attr === '1';
9078          }
9079        }, {
9080          key: "toIntAttribute",
9081          value: function toIntAttribute(value, dflt) {
9082            var always = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
9083            return BaseXform.toAttribute(value, dflt, always);
9084          }
9085        }, {
9086          key: "toIntValue",
9087          value: function toIntValue(attr, dflt) {
9088            return attr === undefined ? dflt : parseInt(attr, 10);
9089          }
9090        }, {
9091          key: "toFloatAttribute",
9092          value: function toFloatAttribute(value, dflt) {
9093            var always = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
9094            return BaseXform.toAttribute(value, dflt, always);
9095          }
9096        }, {
9097          key: "toFloatValue",
9098          value: function toFloatValue(attr, dflt) {
9099            return attr === undefined ? dflt : parseFloat(attr);
9100          }
9101        }]);
9102
9103        return BaseXform;
9104      }();
9105
9106      module.exports = BaseXform;
9107    }, {
9108      "../../utils/parse-sax": 19,
9109      "../../utils/xml-stream": 25
9110    }],
9111    30: [function (require, module, exports) {
9112      "use strict";
9113
9114      function _typeof(obj) {
9115        "@babel/helpers - typeof";
9116
9117        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
9118          _typeof = function _typeof(obj) {
9119            return typeof obj;
9120          };
9121        } else {
9122          _typeof = function _typeof(obj) {
9123            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
9124          };
9125        }
9126
9127        return _typeof(obj);
9128      }
9129
9130      function _classCallCheck(instance, Constructor) {
9131        if (!(instance instanceof Constructor)) {
9132          throw new TypeError("Cannot call a class as a function");
9133        }
9134      }
9135
9136      function _defineProperties(target, props) {
9137        for (var i = 0; i < props.length; i++) {
9138          var descriptor = props[i];
9139          descriptor.enumerable = descriptor.enumerable || false;
9140          descriptor.configurable = true;
9141          if ("value" in descriptor) descriptor.writable = true;
9142          Object.defineProperty(target, descriptor.key, descriptor);
9143        }
9144      }
9145
9146      function _createClass(Constructor, protoProps, staticProps) {
9147        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
9148        if (staticProps) _defineProperties(Constructor, staticProps);
9149        return Constructor;
9150      }
9151
9152      function _inherits(subClass, superClass) {
9153        if (typeof superClass !== "function" && superClass !== null) {
9154          throw new TypeError("Super expression must either be null or a function");
9155        }
9156
9157        subClass.prototype = Object.create(superClass && superClass.prototype, {
9158          constructor: {
9159            value: subClass,
9160            writable: true,
9161            configurable: true
9162          }
9163        });
9164        if (superClass) _setPrototypeOf(subClass, superClass);
9165      }
9166
9167      function _setPrototypeOf(o, p) {
9168        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
9169          o.__proto__ = p;
9170          return o;
9171        };
9172
9173        return _setPrototypeOf(o, p);
9174      }
9175
9176      function _createSuper(Derived) {
9177        return function () {
9178          var Super = _getPrototypeOf(Derived),
9179              result;
9180
9181          if (_isNativeReflectConstruct()) {
9182            var NewTarget = _getPrototypeOf(this).constructor;
9183
9184            result = Reflect.construct(Super, arguments, NewTarget);
9185          } else {
9186            result = Super.apply(this, arguments);
9187          }
9188
9189          return _possibleConstructorReturn(this, result);
9190        };
9191      }
9192
9193      function _possibleConstructorReturn(self, call) {
9194        if (call && (_typeof(call) === "object" || typeof call === "function")) {
9195          return call;
9196        }
9197
9198        return _assertThisInitialized(self);
9199      }
9200
9201      function _assertThisInitialized(self) {
9202        if (self === void 0) {
9203          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
9204        }
9205
9206        return self;
9207      }
9208
9209      function _isNativeReflectConstruct() {
9210        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
9211        if (Reflect.construct.sham) return false;
9212        if (typeof Proxy === "function") return true;
9213
9214        try {
9215          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
9216          return true;
9217        } catch (e) {
9218          return false;
9219        }
9220      }
9221
9222      function _getPrototypeOf(o) {
9223        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
9224          return o.__proto__ || Object.getPrototypeOf(o);
9225        };
9226        return _getPrototypeOf(o);
9227      }
9228
9229      var BaseXform = require('../base-xform');
9230
9231      var colCache = require('../../../utils/col-cache');
9232
9233      var DefinedNamesXform = /*#__PURE__*/function (_BaseXform) {
9234        _inherits(DefinedNamesXform, _BaseXform);
9235
9236        var _super = _createSuper(DefinedNamesXform);
9237
9238        function DefinedNamesXform() {
9239          _classCallCheck(this, DefinedNamesXform);
9240
9241          return _super.apply(this, arguments);
9242        }
9243
9244        _createClass(DefinedNamesXform, [{
9245          key: "render",
9246          value: function render(xmlStream, model) {
9247            // <definedNames>
9248            //   <definedName name="name">name.ranges.join(',')</definedName>
9249            //   <definedName name="_xlnm.Print_Area" localSheetId="0">name.ranges.join(',')</definedName>
9250            // </definedNames>
9251            xmlStream.openNode('definedName', {
9252              name: model.name,
9253              localSheetId: model.localSheetId
9254            });
9255            xmlStream.writeText(model.ranges.join(','));
9256            xmlStream.closeNode();
9257          }
9258        }, {
9259          key: "parseOpen",
9260          value: function parseOpen(node) {
9261            switch (node.name) {
9262              case 'definedName':
9263                this._parsedName = node.attributes.name;
9264                this._parsedLocalSheetId = node.attributes.localSheetId;
9265                this._parsedText = [];
9266                return true;
9267
9268              default:
9269                return false;
9270            }
9271          }
9272        }, {
9273          key: "parseText",
9274          value: function parseText(text) {
9275            this._parsedText.push(text);
9276          }
9277        }, {
9278          key: "parseClose",
9279          value: function parseClose() {
9280            this.model = {
9281              name: this._parsedName,
9282              ranges: extractRanges(this._parsedText.join(''))
9283            };
9284
9285            if (this._parsedLocalSheetId !== undefined) {
9286              this.model.localSheetId = parseInt(this._parsedLocalSheetId, 10);
9287            }
9288
9289            return false;
9290          }
9291        }]);
9292
9293        return DefinedNamesXform;
9294      }(BaseXform);
9295
9296      function isValidRange(range) {
9297        try {
9298          colCache.decodeEx(range);
9299          return true;
9300        } catch (err) {
9301          return false;
9302        }
9303      }
9304
9305      function extractRanges(parsedText) {
9306        var ranges = [];
9307        var quotesOpened = false;
9308        var last = '';
9309        parsedText.split(',').forEach(function (item) {
9310          if (!item) {
9311            return;
9312          }
9313
9314          var quotes = (item.match(/'/g) || []).length;
9315
9316          if (!quotes) {
9317            if (quotesOpened) {
9318              last += "".concat(item, ",");
9319            } else if (isValidRange(item)) {
9320              ranges.push(item);
9321            }
9322
9323            return;
9324          }
9325
9326          var quotesEven = quotes % 2 === 0;
9327
9328          if (!quotesOpened && quotesEven && isValidRange(item)) {
9329            ranges.push(item);
9330          } else if (quotesOpened && !quotesEven) {
9331            quotesOpened = false;
9332
9333            if (isValidRange(last + item)) {
9334              ranges.push(last + item);
9335            }
9336
9337            last = '';
9338          } else {
9339            quotesOpened = true;
9340            last += "".concat(item, ",");
9341          }
9342        });
9343        return ranges;
9344      }
9345
9346      module.exports = DefinedNamesXform;
9347    }, {
9348      "../../../utils/col-cache": 17,
9349      "../base-xform": 29
9350    }],
9351    31: [function (require, module, exports) {
9352      "use strict";
9353
9354      function _typeof(obj) {
9355        "@babel/helpers - typeof";
9356
9357        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
9358          _typeof = function _typeof(obj) {
9359            return typeof obj;
9360          };
9361        } else {
9362          _typeof = function _typeof(obj) {
9363            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
9364          };
9365        }
9366
9367        return _typeof(obj);
9368      }
9369
9370      function _classCallCheck(instance, Constructor) {
9371        if (!(instance instanceof Constructor)) {
9372          throw new TypeError("Cannot call a class as a function");
9373        }
9374      }
9375
9376      function _defineProperties(target, props) {
9377        for (var i = 0; i < props.length; i++) {
9378          var descriptor = props[i];
9379          descriptor.enumerable = descriptor.enumerable || false;
9380          descriptor.configurable = true;
9381          if ("value" in descriptor) descriptor.writable = true;
9382          Object.defineProperty(target, descriptor.key, descriptor);
9383        }
9384      }
9385
9386      function _createClass(Constructor, protoProps, staticProps) {
9387        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
9388        if (staticProps) _defineProperties(Constructor, staticProps);
9389        return Constructor;
9390      }
9391
9392      function _inherits(subClass, superClass) {
9393        if (typeof superClass !== "function" && superClass !== null) {
9394          throw new TypeError("Super expression must either be null or a function");
9395        }
9396
9397        subClass.prototype = Object.create(superClass && superClass.prototype, {
9398          constructor: {
9399            value: subClass,
9400            writable: true,
9401            configurable: true
9402          }
9403        });
9404        if (superClass) _setPrototypeOf(subClass, superClass);
9405      }
9406
9407      function _setPrototypeOf(o, p) {
9408        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
9409          o.__proto__ = p;
9410          return o;
9411        };
9412
9413        return _setPrototypeOf(o, p);
9414      }
9415
9416      function _createSuper(Derived) {
9417        return function () {
9418          var Super = _getPrototypeOf(Derived),
9419              result;
9420
9421          if (_isNativeReflectConstruct()) {
9422            var NewTarget = _getPrototypeOf(this).constructor;
9423
9424            result = Reflect.construct(Super, arguments, NewTarget);
9425          } else {
9426            result = Super.apply(this, arguments);
9427          }
9428
9429          return _possibleConstructorReturn(this, result);
9430        };
9431      }
9432
9433      function _possibleConstructorReturn(self, call) {
9434        if (call && (_typeof(call) === "object" || typeof call === "function")) {
9435          return call;
9436        }
9437
9438        return _assertThisInitialized(self);
9439      }
9440
9441      function _assertThisInitialized(self) {
9442        if (self === void 0) {
9443          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
9444        }
9445
9446        return self;
9447      }
9448
9449      function _isNativeReflectConstruct() {
9450        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
9451        if (Reflect.construct.sham) return false;
9452        if (typeof Proxy === "function") return true;
9453
9454        try {
9455          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
9456          return true;
9457        } catch (e) {
9458          return false;
9459        }
9460      }
9461
9462      function _getPrototypeOf(o) {
9463        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
9464          return o.__proto__ || Object.getPrototypeOf(o);
9465        };
9466        return _getPrototypeOf(o);
9467      }
9468
9469      var utils = require('../../../utils/utils');
9470
9471      var BaseXform = require('../base-xform');
9472
9473      var WorksheetXform = /*#__PURE__*/function (_BaseXform) {
9474        _inherits(WorksheetXform, _BaseXform);
9475
9476        var _super = _createSuper(WorksheetXform);
9477
9478        function WorksheetXform() {
9479          _classCallCheck(this, WorksheetXform);
9480
9481          return _super.apply(this, arguments);
9482        }
9483
9484        _createClass(WorksheetXform, [{
9485          key: "render",
9486          value: function render(xmlStream, model) {
9487            xmlStream.leafNode('sheet', {
9488              sheetId: model.id,
9489              name: model.name,
9490              state: model.state,
9491              'r:id': model.rId
9492            });
9493          }
9494        }, {
9495          key: "parseOpen",
9496          value: function parseOpen(node) {
9497            if (node.name === 'sheet') {
9498              this.model = {
9499                name: utils.xmlDecode(node.attributes.name),
9500                id: parseInt(node.attributes.sheetId, 10),
9501                state: node.attributes.state,
9502                rId: node.attributes['r:id']
9503              };
9504              return true;
9505            }
9506
9507            return false;
9508          }
9509        }, {
9510          key: "parseText",
9511          value: function parseText() {}
9512        }, {
9513          key: "parseClose",
9514          value: function parseClose() {
9515            return false;
9516          }
9517        }]);
9518
9519        return WorksheetXform;
9520      }(BaseXform);
9521
9522      module.exports = WorksheetXform;
9523    }, {
9524      "../../../utils/utils": 24,
9525      "../base-xform": 29
9526    }],
9527    32: [function (require, module, exports) {
9528      "use strict";
9529
9530      function _typeof(obj) {
9531        "@babel/helpers - typeof";
9532
9533        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
9534          _typeof = function _typeof(obj) {
9535            return typeof obj;
9536          };
9537        } else {
9538          _typeof = function _typeof(obj) {
9539            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
9540          };
9541        }
9542
9543        return _typeof(obj);
9544      }
9545
9546      function _classCallCheck(instance, Constructor) {
9547        if (!(instance instanceof Constructor)) {
9548          throw new TypeError("Cannot call a class as a function");
9549        }
9550      }
9551
9552      function _defineProperties(target, props) {
9553        for (var i = 0; i < props.length; i++) {
9554          var descriptor = props[i];
9555          descriptor.enumerable = descriptor.enumerable || false;
9556          descriptor.configurable = true;
9557          if ("value" in descriptor) descriptor.writable = true;
9558          Object.defineProperty(target, descriptor.key, descriptor);
9559        }
9560      }
9561
9562      function _createClass(Constructor, protoProps, staticProps) {
9563        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
9564        if (staticProps) _defineProperties(Constructor, staticProps);
9565        return Constructor;
9566      }
9567
9568      function _inherits(subClass, superClass) {
9569        if (typeof superClass !== "function" && superClass !== null) {
9570          throw new TypeError("Super expression must either be null or a function");
9571        }
9572
9573        subClass.prototype = Object.create(superClass && superClass.prototype, {
9574          constructor: {
9575            value: subClass,
9576            writable: true,
9577            configurable: true
9578          }
9579        });
9580        if (superClass) _setPrototypeOf(subClass, superClass);
9581      }
9582
9583      function _setPrototypeOf(o, p) {
9584        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
9585          o.__proto__ = p;
9586          return o;
9587        };
9588
9589        return _setPrototypeOf(o, p);
9590      }
9591
9592      function _createSuper(Derived) {
9593        return function () {
9594          var Super = _getPrototypeOf(Derived),
9595              result;
9596
9597          if (_isNativeReflectConstruct()) {
9598            var NewTarget = _getPrototypeOf(this).constructor;
9599
9600            result = Reflect.construct(Super, arguments, NewTarget);
9601          } else {
9602            result = Super.apply(this, arguments);
9603          }
9604
9605          return _possibleConstructorReturn(this, result);
9606        };
9607      }
9608
9609      function _possibleConstructorReturn(self, call) {
9610        if (call && (_typeof(call) === "object" || typeof call === "function")) {
9611          return call;
9612        }
9613
9614        return _assertThisInitialized(self);
9615      }
9616
9617      function _assertThisInitialized(self) {
9618        if (self === void 0) {
9619          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
9620        }
9621
9622        return self;
9623      }
9624
9625      function _isNativeReflectConstruct() {
9626        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
9627        if (Reflect.construct.sham) return false;
9628        if (typeof Proxy === "function") return true;
9629
9630        try {
9631          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
9632          return true;
9633        } catch (e) {
9634          return false;
9635        }
9636      }
9637
9638      function _getPrototypeOf(o) {
9639        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
9640          return o.__proto__ || Object.getPrototypeOf(o);
9641        };
9642        return _getPrototypeOf(o);
9643      }
9644
9645      var BaseXform = require('../base-xform');
9646
9647      var WorkbookCalcPropertiesXform = /*#__PURE__*/function (_BaseXform) {
9648        _inherits(WorkbookCalcPropertiesXform, _BaseXform);
9649
9650        var _super = _createSuper(WorkbookCalcPropertiesXform);
9651
9652        function WorkbookCalcPropertiesXform() {
9653          _classCallCheck(this, WorkbookCalcPropertiesXform);
9654
9655          return _super.apply(this, arguments);
9656        }
9657
9658        _createClass(WorkbookCalcPropertiesXform, [{
9659          key: "render",
9660          value: function render(xmlStream, model) {
9661            xmlStream.leafNode('calcPr', {
9662              calcId: 171027,
9663              fullCalcOnLoad: model.fullCalcOnLoad ? 1 : undefined
9664            });
9665          }
9666        }, {
9667          key: "parseOpen",
9668          value: function parseOpen(node) {
9669            if (node.name === 'calcPr') {
9670              this.model = {};
9671              return true;
9672            }
9673
9674            return false;
9675          }
9676        }, {
9677          key: "parseText",
9678          value: function parseText() {}
9679        }, {
9680          key: "parseClose",
9681          value: function parseClose() {
9682            return false;
9683          }
9684        }]);
9685
9686        return WorkbookCalcPropertiesXform;
9687      }(BaseXform);
9688
9689      module.exports = WorkbookCalcPropertiesXform;
9690    }, {
9691      "../base-xform": 29
9692    }],
9693    33: [function (require, module, exports) {
9694      "use strict";
9695
9696      function _typeof(obj) {
9697        "@babel/helpers - typeof";
9698
9699        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
9700          _typeof = function _typeof(obj) {
9701            return typeof obj;
9702          };
9703        } else {
9704          _typeof = function _typeof(obj) {
9705            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
9706          };
9707        }
9708
9709        return _typeof(obj);
9710      }
9711
9712      function _classCallCheck(instance, Constructor) {
9713        if (!(instance instanceof Constructor)) {
9714          throw new TypeError("Cannot call a class as a function");
9715        }
9716      }
9717
9718      function _defineProperties(target, props) {
9719        for (var i = 0; i < props.length; i++) {
9720          var descriptor = props[i];
9721          descriptor.enumerable = descriptor.enumerable || false;
9722          descriptor.configurable = true;
9723          if ("value" in descriptor) descriptor.writable = true;
9724          Object.defineProperty(target, descriptor.key, descriptor);
9725        }
9726      }
9727
9728      function _createClass(Constructor, protoProps, staticProps) {
9729        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
9730        if (staticProps) _defineProperties(Constructor, staticProps);
9731        return Constructor;
9732      }
9733
9734      function _inherits(subClass, superClass) {
9735        if (typeof superClass !== "function" && superClass !== null) {
9736          throw new TypeError("Super expression must either be null or a function");
9737        }
9738
9739        subClass.prototype = Object.create(superClass && superClass.prototype, {
9740          constructor: {
9741            value: subClass,
9742            writable: true,
9743            configurable: true
9744          }
9745        });
9746        if (superClass) _setPrototypeOf(subClass, superClass);
9747      }
9748
9749      function _setPrototypeOf(o, p) {
9750        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
9751          o.__proto__ = p;
9752          return o;
9753        };
9754
9755        return _setPrototypeOf(o, p);
9756      }
9757
9758      function _createSuper(Derived) {
9759        return function () {
9760          var Super = _getPrototypeOf(Derived),
9761              result;
9762
9763          if (_isNativeReflectConstruct()) {
9764            var NewTarget = _getPrototypeOf(this).constructor;
9765
9766            result = Reflect.construct(Super, arguments, NewTarget);
9767          } else {
9768            result = Super.apply(this, arguments);
9769          }
9770
9771          return _possibleConstructorReturn(this, result);
9772        };
9773      }
9774
9775      function _possibleConstructorReturn(self, call) {
9776        if (call && (_typeof(call) === "object" || typeof call === "function")) {
9777          return call;
9778        }
9779
9780        return _assertThisInitialized(self);
9781      }
9782
9783      function _assertThisInitialized(self) {
9784        if (self === void 0) {
9785          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
9786        }
9787
9788        return self;
9789      }
9790
9791      function _isNativeReflectConstruct() {
9792        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
9793        if (Reflect.construct.sham) return false;
9794        if (typeof Proxy === "function") return true;
9795
9796        try {
9797          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
9798          return true;
9799        } catch (e) {
9800          return false;
9801        }
9802      }
9803
9804      function _getPrototypeOf(o) {
9805        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
9806          return o.__proto__ || Object.getPrototypeOf(o);
9807        };
9808        return _getPrototypeOf(o);
9809      }
9810
9811      var BaseXform = require('../base-xform');
9812
9813      var WorksheetPropertiesXform = /*#__PURE__*/function (_BaseXform) {
9814        _inherits(WorksheetPropertiesXform, _BaseXform);
9815
9816        var _super = _createSuper(WorksheetPropertiesXform);
9817
9818        function WorksheetPropertiesXform() {
9819          _classCallCheck(this, WorksheetPropertiesXform);
9820
9821          return _super.apply(this, arguments);
9822        }
9823
9824        _createClass(WorksheetPropertiesXform, [{
9825          key: "render",
9826          value: function render(xmlStream, model) {
9827            xmlStream.leafNode('workbookPr', {
9828              date1904: model.date1904 ? 1 : undefined,
9829              defaultThemeVersion: 164011,
9830              filterPrivacy: 1
9831            });
9832          }
9833        }, {
9834          key: "parseOpen",
9835          value: function parseOpen(node) {
9836            if (node.name === 'workbookPr') {
9837              this.model = {
9838                date1904: node.attributes.date1904 === '1'
9839              };
9840              return true;
9841            }
9842
9843            return false;
9844          }
9845        }, {
9846          key: "parseText",
9847          value: function parseText() {}
9848        }, {
9849          key: "parseClose",
9850          value: function parseClose() {
9851            return false;
9852          }
9853        }]);
9854
9855        return WorksheetPropertiesXform;
9856      }(BaseXform);
9857
9858      module.exports = WorksheetPropertiesXform;
9859    }, {
9860      "../base-xform": 29
9861    }],
9862    34: [function (require, module, exports) {
9863      "use strict";
9864
9865      function _typeof(obj) {
9866        "@babel/helpers - typeof";
9867
9868        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
9869          _typeof = function _typeof(obj) {
9870            return typeof obj;
9871          };
9872        } else {
9873          _typeof = function _typeof(obj) {
9874            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
9875          };
9876        }
9877
9878        return _typeof(obj);
9879      }
9880
9881      function _classCallCheck(instance, Constructor) {
9882        if (!(instance instanceof Constructor)) {
9883          throw new TypeError("Cannot call a class as a function");
9884        }
9885      }
9886
9887      function _defineProperties(target, props) {
9888        for (var i = 0; i < props.length; i++) {
9889          var descriptor = props[i];
9890          descriptor.enumerable = descriptor.enumerable || false;
9891          descriptor.configurable = true;
9892          if ("value" in descriptor) descriptor.writable = true;
9893          Object.defineProperty(target, descriptor.key, descriptor);
9894        }
9895      }
9896
9897      function _createClass(Constructor, protoProps, staticProps) {
9898        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
9899        if (staticProps) _defineProperties(Constructor, staticProps);
9900        return Constructor;
9901      }
9902
9903      function _inherits(subClass, superClass) {
9904        if (typeof superClass !== "function" && superClass !== null) {
9905          throw new TypeError("Super expression must either be null or a function");
9906        }
9907
9908        subClass.prototype = Object.create(superClass && superClass.prototype, {
9909          constructor: {
9910            value: subClass,
9911            writable: true,
9912            configurable: true
9913          }
9914        });
9915        if (superClass) _setPrototypeOf(subClass, superClass);
9916      }
9917
9918      function _setPrototypeOf(o, p) {
9919        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
9920          o.__proto__ = p;
9921          return o;
9922        };
9923
9924        return _setPrototypeOf(o, p);
9925      }
9926
9927      function _createSuper(Derived) {
9928        return function () {
9929          var Super = _getPrototypeOf(Derived),
9930              result;
9931
9932          if (_isNativeReflectConstruct()) {
9933            var NewTarget = _getPrototypeOf(this).constructor;
9934
9935            result = Reflect.construct(Super, arguments, NewTarget);
9936          } else {
9937            result = Super.apply(this, arguments);
9938          }
9939
9940          return _possibleConstructorReturn(this, result);
9941        };
9942      }
9943
9944      function _possibleConstructorReturn(self, call) {
9945        if (call && (_typeof(call) === "object" || typeof call === "function")) {
9946          return call;
9947        }
9948
9949        return _assertThisInitialized(self);
9950      }
9951
9952      function _assertThisInitialized(self) {
9953        if (self === void 0) {
9954          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
9955        }
9956
9957        return self;
9958      }
9959
9960      function _isNativeReflectConstruct() {
9961        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
9962        if (Reflect.construct.sham) return false;
9963        if (typeof Proxy === "function") return true;
9964
9965        try {
9966          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
9967          return true;
9968        } catch (e) {
9969          return false;
9970        }
9971      }
9972
9973      function _getPrototypeOf(o) {
9974        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
9975          return o.__proto__ || Object.getPrototypeOf(o);
9976        };
9977        return _getPrototypeOf(o);
9978      }
9979
9980      var BaseXform = require('../base-xform');
9981
9982      var WorkbookViewXform = /*#__PURE__*/function (_BaseXform) {
9983        _inherits(WorkbookViewXform, _BaseXform);
9984
9985        var _super = _createSuper(WorkbookViewXform);
9986
9987        function WorkbookViewXform() {
9988          _classCallCheck(this, WorkbookViewXform);
9989
9990          return _super.apply(this, arguments);
9991        }
9992
9993        _createClass(WorkbookViewXform, [{
9994          key: "render",
9995          value: function render(xmlStream, model) {
9996            var attributes = {
9997              xWindow: model.x || 0,
9998              yWindow: model.y || 0,
9999              windowWidth: model.width || 12000,
10000              windowHeight: model.height || 24000,
10001              firstSheet: model.firstSheet,
10002              activeTab: model.activeTab
10003            };
10004
10005            if (model.visibility && model.visibility !== 'visible') {
10006              attributes.visibility = model.visibility;
10007            }
10008
10009            xmlStream.leafNode('workbookView', attributes);
10010          }
10011        }, {
10012          key: "parseOpen",
10013          value: function parseOpen(node) {
10014            if (node.name === 'workbookView') {
10015              var model = this.model = {};
10016
10017              var addS = function addS(name, value, dflt) {
10018                var s = value !== undefined ? model[name] = value : dflt;
10019
10020                if (s !== undefined) {
10021                  model[name] = s;
10022                }
10023              };
10024
10025              var addN = function addN(name, value, dflt) {
10026                var n = value !== undefined ? model[name] = parseInt(value, 10) : dflt;
10027
10028                if (n !== undefined) {
10029                  model[name] = n;
10030                }
10031              };
10032
10033              addN('x', node.attributes.xWindow, 0);
10034              addN('y', node.attributes.yWindow, 0);
10035              addN('width', node.attributes.windowWidth, 25000);
10036              addN('height', node.attributes.windowHeight, 10000);
10037              addS('visibility', node.attributes.visibility, 'visible');
10038              addN('activeTab', node.attributes.activeTab, undefined);
10039              addN('firstSheet', node.attributes.firstSheet, undefined);
10040              return true;
10041            }
10042
10043            return false;
10044          }
10045        }, {
10046          key: "parseText",
10047          value: function parseText() {}
10048        }, {
10049          key: "parseClose",
10050          value: function parseClose() {
10051            return false;
10052          }
10053        }]);
10054
10055        return WorkbookViewXform;
10056      }(BaseXform);
10057
10058      module.exports = WorkbookViewXform;
10059    }, {
10060      "../base-xform": 29
10061    }],
10062    35: [function (require, module, exports) {
10063      "use strict";
10064
10065      function _typeof(obj) {
10066        "@babel/helpers - typeof";
10067
10068        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
10069          _typeof = function _typeof(obj) {
10070            return typeof obj;
10071          };
10072        } else {
10073          _typeof = function _typeof(obj) {
10074            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
10075          };
10076        }
10077
10078        return _typeof(obj);
10079      }
10080
10081      function _classCallCheck(instance, Constructor) {
10082        if (!(instance instanceof Constructor)) {
10083          throw new TypeError("Cannot call a class as a function");
10084        }
10085      }
10086
10087      function _defineProperties(target, props) {
10088        for (var i = 0; i < props.length; i++) {
10089          var descriptor = props[i];
10090          descriptor.enumerable = descriptor.enumerable || false;
10091          descriptor.configurable = true;
10092          if ("value" in descriptor) descriptor.writable = true;
10093          Object.defineProperty(target, descriptor.key, descriptor);
10094        }
10095      }
10096
10097      function _createClass(Constructor, protoProps, staticProps) {
10098        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
10099        if (staticProps) _defineProperties(Constructor, staticProps);
10100        return Constructor;
10101      }
10102
10103      function _inherits(subClass, superClass) {
10104        if (typeof superClass !== "function" && superClass !== null) {
10105          throw new TypeError("Super expression must either be null or a function");
10106        }
10107
10108        subClass.prototype = Object.create(superClass && superClass.prototype, {
10109          constructor: {
10110            value: subClass,
10111            writable: true,
10112            configurable: true
10113          }
10114        });
10115        if (superClass) _setPrototypeOf(subClass, superClass);
10116      }
10117
10118      function _setPrototypeOf(o, p) {
10119        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
10120          o.__proto__ = p;
10121          return o;
10122        };
10123
10124        return _setPrototypeOf(o, p);
10125      }
10126
10127      function _createSuper(Derived) {
10128        return function () {
10129          var Super = _getPrototypeOf(Derived),
10130              result;
10131
10132          if (_isNativeReflectConstruct()) {
10133            var NewTarget = _getPrototypeOf(this).constructor;
10134
10135            result = Reflect.construct(Super, arguments, NewTarget);
10136          } else {
10137            result = Super.apply(this, arguments);
10138          }
10139
10140          return _possibleConstructorReturn(this, result);
10141        };
10142      }
10143
10144      function _possibleConstructorReturn(self, call) {
10145        if (call && (_typeof(call) === "object" || typeof call === "function")) {
10146          return call;
10147        }
10148
10149        return _assertThisInitialized(self);
10150      }
10151
10152      function _assertThisInitialized(self) {
10153        if (self === void 0) {
10154          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
10155        }
10156
10157        return self;
10158      }
10159
10160      function _isNativeReflectConstruct() {
10161        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
10162        if (Reflect.construct.sham) return false;
10163        if (typeof Proxy === "function") return true;
10164
10165        try {
10166          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
10167          return true;
10168        } catch (e) {
10169          return false;
10170        }
10171      }
10172
10173      function _getPrototypeOf(o) {
10174        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
10175          return o.__proto__ || Object.getPrototypeOf(o);
10176        };
10177        return _getPrototypeOf(o);
10178      }
10179
10180      var _ = require('../../../utils/under-dash');
10181
10182      var colCache = require('../../../utils/col-cache');
10183
10184      var XmlStream = require('../../../utils/xml-stream');
10185
10186      var BaseXform = require('../base-xform');
10187
10188      var StaticXform = require('../static-xform');
10189
10190      var ListXform = require('../list-xform');
10191
10192      var DefinedNameXform = require('./defined-name-xform');
10193
10194      var SheetXform = require('./sheet-xform');
10195
10196      var WorkbookViewXform = require('./workbook-view-xform');
10197
10198      var WorkbookPropertiesXform = require('./workbook-properties-xform');
10199
10200      var WorkbookCalcPropertiesXform = require('./workbook-calc-properties-xform');
10201
10202      var WorkbookXform = /*#__PURE__*/function (_BaseXform) {
10203        _inherits(WorkbookXform, _BaseXform);
10204
10205        var _super = _createSuper(WorkbookXform);
10206
10207        function WorkbookXform() {
10208          var _this;
10209
10210          _classCallCheck(this, WorkbookXform);
10211
10212          _this = _super.call(this);
10213          _this.map = {
10214            fileVersion: WorkbookXform.STATIC_XFORMS.fileVersion,
10215            workbookPr: new WorkbookPropertiesXform(),
10216            bookViews: new ListXform({
10217              tag: 'bookViews',
10218              count: false,
10219              childXform: new WorkbookViewXform()
10220            }),
10221            sheets: new ListXform({
10222              tag: 'sheets',
10223              count: false,
10224              childXform: new SheetXform()
10225            }),
10226            definedNames: new ListXform({
10227              tag: 'definedNames',
10228              count: false,
10229              childXform: new DefinedNameXform()
10230            }),
10231            calcPr: new WorkbookCalcPropertiesXform()
10232          };
10233          return _this;
10234        }
10235
10236        _createClass(WorkbookXform, [{
10237          key: "prepare",
10238          value: function prepare(model) {
10239            model.sheets = model.worksheets; // collate all the print areas from all of the sheets and add them to the defined names
10240
10241            var printAreas = [];
10242            var index = 0; // sheets is sparse array - calc index manually
10243
10244            model.sheets.forEach(function (sheet) {
10245              if (sheet.pageSetup && sheet.pageSetup.printArea) {
10246                sheet.pageSetup.printArea.split('&&').forEach(function (printArea) {
10247                  var printAreaComponents = printArea.split(':');
10248                  var definedName = {
10249                    name: '_xlnm.Print_Area',
10250                    ranges: ["'".concat(sheet.name, "'!$").concat(printAreaComponents[0], ":$").concat(printAreaComponents[1])],
10251                    localSheetId: index
10252                  };
10253                  printAreas.push(definedName);
10254                });
10255              }
10256
10257              if (sheet.pageSetup && (sheet.pageSetup.printTitlesRow || sheet.pageSetup.printTitlesColumn)) {
10258                var ranges = [];
10259
10260                if (sheet.pageSetup.printTitlesColumn) {
10261                  var titlesColumns = sheet.pageSetup.printTitlesColumn.split(':');
10262                  ranges.push("'".concat(sheet.name, "'!$").concat(titlesColumns[0], ":$").concat(titlesColumns[1]));
10263                }
10264
10265                if (sheet.pageSetup.printTitlesRow) {
10266                  var titlesRows = sheet.pageSetup.printTitlesRow.split(':');
10267                  ranges.push("'".concat(sheet.name, "'!$").concat(titlesRows[0], ":$").concat(titlesRows[1]));
10268                }
10269
10270                var definedName = {
10271                  name: '_xlnm.Print_Titles',
10272                  ranges: ranges,
10273                  localSheetId: index
10274                };
10275                printAreas.push(definedName);
10276              }
10277
10278              index++;
10279            });
10280
10281            if (printAreas.length) {
vendor: 5,922 bytes, lines 10282-10443
10282              model.definedNames = model.definedNames.concat(printAreas);
10283            }
10284
10285            (model.media || []).forEach(function (medium, i) {
10286              // assign name
10287              medium.name = medium.type + (i + 1);
10288            });
10289          }
10290        }, {
10291          key: "render",
10292          value: function render(xmlStream, model) {
10293            xmlStream.openXml(XmlStream.StdDocAttributes);
10294            xmlStream.openNode('workbook', WorkbookXform.WORKBOOK_ATTRIBUTES);
10295            this.map.fileVersion.render(xmlStream);
10296            this.map.workbookPr.render(xmlStream, model.properties);
10297            this.map.bookViews.render(xmlStream, model.views);
10298            this.map.sheets.render(xmlStream, model.sheets);
10299            this.map.definedNames.render(xmlStream, model.definedNames);
10300            this.map.calcPr.render(xmlStream, model.calcProperties);
10301            xmlStream.closeNode();
10302          }
10303        }, {
10304          key: "parseOpen",
10305          value: function parseOpen(node) {
10306            if (this.parser) {
10307              this.parser.parseOpen(node);
10308              return true;
10309            }
10310
10311            switch (node.name) {
10312              case 'workbook':
10313                return true;
10314
10315              default:
10316                this.parser = this.map[node.name];
10317
10318                if (this.parser) {
10319                  this.parser.parseOpen(node);
10320                }
10321
10322                return true;
10323            }
10324          }
10325        }, {
10326          key: "parseText",
10327          value: function parseText(text) {
10328            if (this.parser) {
10329              this.parser.parseText(text);
10330            }
10331          }
10332        }, {
10333          key: "parseClose",
10334          value: function parseClose(name) {
10335            if (this.parser) {
10336              if (!this.parser.parseClose(name)) {
10337                this.parser = undefined;
10338              }
10339
10340              return true;
10341            }
10342
10343            switch (name) {
10344              case 'workbook':
10345                this.model = {
10346                  sheets: this.map.sheets.model,
10347                  properties: this.map.workbookPr.model || {},
10348                  views: this.map.bookViews.model,
10349                  calcProperties: {}
10350                };
10351
10352                if (this.map.definedNames.model) {
10353                  this.model.definedNames = this.map.definedNames.model;
10354                }
10355
10356                return false;
10357
10358              default:
10359                // not quite sure how we get here!
10360                return true;
10361            }
10362          }
10363        }, {
10364          key: "reconcile",
10365          value: function reconcile(model) {
10366            var rels = (model.workbookRels || []).reduce(function (map, rel) {
10367              map[rel.Id] = rel;
10368              return map;
10369            }, {}); // reconcile sheet ids, rIds and names
10370
10371            var worksheets = [];
10372            var worksheet;
10373            var index = 0;
10374            (model.sheets || []).forEach(function (sheet) {
10375              var rel = rels[sheet.rId];
10376
10377              if (!rel) {
10378                return;
10379              } // if rel.Target start with `[space]/xl/` or `/xl/` , then it will be replaced with `''` and spliced behind `xl/`,
10380              // otherwise it will be spliced directly behind `xl/`. i.g.
10381
10382
10383              worksheet = model.worksheetHash["xl/".concat(rel.Target.replace(/^(\s|\/xl\/)+/, ''))]; // If there are "chartsheets" in the file, rel.Target will
10384              // come out as chartsheets/sheet1.xml or similar here, and
10385              // that won't be in model.worksheetHash.
10386              // As we don't have the infrastructure to support chartsheets,
10387              // we will ignore them for now:
10388
10389              if (worksheet) {
10390                worksheet.name = sheet.name;
10391                worksheet.id = sheet.id;
10392                worksheet.state = sheet.state;
10393                worksheets[index++] = worksheet;
10394              }
10395            }); // reconcile print areas
10396
10397            var definedNames = [];
10398
10399            _.each(model.definedNames, function (definedName) {
10400              if (definedName.name === '_xlnm.Print_Area') {
10401                worksheet = worksheets[definedName.localSheetId];
10402
10403                if (worksheet) {
10404                  if (!worksheet.pageSetup) {
10405                    worksheet.pageSetup = {};
10406                  }
10407
10408                  var range = colCache.decodeEx(definedName.ranges[0]);
10409                  worksheet.pageSetup.printArea = worksheet.pageSetup.printArea ? "".concat(worksheet.pageSetup.printArea, "&&").concat(range.dimensions) : range.dimensions;
10410                }
10411              } else if (definedName.name === '_xlnm.Print_Titles') {
10412                worksheet = worksheets[definedName.localSheetId];
10413
10414                if (worksheet) {
10415                  if (!worksheet.pageSetup) {
10416                    worksheet.pageSetup = {};
10417                  }
10418
10419                  var rangeString = definedName.ranges.join(',');
10420                  var dollarRegex = /\$/g;
10421                  var rowRangeRegex = /\$\d+:\$\d+/;
10422                  var rowRangeMatches = rangeString.match(rowRangeRegex);
10423
10424                  if (rowRangeMatches && rowRangeMatches.length) {
10425                    var _range = rowRangeMatches[0];
10426                    worksheet.pageSetup.printTitlesRow = _range.replace(dollarRegex, '');
10427                  }
10428
10429                  var columnRangeRegex = /\$[A-Z]+:\$[A-Z]+/;
10430                  var columnRangeMatches = rangeString.match(columnRangeRegex);
10431
10432                  if (columnRangeMatches && columnRangeMatches.length) {
10433                    var _range2 = columnRangeMatches[0];
10434                    worksheet.pageSetup.printTitlesColumn = _range2.replace(dollarRegex, '');
10435                  }
10436                }
10437              } else {
10438                definedNames.push(definedName);
10439              }
10440            });
10441
10442            model.definedNames = definedNames; // used by sheets to build their image models
10443
10444            model.media.forEach(function (media, i) {
10445              media.index = i;
10446            });
10447          }
10448        }]);
10449
10450        return WorkbookXform;
10451      }(BaseXform);
10452
10453      WorkbookXform.WORKBOOK_ATTRIBUTES = {
10454        xmlns: 'http://schemas.openxmlformats.org/spreadsheetml/2006/main',
10455        'xmlns:r': 'http://schemas.openxmlformats.org/officeDocument/2006/relationships',
10456        'xmlns:mc': 'http://schemas.openxmlformats.org/markup-compatibility/2006',
10457        'mc:Ignorable': 'x15',
10458        'xmlns:x15': 'http://schemas.microsoft.com/office/spreadsheetml/2010/11/main'
10459      };
10460      WorkbookXform.STATIC_XFORMS = {
10461        fileVersion: new StaticXform({
10462          tag: 'fileVersion',
10463          $: {
10464            appName: 'xl',
10465            lastEdited: 5,
10466            lowestEdited: 5,
10467            rupBuild: 9303
10468          }
10469        })
10470      };
10471      module.exports = WorkbookXform;
10472    }, {
10473      "../../../utils/col-cache": 17,
10474      "../../../utils/under-dash": 23,
10475      "../../../utils/xml-stream": 25,
10476      "../base-xform": 29,
10477      "../list-xform": 68,
10478      "../static-xform": 117,
10479      "./defined-name-xform": 30,
10480      "./sheet-xform": 31,
10481      "./workbook-calc-properties-xform": 32,
10482      "./workbook-properties-xform": 33,
10483      "./workbook-view-xform": 34
10484    }],
10485    36: [function (require, module, exports) {
10486      "use strict";
10487
10488      function ownKeys(object, enumerableOnly) {
10489        var keys = Object.keys(object);
10490
10491        if (Object.getOwnPropertySymbols) {
10492          var symbols = Object.getOwnPropertySymbols(object);
10493          if (enumerableOnly) symbols = symbols.filter(function (sym) {
10494            return Object.getOwnPropertyDescriptor(object, sym).enumerable;
10495          });
10496          keys.push.apply(keys, symbols);
10497        }
10498
10499        return keys;
10500      }
10501
10502      function _objectSpread(target) {
10503        for (var i = 1; i < arguments.length; i++) {
10504          var source = arguments[i] != null ? arguments[i] : {};
10505
10506          if (i % 2) {
10507            ownKeys(Object(source), true).forEach(function (key) {
10508              _defineProperty(target, key, source[key]);
10509            });
10510          } else if (Object.getOwnPropertyDescriptors) {
10511            Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
10512          } else {
10513            ownKeys(Object(source)).forEach(function (key) {
10514              Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
10515            });
10516          }
10517        }
10518
10519        return target;
10520      }
10521
10522      function _defineProperty(obj, key, value) {
10523        if (key in obj) {
10524          Object.defineProperty(obj, key, {
10525            value: value,
10526            enumerable: true,
10527            configurable: true,
10528            writable: true
10529          });
10530        } else {
10531          obj[key] = value;
10532        }
10533
10534        return obj;
10535      }
10536
10537      var RichTextXform = require('../strings/rich-text-xform');
10538
10539      var utils = require('../../../utils/utils');
10540
10541      var BaseXform = require('../base-xform');
10542      /**
10543        <comment ref="B1" authorId="0">
10544          <text>
10545            <r>
10546              <rPr>
10547                <b/>
10548                <sz val="9"/>
10549                <rFont val="宋体"/>
10550                <charset val="134"/>
10551              </rPr>
10552              <t>51422:</t>
10553            </r>
10554            <r>
10555              <rPr>
10556                <sz val="9"/>
10557                <rFont val="宋体"/>
10558                <charset val="134"/>
10559              </rPr>
10560              <t xml:space="preserve">&#10;test</t>
10561            </r>
10562          </text>
10563        </comment>
10564       */
10565
10566
10567      var CommentXform = module.exports = function (model) {
10568        this.model = model;
10569      };
10570
10571      utils.inherits(CommentXform, BaseXform, {
10572        get tag() {
10573          return 'r';
10574        },
10575
10576        get richTextXform() {
10577          if (!this._richTextXform) {
10578            this._richTextXform = new RichTextXform();
10579          }
10580
10581          return this._richTextXform;
10582        },
10583
10584        render: function render(xmlStream, model) {
10585          var _this = this;
10586
10587          model = model || this.model;
10588          xmlStream.openNode('comment', {
10589            ref: model.ref,
10590            authorId: 0
10591          });
10592          xmlStream.openNode('text');
10593
10594          if (model && model.note && model.note.texts) {
vendor: 4,152 bytes, lines 10595-10749
10595            model.note.texts.forEach(function (text) {
10596              _this.richTextXform.render(xmlStream, text);
10597            });
10598          }
10599
10600          xmlStream.closeNode();
10601          xmlStream.closeNode();
10602        },
10603        parseOpen: function parseOpen(node) {
10604          if (this.parser) {
10605            this.parser.parseOpen(node);
10606            return true;
10607          }
10608
10609          switch (node.name) {
10610            case 'comment':
10611              this.model = _objectSpread({
10612                type: 'note',
10613                note: {
10614                  texts: []
10615                }
10616              }, node.attributes);
10617              return true;
10618
10619            case 'r':
10620              this.parser = this.richTextXform;
10621              this.parser.parseOpen(node);
10622              return true;
10623
10624            default:
10625              return false;
10626          }
10627        },
10628        parseText: function parseText(text) {
10629          if (this.parser) {
10630            this.parser.parseText(text);
10631          }
10632        },
10633        parseClose: function parseClose(name) {
10634          switch (name) {
10635            case 'comment':
10636              return false;
10637
10638            case 'r':
10639              this.model.note.texts.push(this.parser.model);
10640              this.parser = undefined;
10641              return true;
10642
10643            default:
10644              if (this.parser) {
10645                this.parser.parseClose(name);
10646              }
10647
10648              return true;
10649          }
10650        }
10651      });
10652    }, {
10653      "../../../utils/utils": 24,
10654      "../base-xform": 29,
10655      "../strings/rich-text-xform": 119
10656    }],
10657    37: [function (require, module, exports) {
10658      "use strict";
10659
10660      var XmlStream = require('../../../utils/xml-stream');
10661
10662      var utils = require('../../../utils/utils');
10663
10664      var BaseXform = require('../base-xform');
10665
10666      var CommentXform = require('./comment-xform');
10667
10668      var CommentsXform = module.exports = function () {
10669        this.map = {
10670          comment: new CommentXform()
10671        };
10672      };
10673
10674      utils.inherits(CommentsXform, BaseXform, {
10675        COMMENTS_ATTRIBUTES: {
10676          xmlns: 'http://schemas.openxmlformats.org/spreadsheetml/2006/main'
10677        }
10678      }, {
10679        render: function render(xmlStream, model) {
10680          var _this = this;
10681
10682          model = model || this.model;
10683          xmlStream.openXml(XmlStream.StdDocAttributes);
10684          xmlStream.openNode('comments', CommentsXform.COMMENTS_ATTRIBUTES); // authors
10685          // TODO: support authors properly
10686
10687          xmlStream.openNode('authors');
10688          xmlStream.leafNode('author', null, 'Author');
10689          xmlStream.closeNode(); // comments
10690
10691          xmlStream.openNode('commentList');
10692          model.comments.forEach(function (comment) {
10693            _this.map.comment.render(xmlStream, comment);
10694          });
10695          xmlStream.closeNode();
10696          xmlStream.closeNode();
10697        },
10698        parseOpen: function parseOpen(node) {
10699          if (this.parser) {
10700            this.parser.parseOpen(node);
10701            return true;
10702          }
10703
10704          switch (node.name) {
10705            case 'commentList':
10706              this.model = {
10707                comments: []
10708              };
10709              return true;
10710
10711            case 'comment':
10712              this.parser = this.map.comment;
10713              this.parser.parseOpen(node);
10714              return true;
10715
10716            default:
10717              return false;
10718          }
10719        },
10720        parseText: function parseText(text) {
10721          if (this.parser) {
10722            this.parser.parseText(text);
10723          }
10724        },
10725        parseClose: function parseClose(name) {
10726          switch (name) {
10727            case 'commentList':
10728              return false;
10729
10730            case 'comment':
10731              this.model.comments.push(this.parser.model);
10732              this.parser = undefined;
10733              return true;
10734
10735            default:
10736              if (this.parser) {
10737                this.parser.parseClose(name);
10738              }
10739
10740              return true;
10741          }
10742        }
10743      });
10744    }, {
10745      "../../../utils/utils": 24,
10746      "../../../utils/xml-stream": 25,
10747      "../base-xform": 29,
10748      "./comment-xform": 36
10749    }],
10750    38: [function (require, module, exports) {
10751      "use strict";
10752
10753      function _typeof(obj) {
10754        "@babel/helpers - typeof";
10755
10756        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
10757          _typeof = function _typeof(obj) {
10758            return typeof obj;
10759          };
10760        } else {
10761          _typeof = function _typeof(obj) {
10762            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
10763          };
10764        }
10765
10766        return _typeof(obj);
10767      }
10768
10769      function _classCallCheck(instance, Constructor) {
10770        if (!(instance instanceof Constructor)) {
10771          throw new TypeError("Cannot call a class as a function");
10772        }
10773      }
10774
10775      function _defineProperties(target, props) {
10776        for (var i = 0; i < props.length; i++) {
10777          var descriptor = props[i];
10778          descriptor.enumerable = descriptor.enumerable || false;
10779          descriptor.configurable = true;
10780          if ("value" in descriptor) descriptor.writable = true;
10781          Object.defineProperty(target, descriptor.key, descriptor);
10782        }
10783      }
10784
10785      function _createClass(Constructor, protoProps, staticProps) {
10786        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
10787        if (staticProps) _defineProperties(Constructor, staticProps);
10788        return Constructor;
10789      }
10790
10791      function _inherits(subClass, superClass) {
10792        if (typeof superClass !== "function" && superClass !== null) {
10793          throw new TypeError("Super expression must either be null or a function");
10794        }
10795
10796        subClass.prototype = Object.create(superClass && superClass.prototype, {
10797          constructor: {
10798            value: subClass,
10799            writable: true,
10800            configurable: true
10801          }
10802        });
10803        if (superClass) _setPrototypeOf(subClass, superClass);
10804      }
10805
10806      function _setPrototypeOf(o, p) {
10807        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
10808          o.__proto__ = p;
10809          return o;
10810        };
10811
10812        return _setPrototypeOf(o, p);
10813      }
10814
10815      function _createSuper(Derived) {
10816        return function () {
10817          var Super = _getPrototypeOf(Derived),
10818              result;
10819
10820          if (_isNativeReflectConstruct()) {
10821            var NewTarget = _getPrototypeOf(this).constructor;
10822
10823            result = Reflect.construct(Super, arguments, NewTarget);
10824          } else {
10825            result = Super.apply(this, arguments);
10826          }
10827
10828          return _possibleConstructorReturn(this, result);
10829        };
10830      }
10831
10832      function _possibleConstructorReturn(self, call) {
10833        if (call && (_typeof(call) === "object" || typeof call === "function")) {
10834          return call;
10835        }
10836
10837        return _assertThisInitialized(self);
10838      }
10839
10840      function _assertThisInitialized(self) {
10841        if (self === void 0) {
10842          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
10843        }
10844
10845        return self;
10846      }
10847
10848      function _isNativeReflectConstruct() {
10849        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
10850        if (Reflect.construct.sham) return false;
10851        if (typeof Proxy === "function") return true;
10852
10853        try {
10854          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
10855          return true;
10856        } catch (e) {
10857          return false;
10858        }
10859      }
10860
10861      function _getPrototypeOf(o) {
10862        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
10863          return o.__proto__ || Object.getPrototypeOf(o);
10864        };
10865        return _getPrototypeOf(o);
10866      }
10867
10868      var BaseXform = require('../../base-xform');
10869
10870      var VmlPositionXform = /*#__PURE__*/function (_BaseXform) {
10871        _inherits(VmlPositionXform, _BaseXform);
10872
10873        var _super = _createSuper(VmlPositionXform);
10874
10875        function VmlPositionXform(model) {
10876          var _this;
10877
10878          _classCallCheck(this, VmlPositionXform);
10879
10880          _this = _super.call(this);
10881          _this._model = model;
10882          return _this;
10883        }
10884
10885        _createClass(VmlPositionXform, [{
10886          key: "render",
10887          value: function render(xmlStream, model, type) {
10888            if (model === type[2]) {
10889              xmlStream.leafNode(this.tag);
10890            } else if (this.tag === 'x:SizeWithCells' && model === type[1]) {
10891              xmlStream.leafNode(this.tag);
10892            }
10893          }
10894        }, {
10895          key: "parseOpen",
10896          value: function parseOpen(node) {
10897            switch (node.name) {
10898              case this.tag:
10899                this.model = {};
10900                this.model[this.tag] = true;
10901                return true;
10902
10903              default:
10904                return false;
10905            }
10906          }
10907        }, {
10908          key: "parseText",
10909          value: function parseText() {}
10910        }, {
10911          key: "parseClose",
10912          value: function parseClose() {
10913            return false;
10914          }
10915        }, {
10916          key: "tag",
10917          get: function get() {
10918            return this._model && this._model.tag;
10919          }
10920        }]);
10921
10922        return VmlPositionXform;
10923      }(BaseXform);
10924
10925      module.exports = VmlPositionXform;
10926    }, {
10927      "../../base-xform": 29
10928    }],
10929    39: [function (require, module, exports) {
10930      "use strict";
10931
10932      function _typeof(obj) {
10933        "@babel/helpers - typeof";
10934
10935        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
10936          _typeof = function _typeof(obj) {
10937            return typeof obj;
10938          };
10939        } else {
10940          _typeof = function _typeof(obj) {
10941            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
10942          };
10943        }
10944
10945        return _typeof(obj);
10946      }
10947
10948      function _classCallCheck(instance, Constructor) {
10949        if (!(instance instanceof Constructor)) {
10950          throw new TypeError("Cannot call a class as a function");
10951        }
10952      }
10953
10954      function _defineProperties(target, props) {
10955        for (var i = 0; i < props.length; i++) {
10956          var descriptor = props[i];
10957          descriptor.enumerable = descriptor.enumerable || false;
10958          descriptor.configurable = true;
10959          if ("value" in descriptor) descriptor.writable = true;
10960          Object.defineProperty(target, descriptor.key, descriptor);
10961        }
10962      }
10963
10964      function _createClass(Constructor, protoProps, staticProps) {
10965        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
10966        if (staticProps) _defineProperties(Constructor, staticProps);
10967        return Constructor;
10968      }
10969
10970      function _inherits(subClass, superClass) {
10971        if (typeof superClass !== "function" && superClass !== null) {
10972          throw new TypeError("Super expression must either be null or a function");
10973        }
10974
10975        subClass.prototype = Object.create(superClass && superClass.prototype, {
10976          constructor: {
10977            value: subClass,
10978            writable: true,
10979            configurable: true
10980          }
10981        });
10982        if (superClass) _setPrototypeOf(subClass, superClass);
10983      }
10984
10985      function _setPrototypeOf(o, p) {
10986        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
10987          o.__proto__ = p;
10988          return o;
10989        };
10990
10991        return _setPrototypeOf(o, p);
10992      }
10993
10994      function _createSuper(Derived) {
10995        return function () {
10996          var Super = _getPrototypeOf(Derived),
10997              result;
10998
10999          if (_isNativeReflectConstruct()) {
11000            var NewTarget = _getPrototypeOf(this).constructor;
11001
11002            result = Reflect.construct(Super, arguments, NewTarget);
11003          } else {
11004            result = Super.apply(this, arguments);
11005          }
11006
11007          return _possibleConstructorReturn(this, result);
11008        };
11009      }
11010
11011      function _possibleConstructorReturn(self, call) {
11012        if (call && (_typeof(call) === "object" || typeof call === "function")) {
11013          return call;
11014        }
11015
11016        return _assertThisInitialized(self);
11017      }
11018
11019      function _assertThisInitialized(self) {
11020        if (self === void 0) {
11021          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
11022        }
11023
11024        return self;
11025      }
11026
11027      function _isNativeReflectConstruct() {
11028        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
11029        if (Reflect.construct.sham) return false;
11030        if (typeof Proxy === "function") return true;
11031
11032        try {
11033          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
11034          return true;
11035        } catch (e) {
11036          return false;
11037        }
11038      }
11039
11040      function _getPrototypeOf(o) {
11041        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o
11041) {
11042          return o.__proto__ || Object.getPrototypeOf(o);
11043        };
11044        return _getPrototypeOf(o);
11045      }
11046
11047      var BaseXform = require('../../base-xform');
11048
11049      var VmlProtectionXform = /*#__PURE__*/function (_BaseXform) {
11050        _inherits(VmlProtectionXform, _BaseXform);
11051
11052        var _super = _createSuper(VmlProtectionXform);
11053
11054        function VmlProtectionXform(model) {
11055          var _this;
11056
11057          _classCallCheck(this, VmlProtectionXform);
11058
11059          _this = _super.call(this);
11060          _this._model = model;
11061          return _this;
11062        }
11063
11064        _createClass(VmlProtectionXform, [{
11065          key: "render",
11066          value: function render(xmlStream, model) {
11067            xmlStream.leafNode(this.tag, null, model);
11068          }
11069        }, {
11070          key: "parseOpen",
11071          value: function parseOpen(node) {
11072            switch (node.name) {
11073              case this.tag:
11074                this.text = '';
11075                return true;
11076
11077              default:
11078                return false;
11079            }
11080          }
11081        }, {
11082          key: "parseText",
11083          value: function parseText(text) {
11084            this.text = text;
11085          }
11086        }, {
11087          key: "parseClose",
11088          value: function parseClose() {
11089            return false;
11090          }
11091        }, {
11092          key: "tag",
11093          get: function get() {
11094            return this._model && this._model.tag;
11095          }
11096        }]);
11097
11098        return VmlProtectionXform;
11099      }(BaseXform);
11100
11101      module.exports = VmlProtectionXform;
11102    }, {
11103      "../../base-xform": 29
11104    }],
11105    40: [function (require, module, exports) {
11106      "use strict";
11107
11108      function _typeof(obj) {
11109        "@babel/helpers - typeof";
11110
11111        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
11112          _typeof = function _typeof(obj) {
11113            return typeof obj;
11114          };
11115        } else {
11116          _typeof = function _typeof(obj) {
11117            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
11118          };
11119        }
11120
11121        return _typeof(obj);
11122      }
11123
11124      function _classCallCheck(instance, Constructor) {
11125        if (!(instance instanceof Constructor)) {
11126          throw new TypeError("Cannot call a class as a function");
11127        }
11128      }
11129
11130      function _defineProperties(target, props) {
11131        for (var i = 0; i < props.length; i++) {
11132          var descriptor = props[i];
11133          descriptor.enumerable = descriptor.enumerable || false;
11134          descriptor.configurable = true;
11135          if ("value" in descriptor) descriptor.writable = true;
11136          Object.defineProperty(target, descriptor.key, descriptor);
11137        }
11138      }
11139
11140      function _createClass(Constructor, protoProps, staticProps) {
11141        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
11142        if (staticProps) _defineProperties(Constructor, staticProps);
11143        return Constructor;
11144      }
11145
11146      function _inherits(subClass, superClass) {
11147        if (typeof superClass !== "function" && superClass !== null) {
11148          throw new TypeError("Super expression must either be null or a function");
11149        }
11150
11151        subClass.prototype = Object.create(superClass && superClass.prototype, {
11152          constructor: {
11153            value: subClass,
11154            writable: true,
11155            configurable: true
11156          }
11157        });
11158        if (superClass) _setPrototypeOf(subClass, superClass);
11159      }
11160
11161      function _setPrototypeOf(o, p) {
11162        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
11163          o.__proto__ = p;
11164          return o;
11165        };
11166
11167        return _setPrototypeOf(o, p);
11168      }
11169
11170      function _createSuper(Derived) {
11171        return function () {
11172          var Super = _getPrototypeOf(Derived),
11173              result;
11174
11175          if (_isNativeReflectConstruct()) {
11176            var NewTarget = _getPrototypeOf(this).constructor;
11177
11178            result = Reflect.construct(Super, arguments, NewTarget);
11179          } else {
11180            result = Super.apply(this, arguments);
11181          }
11182
11183          return _possibleConstructorReturn(this, result);
11184        };
11185      }
11186
11187      function _possibleConstructorReturn(self, call) {
11188        if (call && (_typeof(call) === "object" || typeof call === "function")) {
11189          return call;
11190        }
11191
11192        return _assertThisInitialized(self);
11193      }
11194
11195      function _assertThisInitialized(self) {
11196        if (self === void 0) {
11197          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
11198        }
11199
11200        return self;
11201      }
11202
11203      function _isNativeReflectConstruct() {
11204        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
11205        if (Reflect.construct.sham) return false;
11206        if (typeof Proxy === "function") return true;
11207
11208        try {
11209          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
11210          return true;
11211        } catch (e) {
11212          return false;
11213        }
11214      }
11215
11216      function _getPrototypeOf(o) {
11217        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
11218          return o.__proto__ || Object.getPrototypeOf(o);
11219        };
11220        return _getPrototypeOf(o);
11221      }
11222
11223      var BaseXform = require('../base-xform'); // render the triangle in the cell for the comment
11224
11225
11226      var VmlAnchorXform = /*#__PURE__*/function (_BaseXform) {
11227        _inherits(VmlAnchorXform, _BaseXform);
11228
11229        var _super = _createSuper(VmlAnchorXform);
11230
11231        function VmlAnchorXform() {
11232          _classCallCheck(this, VmlAnchorXform);
11233
11234          return _super.apply(this, arguments);
11235        }
11236
11237        _createClass(VmlAnchorXform, [{
11238          key: "getAnchorRect",
11239          value: function getAnchorRect(anchor) {
11240            var l = Math.floor(anchor.left);
11241            var lf = Math.floor((anchor.left - l) * 68);
11242            var t = Math.floor(anchor.top);
11243            var tf = Math.floor((anchor.top - t) * 18);
11244            var r = Math.floor(anchor.right);
11245            var rf = Math.floor((anchor.right - r) * 68);
11246            var b = Math.floor(anchor.bottom);
11247            var bf = Math.floor((anchor.bottom - b) * 18);
11248            return [l, lf, t, tf, r, rf, b, bf];
11249          }
11250        }, {
11251          key: "getDefaultRect",
11252          value: function getDefaultRect(ref) {
11253            var l = ref.col;
11254            var lf = 6;
11255            var t = Math.max(ref.row - 2, 0);
11256            var tf = 14;
11257            var r = l + 2;
11258            var rf = 2;
11259            var b = t + 4;
11260            var bf = 16;
11261            return [l, lf, t, tf, r, rf, b, bf];
11262          }
11263        }, {
11264          key: "render",
11265          value: function render(xmlStream, model) {
11266            var rect = model.anchor ? this.getAnchorRect(model.anchor) : this.getDefaultRect(model.refAddress);
11267            xmlStream.leafNode('x:Anchor', null, rect.join(', '));
11268          }
11269        }, {
11270          key: "parseOpen",
11271          value: function parseOpen(node) {
11272            switch (node.name) {
11273              case this.tag:
11274                this.text = '';
11275                return true;
11276
11277              default:
11278                return false;
11279            }
11280          }
11281        }, {
11282          key: "parseText",
11283          value: function parseText(text) {
11284            this.text = text;
11285          }
11286        }, {
11287          key: "parseClose",
11288          value: function parseClose() {
11289            return false;
11290          }
11291        }, {
11292          key: "tag",
11293          get: function get() {
11294            return 'x:Anchor';
11295          }
11296        }]);
11297
11298        return VmlAnchorXform;
11299      }(BaseXform);
11300
11301      module.exports = VmlAnchorXform;
11302    }, {
11303      "../base-xform": 29
11304    }],
11305    41: [function (require, module, exports) {
11306      "use strict";
11307
11308      function _typeof(obj) {
11309        "@babel/helpers - typeof";
11310
11311        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
11312          _typeof = function _typeof(obj) {
11313            return typeof obj;
11314          };
11315        } else {
11316          _typeof = function _typeof(obj) {
11317            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
11318          };
11319        }
11320
11321        return _typeof(obj);
11322      }
11323
11324      function _classCallCheck(instance, Constructor) {
11325        if (!(instance instanceof Constructor)) {
11326          throw new TypeError("Cannot call a class as a function");
11327        }
11328      }
11329
11330      function _defineProperties(target, props) {
11331        for (var i = 0; i < props.length; i++) {
11332          var descriptor = props[i];
11333          descriptor.enumerable = descriptor.enumerable || false;
11334          descriptor.configurable = true;
11335          if ("value" in descriptor) descriptor.writable = true;
11336          Object.defineProperty(target, descriptor.key, descriptor);
11337        }
11338      }
11339
11340      function _createClass(Constructor, protoProps, staticProps) {
11341        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
11342        if (staticProps) _defineProperties(Constructor, staticProps);
11343        return Constructor;
11344      }
11345
11346      function _inherits(subClass, superClass) {
11347        if (typeof superClass !== "function" && superClass !== null) {
11348          throw new TypeError("Super expression must either be null or a function");
11349        }
11350
11351        subClass.prototype = Object.create(superClass && superClass.prototype, {
11352          constructor: {
11353            value: subClass,
11354            writable: true,
11355            configurable: true
11356          }
11357        });
11358        if (superClass) _setPrototypeOf(subClass, superClass);
11359      }
11360
11361      function _setPrototypeOf(o, p) {
11362        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
11363          o.__proto__ = p;
11364          return o;
11365        };
11366
11367        return _setPrototypeOf(o, p);
11368      }
11369
11370      function _createSuper(Derived) {
11371        return function () {
11372          var Super = _getPrototypeOf(Derived),
11373              result;
11374
11375          if (_isNativeReflectConstruct()) {
11376            var NewTarget = _getPrototypeOf(this).constructor;
11377
11378            result = Reflect.construct(Super, arguments, NewTarget);
11379          } else {
11380            result = Super.apply(this, arguments);
11381          }
11382
11383          return _possibleConstructorReturn(this, result);
11384        };
11385      }
11386
11387      function _possibleConstructorReturn(self, call) {
11388        if (call && (_typeof(call) === "object" || typeof call === "function")) {
11389          return call;
11390        }
11391
11392        return _assertThisInitialized(self);
11393      }
11394
11395      function _assertThisInitialized(self) {
11396        if (self === void 0) {
11397          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
11398        }
11399
11400        return self;
11401      }
11402
11403      function _isNativeReflectConstruct() {
11404        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
11405        if (Reflect.construct.sham) return false;
11406        if (typeof Proxy === "function") return true;
11407
11408        try {
11409          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
11410          return true;
11411        } catch (e) {
11412          return false;
11413        }
11414      }
11415
11416      function _getPrototypeOf(o) {
11417        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
11418          return o.__proto__ || Object.getPrototypeOf(o);
11419        };
11420        return _getPrototypeOf(o);
11421      }
11422
11423      var BaseXform = require('../base-xform');
11424
11425      var VmlAnchorXform = require('./vml-anchor-xform');
11426
11427      var VmlProtectionXform = require('./style/vml-protection-xform');
11428
11429      var VmlPositionXform = require('./style/vml-position-xform');
11430
11431      var POSITION_TYPE = ['twoCells', 'oneCells', 'absolute'];
11432
11433      var VmlClientDataXform = /*#__PURE__*/function (_BaseXform) {
11434        _inherits(VmlClientDataXform, _BaseXform);
11435
11436        var _super = _createSuper(VmlClientDataXform);
11437
11438        function VmlClientDataXform() {
11439          var _this;
11440
11441          _classCallCheck(this, VmlClientDataXform);
11442
11443          _this = _super.call(this);
11444          _this.map = {
11445            'x:Anchor': new VmlAnchorXform(),
11446            'x:Locked': new VmlProtectionXform({
11447              tag: 'x:Locked'
11448            }),
11449            'x:LockText': new VmlProtectionXform({
11450              tag: 'x:LockText'
11451            }),
11452            'x:SizeWithCells': new VmlPositionXform({
11453              tag: 'x:SizeWithCells'
11454            }),
11455            'x:MoveWithCells': new VmlPositionXform({
11456              tag: 'x:MoveWithCells'
11457            })
11458          };
11459          return _this;
11460        }
11461
11462        _createClass(VmlClientDataXform, [{
11463          key: "render",
11464          value: function render(xmlStream, model) {
11465            var _model$note = model.note,
11466                protection = _model$note.protection,
11467                editAs = _model$note.editAs;
11468            xmlStream.openNode(this.tag, {
11469              ObjectType: 'Note'
11470            });
11471            this.map['x:MoveWithCells'].render(xmlStream, editAs, POSITION_TYPE);
11472            this.map['x:SizeWithCells'].render(xmlStream, editAs, POSITION_TYPE);
11473            this.map['x:Anchor'].render(xmlStream, model);
11474            this.map['x:Locked'].render(xmlStream, protection.locked);
11475            xmlStream.leafNode('x:AutoFill', null, 'False');
11476            this.map['x:LockText'].render(xmlStream, protection.lockText);
11477            xmlStream.leafNode('x:Row', null, model.refAddress.row - 1);
11478            xmlStream.leafNode('x:Column', null, model.refAddress.col - 1);
11479            xmlStream.closeNode();
11480          }
11481        }, {
11482          key: "parseOpen",
11483          value: function parseOpen(node) {
11484            switch (node.name) {
11485              case this.tag:
11486                this.reset();
11487                this.model = {
11488                  anchor: [],
11489                  protection: {},
11490                  editAs: ''
11491                };
11492                break;
11493
11494              default:
11495                this.parser = this.map[node.name];
11496
11497                if (this.parser) {
11498                  this.parser.parseOpen(node);
11499                }
11500
11501                break;
11502            }
11503
11504            return true;
11505          }
11506        }, {
11507          key: "parseText",
11508          value: function parseText(text) {
11509            if (this.parser) {
11510              this.parser.parseText(text);
11511            }
11512          }
11513        }, {
11514          key: "parseClose",
11515          value: function parseClose(name) {
11516            if (this.parser) {
11517              if (!this.parser.parseClose(name)) {
11518                this.parser = undefined;
11519              }
11520
11521              return true;
11522            }
11523
11524            switch (name) {
11525              case this.tag:
11526                this.normalizeModel();
11527                return false;
11528
11529              default:
11530                return true;
11531            }
11532          }
11533        }, {
11534          key: "normalizeModel",
11535          value: function normalizeModel() {
11536            var position = Object.assign({}, this.map['x:MoveWithCells'].model, this.map['x:SizeWithCells'].model);
11537            var len = Object.keys(position).length;
11538            this.model.editAs = POSITION_TYPE[len];
11539            this.model.anchor = this.map['x:Anchor'].text;
11540            this.model.protection.locked = this.map['x:Locked'].text;
11541            this.model.protection.lockText = this.map['x:LockText'].text;
11542          }
11543        }, {
11544          key: "tag",
11545          get: function get() {
11546            return 'x:ClientData';
11547          }
11548        }]);
11549
11550        return VmlClientDataXform;
11551      }(BaseXform);
11552
11553      module.exports = VmlClientDataXform;
11554    }, {
11555      "../base-xform": 29,
11556      "./style/vml-position-xform": 38,
11557      "./style/vml-protection-xform": 39,
11558      "./vml-anchor-xform": 40
11559    }],
11560    42: [function (require, module, exports) {
11561      "use strict";
11562
11563      function _typeof(obj) {
11564        "@babel/helpers - typeof";
11565
11566        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
11567          _typeof = function _typeof(obj) {
11568            return typeof obj;
11569          };
11570        } else {
11571          _typeof = function _typeof(obj) {
11572            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
11573          };
11574        }
11575
11576        return _typeof(obj);
11577      }
11578
11579      function _classCallCheck(instance, Constructor) {
11580        if (!(instance instanceof Constructor)) {
11581          throw new TypeError("Cannot call a class as a function");
11582        }
11583      }
11584
11585      function _defineProperties(target, props) {
11586        for (var i = 0; i < props.length; i++) {
11587          var descriptor = props[i];
11588          descriptor.enumerable = descriptor.enumerable || false;
11589          descriptor.configurable = true;
11590          if ("value" in descriptor) descriptor.writable = true;
11591          Object.defineProperty(target, descriptor.key, descriptor);
11592        }
11593      }
11594
11595      function _createClass(Constructor, protoProps, staticProps) {
11596        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
11597        if (staticProps) _defineProperties(Constructor, staticProps);
11598        return Constructor;
11599      }
11600
11601      function _inherits(subClass, superClass) {
11602        if (typeof superClass !== "function" && superClass !== null) {
11603          throw new TypeError("Super expression must either be null or a function");
11604        }
11605
11606        subClass.prototype = Object.create(superClass && superClass.prototype, {
11607          constructor: {
11608            value: subClass,
11609            writable: true,
11610            configurable: true
11611          }
11612        });
11613        if (superClass) _setPrototypeOf(subClass, superClass);
11614      }
11615
11616      function _setPrototypeOf(o, p) {
11617        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
11618          o.__proto__ = p;
11619          return o;
11620        };
11621
11622        return _setPrototypeOf(o, p);
11623      }
11624
11625      function _createSuper(Derived) {
11626        return function () {
11627          var Super = _getPrototypeOf(Derived),
11628              result;
11629
11630          if (_isNativeReflectConstruct()) {
11631            var NewTarget = _getPrototypeOf(this).constructor;
11632
11633            result = Reflect.construct(Super, arguments, NewTarget);
11634          } else {
11635            result = Super.apply(this, arguments);
11636          }
11637
11638          return _possibleConstructorReturn(this, result);
11639        };
11640      }
11641
11642      function _possibleConstructorReturn(self, call) {
11643        if (call && (_typeof(call) === "object" || typeof call === "function")) {
11644          return call;
11645        }
11646
11647        return _assertThisInitialized(self);
11648      }
11649
11650      function _assertThisInitialized(self) {
11651        if (self === void 0) {
11652          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
11653        }
11654
11655        return self;
11656      }
11657
11658      function _isNativeReflectConstruct() {
11659        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
11660        if (Reflect.construct.sham) return false;
11661        if (typeof Proxy === "function") return true;
11662
11663        try {
11664          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
11665          return true;
11666        } catch (e) {
11667          return false;
11668        }
11669      }
11670
11671      function _getPrototypeOf(o) {
11672        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
11673          return o.__proto__ || Object.getPrototypeOf(o);
11674        };
11675        return _getPrototypeOf(o);
11676      }
11677
11678      var XmlStream = require('../../../utils/xml-stream');
11679
11680      var BaseXform = require('../base-xform');
11681
11682      var VmlShapeXform = require('./vml-shape-xform'); // This class is (currently) single purposed to insert the triangle
11683      // drawing icons on commented cells
11684
11685
11686      var VmlNotesXform = /*#__PURE__*/function (_BaseXform) {
11687        _inherits(VmlNotesXform, _BaseXform);
11688
11689        var _super = _createSuper(VmlNotesXform);
11690
11691        function VmlNotesXform() {
11692          var _this;
11693
11694          _classCallCheck(this, VmlNotesXform);
11695
11696          _this = _super.call(this);
11697          _this.map = {
11698            'v:shape': new VmlShapeXform()
11699          };
11700          return _this;
11701        }
11702
11703        _createClass(VmlNotesXform, [{
11704          key: "render",
11705          value: function render(xmlStream, model) {
11706            var _this2 = this;
11707
11708            xmlStream.openXml(XmlStream.StdDocAttributes);
11709            xmlStream.openNode(this.tag, VmlNotesXform.DRAWING_ATTRIBUTES);
11710            xmlStream.openNode('o:shapelayout', {
11711              'v:ext': 'edit'
11712            });
11713            xmlStream.leafNode('o:idmap', {
11714              'v:ext': 'edit',
11715              data: 1
11716            });
11717            xmlStream.closeNode();
11718            xmlStream.openNode('v:shapetype', {
11719              id: '_x0000_t202',
11720              coordsize: '21600,21600',
11721              'o:spt': 202,
11722              path: 'm,l,21600r21600,l21600,xe'
11723            });
11724            xmlStream.leafNode('v:stroke', {
11725              joinstyle: 'miter'
11726            });
11727            xmlStream.leafNode('v:path', {
11728              gradientshapeok: 't',
11729              'o:connecttype': 'rect'
11730            });
11731            xmlStream.closeNode();
11732            model.comments.forEach(function (item, index) {
11733              _this2.map['v:shape'].render(xmlStream, item, index);
11734            });
11735            xmlStream.closeNode();
11736          }
11737        }, {
11738          key: "parseOpen",
11739          value: function parseOpen(node) {
11740            if (this.parser) {
11741              this.parser.parseOpen(node);
11742              return true;
11743            }
11744
11745            switch (node.name) {
11746              case this.tag:
11747                this.reset();
11748                this.model = {
11749                  comments: []
11750                };
11751                break;
11752
11753              default:
11754                this.parser = this.map[node.name];
11755
11756                if (this.parser) {
11757                  this.parser.parseOpen(node);
11758                }
11759
11760                break;
11761            }
11762
11763            return true;
11764          }
11765        }, {
11766          key: "parseText",
11767          value: function parseText(text) {
11768            if (this.parser) {
11769              this.parser.parseText(text);
11770            }
11771          }
11772        }, {
11773          key: "parseClose",
11774          value: function parseClose(name) {
11775            if (this.parser) {
11776              if (!this.parser.parseClose(name)) {
11777                this.model.comments.push(this.parser.model);
11778                this.parser = undefined;
11779              }
11780
11781              return true;
11782            }
11783
11784            switch (name) {
11785              case this.tag:
11786                return false;
11787
11788              default:
11789                // could be some unrecognised tags
11790                return true;
11791            }
11792          }
11793        }, {
11794          key: "reconcile",
11795          value: function reconcile(model, options) {
11796            var _this3 = this;
11797
11798            model.anchors.forEach(function (anchor) {
11799              if (anchor.br) {
11800                _this3.map['xdr:twoCellAnchor'].reconcile(anchor, options);
11801              } else {
11802                _this3.map['xdr:oneCellAnchor'].reconcile(anchor, options);
11803              }
11804            });
11805          }
11806        }, {
11807          key: "tag",
11808          get: function get() {
11809            return 'xml';
11810          }
11811        }]);
11812
11813        return VmlNotesXform;
11814      }(BaseXform);
11815
11816      VmlNotesXform.DRAWING_ATTRIBUTES = {
11817        'xmlns:v': 'urn:schemas-microsoft-com:vml',
11818        'xmlns:o': 'urn:schemas-microsoft-com:office:office',
11819        'xmlns:x': 'urn:schemas-microsoft-com:office:excel'
11820      };
11821      module.exports = VmlNotesXform;
11822    }, {
11823      "../../../utils/xml-stream": 25,
11824      "../base-xform": 29,
11825      "./vml-shape-xform": 43
11826    }],
11827    43: [function (require, module, exports) {
11828      "use strict";
11829
11830      function _typeof(obj) {
11831        "@babel/helpers - typeof";
11832
11833        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
11834          _typeof = function _typeof(obj) {
11835            return typeof obj;
11836          };
11837        } else {
11838          _typeof = function _typeof(obj) {
11839            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
11840          };
11841        }
11842
11843        return _typeof(obj);
11844      }
11845
11846      function _classCallCheck(instance, Constructor) {
11847        if (!(instance instanceof Constructor)) {
11848          throw new TypeError("Cannot call a class as a function");
11849        }
11850      }
11851
11852      function _defineProperties(target, props) {
11853        for (var i = 0; i < props.length; i++) {
11854          var descriptor = props[i];
11855          descriptor.enumerable = descriptor.enumerable || false;
11856          descriptor.configurable = true;
11857          if ("value" in descriptor) descriptor.writable = true;
11858          Object.defineProperty(target, descriptor.key, descriptor);
11859        }
11860      }
11861
11862      function _createClass(Constructor, protoProps, staticProps) {
11863        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
11864        if (staticProps) _defineProperties(Constructor, staticProps);
11865        return Constructor;
11866      }
11867
11868      function _inherits(subClass, superClass) {
11869        if (typeof superClass !== "function" && superClass !== null) {
11870          throw new TypeError("Super expression must either be null or a function");
11871        }
11872
11873        subClass.prototype = Object.create(superClass && superClass.prototype, {
11874          constructor: {
11875            value: subClass,
11876            writable: true,
11877            configurable: true
11878          }
11879        });
11880        if (superClass) _setPrototypeOf(subClass, superClass);
11881      }
11882
11883      function _setPrototypeOf(o, p) {
11884        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
11885          o.__proto__ = p;
11886          return o;
11887        };
11888
11889        return _setPrototypeOf(o, p);
11890      }
11891
11892      function _createSuper(Derived) {
11893        return function () {
11894          var Super = _getPrototypeOf(Derived),
11895              result;
11896
11897          if (_isNativeReflectConstruct()) {
11898            var NewTarget = _getPrototypeOf(this).constructor;
11899
11900            result = Reflect.construct(Super, arguments, NewTarget);
11901          } else {
11902            result = Super.apply(this, arguments);
11903          }
11904
11905          return _possibleConstructorReturn(this, result);
11906        };
11907      }
11908
11909      function _possibleConstructorReturn(self, call) {
11910        if (call && (_typeof(call) === "object" || typeof call === "function")) {
11911          return call;
11912        }
11913
11914        return _assertThisInitialized(self);
11915      }
11916
11917      function _assertThisInitialized(self) {
11918        if (self === void 0) {
11919          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
11920        }
11921
11922        return self;
11923      }
11924
11925      function _isNativeReflectConstruct() {
11926        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
11927        if (Reflect.construct.sham) return false;
11928        if (typeof Proxy === "function") return true;
11929
11930        try {
11931          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
11932          return true;
11933        } catch (e) {
11934          return false;
11935        }
11936      }
11937
11938      function _getPrototypeOf(o) {
11939        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
11940          return o.__proto__ || Object.getPrototypeOf(o);
11941        };
11942        return _getPrototypeOf(o);
11943      }
11944
11945      var BaseXform = require('../base-xform');
11946
11947      var VmlTextboxXform = require('./vml-textbox-xform');
11948
11949      var VmlClientDataXform = require('./vml-client-data-xform');
11950
11951      var VmlShapeXform = /*#__PURE__*/function (_BaseXform) {
11952        _inherits(VmlShapeXform, _BaseXform);
11953
11954        var _super = _createSuper(VmlShapeXform);
11955
11956        function VmlShapeXform() {
11957          var _this;
11958
11959          _classCallCheck(this, VmlShapeXform);
11960
11961          _this = _super.call(this);
11962          _this.map = {
11963            'v:textbox': new VmlTextboxXform(),
11964            'x:ClientData': new VmlClientDataXform()
11965          };
11966          return _this;
11967        }
11968
11969        _createClass(VmlShapeXform, [{
11970          key: "render",
11971          value: function render(xmlStream, model, index) {
11972            xmlStream.openNode('v:shape', VmlShapeXform.V_SHAPE_ATTRIBUTES(model, index));
11973            xmlStream.leafNode('v:fill', {
11974              color2: 'infoBackground [80]'
11975            });
11976            xmlStream.leafNode('v:shadow', {
11977              color: 'none [81]',
11978              obscured: 't'
11979            });
11980            xmlStream.leafNode('v:path', {
11981              'o:connecttype': 'none'
11982            });
11983            this.map['v:textbox'].render(xmlStream, model);
11984            this.map['x:ClientData'].render(xmlStream, model);
11985            xmlStream.closeNode();
11986          }
11987        }, {
11988          key: "parseOpen",
11989          value: function parseOpen(node) {
11990            if (this.parser) {
11991              this.parser.parseOpen(node);
11992              return true;
11993            }
11994
11995            switch (node.name) {
11996              case this.tag:
11997                this.reset();
11998                this.model = {
11999                  margins: {
12000                    insetmode: node.attributes['o:insetmode']
12001                  },
12002                  anchor: '',
12003                  editAs: '',
12004                  protection: {}
12005                };
12006                break;
12007
12008              default:
12009                this.parser = this.map[node.name];
12010
12011                if (this.parser) {
12012                  this.parser.parseOpen(node);
12013                }
12014
12015                break;
12016            }
12017
12018            return true;
12019          }
12020        }, {
12021          key: "parseText",
12022          value: function parseText(text) {
12023            if (this.parser) {
12024              this.parser.parseText(text);
12025            }
12026          }
12027        }, {
12028          key: "parseClose",
12029          value: function parseClose(name) {
12030            if (this.parser) {
12031              if (!this.parser.parseClose(name)) {
12032                this.parser = undefined;
12033              }
12034
12035              return true;
12036            }
12037
12038            switch (name) {
12039              case this.tag:
12040                this.model.margins.inset = this.map['v:textbox'].model && this.map['v:textbox'].model.inset;
12041                this.model.protection = this.map['x:ClientData'].model && this.map['x:ClientData'].model.protection;
12042                this.model.anchor = this.map['x:ClientData'].model && this.map['x:ClientData'].model.anchor;
12043                this.model.editAs = this.map['x:ClientData'].model && this.map['x:ClientData'].model.editAs;
12044                return false;
12045
12046              default:
12047                return true;
12048            }
12049          }
12050        }, {
12051          key: "tag",
12052          get: function get() {
12053            return 'v:shape';
12054          }
12055        }]);
12056
12057        return VmlShapeXform;
12058      }(BaseXform);
12059
12060      VmlShapeXform.V_SHAPE_ATTRIBUTES = function (model, index) {
12061        return {
12062          id: "_x0000_s".concat(1025 + index),
12063          type: '#_x0000_t202',
12064          style: 'position:absolute; margin-left:105.3pt;margin-top:10.5pt;width:97.8pt;height:59.1pt;z-index:1;visibility:hidden',
12065          fillcolor: 'infoBackground [80]',
12066          strokecolor: 'none [81]',
12067          'o:insetmode': model.note.margins && model.note.margins.insetmode
12068        };
12069      };
12070
12071      module.exports = VmlShapeXform;
12072    }, {
12073      "../base-xform": 29,
12074      "./vml-client-data-xform": 41,
12075      "./vml-textbox-xform": 44
12076    }],
12077    44: [function (require, module, exports) {
12078      "use strict";
12079
12080      function _typeof(obj) {
12081        "@babel/helpers - typeof";
12082
12083        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
12084          _typeof = function _typeof(obj) {
12085            return typeof obj;
12086          };
12087        } else {
12088          _typeof = function _typeof(obj) {
12089            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
12090          };
12091        }
12092
12093        return _typeof(obj);
12094      }
12095
12096      function _classCallCheck(instance, Constructor) {
12097        if (!(instance instanceof Constructor)) {
12098          throw new TypeError("Cannot call a class as a function");
12099        }
12100      }
12101
12102      function _defineProperties(target, props) {
12103        for (var i = 0; i < props.length; i++) {
12104          var descriptor = props[i];
12105          descriptor.enumerable = descriptor.enumerable || false;
12106          descriptor.configurable = true;
12107          if ("value" in descriptor) descriptor.writable = true;
12108          Object.defineProperty(target, descriptor.key, descriptor);
12109        }
12110      }
12111
12112      function _createClass(Constructor, protoProps, staticProps) {
12113        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
12114        if (staticProps) _defineProperties(Constructor, staticProps);
12115        return Constructor;
12116      }
12117
12118      function _inherits(subClass, superClass) {
12119        if (typeof superClass !== "function" && superClass !== null) {
12120          throw new TypeError("Super expression must either be null or a function");
12121        }
12122
12123        subClass.prototype = Object.create(superClass && superClass.prototype, {
12124          constructor: {
12125            value: subClass,
12126            writable: true,
12127            configurable: true
12128          }
12129        });
12130        if (superClass) _setPrototypeOf(subClass, superClass);
12131      }
12132
12133      function _setPrototypeOf(o, p) {
12134        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
12135          o.__proto__ = p;
12136          return o;
12137        };
12138
12139        return _setPrototypeOf(o, p);
12140      }
12141
12142      function _createSuper(Derived) {
12143        return function () {
12144          var Super = _getPrototypeOf(Derived),
12145              result;
12146
12147          if (_isNativeReflectConstruct()) {
12148            var NewTarget = _getPrototypeOf(this).constructor;
12149
12150            result = Reflect.construct(Super, arguments, NewTarget);
12151          } else {
12152            result = Super.apply(this, arguments);
12153          }
12154
12155          return _possibleConstructorReturn(this, result);
12156        };
12157      }
12158
12159      function _possibleConstructorReturn(self, call) {
12160        if (call && (_typeof(call) === "object" || typeof call === "function")) {
12161          return call;
12162        }
12163
12164        return _assertThisInitialized(self);
12165      }
12166
12167      function _assertThisInitialized(self) {
12168        if (self === void 0) {
12169          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
12170        }
12171
12172        return self;
12173      }
12174
12175      function _isNativeReflectConstruct() {
12176        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
12177        if (Reflect.construct.sham) return false;
12178        if (typeof Proxy === "function") return true;
12179
12180        try {
12181          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
12182          return true;
12183        } catch (e) {
12184          return false;
12185        }
12186      }
12187
12188      function _getPrototypeOf(o) {
12189        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
12190          return o.__proto__ || Object.getPrototypeOf(o);
12191        };
12192        return _getPrototypeOf(o);
12193      }
12194
12195      var BaseXform = require('../base-xform');
12196
12197      var VmlTextboxXform = /*#__PURE__*/function (_BaseXform) {
12198        _inherits(VmlTextboxXform, _BaseXform);
12199
12200        var _super = _createSuper(VmlTextboxXform);
12201
12202        function VmlTextboxXform() {
12203          _classCallCheck(this, VmlTextboxXform);
12204
12205          return _super.apply(this, arguments);
12206        }
12207
12208        _createClass(VmlTextboxXform, [{
12209          key: "conversionUnit",
12210          value: function conversionUnit(value, multiple, unit) {
12211            return "".concat(parseFloat(value) * multiple.toFixed(2)).concat(unit);
12212          }
12213        }, {
12214          key: "reverseConversionUnit",
12215          value: function reverseConversionUnit(inset) {
12216            var _this = this;
12217
12218            return (inset || '').split(',').map(function (margin) {
12219              return Number(parseFloat(_this.conversionUnit(parseFloat(margin), 0.1, '')).toFixed(2));
12220            });
12221          }
12222        }, {
12223          key: "render",
12224          value: function render(xmlStream, model) {
12225            var _this2 = this;
12226
12227            var attributes = {
12228              style: 'mso-direction-alt:auto'
12229            };
12230
12231            if (model && model.note) {
12232              var _ref = model.note && model.note.margins,
12233                  inset = _ref.inset;
12234
12235              if (Array.isArray(inset)) {
12236                inset = inset.map(function (margin) {
12237                  return _this2.conversionUnit(margin, 10, 'mm');
12238                }).join(',');
12239              }
12240
12241              if (inset) {
12242                attributes.inset = inset;
12243              }
12244            }
12245
12246            xmlStream.openNode('v:textbox', attributes);
12247            xmlStream.leafNode('div', {
12248              style: 'text-align:left'
12249            });
12250            xmlStream.closeNode();
12251          }
12252        }, {
12253          key: "parseOpen",
12254          value: function parseOpen(node) {
12255            switch (node.name) {
12256              case this.tag:
12257                this.model = {
12258                  inset: this.reverseConversionUnit(node.attributes.inset)
12259                };
12260                return true;
12261
12262              default:
12263                return true;
12264            }
12265          }
12266        }, {
12267          key: "parseText",
12268          value: function parseText() {}
12269        }, {
12270          key: "parseClose",
12271          value: function parseClose(name) {
12272            switch (name) {
12273              case this.tag:
12274                return false;
12275
12276              default:
12277                return true;
12278            }
12279          }
12280        }, {
12281          key: "tag",
12282          get: function get() {
12283            return 'v:textbox';
12284          }
12285        }]);
12286
12287        return VmlTextboxXform;
12288      }(BaseXform);
12289
12290      module.exports = VmlTextboxXform;
12291    }, {
12292      "../base-xform": 29
12293    }],
12294    45: [function (require, module, exports) {
12295      "use strict";
12296
12297      function _typeof(obj) {
12298        "@babel/helpers - typeof";
12299
12300        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
12301          _typeof = function _typeof(obj) {
12302            return typeof obj;
12303          };
12304        } else {
12305          _typeof = function _typeof(obj) {
12306            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
12307          };
12308        }
12309
12310        return _typeof(obj);
12311      }
12312
12313      function _classCallCheck(instance, Constructor) {
12314        if (!(instance instanceof Constructor)) {
12315          throw new TypeError("Cannot call a class as a function");
12316        }
12317      }
12318
12319      function _defineProperties(target, props) {
12320        for (var i = 0; i < props.length; i++) {
12321          var descriptor = props[i];
12322          descriptor.enumerable = descriptor.enumerable || false;
12323          descriptor.configurable = true;
12324          if ("value" in descriptor) descriptor.writable = true;
12325          Object.defineProperty(target, descriptor.key, descriptor);
12326        }
12327      }
12328
12329      function _createClass(Constructor, protoProps, staticProps) {
12330        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
12331        if (staticProps) _defineProperties(Constructor, staticProps);
12332        return Constructor;
12333      }
12334
12335      function _inherits(subClass, superClass) {
12336        if (typeof superClass !== "function" && superClass !== null) {
12337          throw new TypeError("Super expression must either be null or a function");
12338        }
12339
12340        subClass.prototype = Object.create(superClass && superClass.prototype, {
12341          constructor: {
12342            value: subClass,
12343            writable: true,
12344            configurable: true
12345          }
12346        });
12347        if (superClass) _setPrototypeOf(subClass, superClass);
12348      }
12349
12350      function _setPrototypeOf(o, p) {
12351        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
12352          o.__proto__ = p;
12353          return o;
12354        };
12355
12356        return _setPrototypeOf(o, p);
12357      }
12358
12359      function _createSuper(Derived) {
12360        return function () {
12361          var Super = _getPrototypeOf(Derived),
12362              result;
12363
12364          if (_isNativeReflectConstruct()) {
12365            var NewTarget = _getPrototypeOf(this).constructor;
12366
12367            result = Reflect.construct(Super, arguments, NewTarget);
12368          } else {
12369            result = Super.apply(this, arguments);
12370          }
12371
12372          return _possibleConstructorReturn(this, result);
12373        };
12374      }
12375
12376      function _possibleConstructorReturn(self, call) {
12377        if (call && (_typeof(call) === "object" || typeof call === "function")) {
12378          return call;
12379        }
12380
12381        return _assertThisInitialized(self);
12382      }
12383
12384      function _assertThisInitialized(self) {
12385        if (self === void 0) {
12386          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
12387        }
12388
12389        return self;
12390      }
12391
12392      function _isNativeReflectConstruct() {
12393        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
12394        if (Reflect.construct.sham) return false;
12395        if (typeof Proxy === "function") return true;
12396
12397        try {
12398          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
12399          return true;
12400        } catch (e) {
12401          return false;
12402        }
12403      }
12404
12405      function _getPrototypeOf(o) {
12406        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
12407          return o.__proto__ || Object.getPrototypeOf(o);
12408        };
12409        return _getPrototypeOf(o);
12410      }
12411
12412      var BaseXform = require('./base-xform');
12413      /* 'virtual' methods used as a form of documentation */
12414
12415      /* eslint-disable class-methods-use-this */
12416      // base class for xforms that are composed of other xforms
12417      // offers some default implementations
12418
12419
12420      var CompositeXform = /*#__PURE__*/function (_BaseXform) {
12421        _inherits(CompositeXform, _BaseXform);
12422
12423        var _super = _createSuper(CompositeXform);
12424
12425        function CompositeXform() {
12426          _classCallCheck(this, CompositeXform);
12427
12428          return _super.apply(this, arguments);
12429        }
12430
12431        _createClass(CompositeXform, [{
12432          key: "createNewModel",
12433          value: function createNewModel(node) {
12434            return {};
12435          }
12436        }, {
12437          key: "parseOpen",
12438          value: function parseOpen(node) {
12439            // Typical pattern for composite xform
12440            this.parser = this.parser || this.map[node.name];
12441
12442            if (this.parser) {
12443              this.parser.parseOpen(node);
12444              return true;
12445            }
12446
12447            if (node.name === this.tag) {
12448              this.model = this.createNewModel(node);
12449              return true;
12450            }
12451
12452            return false;
12453          }
12454        }, {
12455          key: "parseText",
12456          value: function parseText(text) {
12457            // Default implementation. Send text to child parser
12458            if (this.parser) {
12459              this.parser.parseText(text);
12460            }
12461          }
12462        }, {
12463          key: "onParserClose",
12464          value: function onParserClose(name, parser) {
12465            // parseClose has seen a child parser close
12466            // now need to incorporate into this.model somehow
12467            this.model[name] = parser.model;
12468          }
12469        }, {
12470          key: "parseClose",
12471          value: function parseClose(name) {
12472            // Default implementation
12473            if (this.parser) {
12474              if (!this.parser.parseClose(name)) {
12475                this.onParserClose(name, this.parser);
12476                this.parser = undefined;
12477              }
12478
12479              return true;
12480            }
12481
12482            return name !== this.tag;
12483          }
12484        }]);
12485
12486        return CompositeXform;
12487      }(BaseXform);
12488
12489      module.exports = CompositeXform;
12490    }, {
12491      "./base-xform": 29
12492    }],
12493    46: [function (require, module, exports) {
12494      "use strict";
12495
12496      function _typeof(obj) {
12497        "@babel/helpers - typeof";
12498
12499        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
12500          _typeof = function _typeof(obj) {
12501            return typeof obj;
12502          };
12503        } else {
12504          _typeof = function _typeof(obj) {
12505            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
12506          };
12507        }
12508
12509        return _typeof(obj);
12510      }
12511
12512      function _classCallCheck(instance, Constructor) {
12513        if (!(instance instanceof Constructor)) {
12514          throw new TypeError("Cannot call a class as a function");
12515        }
12516      }
12517
12518      function _defineProperties(target, props) {
12519        for (var i = 0; i < props.length; i++) {
12520          var descriptor = props[i];
12521          descriptor.enumerable = descriptor.enumerable || false;
12522          descriptor.configurable = true;
12523          if ("value" in descriptor) descriptor.writable = true;
12524          Object.defineProperty(target, descriptor.key, descriptor);
12525        }
12526      }
12527
12528      function _createClass(Constructor, protoProps, staticProps) {
12529        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
12530        if (staticProps) _defineProperties(Constructor, staticProps);
12531        return Constructor;
12532      }
12533
12534      function _inherits(subClass, superClass) {
12535        if (typeof superClass !== "function" && superClass !== null) {
12536          throw new TypeError("Super expression must either be null or a function");
12537        }
12538
12539        subClass.prototype = Object.create(superClass && superClass.prototype, {
12540          constructor: {
12541            value: subClass,
12542            writable: true,
12543            configurable: true
12544          }
12545        });
12546        if (superClass) _setPrototypeOf(subClass, superClass);
12547      }
12548
12549      function _setPrototypeOf(o, p) {
12550        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
12551          o.__proto__ = p;
12552          return o;
12553        };
12554
12555        return _setPrototypeOf(o, p);
12556      }
12557
12558      function _createSuper(Derived) {
12559        return function () {
12560          var Super = _getPrototypeOf(Derived),
12561              result;
12562
12563          if (_isNativeReflectConstruct()) {
12564            var NewTarget = _getPrototypeOf(this).constructor;
12565
12566            result = Reflect.construct(Super, arguments, NewTarget);
12567          } else {
12568            result = Super.apply(this, arguments);
12569          }
12570
12571          return _possibleConstructorReturn(this, result);
12572        };
12573      }
12574
12575      function _possibleConstructorReturn(self, call) {
12576        if (call && (_typeof(call) === "object" || typeof call === "function")) {
12577          return call;
12578        }
12579
12580        return _assertThisInitialized(self);
12581      }
12582
12583      function _assertThisInitialized(self) {
12584        if (self === void 0) {
12585          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
12586        }
12587
12588        return self;
12589      }
12590
12591      function _isNativeReflectConstruct() {
12592        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
12593        if (Reflect.construct.sham) return false;
12594        if (typeof Proxy === "function") return true;
12595
12596        try {
12597          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
12598          return true;
12599        } catch (e) {
12600          return false;
12601        }
12602      }
12603
12604      function _getPrototypeOf(o) {
12605        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
12606          return o.__proto__ || Object.getPrototypeOf(o);
12607        };
12608        return _getPrototypeOf(o);
12609      }
12610
12611      var BaseXform = require('../base-xform');
12612
12613      var AppHeadingPairsXform = /*#__PURE__*/function (_BaseXform) {
12614        _inherits(AppHeadingPairsXform, _BaseXform);
12615
12616        var _super = _createSuper(AppHeadingPairsXform);
12617
12618        function AppHeadingPairsXform() {
12619          _classCallCheck(this, AppHeadingPairsXform);
12620
12621          return _super.apply(this, arguments);
12622        }
12623
12624        _createClass(AppHeadingPairsXform, [{
12625          key: "render",
12626          value: function render(xmlStream, model) {
12627            xmlStream.openNode('HeadingPairs');
12628            xmlStream.openNode('vt:vector', {
12629              size: 2,
12630              baseType: 'variant'
12631            });
12632            xmlStream.openNode('vt:variant');
12633            xmlStream.leafNode('vt:lpstr', undefined, 'Worksheets');
12634            xmlStream.closeNode();
12635            xmlStream.openNode('vt:variant');
12636            xmlStream.leafNode('vt:i4', undefined, model.length);
12637            xmlStream.closeNode();
12638            xmlStream.closeNode();
12639            xmlStream.closeNode();
12640          }
12641        }, {
12642          key: "parseOpen",
12643          value: function parseOpen(node) {
12644            // no parsing
12645            return node.name === 'HeadingPairs';
12646          }
12647        }, {
12648          key: "parseText",
12649          value: function parseText() {}
12650        }, {
12651          key: "parseClose",
12652          value: function parseClose(name) {
12653            return name !== 'HeadingPairs';
12654          }
12655        }]);
12656
12657        return AppHeadingPairsXform;
12658      }(BaseXform);
12659
12660      module.exports = AppHeadingPairsXform;
12661    }, {
12662      "../base-xform": 29
12663    }],
12664    47: [function (require, module, exports) {
12665      "use strict";
12666
12667      function _typeof(obj) {
12668        "@babel/helpers - typeof";
12669
12670        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
12671          _typeof = function _typeof(obj) {
12672            return typeof obj;
12673          };
12674        } else {
12675          _typeof = function _typeof(obj) {
12676            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
12677          };
12678        }
12679
12680        return _typeof(obj);
12681      }
12682
12683      function _classCallCheck(instance, Constructor) {
12684        if (!(instance instanceof Constructor)) {
12685          throw new TypeError("Cannot call a class as a function");
12686        }
12687      }
12688
12689      function _defineProperties(target, props) {
12690        for (var i = 0; i < props.length; i++) {
12691          var descriptor = props[i];
12692          descriptor.enumerable = descriptor.enumerable || false;
12693          descriptor.configurable = true;
12694          if ("value" in descriptor) descriptor.writable = true;
12695          Object.defineProperty(target, descriptor.key, descriptor);
12696        }
12697      }
12698
12699      function _createClass(Constructor, protoProps, staticProps) {
12700        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
12701        if (staticProps) _defineProperties(Constructor, staticProps);
12702        return Constructor;
12703      }
12704
12705      function _inherits(subClass, superClass) {
12706        if (typeof superClass !== "function" && superClass !== null) {
12707          throw new TypeError("Super expression must either be null or a function");
12708        }
12709
12710        subClass.prototype = Object.create(superClass && superClass.prototype, {
12711          constructor: {
12712            value: subClass,
12713            writable: true,
12714            configurable: true
12715          }
12716        });
12717        if (superClass) _setPrototypeOf(subClass, superClass);
12718      }
12719
12720      function _setPrototypeOf(o, p) {
12721        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
12722          o.__proto__ = p;
12723          return o;
12724        };
12725
12726        return _setPrototypeOf(o, p);
12727      }
12728
12729      function _createSuper(Derived) {
12730        return function () {
12731          var Super = _getPrototypeOf(Derived),
12732              result;
12733
12734          if (_isNativeReflectConstruct()) {
12735            var NewTarget = _getPrototypeOf(this).constructor;
12736
12737            result = Reflect.construct(Super, arguments, NewTarget);
12738          } else {
12739            result = Super.apply(this, arguments);
12740          }
12741
12742          return _possibleConstructorReturn(this, result);
12743        };
12744      }
12745
12746      function _possibleConstructorReturn(self, call) {
12747        if (call && (_typeof(call) === "object" || typeof call === "function")) {
12748          return call;
12749        }
12750
12751        return _assertThisInitialized(self);
12752      }
12753
12754      function _assertThisInitialized(self) {
12755        if (self === void 0) {
12756          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
12757        }
12758
12759        return self;
12760      }
12761
12762      function _isNativeReflectConstruct() {
12763        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
12764        if (Reflect.construct.sham) return false;
12765        if (typeof Proxy === "function") return true;
12766
12767        try {
12768          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
12769          return true;
12770        } catch (e) {
12771          return false;
12772        }
12773      }
12774
12775      function _getPrototypeOf(o) {
12776        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
12777          return o.__proto__ || Object.getPrototypeOf(o);
12778        };
12779        return _getPrototypeOf(o);
12780      }
12781
12782      var BaseXform = require('../base-xform');
12783
12784      var AppTitlesOfPartsXform = /*#__PURE__*/function (_BaseXform) {
12785        _inherits(AppTitlesOfPartsXform, _BaseXform);
12786
12787        var _super = _createSuper(AppTitlesOfPartsXform);
12788
12789        function AppTitlesOfPartsXform() {
12790          _classCallCheck(this, AppTitlesOfPartsXform);
12791
12792          return _super.apply(this, arguments);
12793        }
12794
12795        _createClass(AppTitlesOfPartsXform, [{
12796          key: "render",
12797          value: function render(xmlStream, model) {
12798            xmlStream.openNode('TitlesOfParts');
12799            xmlStream.openNode('vt:vector', {
12800              size: model.length,
12801              baseType: 'lpstr'
12802            });
12803            model.forEach(function (sheet) {
12804              xmlStream.leafNode('vt:lpstr', undefined, sheet.name);
12805            });
12806            xmlStream.closeNode();
12807            xmlStream.closeNode();
12808          }
12809        }, {
12810          key: "parseOpen",
12811          value: function parseOpen(node) {
12812            // no parsing
12813            return node.name === 'TitlesOfParts';
12814          }
12815        }, {
12816          key: "parseText",
12817          value: function parseText() {}
12818        }, {
12819          key: "parseClose",
12820          value: function parseClose(name) {
12821            return name !== 'TitlesOfParts';
12822          }
12823        }]);
12824
12825        return AppTitlesOfPartsXform;
12826      }(BaseXform);
12827
12828      module.exports = AppTitlesOfPartsXform;
12829    }, {
12830      "../base-xform": 29
12831    }],
12832    48: [function (require, module, exports) {
12833      "use strict";
12834
12835      function _typeof(obj) {
12836        "@babel/helpers - typeof";
12837
12838        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
12839          _typeof = function _typeof(obj) {
12840            return typeof obj;
12841          };
12842        } else {
12843          _typeof = function _typeof(obj) {
12844            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
12845          };
12846        }
12847
12848        return _typeof(obj);
12849      }
12850
12851      function _classCallCheck(instance, Constructor) {
12852        if (!(instance instanceof Constructor)) {
12853          throw new TypeError("Cannot call a class as a function");
12854        }
12855      }
12856
12857      function _defineProperties(target, props) {
12858        for (var i = 0; i < props.length; i++) {
12859          var descriptor = props[i];
12860          descriptor.enumerable = descriptor.enumerable || false;
12861          descriptor.configurable = true;
12862          if ("value" in descriptor) descriptor.writable = true;
12863          Object.defineProperty(target, descriptor.key, descriptor);
12864        }
12865      }
12866
12867      function _createClass(Constructor, protoProps, staticProps) {
12868        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
12869        if (staticProps) _defineProperties(Constructor, staticProps);
12870        return Constructor;
12871      }
12872
12873      function _inherits(subClass, superClass) {
12874        if (typeof superClass !== "function" && superClass !== null) {
12875          throw new TypeError("Super expression must either be null or a function");
12876        }
12877
12878        subClass.prototype = Object.create(superClass && superClass.prototype, {
12879          constructor: {
12880            value: subClass,
12881            writable: true,
12882            configurable: true
12883          }
12884        });
12885        if (superClass) _setPrototypeOf(subClass, superClass);
12886      }
12887
12888      function _setPrototypeOf(o, p) {
12889        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
12890          o.__proto__ = p;
12891          return o;
12892        };
12893
12894        return _setPrototypeOf(o, p);
12895      }
12896
12897      function _createSuper(Derived) {
12898        return function () {
12899          var Super = _getPrototypeOf(Derived),
12900              result;
12901
12902          if (_isNativeReflectConstruct()) {
12903            var NewTarget = _getPrototypeOf(this).constructor;
12904
12905            result = Reflect.construct(Super, arguments, NewTarget);
12906          } else {
12907            result = Super.apply(this, arguments);
12908          }
12909
12910          return _possibleConstructorReturn(this, result);
12911        };
12912      }
12913
12914      function _possibleConstructorReturn(self, call) {
12915        if (call && (_typeof(call) === "object" || typeof call === "function")) {
12916          return call;
12917        }
12918
12919        return _assertThisInitialized(self);
12920      }
12921
12922      function _assertThisInitialized(self) {
12923        if (self === void 0) {
12924          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
12925        }
12926
12927        return self;
12928      }
12929
12930      function _isNativeReflectConstruct() {
12931        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
12932        if (Reflect.construct.sham) return false;
12933        if (typeof Proxy === "function") return true;
12934
12935        try {
12936          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
12937          return true;
12938        } catch (e) {
12939          return false;
12940        }
12941      }
12942
12943      function _getPrototypeOf(o) {
12944        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
12945          return o.__proto__ || Object.getPrototypeOf(o);
12946        };
12947        return _getPrototypeOf(o);
12948      }
12949
12950      var XmlStream = require('../../../utils/xml-stream');
12951
12952      var BaseXform = require('../base-xform');
12953
12954      var StringXform = require('../simple/string-xform');
12955
12956      var AppHeadingPairsXform = require('./app-heading-pairs-xform');
12957
12958      var AppTitleOfPartsXform = require('./app-titles-of-parts-xform');
12959
12960      var AppXform = /*#__PURE__*/function (_BaseXform) {
12961        _inherits(AppXform, _BaseXform);
12962
12963        var _super = _createSuper(AppXform);
12964
12965        function AppXform() {
12966          var _this;
12967
12968          _classCallCheck(this, AppXform);
12969
12970          _this = _super.call(this);
12971          _this.map = {
12972            Company: new StringXform({
12973              tag: 'Company'
12974            }),
12975            Manager: new StringXform({
12976              tag: 'Manager'
12977            }),
12978            HeadingPairs: new AppHeadingPairsXform(),
12979            TitleOfParts: new AppTitleOfPartsXform()
12980          };
12981          return _this;
12982        }
12983
12984        _createClass(AppXform, [{
12985          key: "render",
12986          value: function render(xmlStream, model) {
12987            xmlStream.openXml(XmlStream.StdDocAttributes);
12988            xmlStream.openNode('Properties', AppXform.PROPERTY_ATTRIBUTES);
12989            xmlStream.leafNode('Application', undefined, 'Microsoft Excel');
12990            xmlStream.leafNode('DocSecurity', undefined, '0');
12991            xmlStream.leafNode('ScaleCrop', undefined, 'false');
12992            this.map.HeadingPairs.render(xmlStream, model.worksheets);
12993            this.map.TitleOfParts.render(xmlStream, model.worksheets);
12994            this.map.Company.render(xmlStream, model.company || '');
12995            this.map.Manager.render(xmlStream, model.manager);
12996            xmlStream.leafNode('LinksUpToDate', undefined, 'false');
12997            xmlStream.leafNode('SharedDoc', undefined, 'false');
12998            xmlStream.leafNode('HyperlinksChanged', undefined, 'false');
12999            xmlStream.leafNode('AppVersion', undefined, '16.0300');
13000            xmlStream.closeNode();
13001          }
13002        }, {
13003          key: "parseOpen",
13004          value: function parseOpen(node) {
13005            if (this.parser) {
13006              this.parser.parseOpen(node);
13007              return true;
13008            }
13009
13010            switch (node.name) {
13011              case 'Properties':
13012                return true;
13013
13014              default:
13015                this.parser = this.map[node.name];
13016
13017                if (this.parser) {
13018                  this.parser.parseOpen(node);
13019                  return true;
13020                } // there's a lot we don't bother to parse
13021
13022
13023                return false;
13024            }
13025          }
13026        }, {
13027          key: "parseText",
13028          value: function parseText(text) {
13029            if (this.parser) {
13030              this.parser.parseText(text);
13031            }
13032          }
13033        }, {
13034          key: "parseClose",
13035          value: function parseClose(name) {
13036            if (this.parser) {
13037              if (!this.parser.parseClose(name)) {
13038                this.parser = undefined;
13039              }
13040
13041              return true;
13042            }
13043
13044            switch (name) {
13045              case 'Properties':
13046                this.model = {
13047                  worksheets: this.map.TitleOfParts.model,
13048                  company: this.map.Company.model,
13049                  manager: this.map.Manager.model
13050                };
13051                return false;
13052
13053              default:
13054                return true;
13055            }
13056          }
13057        }]);
13058
13059        return AppXform;
13060      }(BaseXform);
13061
13062      AppXform.DateFormat = function (dt) {
13063        return dt.toISOString().replace(/[.]\d{3,6}/, '');
13064      };
13065
13066      AppXform.DateAttrs = {
13067        'xsi:type': 'dcterms:W3CDTF'
13068      };
13069      AppXform.PROPERTY_ATTRIBUTES = {
13070        xmlns: 'http://schemas.openxmlformats.org/officeDocument/2006/extended-properties',
13071        'xmlns:vt': 'http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes'
13072      };
13073      module.exports = AppXform;
13074    }, {
13075      "../../../utils/xml-stream": 25,
13076      "../base-xform": 29,
13077      "../simple/string-xform": 116,
13078      "./app-heading-pairs-xform": 46,
13079      "./app-titles-of-parts-xform": 47
13080    }],
13081    49: [function (require, module, exports) {
13082      "use strict";
13083
13084      function _typeof(obj) {
13085        "@babel/helpers - typeof";
13086
13087        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
13088          _typeof = function _typeof(obj) {
13089            return typeof obj;
13090          };
13091        } else {
13092          _typeof = function _typeof(obj) {
13093            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
13094          };
13095        }
13096
13097        return _typeof(obj);
13098      }
13099
13100      function _classCallCheck(instance, Constructor) {
13101        if (!(instance instanceof Constructor)) {
13102          throw new TypeError("Cannot call a class as a function");
13103        }
13104      }
13105
13106      function _defineProperties(target, props) {
13107        for (var i = 0; i < props.length; i++) {
13108          var descriptor = props[i];
13109          descriptor.enumerable = descriptor.enumerable || false;
13110          descriptor.configurable = true;
13111          if ("value" in descriptor) descriptor.writable = true;
13112          Object.defineProperty(target, descriptor.key, descriptor);
13113        }
13114      }
13115
13116      function _createClass(Constructor, protoProps, staticProps) {
13117        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
13118        if (staticProps) _defineProperties(Constructor, staticProps);
13119        return Constructor;
13120      }
13121
13122      function _inherits(subClass, superClass) {
13123        if (typeof superClass !== "function" && superClass !== null) {
13124          throw new TypeError("Super expression must either be null or a function");
13125        }
13126
13127        subClass.prototype = Object.create(superClass && superClass.prototype, {
13128          constructor: {
13129            value: subClass,
13130            writable: true,
13131            configurable: true
13132          }
13133        });
13134        if (superClass) _setPrototypeOf(subClass, superClass);
13135      }
13136
13137      function _setPrototypeOf(o, p) {
13138        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
13139          o.__proto__ = p;
13140          return o;
13141        };
13142
13143        return _setPrototypeOf(o, p);
13144      }
13145
13146      function _createSuper(Derived) {
13147        return function () {
13148          var Super = _getPrototypeOf(Derived),
13149              result;
13150
13151          if (_isNativeReflectConstruct()) {
13152            var NewTarget = _getPrototypeOf(this).constructor;
13153
13154            result = Reflect.construct(Super, arguments, NewTarget);
13155          } else {
13156            result = Super.apply(this, arguments);
13157          }
13158
13159          return _possibleConstructorReturn(this, result);
13160        };
13161      }
13162
13163      function _possibleConstructorReturn(self, call) {
13164        if (call && (_typeof(call) === "object" || typeof call === "function")) {
13165          return call;
13166        }
13167
13168        return _assertThisInitialized(self);
13169      }
13170
13171      function _assertThisInitialized(self) {
13172        if (self === void 0) {
13173          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
13174        }
13175
13176        return self;
13177      }
13178
13179      function _isNativeReflectConstruct() {
13180        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
13181        if (Reflect.construct.sham) return false;
13182        if (typeof Proxy === "function") return true;
13183
13184        try {
13185          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
13186          return true;
13187        } catch (e) {
13188          return false;
13189        }
13190      }
13191
13192      function _getPrototypeOf(o) {
13193        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
13194          return o.__proto__ || Object.getPrototypeOf(o);
13195        };
13196        return _getPrototypeOf(o);
13197      }
13198
13199      var XmlStream = require('../../../utils/xml-stream');
13200
13201      var BaseXform = require('../base-xform'); // used for rendering the [Content_Types].xml file
13202      // not used for parsing
13203
13204
13205      var ContentTypesXform = /*#__PURE__*/function (_BaseXform) {
13206        _inherits(ContentTypesXform, _BaseXform);
13207
13208        var _super = _createSuper(ContentTypesXform);
13209
13210        function ContentTypesXform() {
13211          _classCallCheck(this, ContentTypesXform);
13212
13213          return _super.apply(this, arguments);
13214        }
13215
13216        _createClass(ContentTypesXform, [{
13217          key: "render",
13218          value: function render(xmlStream, model) {
13219            xmlStream.openXml(XmlStream.StdDocAttributes);
13220            xmlStream.openNode('Types', ContentTypesXform.PROPERTY_ATTRIBUTES);
13221            var mediaHash = {};
vendor: 4,188 bytes, lines 13222-13324
13222            (model.media || []).forEach(function (medium) {
13223              if (medium.type === 'image') {
13224                var imageType = medium.extension;
13225
13226                if (!mediaHash[imageType]) {
13227                  mediaHash[imageType] = true;
13228                  xmlStream.leafNode('Default', {
13229                    Extension: imageType,
13230                    ContentType: "image/".concat(imageType)
13231                  });
13232                }
13233              }
13234            });
13235            xmlStream.leafNode('Default', {
13236              Extension: 'rels',
13237              ContentType: 'application/vnd.openxmlformats-package.relationships+xml'
13238            });
13239            xmlStream.leafNode('Default', {
13240              Extension: 'xml',
13241              ContentType: 'application/xml'
13242            });
13243            xmlStream.leafNode('Override', {
13244              PartName: '/xl/workbook.xml',
13245              ContentType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml'
13246            });
13247            model.worksheets.forEach(function (worksheet) {
13248              var name = "/xl/worksheets/sheet".concat(worksheet.id, ".xml");
13249              xmlStream.leafNode('Override', {
13250                PartName: name,
13251                ContentType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml'
13252              });
13253            });
13254            xmlStream.leafNode('Override', {
13255              PartName: '/xl/theme/theme1.xml',
13256              ContentType: 'application/vnd.openxmlformats-officedocument.theme+xml'
13257            });
13258            xmlStream.leafNode('Override', {
13259              PartName: '/xl/styles.xml',
13260              ContentType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml'
13261            });
13262            var hasSharedStrings = model.sharedStrings && model.sharedStrings.count;
13263
13264            if (hasSharedStrings) {
13265              xmlStream.leafNode('Override', {
13266                PartName: '/xl/sharedStrings.xml',
13267                ContentType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml'
13268              });
13269            }
13270
13271            if (model.tables) {
13272              model.tables.forEach(function (table) {
13273                xmlStream.leafNode('Override', {
13274                  PartName: "/xl/tables/".concat(table.target),
13275                  ContentType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml'
13276                });
13277              });
13278            }
13279
13280            if (model.drawings) {
13281              model.drawings.forEach(function (drawing) {
13282                xmlStream.leafNode('Override', {
13283                  PartName: "/xl/drawings/".concat(drawing.name, ".xml"),
13284                  ContentType: 'application/vnd.openxmlformats-officedocument.drawing+xml'
13285                });
13286              });
13287            }
13288
13289            if (model.commentRefs) {
13290              xmlStream.leafNode('Default', {
13291                Extension: 'vml',
13292                ContentType: 'application/vnd.openxmlformats-officedocument.vmlDrawing'
13293              });
13294              model.commentRefs.forEach(function (_ref) {
13295                var commentName = _ref.commentName;
13296                xmlStream.leafNode('Override', {
13297                  PartName: "/xl/".concat(commentName, ".xml"),
13298                  ContentType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml'
13299                });
13300              });
13301            }
13302
13303            xmlStream.leafNode('Override', {
13304              PartName: '/docProps/core.xml',
13305              ContentType: 'application/vnd.openxmlformats-package.core-properties+xml'
13306            });
13307            xmlStream.leafNode('Override', {
13308              PartName: '/docProps/app.xml',
13309              ContentType: 'application/vnd.openxmlformats-officedocument.extended-properties+xml'
13310            });
13311            xmlStream.closeNode();
13312          }
13313        }, {
13314          key: "parseOpen",
13315          value: function parseOpen() {
13316            return false;
13317          }
13318        }, {
13319          key: "parseText",
13320          value: function parseText() {}
13321        }, {
13322          key: "parseClose",
13323          value: function parseClose() {
13324            return false;
13325          }
13326        }]);
13327
13328        return ContentTypesXform;
13329      }(BaseXform);
13330
13331      ContentTypesXform.PROPERTY_ATTRIBUTES = {
13332        xmlns: 'http://schemas.openxmlformats.org/package/2006/content-types'
13333      };
13334      module.exports = ContentTypesXform;
13335    }, {
13336      "../../../utils/xml-stream": 25,
13337      "../base-xform": 29
13338    }],
13339    50: [function (require, module, exports) {
13340      "use strict";
13341
13342      function _typeof(obj) {
13343        "@babel/helpers - typeof";
13344
13345        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
13346          _typeof = function _typeof(obj) {
13347            return typeof obj;
13348          };
13349        } else {
13350          _typeof = function _typeof(obj) {
13351            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
13352          };
13353        }
13354
13355        return _typeof(obj);
13356      }
13357
13358      function _classCallCheck(instance, Constructor) {
13359        if (!(instance instanceof Constructor)) {
13360          throw new TypeError("Cannot call a class as a function");
13361        }
13362      }
13363
13364      function _defineProperties(target, props) {
13365        for (var i = 0; i < props.length; i++) {
13366          var descriptor = props[i];
13367          descriptor.enumerable = descriptor.enumerable || false;
13368          descriptor.configurable = true;
13369          if ("value" in descriptor) descriptor.writable = true;
13370          Object.defineProperty(target, descriptor.key, descriptor);
13371        }
13372      }
13373
13374      function _createClass(Constructor, protoProps, staticProps) {
13375        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
13376        if (staticProps) _defineProperties(Constructor, staticProps);
13377        return Constructor;
13378      }
13379
13380      function _inherits(subClass, superClass) {
13381        if (typeof superClass !== "function" && superClass !== null) {
13382          throw new TypeError("Super expression must either be null or a function");
13383        }
13384
13385        subClass.prototype = Object.create(superClass && superClass.prototype, {
13386          constructor: {
13387            value: subClass,
13388            writable: true,
13389            configurable: true
13390          }
13391        });
13392        if (superClass) _setPrototypeOf(subClass, superClass);
13393      }
13394
13395      function _setPrototypeOf(o, p) {
13396        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
13397          o.__proto__ = p;
13398          return o;
13399        };
13400
13401        return _setPrototypeOf(o, p);
13402      }
13403
13404      function _createSuper(Derived) {
13405        return function () {
13406          var Super = _getPrototypeOf(Derived),
13407              result;
13408
13409          if (_isNativeReflectConstruct()) {
13410            var NewTarget = _getPrototypeOf(this).constructor;
13411
13412            result = Reflect.construct(Super, arguments, NewTarget);
13413          } else {
13414            result = Super.apply(this, arguments);
13415          }
13416
13417          return _possibleConstructorReturn(this, result);
13418        };
13419      }
13420
13421      function _possibleConstructorReturn(self, call) {
13422        if (call && (_typeof(call) === "object" || typeof call === "function")) {
13423          return call;
13424        }
13425
13426        return _assertThisInitialized(self);
13427      }
13428
13429      function _assertThisInitialized(self) {
13430        if (self === void 0) {
13431          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
13432        }
13433
13434        return self;
13435      }
13436
13437      function _isNativeReflectConstruct() {
13438        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
13439        if (Reflect.construct.sham) return false;
13440        if (typeof Proxy === "function") return true;
13441
13442        try {
13443          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
13444          return true;
13445        } catch (e) {
13446          return false;
13447        }
13448      }
13449
13450      function _getPrototypeOf(o) {
13451        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
13452          return o.__proto__ || Object.getPrototypeOf(o);
13453        };
13454        return _getPrototypeOf(o);
13455      }
13456
13457      var XmlStream = require('../../../utils/xml-stream');
13458
13459      var BaseXform = require('../base-xform');
13460
13461      var DateXform = require('../simple/date-xform');
13462
13463      var StringXform = require('../simple/string-xform');
13464
13465      var IntegerXform = require('../simple/integer-xform');
13466
13467      var CoreXform = /*#__PURE__*/function (_BaseXform) {
13468        _inherits(CoreXform, _BaseXform);
13469
13470        var _super = _createSuper(CoreXform);
13471
13472        function CoreXform() {
13473          var _this;
13474
13475          _classCallCheck(this, CoreXform);
13476
13477          _this = _super.call(this);
13478          _this.map = {
13479            'dc:creator': new StringXform({
13480              tag: 'dc:creator'
13481            }),
13482            'dc:title': new StringXform({
13483              tag: 'dc:title'
13484            }),
13485            'dc:subject': new StringXform({
13486              tag: 'dc:subject'
13487            }),
13488            'dc:description': new StringXform({
13489              tag: 'dc:description'
13490            }),
13491            'dc:identifier': new StringXform({
13492              tag: 'dc:identifier'
13493            }),
13494            'dc:language': new StringXform({
13495              tag: 'dc:language'
13496            }),
13497            'cp:keywords': new StringXform({
13498              tag: 'cp:keywords'
13499            }),
13500            'cp:category': new StringXform({
13501              tag: 'cp:category'
13502            }),
13503            'cp:lastModifiedBy': new StringXform({
13504              tag: 'cp:lastModifiedBy'
13505            }),
13506            'cp:lastPrinted': new DateXform({
13507              tag: 'cp:lastPrinted',
13508              format: CoreXform.DateFormat
13509            }),
13510            'cp:revision': new IntegerXform({
13511              tag: 'cp:revision'
13512            }),
13513            'cp:version': new StringXform({
13514              tag: 'cp:version'
13515            }),
13516            'cp:contentStatus': new StringXform({
13517              tag: 'cp:contentStatus'
13518            }),
13519            'cp:contentType': new StringXform({
13520              tag: 'cp:contentType'
13521            }),
13522            'dcterms:created': new DateXform({
13523              tag: 'dcterms:created',
13524              attrs: CoreXform.DateAttrs,
13525              format: CoreXform.DateFormat
13526            }),
13527            'dcterms:modified': new DateXform({
13528              tag: 'dcterms:modified',
13529              attrs: CoreXform.DateAttrs,
13530              format: CoreXform.DateFormat
13531            })
13532          };
13533          return _this;
13534        }
13535
13536        _createClass(CoreXform, [{
13537          key: "render",
13538          value: function render(xmlStream, model) {
13539            xmlStream.openXml(XmlStream.StdDocAttributes);
13540            xmlStream.openNode('cp:coreProperties', CoreXform.CORE_PROPERTY_ATTRIBUTES);
13541            this.map['dc:creator'].render(xmlStream, model.creator);
13542            this.map['dc:title'].render(xmlStream, model.title);
13543            this.map['dc:subject'].render(xmlStream, model.subject);
13544            this.map['dc:description'].render(xmlStream, model.description);
13545            this.map['dc:identifier'].render(xmlStream, model.identifier);
13546            this.map['dc:language'].render(xmlStream, model.language);
13547            this.map['cp:keywords'].render(xmlStream, model.keywords);
13548            this.map['cp:category'].render(xmlStream, model.category);
13549            this.map['cp:lastModifiedBy'].render(xmlStream, model.lastModifiedBy);
13550            this.map['cp:lastPrinted'].render(xmlStream, model.lastPrinted);
13551            this.map['cp:revision'].render(xmlStream, model.revision);
13552            this.map['cp:version'].render(xmlStream, model.version);
13553            this.map['cp:contentStatus'].render(xmlStream, model.contentStatus);
13554            this.map['cp:contentType'].render(xmlStream, model.contentType);
13555            this.map['dcterms:created'].render(xmlStream, model.created);
13556            this.map['dcterms:modified'].render(xmlStream, model.modified);
13557            xmlStream.closeNode();
13558          }
13559        }, {
13560          key: "parseOpen",
13561          value: function parseOpen(node) {
13562            if (this.parser) {
13563              this.parser.parseOpen(node);
13564              return true;
13565            }
13566
13567            switch (node.name) {
13568              case 'cp:coreProperties':
13569              case 'coreProperties':
13570                return true;
13571
13572              default:
13573                this.parser = this.map[node.name];
13574
13575                if (this.parser) {
13576                  this.parser.parseOpen(node);
13577                  return true;
13578                }
13579
13580                throw new Error("Unexpected xml node in parseOpen: ".concat(JSON.stringify(node)));
13581            }
13582          }
13583        }, {
13584          key: "parseText",
13585          value: function parseText(text) {
13586            if (this.parser) {
13587              this.parser.parseText(text);
13588            }
13589          }
13590        }, {
13591          key: "parseClose",
13592          value: function parseClose(name) {
13593            if (this.parser) {
13594              if (!this.parser.parseClose(name)) {
13595                this.parser = undefined;
13596              }
13597
13598              return true;
13599            }
13600
13601            switch (name) {
13602              case 'cp:coreProperties':
13603              case 'coreProperties':
13604                this.model = {
13605                  creator: this.map['dc:creator'].model,
13606                  title: this.map['dc:title'].model,
13607                  subject: this.map['dc:subject'].model,
13608                  description: this.map['dc:description'].model,
13609                  identifier: this.map['dc:identifier'].model,
13610                  language: this.map['dc:language'].model,
13611                  keywords: this.map['cp:keywords'].model,
13612                  category: this.map['cp:category'].model,
13613                  lastModifiedBy: this.map['cp:lastModifiedBy'].model,
13614                  lastPrinted: this.map['cp:lastPrinted'].model,
13615                  revision: this.map['cp:revision'].model,
13616                  contentStatus: this.map['cp:contentStatus'].model,
13617                  contentType: this.map['cp:contentType'].model,
13618                  created: this.map['dcterms:created'].model,
13619                  modified: this.map['dcterms:modified'].model
13620                };
13621                return false;
13622
13623              default:
13624                throw new Error("Unexpected xml node in parseClose: ".concat(name));
13625            }
13626          }
13627        }]);
13628
13629        return CoreXform;
13630      }(BaseXform);
13631
13632      CoreXform.DateFormat = function (dt) {
13633        return dt.toISOString().replace(/[.]\d{3}/, '');
13634      };
13635
13636      CoreXform.DateAttrs = {
13637        'xsi:type': 'dcterms:W3CDTF'
13638      };
13639      CoreXform.CORE_PROPERTY_ATTRIBUTES = {
13640        'xmlns:cp': 'http://schemas.openxmlformats.org/package/2006/metadata/core-properties',
13641        'xmlns:dc': 'http://purl.org/dc/elements/1.1/',
13642        'xmlns:dcterms': 'http://purl.org/dc/terms/',
13643        'xmlns:dcmitype': 'http://purl.org/dc/dcmitype/',
13644        'xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance'
13645      };
13646      module.exports = CoreXform;
13647    }, {
13648      "../../../utils/xml-stream": 25,
13649      "../base-xform": 29,
13650      "../simple/date-xform": 114,
13651      "../simple/integer-xform": 115,
13652      "../simple/string-xform": 116
13653    }],
13654    51: [function (require, module, exports) {
13655      "use strict";
13656
13657      function _typeof(obj) {
13658        "@babel/helpers - typeof";
13659
13660        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
13661          _typeof = function _typeof(obj) {
13662            return typeof obj;
13663          };
13664        } else {
13665          _typeof = function _typeof(obj) {
13666            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
13667          };
13668        }
13669
13670        return _typeof(obj);
13671      }
13672
13673      function _classCallCheck(instance, Constructor) {
13674        if (!(instance instanceof Constructor)) {
13675          throw new TypeError("Cannot call a class as a function");
13676        }
13677      }
13678
13679      function _defineProperties(target, props) {
13680        for (var i = 0; i < props.length; i++) {
13681          var descriptor = props[i];
13682          descriptor.enumerable = descriptor.enumerable || false;
13683          descriptor.configurable = true;
13684          if ("value" in descriptor) descriptor.writable = true;
13685          Object.defineProperty(target, descriptor.key, descriptor);
13686        }
13687      }
13688
13689      function _createClass(Constructor, protoProps, staticProps) {
13690        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
13691        if (staticProps) _defineProperties(Constructor, staticProps);
13692        return Constructor;
13693      }
13694
13695      function _inherits(subClass, superClass) {
13696        if (typeof superClass !== "function" && superClass !== null) {
13697          throw new TypeError("Super expression must either be null or a function");
13698        }
13699
13700        subClass.prototype = Object.create(superClass && superClass.prototype, {
13701          constructor: {
13702            value: subClass,
13703            writable: true,
13704            configurable: true
13705          }
13706        });
13707        if (superClass) _setPrototypeOf(subClass, superClass);
13708      }
13709
13710      function _setPrototypeOf(o, p) {
13711        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
13712          o.__proto__ = p;
13713          return o;
13714        };
13715
13716        return _setPrototypeOf(o, p);
13717      }
13718
13719      function _createSuper(Derived) {
13720        return function () {
13721          var Super = _getPrototypeOf(Derived),
13722              result;
13723
13724          if (_isNativeReflectConstruct()) {
13725            var NewTarget = _getPrototypeOf(this).constructor;
13726
13727            result = Reflect.construct(Super, arguments, NewTarget);
13728          } else {
13729            result = Super.apply(this, arguments);
13730          }
13731
13732          return _possibleConstructorReturn(this, result);
13733        };
13734      }
13735
13736      function _possibleConstructorReturn(self, call) {
13737        if (call && (_typeof(call) === "object" || typeof call === "function")) {
13738          return call;
13739        }
13740
13741        return _assertThisInitialized(self);
13742      }
13743
13744      function _assertThisInitialized(self) {
13745        if (self === void 0) {
13746          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
13747        }
13748
13749        return self;
13750      }
13751
13752      function _isNativeReflectConstruct() {
13753        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
13754        if (Reflect.construct.sham) return false;
13755        if (typeof Proxy === "function") return true;
13756
13757        try {
13758          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
13759          return true;
13760        } catch (e) {
13761          return false;
13762        }
13763      }
13764
13765      function _getPrototypeOf(o) {
13766        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
13767          return o.__proto__ || Object.getPrototypeOf(o);
13768        };
13769        return _getPrototypeOf(o);
13770      }
13771
13772      var BaseXform = require('../base-xform');
13773
13774      var RelationshipXform = /*#__PURE__*/function (_BaseXform) {
13775        _inherits(RelationshipXform, _BaseXform);
13776
13777        var _super = _createSuper(RelationshipXform);
13778
13779        function RelationshipXform() {
13780          _classCallCheck(this, RelationshipXform);
13781
13782          return _super.apply(this, arguments);
13783        }
13784
13785        _createClass(RelationshipXform, [{
13786          key: "render",
13787          value: function render(xmlStream, model) {
13788            xmlStream.leafNode('Relationship', model);
13789          }
13790        }, {
13791          key: "parseOpen",
13792          value: function parseOpen(node) {
13793            switch (node.name) {
13794              case 'Relationship':
13795                this.model = node.attributes;
13796                return true;
13797
13798              default:
13799                return false;
13800            }
13801          }
13802        }, {
13803          key: "parseText",
13804          value: function parseText() {}
13805        }, {
13806          key: "parseClose",
13807          value: function parseClose() {
13808            return false;
13809          }
13810        }]);
13811
13812        return RelationshipXform;
13813      }(BaseXform);
13814
13815      module.exports = RelationshipXform;
13816    }, {
13817      "../base-xform": 29
13818    }],
13819    52: [function (require, module, exports) {
13820      "use strict";
13821
13822      function _typeof(obj) {
13823        "@babel/helpers - typeof";
13824
13825        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
13826          _typeof = function _typeof(obj) {
13827            return typeof obj;
13828          };
13829        } else {
13830          _typeof = function _typeof(obj) {
13831            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
13832          };
13833        }
13834
13835        return _typeof(obj);
13836      }
13837
13838      function _classCallCheck(instance, Constructor) {
13839        if (!(instance instanceof Constructor)) {
13840          throw new TypeError("Cannot call a class as a function");
13841        }
13842      }
13843
13844      function _defineProperties(target, props) {
13845        for (var i = 0; i < props.length; i++) {
13846          var descriptor = props[i];
13847          descriptor.enumerable = descriptor.enumerable || false;
13848          descriptor.configurable = true;
13849          if ("value" in descriptor) descriptor.writable = true;
13850          Object.defineProperty(target, descriptor.key, descriptor);
13851        }
13852      }
13853
13854      function _createClass(Constructor, protoProps, staticProps) {
13855        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
13856        if (staticProps) _defineProperties(Constructor, staticProps);
13857        return Constructor;
13858      }
13859
13860      function _inherits(subClass, superClass) {
13861        if (typeof superClass !== "function" && superClass !== null) {
13862          throw new TypeError("Super expression must either be null or a function");
13863        }
13864
13865        subClass.prototype = Object.create(superClass && superClass.prototype, {
13866          constructor: {
13867            value: subClass,
13868            writable: true,
13869            configurable: true
13870          }
13871        });
13872        if (superClass) _setPrototypeOf(subClass, superClass);
13873      }
13874
13875      function _setPrototypeOf(o, p) {
13876        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
13877          o.__proto__ = p;
13878          return o;
13879        };
13880
13881        return _setPrototypeOf(o, p);
13882      }
13883
13884      function _createSuper(Derived) {
13885        return function () {
13886          var Super = _getPrototypeOf(Derived),
13887              result;
13888
13889          if (_isNativeReflectConstruct()) {
13890            var NewTarget = _getPrototypeOf(this).constructor;
13891
13892            result = Reflect.construct(Super, arguments, NewTarget);
13893          } else {
13894            result = Super.apply(this, arguments);
13895          }
13896
13897          return _possibleConstructorReturn(this, result);
13898        };
13899      }
13900
13901      function _possibleConstructorReturn(self, call) {
13902        if (call && (_typeof(call) === "object" || typeof call === "function")) {
13903          return call;
13904        }
13905
13906        return _assertThisInitialized(self);
13907      }
13908
13909      function _assertThisInitialized(self) {
13910        if (self === void 0) {
13911          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
13912        }
13913
13914        return self;
13915      }
13916
13917      function _isNativeReflectConstruct() {
13918        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
13919        if (Reflect.construct.sham) return false;
13920        if (typeof Proxy === "function") return true;
13921
13922        try {
13923          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
13924          return true;
13925        } catch (e) {
13926          return false;
13927        }
13928      }
13929
13930      function _getPrototypeOf(o) {
13931        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
13932          return o.__proto__ || Object.getPrototypeOf(o);
13933        };
13934        return _getPrototypeOf(o);
13935      }
13936
13937      var XmlStream = require('../../../utils/xml-stream');
13938
13939      var BaseXform = require('../base-xform');
13940
13941      var RelationshipXform = require('./relationship-xform');
13942
13943      var RelationshipsXform = /*#__PURE__*/function (_BaseXform) {
13944        _inherits(RelationshipsXform, _BaseXform);
13945
13946        var _super = _createSuper(RelationshipsXform);
13947
13948        function RelationshipsXform() {
13949          var _this;
13950
13951          _classCallCheck(this, RelationshipsXform);
13952
13953          _this = _super.call(this);
13954          _this.map = {
13955            Relationship: new RelationshipXform()
13956          };
13957          return _this;
13958        }
13959
13960        _createClass(RelationshipsXform, [{
13961          key: "render",
13962          value: function render(xmlStream, model) {
13963            var _this2 = this;
13964
13965            model = model || this._values;
13966            xmlStream.openXml(XmlStream.StdDocAttributes);
13967            xmlStream.openNode('Relationships', RelationshipsXform.RELATIONSHIPS_ATTRIBUTES);
13968            model.forEach(function (relationship) {
13969              _this2.map.Relationship.render(xmlStream, relationship);
13970            });
13971            xmlStream.closeNode();
13972          }
13973        }, {
13974          key: "parseOpen",
13975          value: function parseOpen(node) {
13976            if (this.parser) {
13977              this.parser.parseOpen(node);
13978              return true;
13979            }
13980
13981            switch (node.name) {
13982              case 'Relationships':
13983                this.model = [];
13984                return true;
13985
13986              default:
13987                this.parser = this.map[node.name];
13988
13989                if (this.parser) {
13990                  this.parser.parseOpen(node);
13991                  return true;
13992                }
13993
13994                throw new Error("Unexpected xml node in parseOpen: ".concat(JSON.stringify(node)));
13995            }
13996          }
13997        }, {
13998          key: "parseText",
13999          value: function parseText(text) {
14000            if (this.parser) {
14001              this.parser.parseText(text);
14002            }
14003          }
14004        }, {
14005          key: "parseClose",
14006          value: function parseClose(name) {
14007            if (this.parser) {
14008              if (!this.parser.parseClose(name)) {
14009                this.model.push(this.parser.model);
14010                this.parser = undefined;
14011              }
14012
14013              return true;
14014            }
14015
14016            switch (name) {
14017              case 'Relationships':
14018                return false;
14019
14020              default:
14021                throw new Error("Unexpected xml node in parseClose: ".concat(name));
14022            }
14023          }
14024        }]);
14025
14026        return RelationshipsXform;
14027      }(BaseXform);
14028
14029      RelationshipsXform.RELATIONSHIPS_ATTRIBUTES = {
14030        xmlns: 'http://schemas.openxmlformats.org/package/2006/relationships'
14031      };
14032      module.exports = RelationshipsXform;
14033    }, {
14034      "../../../utils/xml-stream": 25,
14035      "../base-xform": 29,
14036      "./relationship-xform": 51
14037    }],
14038    53: [function (require, module, exports) {
14039      "use strict";
14040
14041      function _typeof(obj) {
14042        "@babel/helpers - typeof";
14043
14044        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
14045          _typeof = function _typeof(obj) {
14046            return typeof obj;
14047          };
14048        } else {
14049          _typeof = function _typeof(obj) {
14050            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
14051          };
14052        }
14053
14054        return _typeof(obj);
14055      }
14056
14057      function _classCallCheck(instance, Constructor) {
14058        if (!(instance instanceof Constructor)) {
14059          throw new TypeError("Cannot call a class as a function");
14060        }
14061      }
14062
14063      function _defineProperties(target, props) {
14064        for (var i = 0; i < props.length; i++) {
14065          var descriptor = props[i];
14066          descriptor.enumerable = descriptor.enumerable || false;
14067          descriptor.configurable = true;
14068          if ("value" in descriptor) descriptor.writable = true;
14069          Object.defineProperty(target, descriptor.key, descriptor);
14070        }
14071      }
14072
14073      function _createClass(Constructor, protoProps, staticProps) {
14074        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
14075        if (staticProps) _defineProperties(Constructor, staticProps);
14076        return Constructor;
14077      }
14078
14079      function _inherits(subClass, superClass) {
14080        if (typeof superClass !== "function" && superClass !== null) {
14081          throw new TypeError("Super expression must either be null or a function");
14082        }
14083
14084        subClass.prototype = Object.create(superClass && superClass.prototype, {
14085          constructor: {
14086            value: subClass,
14087            writable: true,
14088            configurable: true
14089          }
14090        });
14091        if (superClass) _setPrototypeOf(subClass, superClass);
14092      }
14093
14094      function _setPrototypeOf(o, p) {
14095        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
14096          o.__proto__ = p;
14097          return o;
14098        };
14099
14100        return _setPrototypeOf(o, p);
14101      }
14102
14103      function _createSuper(Derived) {
14104        return function () {
14105          var Super = _getPrototypeOf(Derived),
14106              result;
14107
14108          if (_isNativeReflectConstruct()) {
14109            var NewTarget = _getPrototypeOf(this).constructor;
14110
14111            result = Reflect.construct(Super, arguments, NewTarget);
14112          } else {
14113            result = Super.apply(this, arguments);
14114          }
14115
14116          return _possibleConstructorReturn(this, result);
14117        };
14118      }
14119
14120      function _possibleConstructorReturn(self, call) {
14121        if (call && (_typeof(call) === "object" || typeof call === "function")) {
14122          return call;
14123        }
14124
14125        return _assertThisInitialized(self);
14126      }
14127
14128      function _assertThisInitialized(self) {
14129        if (self === void 0) {
14130          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
14131        }
14132
14133        return self;
14134      }
14135
14136      function _isNativeReflectConstruct() {
14137        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
14138        if (Reflect.construct.sham) return false;
14139        if (typeof Proxy === "function") return true;
14140
14141        try {
14142          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
14143          return true;
14144        } catch (e) {
14145          return false;
14146        }
14147      }
14148
14149      function _getPrototypeOf(o) {
14150        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
14151          return o.__proto__ || Object.getPrototypeOf(o);
14152        };
14153        return _getPrototypeOf(o);
14154      }
14155
14156      var BaseXform = require('../base-xform');
14157
14158      var BaseCellAnchorXform = /*#__PURE__*/function (_BaseXform) {
14159        _inherits(BaseCellAnchorXform, _BaseXform);
14160
14161        var _super = _createSuper(BaseCellAnchorXform);
14162
14163        function BaseCellAnchorXform() {
14164          _classCallCheck(this, BaseCellAnchorXform);
14165
14166          return _super.apply(this, arguments);
14167        }
14168
14169        _createClass(BaseCellAnchorXform, [{
14170          key: "parseOpen",
14171          value: function parseOpen(node) {
14172            if (this.parser) {
14173              this.parser.parseOpen(node);
14174              return true;
14175            }
14176
14177            switch (node.name) {
14178              case this.tag:
14179                this.reset();
14180                this.model = {
14181                  range: {
14182                    editAs: node.attributes.editAs || 'oneCell'
14183                  }
14184                };
14185                break;
14186
14187              default:
14188                this.parser = this.map[node.name];
14189
14190                if (this.parser) {
14191                  this.parser.parseOpen(node);
14192                }
14193
14194                break;
14195            }
14196
14197            return true;
14198          }
14199        }, {
14200          key: "parseText",
14201          value: function parseText(text) {
14202            if (this.parser) {
14203              this.parser.parseText(text);
14204            }
14205          }
14206        }, {
14207          key: "reconcilePicture",
14208          value: function reconcilePicture(model, options) {
14209            if (model && model.rId) {
14210              var rel = options.rels[model.rId];
14211              var match = rel.Target.match(/.*\/media\/(.+[.][a-zA-Z]{3,4})/);
14212
14213              if (match) {
14214                var name = match[1];
14215                var mediaId = options.mediaIndex[name];
14216                return options.media[mediaId];
14217              }
14218            }
14219
14220            return undefined;
14221          }
14222        }]);
14223
14224        return BaseCellAnchorXform;
14225      }(BaseXform);
14226
14227      module.exports = BaseCellAnchorXform;
14228    }, {
14229      "../base-xform": 29
14230    }],
14231    54: [function (require, module, exports) {
14232      "use strict";
14233
14234      function _typeof(obj) {
14235        "@babel/helpers - typeof";
14236
14237        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
14238          _typeof = function _typeof(obj) {
14239            return typeof obj;
14240          };
14241        } else {
14242          _typeof = function _typeof(obj) {
14243            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
14244          };
14245        }
14246
14247        return _typeof(obj);
14248      }
14249
14250      function _classCallCheck(instance, Constructor) {
14251        if (!(instance instanceof Constructor)) {
14252          throw new TypeError("Cannot call a class as a function");
14253        }
14254      }
14255
14256      function _defineProperties(target, props) {
14257        for (var i = 0; i < props.length; i++) {
14258          var descriptor = props[i];
14259          descriptor.enumerable = descriptor.enumerable || false;
14260          descriptor.configurable = true;
14261          if ("value" in descriptor) descriptor.writable = true;
14262          Object.defineProperty(target, descriptor.key, descriptor);
14263        }
14264      }
14265
14266      function _createClass(Constructor, protoProps, staticProps) {
14267        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
14268        if (staticProps) _defineProperties(Constructor, staticProps);
14269        return Constructor;
14270      }
14271
14272      function _inherits(subClass, superClass) {
14273        if (typeof superClass !== "function" && superClass !== null) {
14274          throw new TypeError("Super expression must either be null or a function");
14275        }
14276
14277        subClass.prototype = Object.create(superClass && superClass.prototype, {
14278          constructor: {
14279            value: subClass,
14280            writable: true,
14281            configurable: true
14282          }
14283        });
14284        if (superClass) _setPrototypeOf(subClass, superClass);
14285      }
14286
14287      function _setPrototypeOf(o, p) {
14288        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
14289          o.__proto__ = p;
14290          return o;
14291        };
14292
14293        return _setPrototypeOf(o, p);
14294      }
14295
14296      function _createSuper(Derived) {
14297        return function () {
14298          var Super = _getPrototypeOf(Derived),
14299              result;
14300
14301          if (_isNativeReflectConstruct()) {
14302            var NewTarget = _getPrototypeOf(this).constructor;
14303
14304            result = Reflect.construct(Super, arguments, NewTarget);
14305          } else {
14306            result = Super.apply(this, arguments);
14307          }
14308
14309          return _possibleConstructorReturn(this, result);
14310        };
14311      }
14312
14313      function _possibleConstructorReturn(self, call) {
14314        if (call && (_typeof(call) === "object" || typeof call === "function")) {
14315          return call;
14316        }
14317
14318        return _assertThisInitialized(self);
14319      }
14320
14321      function _assertThisInitialized(self) {
14322        if (self === void 0) {
14323          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
14324        }
14325
14326        return self;
14327      }
14328
14329      function _isNativeReflectConstruct() {
14330        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
14331        if (Reflect.construct.sham) return false;
14332        if (typeof Proxy === "function") return true;
14333
14334        try {
14335          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
14336          return true;
14337        } catch (e) {
14338          return false;
14339        }
14340      }
14341
14342      function _getPrototypeOf(o) {
14343        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
14344          return o.__proto__ || Object.getPrototypeOf(o);
14345        };
14346        return _getPrototypeOf(o);
14347      }
14348
14349      var BaseXform = require('../base-xform');
14350
14351      var BlipXform = require('./blip-xform');
14352
14353      var BlipFillXform = /*#__PURE__*/function (_BaseXform) {
14354        _inherits(BlipFillXform, _BaseXform);
14355
14356        var _super = _createSuper(BlipFillXform);
14357
14358        function BlipFillXform() {
14359          var _this;
14360
14361          _classCallCheck(this, BlipFillXform);
14362
14363          _this = _super.call(this);
14364          _this.map = {
14365            'a:blip': new BlipXform()
14366          };
14367          return _this;
14368        }
14369
14370        _createClass(BlipFillXform, [{
14371          key: "render",
14372          value: function render(xmlStream, model) {
14373            xmlStream.openNode(this.tag);
14374            this.map['a:blip'].render(xmlStream, model); // TODO: options for this + parsing
14375
14376            xmlStream.openNode('a:stretch');
14377            xmlStream.leafNode('a:fillRect');
14378            xmlStream.closeNode();
14379            xmlStream.closeNode();
14380          }
14381        }, {
14382          key: "parseOpen",
14383          value: function parseOpen(node) {
14384            if (this.parser) {
14385              this.parser.parseOpen(node);
14386              return true;
14387            }
14388
14389            switch (node.name) {
14390              case this.tag:
14391                this.reset();
14392                break;
14393
14394              default:
14395                this.parser = this.map[node.name];
14396
14397                if (this.parser) {
14398                  this.parser.parseOpen(node);
14399                }
14400
14401                break;
14402            }
14403
14404            return true;
14405          }
14406        }, {
14407          key: "parseText",
14408          value: function parseText() {}
14409        }, {
14410          key: "parseClose",
14411          value: function parseClose(name) {
14412            if (this.parser) {
14413              if (!this.parser.parseClose(name)) {
14414                this.parser = undefined;
14415              }
14416
14417              return true;
14418            }
14419
14420            switch (name) {
14421              case this.tag:
14422                this.model = this.map['a:blip'].model;
14423                return false;
14424
14425              default:
14426                return true;
14427            }
14428          }
14429        }, {
14430          key: "tag",
14431          get: function get() {
14432            return 'xdr:blipFill';
14433          }
14434        }]);
14435
14436        return BlipFillXform;
14437      }(BaseXform);
14438
14439      module.exports = BlipFillXform;
14440    }, {
14441      "../base-xform": 29,
14442      "./blip-xform": 55
14443    }],
14444    55: [function (require, module, exports) {
14445      "use strict";
14446
14447      function _typeof(obj) {
14448        "@babel/helpers - typeof";
14449
14450        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
14451          _typeof = function _typeof(obj) {
14452            return typeof obj;
14453          };
14454        } else {
14455          _typeof = function _typeof(obj) {
14456            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
14457          };
14458        }
14459
14460        return _typeof(obj);
14461      }
14462
14463      function _classCallCheck(instance, Constructor) {
14464        if (!(instance instanceof Constructor)) {
14465          throw new TypeError("Cannot call a class as a function");
14466        }
14467      }
14468
14469      function _defineProperties(target, props) {
14470        for (var i = 0; i < props.length; i++) {
14471          var descriptor = props[i];
14472          descriptor.enumerable = descriptor.enumerable || false;
14473          descriptor.configurable = true;
14474          if ("value" in descriptor) descriptor.writable = true;
14475          Object.defineProperty(target, descriptor.key, descriptor);
14476        }
14477      }
14478
14479      function _createClass(Constructor, protoProps, staticProps) {
14480        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
14481        if (staticProps) _defineProperties(Constructor, staticProps);
14482        return Constructor;
14483      }
14484
14485      function _inherits(subClass, superClass) {
14486        if (typeof superClass !== "function" && superClass !== null) {
14487          throw new TypeError("Super expression must either be null or a function");
14488        }
14489
14490        subClass.prototype = Object.create(superClass && superClass.prototype, {
14491          constructor: {
14492            value: subClass,
14493            writable: true,
14494            configurable: true
14495          }
14496        });
14497        if (superClass) _setPrototypeOf(subClass, superClass);
14498      }
14499
14500      function _setPrototypeOf(o, p) {
14501        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
14502          o.__proto__ = p;
14503          return o;
14504        };
14505
14506        return _setPrototypeOf(o, p);
14507      }
14508
14509      function _createSuper(Derived) {
14510        return function () {
14511          var Super = _getPrototypeOf(Derived),
14512              result;
14513
14514          if (_isNativeReflectConstruct()) {
14515            var NewTarget = _getPrototypeOf(this).constructor;
14516
14517            result = Reflect.construct(Super, arguments, NewTarget);
14518          } else {
14519            result = Super.apply(this, arguments);
14520          }
14521
14522          return _possibleConstructorReturn(this, result);
14523        };
14524      }
14525
14526      function _possibleConstructorReturn(self, call) {
14527        if (call && (_typeof(call) === "object" || typeof call === "function")) {
14528          return call;
14529        }
14530
14531        return _assertThisInitialized(self);
14532      }
14533
14534      function _assertThisInitialized(self) {
14535        if (self === void 0) {
14536          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
14537        }
14538
14539        return self;
14540      }
14541
14542      function _isNativeReflectConstruct() {
14543        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
14544        if (Reflect.construct.sham) return false;
14545        if (typeof Proxy === "function") return true;
14546
14547        try {
14548          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
14549          return true;
14550        } catch (e) {
14551          return false;
14552        }
14553      }
14554
14555      function _getPrototypeOf(o) {
14556        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
14557          return o.__proto__ || Object.getPrototypeOf(o);
14558        };
14559        return _getPrototypeOf(o);
14560      }
14561
14562      var BaseXform = require('../base-xform');
14563
14564      var BlipXform = /*#__PURE__*/function (_BaseXform) {
14565        _inherits(BlipXform, _BaseXform);
14566
14567        var _super = _createSuper(BlipXform);
14568
14569        function BlipXform() {
14570          _classCallCheck(this, BlipXform);
14571
14572          return _super.apply(this, arguments);
14573        }
14574
14575        _createClass(BlipXform, [{
14576          key: "render",
14577          value: function render(xmlStream, model) {
14578            xmlStream.leafNode(this.tag, {
14579              'xmlns:r': 'http://schemas.openxmlformats.org/officeDocument/2006/relationships',
14580              'r:embed': model.rId,
14581              cstate: 'print'
14582            }); // TODO: handle children (e.g. a:extLst=>a:ext=>a14:useLocalDpi
14583          }
14584        }, {
14585          key: "parseOpen",
14586          value: function parseOpen(node) {
14587            switch (node.name) {
14588              case this.tag:
14589                this.model = {
14590                  rId: node.attributes['r:embed']
14591                };
14592                return true;
14593
14594              default:
14595                return true;
14596            }
14597          }
14598        }, {
14599          key: "parseText",
14600          value: function parseText() {}
14601        }, {
14602          key: "parseClose",
14603          value: function parseClose(name) {
14604            switch (name) {
14605              case this.tag:
14606                return false;
14607
14608              default:
14609                // unprocessed internal nodes
14610                return true;
14611            }
14612          }
14613        }, {
14614          key: "tag",
14615          get: function get() {
14616            return 'a:blip';
14617          }
14618        }]);
14619
14620        return BlipXform;
14621      }(BaseXform);
14622
14623      module.exports = BlipXform;
14624    }, {
14625      "../base-xform": 29
14626    }],
14627    56: [function (require, module, exports) {
14628      "use strict";
14629
14630      function _typeof(obj) {
14631        "@babel/helpers - typeof";
14632
14633        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
14634          _typeof = function _typeof(obj) {
14635            return typeof obj;
14636          };
14637        } else {
14638          _typeof = function _typeof(obj) {
14639            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
14640          };
14641        }
14642
14643        return _typeof(obj);
14644      }
14645
14646      function _classCallCheck(instance, Constructor) {
14647        if (!(instance instanceof Constructor)) {
14648          throw new TypeError("Cannot call a class as a function");
14649        }
14650      }
14651
14652      function _defineProperties(target, props) {
14653        for (var i = 0; i < props.length; i++) {
14654          var descriptor = props[i];
14655          descriptor.enumerable = descriptor.enumerable || false;
14656          descriptor.configurable = true;
14657          if ("value" in descriptor) descriptor.writable = true;
14658          Object.defineProperty(target, descriptor.key, descriptor);
14659        }
14660      }
14661
14662      function _createClass(Constructor, protoProps, staticProps) {
14663        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
14664        if (staticProps) _defineProperties(Constructor, staticProps);
14665        return Constructor;
14666      }
14667
14668      function _inherits(subClass, superClass) {
14669        if (typeof superClass !== "function" && superClass !== null) {
14670          throw new TypeError("Super expression must either be null or a function");
14671        }
14672
14673        subClass.prototype = Object.create(superClass && superClass.prototype, {
14674          constructor: {
14675            value: subClass,
14676            writable: true,
14677            configurable: true
14678          }
14679        });
14680        if (superClass) _setPrototypeOf(subClass, superClass);
14681      }
14682
14683      function _setPrototypeOf(o, p) {
14684        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
14685          o.__proto__ = p;
14686          return o;
14687        };
14688
14689        return _setPrototypeOf(o, p);
14690      }
14691
14692      function _createSuper(Derived) {
14693        return function () {
14694          var Super = _getPrototypeOf(Derived),
14695              result;
14696
14697          if (_isNativeReflectConstruct()) {
14698            var NewTarget = _getPrototypeOf(this).constructor;
14699
14700            result = Reflect.construct(Super, arguments, NewTarget);
14701          } else {
14702            result = Super.apply(this, arguments);
14703          }
14704
14705          return _possibleConstructorReturn(this, result);
14706        };
14707      }
14708
14709      function _possibleConstructorReturn(self, call) {
14710        if (call && (_typeof(call) === "object" || typeof call === "function")) {
14711          return call;
14712        }
14713
14714        return _assertThisInitialized(self);
14715      }
14716
14717      function _assertThisInitialized(self) {
14718        if (self === void 0) {
14719          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
14720        }
14721
14722        return self;
14723      }
14724
14725      function _isNativeReflectConstruct() {
14726        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
14727        if (Reflect.construct.sham) return false;
14728        if (typeof Proxy === "function") return true;
14729
14730        try {
14731          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
14732          return true;
14733        } catch (e) {
14734          return false;
14735        }
14736      }
14737
14738      function _getPrototypeOf(o) {
14739        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
14740          return o.__proto__ || Object.getPrototypeOf(o);
14741        };
14742        return _getPrototypeOf(o);
14743      }
14744
14745      var BaseXform = require('../base-xform');
14746
14747      var CNvPicPrXform = /*#__PURE__*/function (_BaseXform) {
14748        _inherits(CNvPicPrXform, _BaseXform);
14749
14750        var _super = _createSuper(CNvPicPrXform);
14751
14752        function CNvPicPrXform() {
14753          _classCallCheck(this, CNvPicPrXform);
14754
14755          return _super.apply(this, arguments);
14756        }
14757
14758        _createClass(CNvPicPrXform, [{
14759          key: "render",
14760          value: function render(xmlStream) {
14761            xmlStream.openNode(this.tag);
14762            xmlStream.leafNode('a:picLocks', {
14763              noChangeAspect: '1'
14764            });
14765            xmlStream.closeNode();
14766          }
14767        }, {
14768          key: "parseOpen",
14769          value: function parseOpen(node) {
14770            switch (node.name) {
14771              case this.tag:
14772                return true;
14773
14774              default:
14775                return true;
14776            }
14777          }
14778        }, {
14779          key: "parseText",
14780          value: function parseText() {}
14781        }, {
14782          key: "parseClose",
14783          value: function parseClose(name) {
14784            switch (name) {
14785              case this.tag:
14786                return false;
14787
14788              default:
14789                // unprocessed internal nodes
14790                return true;
14791            }
14792          }
14793        }, {
14794          key: "tag",
14795          get: function get() {
14796            return 'xdr:cNvPicPr';
14797          }
14798        }]);
14799
14800        return CNvPicPrXform;
14801      }(BaseXform);
14802
14803      module.exports = CNvPicPrXform;
14804    }, {
14805      "../base-xform": 29
14806    }],
14807    57: [function (require, module, exports) {
14808      "use strict";
14809
14810      function _typeof(obj) {
14811        "@babel/helpers - typeof";
14812
14813        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
14814          _typeof = function _typeof(obj) {
14815            return typeof obj;
14816          };
14817        } else {
14818          _typeof = function _typeof(obj) {
14819            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
14820          };
14821        }
14822
14823        return _typeof(obj);
14824      }
14825
14826      function _classCallCheck(instance, Constructor) {
14827        if (!(instance instanceof Constructor)) {
14828          throw new TypeError("Cannot call a class as a function");
14829        }
14830      }
14831
14832      function _defineProperties(target, props) {
14833        for (var i = 0; i < props.length; i++) {
14834          var descriptor = props[i];
14835          descriptor.enumerable = descriptor.enumerable || false;
14836          descriptor.configurable = true;
14837          if ("value" in descriptor) descriptor.writable = true;
14838          Object.defineProperty(target, descriptor.key, descriptor);
14839        }
14840      }
14841
14842      function _createClass(Constructor, protoProps, staticProps) {
14843        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
14844        if (staticProps) _defineProperties(Constructor, staticProps);
14845        return Constructor;
14846      }
14847
14848      function _inherits(subClass, superClass) {
14849        if (typeof superClass !== "function" && superClass !== null) {
14850          throw new TypeError("Super expression must either be null or a function");
14851        }
14852
14853        subClass.prototype = Object.create(superClass && superClass.prototype, {
14854          constructor: {
14855            value: subClass,
14856            writable: true,
14857            configurable: true
14858          }
14859        });
14860        if (superClass) _setPrototypeOf(subClass, superClass);
14861      }
14862
14863      function _setPrototypeOf(o, p) {
14864        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
14865          o.__proto__ = p;
14866          return o;
14867        };
14868
14869        return _setPrototypeOf(o, p);
14870      }
14871
14872      function _createSuper(Derived) {
14873        return function () {
14874          var Super = _getPrototypeOf(Derived),
14875              result;
14876
14877          if (_isNativeReflectConstruct()) {
14878            var NewTarget = _getPrototypeOf(this).constructor;
14879
14880            result = Reflect.construct(Super, arguments, NewTarget);
14881          } else {
14882            result = Super.apply(this, arguments);
14883          }
14884
14885          return _possibleConstructorReturn(this, result);
14886        };
14887      }
14888
14889      function _possibleConstructorReturn(self, call) {
14890        if (call && (_typeof(call) === "object" || typeof call === "function")) {
14891          return call;
14892        }
14893
14894        return _assertThisInitialized(self);
14895      }
14896
14897      function _assertThisInitialized(self) {
14898        if (self === void 0) {
14899          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
14900        }
14901
14902        return self;
14903      }
14904
14905      function _isNativeReflectConstruct() {
14906        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
14907        if (Reflect.construct.sham) return false;
14908        if (typeof Proxy === "function") return true;
14909
14910        try {
14911          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
14912          return true;
14913        } catch (e) {
14914          return false;
14915        }
14916      }
14917
14918      function _getPrototypeOf(o) {
14919        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
14920          return o.__proto__ || Object.getPrototypeOf(o);
14921        };
14922        return _getPrototypeOf(o);
14923      }
14924
14925      var BaseXform = require('../base-xform');
14926
14927      var HlickClickXform = require('./hlink-click-xform');
14928
14929      var ExtLstXform = require('./ext-lst-xform');
14930
14931      var CNvPrXform = /*#__PURE__*/function (_BaseXform) {
14932        _inherits(CNvPrXform, _BaseXform);
14933
14934        var _super = _createSuper(CNvPrXform);
14935
14936        function CNvPrXform() {
14937          var _this;
14938
14939          _classCallCheck(this, CNvPrXform);
14940
14941          _this = _super.call(this);
14942          _this.map = {
14943            'a:hlinkClick': new HlickClickXform(),
14944            'a:extLst': new ExtLstXform()
14945          };
14946          return _this;
14947        }
14948
14949        _createClass(CNvPrXform, [{
14950          key: "render",
14951          value: function render(xmlStream, model) {
14952            xmlStream.openNode(this.tag, {
14953              id: model.index,
14954              name: "Picture ".concat(model.index)
14955            });
14956            this.map['a:hlinkClick'].render(xmlStream, model);
14957            this.map['a:extLst'].render(xmlStream, model);
14958            xmlStream.closeNode();
14959          }
14960        }, {
14961          key: "parseOpen",
14962          value: function parseOpen(node) {
14963            if (this.parser) {
14964              this.parser.parseOpen(node);
14965              return true;
14966            }
14967
14968            switch (node.name) {
14969              case this.tag:
14970                this.reset();
14971                break;
14972
14973              default:
14974                this.parser = this.map[node.name];
14975
14976                if (this.parser) {
14977                  this.parser.parseOpen(node);
14978                }
14979
14980                break;
14981            }
14982
14983            return true;
14984          }
14985        }, {
14986          key: "parseText",
14987          value: function parseText() {}
14988        }, {
14989          key: "parseClose",
14990          value: function parseClose(name) {
14991            if (this.parser) {
14992              if (!this.parser.parseClose(name)) {
14993                this.parser = undefined;
14994              }
14995
14996              return true;
14997            }
14998
14999            switch (name) {
15000              case this.tag:
15001                this.model = this.map['a:hlinkClick'].model;
15002                return false;
15003
15004              default:
15005                return true;
15006            }
15007          }
15008        }, {
15009          key: "tag",
15010          get: function get() {
15011            return 'xdr:cNvPr';
15012          }
15013        }]);
15014
15015        return CNvPrXform;
15016      }(BaseXform);
15017
15018      module.exports = CNvPrXform;
15019    }, {
15020      "../base-xform": 29,
15021      "./ext-lst-xform": 60,
15022      "./hlink-click-xform": 62
15023    }],
15024    58: [function (require, module, exports) {
15025      "use strict";
15026
15027      function _typeof(obj) {
15028        "@babel/helpers - typeof";
15029
15030        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
15031          _typeof = function _typeof(obj) {
15032            return typeof obj;
15033          };
15034        } else {
15035          _typeof = function _typeof(obj) {
15036            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
15037          };
15038        }
15039
15040        return _typeof(obj);
15041      }
15042
15043      function _classCallCheck(instance, Constructor) {
15044        if (!(instance instanceof Constructor)) {
15045          throw new TypeError("Cannot call a class as a function");
15046        }
15047      }
15048
15049      function _defineProperties(target, props) {
15050        for (var i = 0; i < props.length; i++) {
15051          var descriptor = props[i];
15052          descriptor.enumerable = descriptor.enumerable || false;
15053          descriptor.configurable = true;
15054          if ("value" in descriptor) descriptor.writable = true;
15055          Object.defineProperty(target, descriptor.key, descriptor);
15056        }
15057      }
15058
15059      function _createClass(Constructor, protoProps, staticProps) {
15060        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
15061        if (staticProps) _defineProperties(Constructor, staticProps);
15062        return Constructor;
15063      }
15064
15065      function _inherits(subClass, superClass) {
15066        if (typeof superClass !== "function" && superClass !== null) {
15067          throw new TypeError("Super expression must either be null or a function");
15068        }
15069
15070        subClass.prototype = Object.create(superClass && superClass.prototype, {
15071          constructor: {
15072            value: subClass,
15073            writable: true,
15074            configurable: true
15075          }
15076        });
15077        if (superClass) _setPrototypeOf(subClass, superClass);
15078      }
15079
15080      function _setPrototypeOf(o, p) {
15081        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
15082          o.__proto__ = p;
15083          return o;
15084        };
15085
15086        return _setPrototypeOf(o, p);
15087      }
15088
15089      function _createSuper(Derived) {
15090        return function () {
15091          var Super = _getPrototypeOf(Derived),
15092              result;
15093
15094          if (_isNativeReflectConstruct()) {
15095            var NewTarget = _getPrototypeOf(this).constructor;
15096
15097            result = Reflect.construct(Super, arguments, NewTarget);
15098          } else {
15099            result = Super.apply(this, arguments);
15100          }
15101
15102          return _possibleConstructorReturn(this, result);
15103        };
15104      }
15105
15106      function _possibleConstructorReturn(self, call) {
15107        if (call && (_typeof(call) === "object" || typeof call === "function")) {
15108          return call;
15109        }
15110
15111        return _assertThisInitialized(self);
15112      }
15113
15114      function _assertThisInitialized(self) {
15115        if (self === void 0) {
15116          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
15117        }
15118
15119        return self;
15120      }
15121
15122      function _isNativeReflectConstruct() {
15123        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
15124        if (Reflect.construct.sham) return false;
15125        if (typeof Proxy === "function") return true;
15126
15127        try {
15128          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
15129          return true;
15130        } catch (e) {
15131          return false;
15132        }
15133      }
15134
15135      function _getPrototypeOf(o) {
15136        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
15137          return o.__proto__ || Object.getPrototypeOf(o);
15138        };
15139        return _getPrototypeOf(o);
15140      }
15141
15142      var BaseXform = require('../base-xform');
15143
15144      var IntegerXform = require('../simple/integer-xform');
15145
15146      var CellPositionXform = /*#__PURE__*/function (_BaseXform) {
15147        _inherits(CellPositionXform, _BaseXform);
15148
15149        var _super = _createSuper(CellPositionXform);
15150
15151        function CellPositionXform(options) {
15152          var _this;
15153
15154          _classCallCheck(this, CellPositionXform);
15155
15156          _this = _super.call(this);
15157          _this.tag = options.tag;
15158          _this.map = {
15159            'xdr:col': new IntegerXform({
15160              tag: 'xdr:col',
15161              zero: true
15162            }),
15163            'xdr:colOff': new IntegerXform({
15164              tag: 'xdr:colOff',
15165              zero: true
15166            }),
15167            'xdr:row': new IntegerXform({
15168              tag: 'xdr:row',
15169              zero: true
15170            }),
15171            'xdr:rowOff': new IntegerXform({
15172              tag: 'xdr:rowOff',
15173              zero: true
15174            })
15175          };
15176          return _this;
15177        }
15178
15179        _createClass(CellPositionXform, [{
15180          key: "render",
15181          value: function render(xmlStream, model) {
15182            xmlStream.openNode(this.tag);
15183            this.map['xdr:col'].render(xmlStream, model.nativeCol);
15184            this.map['xdr:colOff'].render(xmlStream, model.nativeColOff);
15185            this.map['xdr:row'].render(xmlStream, model.nativeRow);
15186            this.map['xdr:rowOff'].render(xmlStream, model.nativeRowOff);
15187            xmlStream.closeNode();
15188          }
15189        }, {
15190          key: "parseOpen",
15191          value: function parseOpen(node) {
15192            if (this.parser) {
15193              this.parser.parseOpen(node);
15194              return true;
15195            }
15196
15197            switch (node.name) {
15198              case this.tag:
15199                this.reset();
15200                break;
15201
15202              default:
15203                this.parser = this.map[node.name];
15204
15205                if (this.parser) {
15206                  this.parser.parseOpen(node);
15207                }
15208
15209                break;
15210            }
15211
15212            return true;
15213          }
15214        }, {
15215          key: "parseText",
15216          value: function parseText(text) {
15217            if (this.parser) {
15218              this.parser.parseText(text);
15219            }
15220          }
15221        }, {
15222          key: "parseClose",
15223          value: function parseClose(name) {
15224            if (this.parser) {
15225              if (!this.parser.parseClose(name)) {
15226                this.parser = undefined;
15227              }
15228
15229              return true;
15230            }
15231
15232            switch (name) {
15233              case this.tag:
15234                this.model = {
15235                  nativeCol: this.map['xdr:col'].model,
15236                  nativeColOff: this.map['xdr:colOff'].model,
15237                  nativeRow: this.map['xdr:row'].model,
15238                  nativeRowOff: this.map['xdr:rowOff'].model
15239                };
15240                return false;
15241
15242              default:
15243                // not quite sure how we get here!
15244                return true;
15245            }
15246          }
15247        }]);
15248
15249        return CellPositionXform;
15250      }(BaseXform);
15251
15252      module.exports = CellPositionXform;
15253    }, {
15254      "../base-xform": 29,
15255      "../simple/integer-xform": 115
15256    }],
15257    59: [function (require, module, exports) {
15258      "use strict";
15259
15260      function _typeof(obj) {
15261        "@babel/helpers - typeof";
15262
15263        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
15264          _typeof = function _typeof(obj) {
15265            return typeof obj;
15266          };
15267        } else {
15268          _typeof = function _typeof(obj) {
15269            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
15270          };
15271        }
15272
15273        return _typeof(obj);
15274      }
15275
15276      function _classCallCheck(instance, Constructor) {
15277        if (!(instance instanceof Constructor)) {
15278          throw new TypeError("Cannot call a class as a function");
15279        }
15280      }
15281
15282      function _defineProperties(target, props) {
15283        for (var i = 0; i < props.length; i++) {
15284          var descriptor = props[i];
15285          descriptor.enumerable = descriptor.enumerable || false;
15286          descriptor.configurable = true;
15287          if ("value" in descriptor) descriptor.writable = true;
15288          Object.defineProperty(target, descriptor.key, descriptor);
15289        }
15290      }
15291
15292      function _createClass(Constructor, protoProps, staticProps) {
15293        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
15294        if (staticProps) _defineProperties(Constructor, staticProps);
15295        return Constructor;
15296      }
15297
15298      function _inherits(subClass, superClass) {
15299        if (typeof superClass !== "function" && superClass !== null) {
15300          throw new TypeError("Super expression must either be null or a function");
15301        }
15302
15303        subClass.prototype = Object.create(superClass && superClass.prototype, {
15304          constructor: {
15305            value: subClass,
15306            writable: true,
15307            configurable: true
15308          }
15309        });
15310        if (superClass) _setPrototypeOf(subClass, superClass);
15311      }
15312
15313      function _setPrototypeOf(o, p) {
15314        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
15315          o.__proto__ = p;
15316          return o;
15317        };
15318
15319        return _setPrototypeOf(o, p);
15320      }
15321
15322      function _createSuper(Derived) {
15323        return function () {
15324          var Super = _getPrototypeOf(Derived),
15325              result;
15326
15327          if (_isNativeReflectConstruct()) {
15328            var NewTarget = _getPrototypeOf(this).constructor;
15329
15330            result = Reflect.construct(Super, arguments, NewTarget);
15331          } else {
15332            result = Super.apply(this, arguments);
15333          }
15334
15335          return _possibleConstructorReturn(this, result);
15336        };
15337      }
15338
15339      function _possibleConstructorReturn(self, call) {
15340        if (call && (_typeof(call) === "object" || typeof call === "function")) {
15341          return call;
15342        }
15343
15344        return _assertThisInitialized(self);
15345      }
15346
15347      function _assertThisInitialized(self) {
15348        if (self === void 0) {
15349          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
15350        }
15351
15352        return self;
15353      }
15354
15355      function _isNativeReflectConstruct() {
15356        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
15357        if (Reflect.construct.sham) return false;
15358        if (typeof Proxy === "function") return true;
15359
15360        try {
15361          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
15362          return true;
15363        } catch (e) {
15364          return false;
15365        }
15366      }
15367
15368      function _getPrototypeOf(o) {
15369        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
15370          return o.__proto__ || Object.getPrototypeOf(o);
15371        };
15372        return _getPrototypeOf(o);
15373      }
15374
15375      var colCache = require('../../../utils/col-cache');
15376
15377      var XmlStream = require('../../../utils/xml-stream');
15378
15379      var BaseXform = require('../base-xform');
15380
15381      var TwoCellAnchorXform = require('./two-cell-anchor-xform');
15382
15383      var OneCellAnchorXform = require('./one-cell-anchor-xform');
15384
15385      function getAnchorType(model) {
15386        var range = typeof model.range === 'string' ? colCache.decode(model.range) : model.range;
15387        return range.br ? 'xdr:twoCellAnchor' : 'xdr:oneCellAnchor';
15388      }
15389
15390      var DrawingXform = /*#__PURE__*/function (_BaseXform) {
15391        _inherits(DrawingXform, _BaseXform);
15392
15393        var _super = _createSuper(DrawingXform);
15394
15395        function DrawingXform() {
15396          var _this;
15397
15398          _classCallCheck(this, DrawingXform);
15399
15400          _this = _super.call(this);
15401          _this.map = {
15402            'xdr:twoCellAnchor': new TwoCellAnchorXform(),
15403            'xdr:oneCellAnchor': new OneCellAnchorXform()
15404          };
15405          return _this;
15406        }
15407
15408        _createClass(DrawingXform, [{
15409          key: "prepare",
15410          value: function prepare(model) {
15411            var _this2 = this;
15412
15413            model.anchors.forEach(function (item, index) {
15414              item.anchorType = getAnchorType(item);
15415              var anchor = _this2.map[item.anchorType];
15416              anchor.prepare(item, {
15417                index: index
15418              });
15419            });
15420          }
15421        }, {
15422          key: "render",
15423          value: function render(xmlStream, model) {
15424            var _this3 = this;
15425
15426            xmlStream.openXml(XmlStream.StdDocAttributes);
15427            xmlStream.openNode(this.tag, DrawingXform.DRAWING_ATTRIBUTES);
15428            model.anchors.forEach(function (item) {
15429              var anchor = _this3.map[item.anchorType];
15430              anchor.render(xmlStream, item);
15431            });
15432            xmlStream.closeNode();
15433          }
15434        }, {
15435          key: "parseOpen",
15436          value: function parseOpen(node) {
15437            if (this.parser) {
15438              this.parser.parseOpen(node);
15439              return true;
15440            }
15441
15442            switch (node.name) {
15443              case this.tag:
15444                this.reset();
15445                this.model = {
15446                  anchors: []
15447                };
15448                break;
15449
15450              default:
15451                this.parser = this.map[node.name];
15452
15453                if (this.parser) {
15454                  this.parser.parseOpen(node);
15455                }
15456
15457                break;
15458            }
15459
15460            return true;
15461          }
15462        }, {
15463          key: "parseText",
15464          value: function parseText(text) {
15465            if (this.parser) {
15466              this.parser.parseText(text);
15467            }
15468          }
15469        }, {
15470          key: "parseClose",
15471          value: function parseClose(name) {
15472            if (this.parser) {
15473              if (!this.parser.parseClose(name)) {
15474                this.model.anchors.push(this.parser.model);
15475                this.parser = undefined;
15476              }
15477
15478              return true;
15479            }
15480
15481            switch (name) {
15482              case this.tag:
15483                return false;
15484
15485              default:
15486                // could be some unrecognised tags
15487                return true;
15488            }
15489          }
15490        }, {
15491          key: "reconcile",
15492          value: function reconcile(model, options) {
15493            var _this4 = this;
15494
15495            model.anchors.forEach(function (anchor) {
15496              if (anchor.br) {
15497                _this4.map['xdr:twoCellAnchor'].reconcile(anchor, options);
15498              } else {
15499                _this4.map['xdr:oneCellAnchor'].reconcile(anchor, options);
15500              }
15501            });
15502          }
15503        }, {
15504          key: "tag",
15505          get: function get() {
15506            return 'xdr:wsDr';
15507          }
15508        }]);
15509
15510        return DrawingXform;
15511      }(BaseXform);
15512
15513      DrawingXform.DRAWING_ATTRIBUTES = {
15514        'xmlns:xdr': 'http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing',
15515        'xmlns:a': 'http://schemas.openxmlformats.org/drawingml/2006/main'
15516      };
15517      module.exports = DrawingXform;
15518    }, {
15519      "../../../utils/col-cache": 17,
15520      "../../../utils/xml-stream": 25,
15521      "../base-xform": 29,
15522      "./one-cell-anchor-xform": 64,
15523      "./two-cell-anchor-xform": 67
15524    }],
15525    60: [function (require, module, exports) {
15526      "use strict";
15527
15528      function _typeof(obj) {
15529        "@babel/helpers - typeof";
15530
15531        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
15532          _typeof = function _typeof(obj) {
15533            return typeof obj;
15534          };
15535        } else {
15536          _typeof = function _typeof(obj) {
15537            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
15538          };
15539        }
15540
15541        return _typeof(obj);
15542      }
15543
15544      function _classCallCheck(instance, Constructor) {
15545        if (!(instance instanceof Constructor)) {
15546          throw new TypeError("Cannot call a class as a function");
15547        }
15548      }
15549
15550      function _defineProperties(target, props) {
15551        for (var i = 0; i < props.length; i++) {
15552          var descriptor = props[i];
15553          descriptor.enumerable = descriptor.enumerable || false;
15554          descriptor.configurable = true;
15555          if ("value" in descriptor) descriptor.writable = true;
15556          Object.defineProperty(target, descriptor.key, descriptor);
15557        }
15558      }
15559
15560      function _createClass(Constructor, protoProps, staticProps) {
15561        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
15562        if (staticProps) _defineProperties(Constructor, staticProps);
15563        return Constructor;
15564      }
15565
15566      function _inherits(subClass, superClass) {
15567        if (typeof superClass !== "function" && superClass !== null) {
15568          throw new TypeError("Super expression must either be null or a function");
15569        }
15570
15571        subClass.prototype = Object.create(superClass && superClass.prototype, {
15572          constructor: {
15573            value: subClass,
15574            writable: true,
15575            configurable: true
15576          }
15577        });
15578        if (superClass) _setPrototypeOf(subClass, superClass);
15579      }
15580
15581      function _setPrototypeOf(o, p) {
15582        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
15583          o.__proto__ = p;
15584          return o;
15585        };
15586
15587        return _setPrototypeOf(o, p);
15588      }
15589
15590      function _createSuper(Derived) {
15591        return function () {
15592          var Super = _getPrototypeOf(Derived),
15593              result;
15594
15595          if (_isNativeReflectConstruct()) {
15596            var NewTarget = _getPrototypeOf(this).constructor;
15597
15598            result = Reflect.construct(Super, arguments, NewTarget);
15599          } else {
15600            result = Super.apply(this, arguments);
15601          }
15602
15603          return _possibleConstructorReturn(this, result);
15604        };
15605      }
15606
15607      function _possibleConstructorReturn(self, call) {
15608        if (call && (_typeof(call) === "object" || typeof call === "function")) {
15609          return call;
15610        }
15611
15612        return _assertThisInitialized(self);
15613      }
15614
15615      function _assertThisInitialized(self) {
15616        if (self === void 0) {
15617          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
15618        }
15619
15620        return self;
15621      }
15622
15623      function _isNativeReflectConstruct() {
15624        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
15625        if (Reflect.construct.sham) return false;
15626        if (typeof Proxy === "function") return true;
15627
15628        try {
15629          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
15630          return true;
15631        } catch (e) {
15632          return false;
15633        }
15634      }
15635
15636      function _getPrototypeOf(o) {
15637        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
15638          return o.__proto__ || Object.getPrototypeOf(o);
15639        };
15640        return _getPrototypeOf(o);
15641      }
15642
15643      var BaseXform = require('../base-xform');
15644
15645      var ExtLstXform = /*#__PURE__*/function (_BaseXform) {
15646        _inherits(ExtLstXform, _BaseXform);
15647
15648        var _super = _createSuper(ExtLstXform);
15649
15650        function ExtLstXform() {
15651          _classCallCheck(this, ExtLstXform);
15652
15653          return _super.apply(this, arguments);
15654        }
15655
15656        _createClass(ExtLstXform, [{
15657          key: "render",
15658          value: function render(xmlStream) {
15659            xmlStream.openNode(this.tag);
15660            xmlStream.openNode('a:ext', {
15661              uri: '{FF2B5EF4-FFF2-40B4-BE49-F238E27FC236}'
15662            });
15663            xmlStream.leafNode('a16:creationId', {
15664              'xmlns:a16': 'http://schemas.microsoft.com/office/drawing/2014/main',
15665              id: '{00000000-0008-0000-0000-000002000000}'
15666            });
15667            xmlStream.closeNode();
15668            xmlStream.closeNode();
15669          }
15670        }, {
15671          key: "parseOpen",
15672          value: function parseOpen(node) {
15673            switch (node.name) {
15674              case this.tag:
15675                return true;
15676
15677              default:
15678                return true;
15679            }
15680          }
15681        }, {
15682          key: "parseText",
15683          value: function parseText() {}
15684        }, {
15685          key: "parseClose",
15686          value: function parseClose(name) {
15687            switch (name) {
15688              case this.tag:
15689                return false;
15690
15691              default:
15692                // unprocessed internal nodes
15693                return true;
15694            }
15695          }
15696        }, {
15697          key: "tag",
15698          get: function get() {
15699            return 'a:extLst';
15700          }
15701        }]);
15702
15703        return ExtLstXform;
15704      }(BaseXform);
15705
15706      module.exports = ExtLstXform;
15707    }, {
15708      "../base-xform": 29
15709    }],
15710    61: [function (require, module, exports) {
15711      "use strict";
15712
15713      function _typeof(obj) {
15714        "@babel/helpers - typeof";
15715
15716        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
15717          _typeof = function _typeof(obj) {
15718            return typeof obj;
15719          };
15720        } else {
15721          _typeof = function _typeof(obj) {
15722            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
15723          };
15724        }
15725
15726        return _typeof(obj);
15727      }
15728
15729      function _classCallCheck(instance, Constructor) {
15730        if (!(instance instanceof Constructor)) {
15731          throw new TypeError("Cannot call a class as a function");
15732        }
15733      }
15734
15735      function _defineProperties(target, props) {
15736        for (var i = 0; i < props.length; i++) {
15737          var descriptor = props[i];
15738          descriptor.enumerable = descriptor.enumerable || false;
15739          descriptor.configurable = true;
15740          if ("value" in descriptor) descriptor.writable = true;
15741          Object.defineProperty(target, descriptor.key, descriptor);
15742        }
15743      }
15744
15745      function _createClass(Constructor, protoProps, staticProps) {
15746        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
15747        if (staticProps) _defineProperties(Constructor, staticProps);
15748        return Constructor;
15749      }
15750
15751      function _inherits(subClass, superClass) {
15752        if (typeof superClass !== "function" && superClass !== null) {
15753          throw new TypeError("Super expression must either be null or a function");
15754        }
15755
15756        subClass.prototype = Object.create(superClass && superClass.prototype, {
15757          constructor: {
15758            value: subClass,
15759            writable: true,
15760            configurable: true
15761          }
15762        });
15763        if (superClass) _setPrototypeOf(subClass, superClass);
15764      }
15765
15766      function _setPrototypeOf(o, p) {
15767        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
15768          o.__proto__ = p;
15769          return o;
15770        };
15771
15772        return _setPrototypeOf(o, p);
15773      }
15774
15775      function _createSuper(Derived) {
15776        return function () {
15777          var Super = _getPrototypeOf(Derived),
15778              result;
15779
15780          if (_isNativeReflectConstruct()) {
15781            var NewTarget = _getPrototypeOf(this).constructor;
15782
15783            result = Reflect.construct(Super, arguments, NewTarget);
15784          } else {
15785            result = Super.apply(this, arguments);
15786          }
15787
15788          return _possibleConstructorReturn(this, result);
15789        };
15790      }
15791
15792      function _possibleConstructorReturn(self, call) {
15793        if (call && (_typeof(call) === "object" || typeof call === "function")) {
15794          return call;
15795        }
15796
15797        return _assertThisInitialized(self);
15798      }
15799
15800      function _assertThisInitialized(self) {
15801        if (self === void 0) {
15802          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
15803        }
15804
15805        return self;
15806      }
15807
15808      function _isNativeReflectConstruct() {
15809        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
15810        if (Reflect.construct.sham) return false;
15811        if (typeof Proxy === "function") return true;
15812
15813        try {
15814          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
15815          return true;
15816        } catch (e) {
15817          return false;
15818        }
15819      }
15820
15821      function _getPrototypeOf(o) {
15822        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
15823          return o.__proto__ || Object.getPrototypeOf(o);
15824        };
15825        return _getPrototypeOf(o);
15826      }
15827
15828      var BaseXform = require('../base-xform');
15829      /** https://en.wikipedia.org/wiki/Office_Open_XML_file_formats#DrawingML */
15830
15831
15832      var EMU_PER_PIXEL_AT_96_DPI = 9525;
15833
15834      var ExtXform = /*#__PURE__*/function (_BaseXform) {
15835        _inherits(ExtXform, _BaseXform);
15836
15837        var _super = _createSuper(ExtXform);
15838
15839        function ExtXform(options) {
15840          var _this;
15841
15842          _classCallCheck(this, ExtXform);
15843
15844          _this = _super.call(this);
15845          _this.tag = options.tag;
15846          _this.map = {};
15847          return _this;
15848        }
15849
15850        _createClass(ExtXform, [{
15851          key: "render",
15852          value: function render(xmlStream, model) {
15853            xmlStream.openNode(this.tag);
15854            var width = Math.floor(model.width * EMU_PER_PIXEL_AT_96_DPI);
15855            var height = Math.floor(model.height * EMU_PER_PIXEL_AT_96_DPI);
15856            xmlStream.addAttribute('cx', width);
15857            xmlStream.addAttribute('cy', height);
15858            xmlStream.closeNode();
15859          }
15860        }, {
15861          key: "parseOpen",
15862          value: function parseOpen(node) {
15863            if (node.name === this.tag) {
15864              this.model = {
15865                width: parseInt(node.attributes.cx || '0', 10) / EMU_PER_PIXEL_AT_96_DPI,
15866                height: parseInt(node.attributes.cy || '0', 10) / EMU_PER_PIXEL_AT_96_DPI
15867              };
15868              return true;
15869            }
15870
15871            return false;
15872          }
15873        }, {
15874          key: "parseText",
15875          value: function parseText()
15876          /* text */
15877          {}
15878        }, {
15879          key: "parseClose",
15880          value: function parseClose()
15881          /* name */
15882          {
15883            return false;
15884          }
15885        }]);
15886
15887        return ExtXform;
15888      }(BaseXform);
15889
15890      module.exports = ExtXform;
15891    }, {
15892      "../base-xform": 29
15893    }],
15894    62: [function (require, module, exports) {
15895      "use strict";
15896
15897      function _typeof(obj) {
15898        "@babel/helpers - typeof";
15899
15900        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
15901          _typeof = function _typeof(obj) {
15902            return typeof obj;
15903          };
15904        } else {
15905          _typeof = function _typeof(obj) {
15906            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
15907          };
15908        }
15909
15910        return _typeof(obj);
15911      }
15912
15913      function _classCallCheck(instance, Constructor) {
15914        if (!(instance instanceof Constructor)) {
15915          throw new TypeError("Cannot call a class as a function");
15916        }
15917      }
15918
15919      function _defineProperties(target, props) {
15920        for (var i = 0; i < props.length; i++) {
15921          var descriptor = props[i];
15922          descriptor.enumerable = descriptor.enumerable || false;
15923          descriptor.configurable = true;
15924          if ("value" in descriptor) descriptor.writable = true;
15925          Object.defineProperty(target, descriptor.key, descriptor);
15926        }
15927      }
15928
15929      function _createClass(Constructor, protoProps, staticProps) {
15930        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
15931        if (staticProps) _defineProperties(Constructor, staticProps);
15932        return Constructor;
15933      }
15934
15935      function _inherits(subClass, superClass) {
15936        if (typeof superClass !== "function" && superClass !== null) {
15937          throw new TypeError("Super expression must either be null or a function");
15938        }
15939
15940        subClass.prototype = Object.create(superClass && superClass.prototype, {
15941          constructor: {
15942            value: subClass,
15943            writable: true,
15944            configurable: true
15945          }
15946        });
15947        if (superClass) _setPrototypeOf(subClass, superClass);
15948      }
15949
15950      function _setPrototypeOf(o, p) {
15951        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
15952          o.__proto__ = p;
15953          return o;
15954        };
15955
15956        return _setPrototypeOf(o, p);
15957      }
15958
15959      function _createSuper(Derived) {
15960        return function () {
15961          var Super = _getPrototypeOf(Derived),
15962              result;
15963
15964          if (_isNativeReflectConstruct()) {
15965            var NewTarget = _getPrototypeOf(this).constructor;
15966
15967            result = Reflect.construct(Super, arguments, NewTarget);
15968          } else {
15969            result = Super.apply(this, arguments);
15970          }
15971
15972          return _possibleConstructorReturn(this, result);
15973        };
15974      }
15975
15976      function _possibleConstructorReturn(self, call) {
15977        if (call && (_typeof(call) === "object" || typeof call === "function")) {
15978          return call;
15979        }
15980
15981        return _assertThisInitialized(self);
15982      }
15983
15984      function _assertThisInitialized(self) {
15985        if (self === void 0) {
15986          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
15987        }
15988
15989        return self;
15990      }
15991
15992      function _isNativeReflectConstruct() {
15993        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
15994        if (Reflect.construct.sham) return false;
15995        if (typeof Proxy === "function") return true;
15996
15997        try {
15998          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
15999          return true;
16000        } catch (e) {
16001          return false;
16002        }
16003      }
16004
16005      function _getPrototypeOf(o) {
16006        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
16007          return o.__proto__ || Object.getPrototypeOf(o);
16008        };
16009        return _getPrototypeOf(o);
16010      }
16011
16012      var BaseXform = require('../base-xform');
16013
16014      var HLinkClickXform = /*#__PURE__*/function (_BaseXform) {
16015        _inherits(HLinkClickXform, _BaseXform);
16016
16017        var _super = _createSuper(HLinkClickXform);
16018
16019        function HLinkClickXform() {
16020          _classCallCheck(this, HLinkClickXform);
16021
16022          return _super.apply(this, arguments);
16023        }
16024
16025        _createClass(HLinkClickXform, [{
16026          key: "render",
16027          value: function render(xmlStream, model) {
16028            if (!(model.hyperlinks && model.hyperlinks.rId)) {
16029              return;
16030            }
16031
16032            xmlStream.leafNode(this.tag, {
16033              'xmlns:r': 'http://schemas.openxmlformats.org/officeDocument/2006/relationships',
16034              'r:id': model.hyperlinks.rId,
16035              tooltip: model.hyperlinks.tooltip
16036            });
16037          }
16038        }, {
16039          key: "parseOpen",
16040          value: function parseOpen(node) {
16041            switch (node.name) {
16042              case this.tag:
16043                this.model = {
16044                  hyperlinks: {
16045                    rId: node.attributes['r:id'],
16046                    tooltip: node.attributes.tooltip
16047                  }
16048                };
16049                return true;
16050
16051              default:
16052                return true;
16053            }
16054          }
16055        }, {
16056          key: "parseText",
16057          value: function parseText() {}
16058        }, {
16059          key: "parseClose",
16060          value: function parseClose() {
16061            return false;
16062          }
16063        }, {
16064          key: "tag",
16065          get: function get() {
16066            return 'a:hlinkClick';
16067          }
16068        }]);
16069
16070        return HLinkClickXform;
16071      }(BaseXform);
16072
16073      module.exports = HLinkClickXform;
16074    }, {
16075      "../base-xform": 29
16076    }],
16077    63: [function (require, module, exports) {
16078      "use strict";
16079
16080      function _typeof(obj) {
16081        "@babel/helpers - typeof";
16082
16083        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
16084          _typeof = function _typeof(obj) {
16085            return typeof obj;
16086          };
16087        } else {
16088          _typeof = function _typeof(obj) {
16089            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
16090          };
16091        }
16092
16093        return _typeof(obj);
16094      }
16095
16096      function _classCallCheck(instance, Constructor) {
16097        if (!(instance instanceof Constructor)) {
16098          throw new TypeError("Cannot call a class as a function");
16099        }
16100      }
16101
16102      function _defineProperties(target, props) {
16103        for (var i = 0; i < props.length; i++) {
16104          var descriptor = props[i];
16105          descriptor.enumerable = descriptor.enumerable || false;
16106          descriptor.configurable = true;
16107          if ("value" in descriptor) descriptor.writable = true;
16108          Object.defineProperty(target, descriptor.key, descriptor);
16109        }
16110      }
16111
16112      function _createClass(Constructor, protoProps, staticProps) {
16113        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
16114        if (staticProps) _defineProperties(Constructor, staticProps);
16115        return Constructor;
16116      }
16117
16118      function _inherits(subClass, superClass) {
16119        if (typeof superClass !== "function" && superClass !== null) {
16120          throw new TypeError("Super expression must either be null or a function");
16121        }
16122
16123        subClass.prototype = Object.create(superClass && superClass.prototype, {
16124          constructor: {
16125            value: subClass,
16126            writable: true,
16127            configurable: true
16128          }
16129        });
16130        if (superClass) _setPrototypeOf(subClass, superClass);
16131      }
16132
16133      function _setPrototypeOf(o, p) {
16134        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
16135          o.__proto__ = p;
16136          return o;
16137        };
16138
16139        return _setPrototypeOf(o, p);
16140      }
16141
16142      function _createSuper(Derived) {
16143        return function () {
16144          var Super = _getPrototypeOf(Derived),
16145              result;
16146
16147          if (_isNativeReflectConstruct()) {
16148            var NewTarget = _getPrototypeOf(this).constructor;
16149
16150            result = Reflect.construct(Super, arguments, NewTarget);
16151          } else {
16152            result = Super.apply(this, arguments);
16153          }
16154
16155          return _possibleConstructorReturn(this, result);
16156        };
16157      }
16158
16159      function _possibleConstructorReturn(self, call) {
16160        if (call && (_typeof(call) === "object" || typeof call === "function")) {
16161          return call;
16162        }
16163
16164        return _assertThisInitialized(self);
16165      }
16166
16167      function _assertThisInitialized(self) {
16168        if (self === void 0) {
16169          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
16170        }
16171
16172        return self;
16173      }
16174
16175      function _isNativeReflectConstruct() {
16176        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
16177        if (Reflect.construct.sham) return false;
16178        if (typeof Proxy === "function") return true;
16179
16180        try {
16181          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
16182          return true;
16183        } catch (e) {
16184          return false;
16185        }
16186      }
16187
16188      function _getPrototypeOf(o) {
16189        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
16190          return o.__proto__ || Object.getPrototypeOf(o);
16191        };
16192        return _getPrototypeOf(o);
16193      }
16194
16195      var BaseXform = require('../base-xform');
16196
16197      var CNvPrXform = require('./c-nv-pr-xform');
16198
16199      var CNvPicPrXform = require('./c-nv-pic-pr-xform');
16200
16201      var NvPicPrXform = /*#__PURE__*/function (_BaseXform) {
16202        _inherits(NvPicPrXform, _BaseXform);
16203
16204        var _super = _createSuper(NvPicPrXform);
16205
16206        function NvPicPrXform() {
16207          var _this;
16208
16209          _classCallCheck(this, NvPicPrXform);
16210
16211          _this = _super.call(this);
16212          _this.map = {
16213            'xdr:cNvPr': new CNvPrXform(),
16214            'xdr:cNvPicPr': new CNvPicPrXform()
16215          };
16216          return _this;
16217        }
16218
16219        _createClass(NvPicPrXform, [{
16220          key: "render",
16221          value: function render(xmlStream, model) {
16222            xmlStream.openNode(this.tag);
16223            this.map['xdr:cNvPr'].render(xmlStream, model);
16224            this.map['xdr:cNvPicPr'].render(xmlStream, model);
16225            xmlStream.closeNode();
16226          }
16227        }, {
16228          key: "parseOpen",
16229          value: function parseOpen(node) {
16230            if (this.parser) {
16231              this.parser.parseOpen(node);
16232              return true;
16233            }
16234
16235            switch (node.name) {
16236              case this.tag:
16237                this.reset();
16238                break;
16239
16240              default:
16241                this.parser = this.map[node.name];
16242
16243                if (this.parser) {
16244                  this.parser.parseOpen(node);
16245                }
16246
16247                break;
16248            }
16249
16250            return true;
16251          }
16252        }, {
16253          key: "parseText",
16254          value: function parseText() {}
16255        }, {
16256          key: "parseClose",
16257          value: function parseClose(name) {
16258            if (this.parser) {
16259              if (!this.parser.parseClose(name)) {
16260                this.parser = undefined;
16261              }
16262
16263              return true;
16264            }
16265
16266            switch (name) {
16267              case this.tag:
16268                this.model = this.map['xdr:cNvPr'].model;
16269                return false;
16270
16271              default:
16272                return true;
16273            }
16274          }
16275        }, {
16276          key: "tag",
16277          get: function get() {
16278            return 'xdr:nvPicPr';
16279          }
16280        }]);
16281
16282        return NvPicPrXform;
16283      }(BaseXform);
16284
16285      module.exports = NvPicPrXform;
16286    }, {
16287      "../base-xform": 29,
16288      "./c-nv-pic-pr-xform": 56,
16289      "./c-nv-pr-xform": 57
16290    }],
16291    64: [function (require, module, exports) {
16292      "use strict";
16293
16294      function _typeof(obj) {
16295        "@babel/helpers - typeof";
16296
16297        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
16298          _typeof = function _typeof(obj) {
16299            return typeof obj;
16300          };
16301        } else {
16302          _typeof = function _typeof(obj) {
16303            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
16304          };
16305        }
16306
16307        return _typeof(obj);
16308      }
16309
16310      function _classCallCheck(instance, Constructor) {
16311        if (!(instance instanceof Constructor)) {
16312          throw new TypeError("Cannot call a class as a function");
16313        }
16314      }
16315
16316      function _defineProperties(target, props) {
16317        for (var i = 0; i < props.length; i++) {
16318          var descriptor = props[i];
16319          descriptor.enumerable = descriptor.enumerable || false;
16320          descriptor.configurable = true;
16321          if ("value" in descriptor) descriptor.writable = true;
16322          Object.defineProperty(target, descriptor.key, descriptor);
16323        }
16324      }
16325
16326      function _createClass(Constructor, protoProps, staticProps) {
16327        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
16328        if (staticProps) _defineProperties(Constructor, staticProps);
16329        return Constructor;
16330      }
16331
16332      function _inherits(subClass, superClass) {
16333        if (typeof superClass !== "function" && superClass !== null) {
16334          throw new TypeError("Super expression must either be null or a function");
16335        }
16336
16337        subClass.prototype = Object.create(superClass && superClass.prototype, {
16338          constructor: {
16339            value: subClass,
16340            writable: true,
16341            configurable: true
16342          }
16343        });
16344        if (superClass) _setPrototypeOf(subClass, superClass);
16345      }
16346
16347      function _setPrototypeOf(o, p) {
16348        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
16349          o.__proto__ = p;
16350          return o;
16351        };
16352
16353        return _setPrototypeOf(o, p);
16354      }
16355
16356      function _createSuper(Derived) {
16357        return function () {
16358          var Super = _getPrototypeOf(Derived),
16359              result;
16360
16361          if (_isNativeReflectConstruct()) {
16362            var NewTarget = _getPrototypeOf(this).constructor;
16363
16364            result = Reflect.construct(Super, arguments, NewTarget);
16365          } else {
16366            result = Super.apply(this, arguments);
16367          }
16368
16369          return _possibleConstructorReturn(this, result);
16370        };
16371      }
16372
16373      function _possibleConstructorReturn(self, call) {
16374        if (call && (_typeof(call) === "object" || typeof call === "function")) {
16375          return call;
16376        }
16377
16378        return _assertThisInitialized(self);
16379      }
16380
16381      function _assertThisInitialized(self) {
16382        if (self === void 0) {
16383          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
16384        }
16385
16386        return self;
16387      }
16388
16389      function _isNativeReflectConstruct() {
16390        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
16391        if (Reflect.construct.sham) return false;
16392        if (typeof Proxy === "function") return true;
16393
16394        try {
16395          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
16396          return true;
16397        } catch (e) {
16398          return false;
16399        }
16400      }
16401
16402      function _getPrototypeOf(o) {
16403        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
16404          return o.__proto__ || Object.getPrototypeOf(o);
16405        };
16406        return _getPrototypeOf(o);
16407      }
16408
16409      var BaseCellAnchorXform = require('./base-cell-anchor-xform');
16410
16411      var StaticXform = require('../static-xform');
16412
16413      var CellPositionXform = require('./cell-position-xform');
16414
16415      var ExtXform = require('./ext-xform');
16416
16417      var PicXform = require('./pic-xform');
16418
16419      var OneCellAnchorXform = /*#__PURE__*/function (_BaseCellAnchorXform) {
16420        _inherits(OneCellAnchorXform, _BaseCellAnchorXform);
16421
16422        var _super = _createSuper(OneCellAnchorXform);
16423
16424        function OneCellAnchorXform() {
16425          var _this;
16426
16427          _classCallCheck(this, OneCellAnchorXform);
16428
16429          _this = _super.call(this);
16430          _this.map = {
16431            'xdr:from': new CellPositionXform({
16432              tag: 'xdr:from'
16433            }),
16434            'xdr:ext': new ExtXform({
16435              tag: 'xdr:ext'
16436            }),
16437            'xdr:pic': new PicXform(),
16438            'xdr:clientData': new StaticXform({
16439              tag: 'xdr:clientData'
16440            })
16441          };
16442          return _this;
16443        }
16444
16445        _createClass(OneCellAnchorXform, [{
16446          key: "prepare",
16447          value: function prepare(model, options) {
16448            this.map['xdr:pic'].prepare(model.picture, options);
16449          }
16450        }, {
16451          key: "render",
16452          value: function render(xmlStream, model) {
16453            xmlStream.openNode(this.tag, {
16454              editAs: model.range.editAs || 'oneCell'
16455            });
16456            this.map['xdr:from'].render(xmlStream, model.range.tl);
16457            this.map['xdr:ext'].render(xmlStream, model.range.ext);
16458            this.map['xdr:pic'].render(xmlStream, model.picture);
16459            this.map['xdr:clientData'].render(xmlStream, {});
16460            xmlStream.closeNode();
16461          }
16462        }, {
16463          key: "parseClose",
16464          value: function parseClose(name) {
16465            if (this.parser) {
16466              if (!this.parser.parseClose(name)) {
16467                this.parser = undefined;
16468              }
16469
16470              return true;
16471            }
16472
16473            switch (name) {
16474              case this.tag:
16475                this.model.range.tl = this.map['xdr:from'].model;
16476                this.model.range.ext = this.map['xdr:ext'].model;
16477                this.model.picture = this.map['xdr:pic'].model;
16478                return false;
16479
16480              default:
16481                // could be some unrecognised tags
16482                return true;
16483            }
16484          }
16485        }, {
16486          key: "reconcile",
16487          value: function reconcile(model, options) {
16488            model.medium = this.reconcilePicture(model.picture, options);
16489          }
16490        }, {
16491          key: "tag",
16492          get: function get() {
16493            return 'xdr:oneCellAnchor';
16494          }
16495        }]);
16496
16497        return OneCellAnchorXform;
16498      }(BaseCellAnchorXform);
16499
16500      module.exports = OneCellAnchorXform;
16501    }, {
16502      "../static-xform": 117,
16503      "./base-cell-anchor-xform": 53,
16504      "./cell-position-xform": 58,
16505      "./ext-xform": 61,
16506      "./pic-xform": 65
16507    }],
16508    65: [function (require, module, exports) {
16509      "use strict";
16510
16511      function _typeof(obj) {
16512        "@babel/helpers - typeof";
16513
16514        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
16515          _typeof = function _typeof(obj) {
16516            return typeof obj;
16517          };
16518        } else {
16519          _typeof = function _typeof(obj) {
16520            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
16521          };
16522        }
16523
16524        return _typeof(obj);
16525      }
16526
16527      function _classCallCheck(instance, Constructor) {
16528        if (!(instance instanceof Constructor)) {
16529          throw new TypeError("Cannot call a class as a function");
16530        }
16531      }
16532
16533      function _defineProperties(target, props) {
16534        for (var i = 0; i < props.length; i++) {
16535          var descriptor = props[i];
16536          descriptor.enumerable = descriptor.enumerable || false;
16537          descriptor.configurable = true;
16538          if ("value" in descriptor) descriptor.writable = true;
16539          Object.defineProperty(target, descriptor.key, descriptor);
16540        }
16541      }
16542
16543      function _createClass(Constructor, protoProps, staticProps) {
16544        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
16545        if (staticProps) _defineProperties(Constructor, staticProps);
16546        return Constructor;
16547      }
16548
16549      function _inherits(subClass, superClass) {
16550        if (typeof superClass !== "function" && superClass !== null) {
16551          throw new TypeError("Super expression must either be null or a function");
16552        }
16553
16554        subClass.prototype = Object.create(superClass && superClass.prototype, {
16555          constructor: {
16556            value: subClass,
16557            writable: true,
16558            configurable: true
16559          }
16560        });
16561        if (superClass) _setPrototypeOf(subClass, superClass);
16562      }
16563
16564      function _setPrototypeOf(o, p) {
16565        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
16566          o.__proto__ = p;
16567          return o;
16568        };
16569
16570        return _setPrototypeOf(o, p);
16571      }
16572
16573      function _createSuper(Derived) {
16574        return function () {
16575          var Super = _getPrototypeOf(Derived),
16576              result;
16577
16578          if (_isNativeReflectConstruct()) {
16579            var NewTarget = _getPrototypeOf(this).constructor;
16580
16581            result = Reflect.construct(Super, arguments, NewTarget);
16582          } else {
16583            result = Super.apply(this, arguments);
16584          }
16585
16586          return _possibleConstructorReturn(this, result);
16587        };
16588      }
16589
16590      function _possibleConstructorReturn(self, call) {
16591        if (call && (_typeof(call) === "object" || typeof call === "function")) {
16592          return call;
16593        }
16594
16595        return _assertThisInitialized(self);
16596      }
16597
16598      function _assertThisInitialized(self) {
16599        if (self === void 0) {
16600          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
16601        }
16602
16603        return self;
16604      }
16605
16606      function _isNativeReflectConstruct() {
16607        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
16608        if (Reflect.construct.sham) return false;
16609        if (typeof Proxy === "function") return true;
16610
16611        try {
16612          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
16613          return true;
16614        } catch (e) {
16615          return false;
16616        }
16617      }
16618
16619      function _getPrototypeOf(o) {
16620        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
16621          return o.__proto__ || Object.getPrototypeOf(o);
16622        };
16623        return _getPrototypeOf(o);
16624      }
16625
16626      var BaseXform = require('../base-xform');
16627
16628      var StaticXform = require('../static-xform');
16629
16630      var BlipFillXform = require('./blip-fill-xform');
16631
16632      var NvPicPrXform = require('./nv-pic-pr-xform');
16633
16634      var spPrJSON = require('./sp-pr');
16635
16636      var PicXform = /*#__PURE__*/function (_BaseXform) {
16637        _inherits(PicXform, _BaseXform);
16638
16639        var _super = _createSuper(PicXform);
16640
16641        function PicXform() {
16642          var _this;
16643
16644          _classCallCheck(this, PicXform);
16645
16646          _this = _super.call(this);
16647          _this.map = {
16648            'xdr:nvPicPr': new NvPicPrXform(),
16649            'xdr:blipFill': new BlipFillXform(),
16650            'xdr:spPr': new StaticXform(spPrJSON)
16651          };
16652          return _this;
16653        }
16654
16655        _createClass(PicXform, [{
16656          key: "prepare",
16657          value: function prepare(model, options) {
16658            model.index = options.index + 1;
16659          }
16660        }, {
16661          key: "render",
16662          value: function render(xmlStream, model) {
16663            xmlStream.openNode(this.tag);
16664            this.map['xdr:nvPicPr'].render(xmlStream, model);
16665            this.map['xdr:blipFill'].render(xmlStream, model);
16666            this.map['xdr:spPr'].render(xmlStream, model);
16667            xmlStream.closeNode();
16668          }
16669        }, {
16670          key: "parseOpen",
16671          value: function parseOpen(node) {
16672            if (this.parser) {
16673              this.parser.parseOpen(node);
16674              return true;
16675            }
16676
16677            switch (node.name) {
16678              case this.tag:
16679                this.reset();
16680                break;
16681
16682              default:
16683                this.parser = this.map[node.name];
16684
16685                if (this.parser) {
16686                  this.parser.parseOpen(node);
16687                }
16688
16689                break;
16690            }
16691
16692            return true;
16693          }
16694        }, {
16695          key: "parseText",
16696          value: function parseText() {}
16697        }, {
16698          key: "parseClose",
16699          value: function parseClose(name) {
16700            if (this.parser) {
16701              if (!this.parser.parseClose(name)) {
16702                this.mergeModel(this.parser.model);
16703                this.parser = undefined;
16704              }
16705
16706              return true;
16707            }
16708
16709            switch (name) {
16710              case this.tag:
16711                return false;
16712
16713              default:
16714                // not quite sure how we get here!
16715                return true;
16716            }
16717          }
16718        }, {
16719          key: "tag",
16720          get: function get() {
16721            return 'xdr:pic';
16722          }
16723        }]);
16724
16725        return PicXform;
16726      }(BaseXform);
16727
16728      module.exports = PicXform;
16729    }, {
16730      "../base-xform": 29,
16731      "../static-xform": 117,
16732      "./blip-fill-xform": 54,
16733      "./nv-pic-pr-xform": 63,
16734      "./sp-pr": 66
16735    }],
16736    66: [function (require, module, exports) {
16737      "use strict";
16738
16739      module.exports = {
16740        tag: 'xdr:spPr',
16741        c: [{
16742          tag: 'a:xfrm',
16743          c: [{
16744            tag: 'a:off',
16745            $: {
16746              x: '0',
16747              y: '0'
16748            }
16749          }, {
16750            tag: 'a:ext',
16751            $: {
16752              cx: '0',
16753              cy: '0'
16754            }
16755          }]
16756        }, {
16757          tag: 'a:prstGeom',
16758          $: {
16759            prst: 'rect'
16760          },
16761          c: [{
16762            tag: 'a:avLst'
16763          }]
16764        }]
16765      };
16766    }, {}],
16767    67: [function (require, module, exports) {
16768      "use strict";
16769
16770      function _typeof(obj) {
16771        "@babel/helpers - typeof";
16772
16773        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
16774          _typeof = function _typeof(obj) {
16775            return typeof obj;
16776          };
16777        } else {
16778          _typeof = function _typeof(obj) {
16779            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
16780          };
16781        }
16782
16783        return _typeof(obj);
16784      }
16785
16786      function _classCallCheck(instance, Constructor) {
16787        if (!(instance instanceof Constructor)) {
16788          throw new TypeError("Cannot call a class as a function");
16789        }
16790      }
16791
16792      function _defineProperties(target, props) {
16793        for (var i = 0; i < props.length; i++) {
16794          var descriptor = props[i];
16795          descriptor.enumerable = descriptor.enumerable || false;
16796          descriptor.configurable = true;
16797          if ("value" in descriptor) descriptor.writable = true;
16798          Object.defineProperty(target, descriptor.key, descriptor);
16799        }
16800      }
16801
16802      function _createClass(Constructor, protoProps, staticProps) {
16803        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
16804        if (staticProps) _defineProperties(Constructor, staticProps);
16805        return Constructor;
16806      }
16807
16808      function _inherits(subClass, superClass) {
16809        if (typeof superClass !== "function" && superClass !== null) {
16810          throw new TypeError("Super expression must either be null or a function");
16811        }
16812
16813        subClass.prototype = Object.create(superClass && superClass.prototype, {
16814          constructor: {
16815            value: subClass,
16816            writable: true,
16817            configurable: true
16818          }
16819        });
16820        if (superClass) _setPrototypeOf(subClass, superClass);
16821      }
16822
16823      function _setPrototypeOf(o, p) {
16824        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
16825          o.__proto__ = p;
16826          return o;
16827        };
16828
16829        return _setPrototypeOf(o, p);
16830      }
16831
16832      function _createSuper(Derived) {
16833        return function () {
16834          var Super = _getPrototypeOf(Derived),
16835              result;
16836
16837          if (_isNativeReflectConstruct()) {
16838            var NewTarget = _getPrototypeOf(this).constructor;
16839
16840            result = Reflect.construct(Super, arguments, NewTarget);
16841          } else {
16842            result = Super.apply(this, arguments);
16843          }
16844
16845          return _possibleConstructorReturn(this, result);
16846        };
16847      }
16848
16849      function _possibleConstructorReturn(self, call) {
16850        if (call && (_typeof(call) === "object" || typeof call === "function")) {
16851          return call;
16852        }
16853
16854        return _assertThisInitialized(self);
16855      }
16856
16857      function _assertThisInitialized(self) {
16858        if (self === void 0) {
16859          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
16860        }
16861
16862        return self;
16863      }
16864
16865      function _isNativeReflectConstruct() {
16866        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
16867        if (Reflect.construct.sham) return false;
16868        if (typeof Proxy === "function") return true;
16869
16870        try {
16871          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
16872          return true;
16873        } catch (e) {
16874          return false;
16875        }
16876      }
16877
16878      function _getPrototypeOf(o) {
16879        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
16880          return o.__proto__ || Object.getPrototypeOf(o);
16881        };
16882        return _getPrototypeOf(o);
16883      }
16884
16885      var BaseCellAnchorXform = require('./base-cell-anchor-xform');
16886
16887      var StaticXform = require('../static-xform');
16888
16889      var CellPositionXform = require('./cell-position-xform');
16890
16891      var PicXform = require('./pic-xform');
16892
16893      var TwoCellAnchorXform = /*#__PURE__*/function (_BaseCellAnchorXform) {
16894        _inherits(TwoCellAnchorXform, _BaseCellAnchorXform);
16895
16896        var _super = _createSuper(TwoCellAnchorXform);
16897
16898        function TwoCellAnchorXform() {
16899          var _this;
16900
16901          _classCallCheck(this, TwoCellAnchorXform);
16902
16903          _this = _super.call(this);
16904          _this.map = {
16905            'xdr:from': new CellPositionXform({
16906              tag: 'xdr:from'
16907            }),
16908            'xdr:to': new CellPositionXform({
16909              tag: 'xdr:to'
16910            }),
16911            'xdr:pic': new PicXform(),
16912            'xdr:clientData': new StaticXform({
16913              tag: 'xdr:clientData'
16914            })
16915          };
16916          return _this;
16917        }
16918
16919        _createClass(TwoCellAnchorXform, [{
16920          key: "prepare",
16921          value: function prepare(model, options) {
16922            this.map['xdr:pic'].prepare(model.picture, options);
16923          }
16924        }, {
16925          key: "render",
16926          value: function render(xmlStream, model) {
16927            xmlStream.openNode(this.tag, {
16928              editAs: model.range.editAs || 'oneCell'
16929            });
16930            this.map['xdr:from'].render(xmlStream, model.range.tl);
16931            this.map['xdr:to'].render(xmlStream, model.range.br);
16932            this.map['xdr:pic'].render(xmlStream, model.picture);
16933            this.map['xdr:clientData'].render(xmlStream, {});
16934            xmlStream.closeNode();
16935          }
16936        }, {
16937          key: "parseClose",
16938          value: function parseClose(name) {
16939            if (this.parser) {
16940              if (!this.parser.parseClose(name)) {
16941                this.parser = undefined;
16942              }
16943
16944              return true;
16945            }
16946
16947            switch (name) {
16948              case this.tag:
16949                this.model.range.tl = this.map['xdr:from'].model;
16950                this.model.range.br = this.map['xdr:to'].model;
16951                this.model.picture = this.map['xdr:pic'].model;
16952                return false;
16953
16954              default:
16955                // could be some unrecognised tags
16956                return true;
16957            }
16958          }
16959        }, {
16960          key: "reconcile",
16961          value: function reconcile(model, options) {
16962            model.medium = this.reconcilePicture(model.picture, options);
16963          }
16964        }, {
16965          key: "tag",
16966          get: function get() {
16967            return 'xdr:twoCellAnchor';
16968          }
16969        }]);
16970
16971        return TwoCellAnchorXform;
16972      }(BaseCellAnchorXform);
16973
16974      module.exports = TwoCellAnchorXform;
16975    }, {
16976      "../static-xform": 117,
16977      "./base-cell-anchor-xform": 53,
16978      "./cell-position-xform": 58,
16979      "./pic-xform": 65
16980    }],
16981    68: [function (require, module, exports) {
16982      "use strict";
16983
16984      function _typeof(obj) {
16985        "@babel/helpers - typeof";
16986
16987        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
16988          _typeof = function _typeof(obj) {
16989            return typeof obj;
16990          };
16991        } else {
16992          _typeof = function _typeof(obj) {
16993            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
16994          };
16995        }
16996
16997        return _typeof(obj);
16998      }
16999
17000      function _classCallCheck(instance, Constructor) {
17001        if (!(instance instanceof Constructor)) {
17002          throw new TypeError("Cannot call a class as a function");
17003        }
17004      }
17005
17006      function _defineProperties(target, props) {
17007        for (var i = 0; i < props.length; i++) {
17008          var descriptor = props[i];
17009          descriptor.enumerable = descriptor.enumerable || false;
17010          descriptor.configurable = true;
17011          if ("value" in descriptor) descriptor.writable = true;
17012          Object.defineProperty(target, descriptor.key, descriptor);
17013        }
17014      }
17015
17016      function _createClass(Constructor, protoProps, staticProps) {
17017        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
17018        if (staticProps) _defineProperties(Constructor, staticProps);
17019        return Constructor;
17020      }
17021
17022      function _inherits(subClass, superClass) {
17023        if (typeof superClass !== "function" && superClass !== null) {
17024          throw new TypeError("Super expression must either be null or a function");
17025        }
17026
17027        subClass.prototype = Object.create(superClass && superClass.prototype, {
17028          constructor: {
17029            value: subClass,
17030            writable: true,
17031            configurable: true
17032          }
17033        });
17034        if (superClass) _setPrototypeOf(subClass, superClass);
17035      }
17036
17037      function _setPrototypeOf(o, p) {
17038        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
17039          o.__proto__ = p;
17040          return o;
17041        };
17042
17043        return _setPrototypeOf(o, p);
17044      }
17045
17046      function _createSuper(Derived) {
17047        return function () {
17048          var Super = _getPrototypeOf(Derived),
17049              result;
17050
17051          if (_isNativeReflectConstruct()) {
17052            var NewTarget = _getPrototypeOf(this).constructor;
17053
17054            result = Reflect.construct(Super, arguments, NewTarget);
17055          } else {
17056            result = Super.apply(this, arguments);
17057          }
17058
17059          return _possibleConstructorReturn(this, result);
17060        };
17061      }
17062
17063      function _possibleConstructorReturn(self, call) {
17064        if (call && (_typeof(call) === "object" || typeof call === "function")) {
17065          return call;
17066        }
17067
17068        return _assertThisInitialized(self);
17069      }
17070
17071      function _assertThisInitialized(self) {
17072        if (self === void 0) {
17073          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
17074        }
17075
17076        return self;
17077      }
17078
17079      function _isNativeReflectConstruct() {
17080        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
17081        if (Reflect.construct.sham) return false;
17082        if (typeof Proxy === "function") return true;
17083
17084        try {
17085          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
17086          return true;
17087        } catch (e) {
17088          return false;
17089        }
17090      }
17091
17092      function _getPrototypeOf(o) {
17093        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
17094          return o.__proto__ || Object.getPrototypeOf(o);
17095        };
17096        return _getPrototypeOf(o);
17097      }
17098
17099      var BaseXform = require('./base-xform');
17100
17101      var ListXform = /*#__PURE__*/function (_BaseXform) {
17102        _inherits(ListXform, _BaseXform);
17103
17104        var _super = _createSuper(ListXform);
17105
17106        function ListXform(options) {
17107          var _this;
17108
17109          _classCallCheck(this, ListXform);
17110
17111          _this = _super.call(this);
17112          _this.tag = options.tag;
17113          _this.always = !!options.always;
17114          _this.count = options.count;
17115          _this.empty = options.empty;
17116          _this.$count = options.$count || 'count';
17117          _this.$ = options.$;
17118          _this.childXform = options.childXform;
17119          _this.maxItems = options.maxItems;
17120          return _this;
17121        }
17122
17123        _createClass(ListXform, [{
17124          key: "prepare",
17125          value: function prepare(model, options) {
17126            var childXform = this.childXform;
17127
17128            if (model) {
17129              model.forEach(function (childModel, index) {
17130                options.index = index;
17131                childXform.prepare(childModel, options);
17132              });
17133            }
17134          }
17135        }, {
17136          key: "render",
17137          value: function render(xmlStream, model) {
17138            if (this.always || model && model.length) {
17139              xmlStream.openNode(this.tag, this.$);
17140
17141              if (this.count) {
17142                xmlStream.addAttribute(this.$count, model && model.length || 0);
17143              }
17144
17145              var childXform = this.childXform;
17146              (model || []).forEach(function (childModel, index) {
17147                childXform.render(xmlStream, childModel, index);
17148              });
17149              xmlStream.closeNode();
17150            } else if (this.empty) {
17151              xmlStream.leafNode(this.tag);
17152            }
17153          }
17154        }, {
17155          key: "parseOpen",
17156          value: function parseOpen(node) {
17157            if (this.parser) {
17158              this.parser.parseOpen(node);
17159              return true;
17160            }
17161
17162            switch (node.name) {
17163              case this.tag:
17164                this.model = [];
17165                return true;
17166
17167              default:
17168                if (this.childXform.parseOpen(node)) {
17169                  this.parser = this.childXform;
17170                  return true;
17171                }
17172
17173                return false;
17174            }
17175          }
17176        }, {
17177          key: "parseText",
17178          value: function parseText(text) {
17179            if (this.parser) {
17180              this.parser.parseText(text);
17181            }
17182          }
17183        }, {
17184          key: "parseClose",
17185          value: function parseClose(name) {
17186            if (this.parser) {
17187              if (!this.parser.parseClose(name)) {
17188                this.model.push(this.parser.model);
17189                this.parser = undefined;
17190
17191                if (this.maxItems && this.model.length > this.maxItems) {
17192                  throw new Error("Max ".concat(this.childXform.tag, " count (").concat(this.maxItems, ") exceeded"));
17193                }
17194              }
17195
17196              return true;
17197            }
17198
17199            return false;
17200          }
17201        }, {
17202          key: "reconcile",
17203          value: function reconcile(model, options) {
17204            if (model) {
17205              var childXform = this.childXform;
17206              model.forEach(function (childModel) {
17207                childXform.reconcile(childModel, options);
17208              });
17209            }
17210          }
17211        }]);
17212
17213        return ListXform;
17214      }(BaseXform);
17215
17216      module.exports = ListXform;
17217    }, {
17218      "./base-xform": 29
17219    }],
17220    69: [function (require, module, exports) {
17221      "use strict";
17222
17223      function _typeof(obj) {
17224        "@babel/helpers - typeof";
17225
17226        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
17227          _typeof = function _typeof(obj) {
17228            return typeof obj;
17229          };
17230        } else {
17231          _typeof = function _typeof(obj) {
17232            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
17233          };
17234        }
17235
17236        return _typeof(obj);
17237      }
17238
17239      function _classCallCheck(instance, Constructor) {
17240        if (!(instance instanceof Constructor)) {
17241          throw new TypeError("Cannot call a class as a function");
17242        }
17243      }
17244
17245      function _defineProperties(target, props) {
17246        for (var i = 0; i < props.length; i++) {
17247          var descriptor = props[i];
17248          descriptor.enumerable = descriptor.enumerable || false;
17249          descriptor.configurable = true;
17250          if ("value" in descriptor) descriptor.writable = true;
17251          Object.defineProperty(target, descriptor.key, descriptor);
17252        }
17253      }
17254
17255      function _createClass(Constructor, protoProps, staticProps) {
17256        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
17257        if (staticProps) _defineProperties(Constructor, staticProps);
17258        return Constructor;
17259      }
17260
17261      function _inherits(subClass, superClass) {
17262        if (typeof superClass !== "function" && superClass !== null) {
17263          throw new TypeError("Super expression must either be null or a function");
17264        }
17265
17266        subClass.prototype = Object.create(superClass && superClass.prototype, {
17267          constructor: {
17268            value: subClass,
17269            writable: true,
17270            configurable: true
17271          }
17272        });
17273        if (superClass) _setPrototypeOf(subClass, superClass);
17274      }
17275
17276      function _setPrototypeOf(o, p) {
17277        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
17278          o.__proto__ = p;
17279          return o;
17280        };
17281
17282        return _setPrototypeOf(o, p);
17283      }
17284
17285      function _createSuper(Derived) {
17286        return function () {
17287          var Super = _getPrototypeOf(Derived),
17288              result;
17289
17290          if (_isNativeReflectConstruct()) {
17291            var NewTarget = _getPrototypeOf(this).constructor;
17292
17293            result = Reflect.construct(Super, arguments, NewTarget);
17294          } else {
17295            result = Super.apply(this, arguments);
17296          }
17297
17298          return _possibleConstructorReturn(this, result);
17299        };
17300      }
17301
17302      function _possibleConstructorReturn(self, call) {
17303        if (call && (_typeof(call) === "object" || typeof call === "function")) {
17304          return call;
17305        }
17306
17307        return _assertThisInitialized(self);
17308      }
17309
17310      function _assertThisInitialized(self) {
17311        if (self === void 0) {
17312          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
17313        }
17314
17315        return self;
17316      }
17317
17318      function _isNativeReflectConstruct() {
17319        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
17320        if (Reflect.construct.sham) return false;
17321        if (typeof Proxy === "function") return true;
17322
17323        try {
17324          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
17325          return true;
17326        } catch (e) {
17327          return false;
17328        }
17329      }
17330
17331      function _getPrototypeOf(o) {
17332        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
17333          return o.__proto__ || Object.getPrototypeOf(o);
17334        };
17335        return _getPrototypeOf(o);
17336      }
17337
17338      var colCache = require('../../../utils/col-cache');
17339
17340      var BaseXform = require('../base-xform');
17341
17342      var AutoFilterXform = /*#__PURE__*/function (_BaseXform) {
17343        _inherits(AutoFilterXform, _BaseXform);
17344
17345        var _super = _createSuper(AutoFilterXform);
17346
17347        function AutoFilterXform() {
17348          _classCallCheck(this, AutoFilterXform);
17349
17350          return _super.apply(this, arguments);
17351        }
17352
17353        _createClass(AutoFilterXform, [{
17354          key: "render",
17355          value: function render(xmlStream, model) {
17356            if (model) {
17357              if (typeof model === 'string') {
17358                // assume range
17359                xmlStream.leafNode('autoFilter', {
17360                  ref: model
17361                });
17362              } else {
17363                var getAddress = function getAddress(addr) {
17364                  if (typeof addr === 'string') {
17365                    return addr;
17366                  }
17367
17368                  return colCache.getAddress(addr.row, addr.column).address;
17369                };
17370
17371                var firstAddress = getAddress(model.from);
17372                var secondAddress = getAddress(model.to);
17373
17374                if (firstAddress && secondAddress) {
17375                  xmlStream.leafNode('autoFilter', {
17376                    ref: "".concat(firstAddress, ":").concat(secondAddress)
17377                  });
17378                }
17379              }
17380            }
17381          }
17382        }, {
17383          key: "parseOpen",
17384          value: function parseOpen(node) {
17385            if (node.name === 'autoFilter') {
17386              this.model = node.attributes.ref;
17387            }
17388          }
17389        }, {
17390          key: "tag",
17391          get: function get() {
17392            return 'autoFilter';
17393          }
17394        }]);
17395
17396        return AutoFilterXform;
17397      }(BaseXform);
17398
17399      module.exports = AutoFilterXform;
17400    }, {
vendor: 4,748 bytes, lines 17401-17552
17401      "../../../utils/col-cache": 17,
17402      "../base-xform": 29
17403    }],
17404    70: [function (require, module, exports) {
17405      "use strict";
17406
17407      function _typeof(obj) {
17408        "@babel/helpers - typeof";
17409
17410        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
17411          _typeof = function _typeof(obj) {
17412            return typeof obj;
17413          };
17414        } else {
17415          _typeof = function _typeof(obj) {
17416            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
17417          };
17418        }
17419
17420        return _typeof(obj);
17421      }
17422
17423      function ownKeys(object, enumerableOnly) {
17424        var keys = Object.keys(object);
17425
17426        if (Object.getOwnPropertySymbols) {
17427          var symbols = Object.getOwnPropertySymbols(object);
17428          if (enumerableOnly) symbols = symbols.filter(function (sym) {
17429            return Object.getOwnPropertyDescriptor(object, sym).enumerable;
17430          });
17431          keys.push.apply(keys, symbols);
17432        }
17433
17434        return keys;
17435      }
17436
17437      function _objectSpread(target) {
17438        for (var i = 1; i < arguments.length; i++) {
17439          var source = arguments[i] != null ? arguments[i] : {};
17440
17441          if (i % 2) {
17442            ownKeys(Object(source), true).forEach(function (key) {
17443              _defineProperty(target, key, source[key]);
17444            });
17445          } else if (Object.getOwnPropertyDescriptors) {
17446            Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
17447          } else {
17448            ownKeys(Object(source)).forEach(function (key) {
17449              Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
17450            });
17451          }
17452        }
17453
17454        return target;
17455      }
17456
17457      function _defineProperty(obj, key, value) {
17458        if (key in obj) {
17459          Object.defineProperty(obj, key, {
17460            value: value,
17461            enumerable: true,
17462            configurable: true,
17463            writable: true
17464          });
17465        } else {
17466          obj[key] = value;
17467        }
17468
17469        return obj;
17470      }
17471
17472      function _classCallCheck(instance, Constructor) {
17473        if (!(instance instanceof Constructor)) {
17474          throw new TypeError("Cannot call a class as a function");
17475        }
17476      }
17477
17478      function _defineProperties(target, props) {
17479        for (var i = 0; i < props.length; i++) {
17480          var descriptor = props[i];
17481          descriptor.enumerable = descriptor.enumerable || false;
17482          descriptor.configurable = true;
17483          if ("value" in descriptor) descriptor.writable = true;
17484          Object.defineProperty(target, descriptor.key, descriptor);
17485        }
17486      }
17487
17488      function _createClass(Constructor, protoProps, staticProps) {
17489        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
17490        if (staticProps) _defineProperties(Constructor, staticProps);
17491        return Constructor;
17492      }
17493
17494      function _inherits(subClass, superClass) {
17495        if (typeof superClass !== "function" && superClass !== null) {
17496          throw new TypeError("Super expression must either be null or a function");
17497        }
17498
17499        subClass.prototype = Object.create(superClass && superClass.prototype, {
17500          constructor: {
17501            value: subClass,
17502            writable: true,
17503            configurable: true
17504          }
17505        });
17506        if (superClass) _setPrototypeOf(subClass, superClass);
17507      }
17508
17509      function _setPrototypeOf(o, p) {
17510        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
17511          o.__proto__ = p;
17512          return o;
17513        };
17514
17515        return _setPrototypeOf(o, p);
17516      }
17517
17518      function _createSuper(Derived) {
17519        return function () {
17520          var Super = _getPrototypeOf(Derived),
17521              result;
17522
17523          if (_isNativeReflectConstruct()) {
17524            var NewTarget = _getPrototypeOf(this).constructor;
17525
17526            result = Reflect.construct(Super, arguments, NewTarget);
17527          } else {
17528            result = Super.apply(this, arguments);
17529          }
17530
17531          return _possibleConstructorReturn(this, result);
17532        };
17533      }
17534
17535      function _possibleConstructorReturn(self, call) {
17536        if (call && (_typeof(call) === "object" || typeof call === "function")) {
17537          return call;
17538        }
17539
17540        return _assertThisInitialized(self);
17541      }
17542
17543      function _assertThisInitialized(self) {
17544        if (self === void 0) {
17545          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
17546        }
17547
17548        return self;
17549      }
17550
17551      function _isNativeReflectConstruct() {
17552        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
vendor: 15,718 bytes, lines 17553-18051
17553        if (Reflect.construct.sham) return false;
17554        if (typeof Proxy === "function") return true;
17555
17556        try {
17557          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
17558          return true;
17559        } catch (e) {
17560          return false;
17561        }
17562      }
17563
17564      function _getPrototypeOf(o) {
17565        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
17566          return o.__proto__ || Object.getPrototypeOf(o);
17567        };
17568        return _getPrototypeOf(o);
17569      }
17570
17571      var utils = require('../../../utils/utils');
17572
17573      var BaseXform = require('../base-xform');
17574
17575      var Range = require('../../../doc/range');
17576
17577      var Enums = require('../../../doc/enums');
17578
17579      var RichTextXform = require('../strings/rich-text-xform');
17580
17581      function getValueType(v) {
17582        if (v === null || v === undefined) {
17583          return Enums.ValueType.Null;
17584        }
17585
17586        if (v instanceof String || typeof v === 'string') {
17587          return Enums.ValueType.String;
17588        }
17589
17590        if (typeof v === 'number') {
17591          return Enums.ValueType.Number;
17592        }
17593
17594        if (typeof v === 'boolean') {
17595          return Enums.ValueType.Boolean;
17596        }
17597
17598        if (v instanceof Date) {
17599          return Enums.ValueType.Date;
17600        }
17601
17602        if (v.text && v.hyperlink) {
17603          return Enums.ValueType.Hyperlink;
17604        }
17605
17606        if (v.formula) {
17607          return Enums.ValueType.Formula;
17608        }
17609
17610        if (v.error) {
17611          return Enums.ValueType.Error;
17612        }
17613
17614        throw new Error('I could not understand type of value');
17615      }
17616
17617      function getEffectiveCellType(cell) {
17618        switch (cell.type) {
17619          case Enums.ValueType.Formula:
17620            return getValueType(cell.result);
17621
17622          default:
17623            return cell.type;
17624        }
17625      }
17626
17627      var CellXform = /*#__PURE__*/function (_BaseXform) {
17628        _inherits(CellXform, _BaseXform);
17629
17630        var _super = _createSuper(CellXform);
17631
17632        function CellXform() {
17633          var _this;
17634
17635          _classCallCheck(this, CellXform);
17636
17637          _this = _super.call(this);
17638          _this.richTextXForm = new RichTextXform();
17639          return _this;
17640        }
17641
17642        _createClass(CellXform, [{
17643          key: "prepare",
17644          value: function prepare(model, options) {
17645            var styleId = options.styles.addStyleModel(model.style || {}, getEffectiveCellType(model));
17646
17647            if (styleId) {
17648              model.styleId = styleId;
17649            }
17650
17651            if (model.comment) {
17652              options.comments.push(_objectSpread(_objectSpread({}, model.comment), {}, {
17653                ref: model.address
17654              }));
17655            }
17656
17657            switch (model.type) {
17658              case Enums.ValueType.String:
17659              case Enums.ValueType.RichText:
17660                if (options.sharedStrings) {
17661                  model.ssId = options.sharedStrings.add(model.value);
17662                }
17663
17664                break;
17665
17666              case Enums.ValueType.Date:
17667                if (options.date1904) {
17668                  model.date1904 = true;
17669                }
17670
17671                break;
17672
17673              case Enums.ValueType.Hyperlink:
17674                if (options.sharedStrings && model.text !== undefined && model.text !== null) {
17675                  model.ssId = options.sharedStrings.add(model.text);
17676                }
17677
17678                options.hyperlinks.push({
17679                  address: model.address,
17680                  target: model.hyperlink,
17681                  tooltip: model.tooltip
17682                });
17683                break;
17684
17685              case Enums.ValueType.Merge:
17686                options.merges.add(model);
17687                break;
17688
17689              case Enums.ValueType.Formula:
17690                if (options.date1904) {
17691                  // in case valueType is date
17692                  model.date1904 = true;
17693                }
17694
17695                if (model.shareType === 'shared') {
17696                  model.si = options.siFormulae++;
17697                }
17698
17699                if (model.formula) {
17700                  options.formulae[model.address] = model;
17701                } else if (model.sharedFormula) {
17702                  var master = options.formulae[model.sharedFormula];
17703
17704                  if (!master) {
17705                    throw new Error("Shared Formula master must exist above and or left of clone for cell ".concat(model.address));
17706                  }
17707
17708                  if (master.si === undefined) {
17709                    master.shareType = 'shared';
17710                    master.si = options.siFormulae++;
17711                    master.range = new Range(master.address, model.address);
17712                  } else if (master.range) {
17713                    master.range.expandToAddress(model.address);
17714                  }
17715
17716                  model.si = master.si;
17717                }
17718
17719                break;
17720
17721              default:
17722                break;
17723            }
17724          }
17725        }, {
17726          key: "renderFormula",
17727          value: function renderFormula(xmlStream, model) {
17728            var attrs = null;
17729
17730            switch (model.shareType) {
17731              case 'shared':
17732                attrs = {
17733                  t: 'shared',
17734                  ref: model.ref || model.range.range,
17735                  si: model.si
17736                };
17737                break;
17738
17739              case 'array':
17740                attrs = {
17741                  t: 'array',
17742                  ref: model.ref
17743                };
17744                break;
17745
17746              default:
17747                if (model.si !== undefined) {
17748                  attrs = {
17749                    t: 'shared',
17750                    si: model.si
17751                  };
17752                }
17753
17754                break;
17755            }
17756
17757            switch (getValueType(model.result)) {
17758              case Enums.ValueType.Null:
17759                // ?
17760                xmlStream.leafNode('f', attrs, model.formula);
17761                break;
17762
17763              case Enums.ValueType.String:
17764                // oddly, formula results don't ever use shared strings
17765                xmlStream.addAttribute('t', 'str');
17766                xmlStream.leafNode('f', attrs, model.formula);
17767                xmlStream.leafNode('v', null, model.result);
17768                break;
17769
17770              case Enums.ValueType.Number:
17771                xmlStream.leafNode('f', attrs, model.formula);
17772                xmlStream.leafNode('v', null, model.result);
17773                break;
17774
17775              case Enums.ValueType.Boolean:
17776                xmlStream.addAttribute('t', 'b');
17777                xmlStream.leafNode('f', attrs, model.formula);
17778                xmlStream.leafNode('v', null, model.result ? 1 : 0);
17779                break;
17780
17781              case Enums.ValueType.Error:
17782                xmlStream.addAttribute('t', 'e');
17783                xmlStream.leafNode('f', attrs, model.formula);
17784                xmlStream.leafNode('v', null, model.result.error);
17785                break;
17786
17787              case Enums.ValueType.Date:
17788                xmlStream.leafNode('f', attrs, model.formula);
17789                xmlStream.leafNode('v', null, utils.dateToExcel(model.result, model.date1904));
17790                break;
17791              // case Enums.ValueType.Hyperlink: // ??
17792              // case Enums.ValueType.Formula:
17793
17794              default:
17795                throw new Error('I could not understand type of value');
17796            }
17797          }
17798        }, {
17799          key: "render",
17800          value: function render(xmlStream, model) {
17801            var _this2 = this;
17802
17803            if (model.type === Enums.ValueType.Null && !model.styleId) {
17804              // if null and no style, exit
17805              return;
17806            }
17807
17808            xmlStream.openNode('c');
17809            xmlStream.addAttribute('r', model.address);
17810
17811            if (model.styleId) {
17812              xmlStream.addAttribute('s', model.styleId);
17813            }
17814
17815            switch (model.type) {
17816              case Enums.ValueType.Null:
17817                break;
17818
17819              case Enums.ValueType.Number:
17820                xmlStream.leafNode('v', null, model.value);
17821                break;
17822
17823              case Enums.ValueType.Boolean:
17824                xmlStream.addAttribute('t', 'b');
17825                xmlStream.leafNode('v', null, model.value ? '1' : '0');
17826                break;
17827
17828              case Enums.ValueType.Error:
17829                xmlStream.addAttribute('t', 'e');
17830                xmlStream.leafNode('v', null, model.value.error);
17831                break;
17832
17833              case Enums.ValueType.String:
17834              case Enums.ValueType.RichText:
17835                if (model.ssId !== undefined) {
17836                  xmlStream.addAttribute('t', 's');
17837                  xmlStream.leafNode('v', null, model.ssId);
17838                } else if (model.value && model.value.richText) {
17839                  xmlStream.addAttribute('t', 'inlineStr');
17840                  xmlStream.openNode('is');
17841                  model.value.richText.forEach(function (text) {
17842                    _this2.richTextXForm.render(xmlStream, text);
17843                  });
17844                  xmlStream.closeNode('is');
17845                } else {
17846                  xmlStream.addAttribute('t', 'str');
17847                  xmlStream.leafNode('v', null, model.value);
17848                }
17849
17850                break;
17851
17852              case Enums.ValueType.Date:
17853                xmlStream.leafNode('v', null, utils.dateToExcel(model.value, model.date1904));
17854                break;
17855
17856              case Enums.ValueType.Hyperlink:
17857                if (model.ssId !== undefined) {
17858                  xmlStream.addAttribute('t', 's');
17859                  xmlStream.leafNode('v', null, model.ssId);
17860                } else {
17861                  xmlStream.addAttribute('t', 'str');
17862                  xmlStream.leafNode('v', null, model.text);
17863                }
17864
17865                break;
17866
17867              case Enums.ValueType.Formula:
17868                this.renderFormula(xmlStream, model);
17869                break;
17870
17871              case Enums.ValueType.Merge:
17872                // nothing to add
17873                break;
17874
17875              default:
17876                break;
17877            }
17878
17879            xmlStream.closeNode(); // </c>
17880          }
17881        }, {
17882          key: "parseOpen",
17883          value: function parseOpen(node) {
17884            if (this.parser) {
17885              this.parser.parseOpen(node);
17886              return true;
17887            }
17888
17889            switch (node.name) {
17890              case 'c':
17891                // const address = colCache.decodeAddress(node.attributes.r);
17892                this.model = {
17893                  address: node.attributes.r
17894                };
17895                this.t = node.attributes.t;
17896
17897                if (node.attributes.s) {
17898                  this.model.styleId = parseInt(node.attributes.s, 10);
17899                }
17900
17901                return true;
17902
17903              case 'f':
17904                this.currentNode = 'f';
17905                this.model.si = node.attributes.si;
17906                this.model.shareType = node.attributes.t;
17907                this.model.ref = node.attributes.ref;
17908                return true;
17909
17910              case 'v':
17911                this.currentNode = 'v';
17912                return true;
17913
17914              case 't':
17915                this.currentNode = 't';
17916                return true;
17917
17918              case 'r':
17919                this.parser = this.richTextXForm;
17920                this.parser.parseOpen(node);
17921                return true;
17922
17923              default:
17924                return false;
17925            }
17926          }
17927        }, {
17928          key: "parseText",
17929          value: function parseText(text) {
17930            if (this.parser) {
17931              this.parser.parseText(text);
17932              return;
17933            }
17934
17935            switch (this.currentNode) {
17936              case 'f':
17937                this.model.formula = this.model.formula ? this.model.formula + text : text;
17938                break;
17939
17940              case 'v':
17941              case 't':
17942                if (this.model.value && this.model.value.richText) {
17943                  this.model.value.richText.text = this.model.value.richText.text ? this.model.value.richText.text + text : text;
17944                } else {
17945                  this.model.value = this.model.value ? this.model.value + text : text;
17946                }
17947
17948                break;
17949
17950              default:
17951                break;
17952            }
17953          }
17954        }, {
17955          key: "parseClose",
17956          value: function parseClose(name) {
17957            switch (name) {
17958              case 'c':
17959                {
17960                  var model = this.model; // first guess on cell type
17961
17962                  if (model.formula || model.shareType) {
17963                    model.type = Enums.ValueType.Formula;
17964
17965                    if (model.value) {
17966                      if (this.t === 'str') {
17967                        model.result = utils.xmlDecode(model.value);
17968                      } else if (this.t === 'b') {
17969                        model.result = parseInt(model.value, 10) !== 0;
17970                      } else if (this.t === 'e') {
17971                        model.result = {
17972                          error: model.value
17973                        };
17974                      } else {
17975                        model.result = parseFloat(model.value);
17976                      }
17977
17978                      model.value = undefined;
17979                    }
17980                  } else if (model.value !== undefined) {
17981                    switch (this.t) {
17982                      case 's':
17983                        model.type = Enums.ValueType.String;
17984                        model.value = parseInt(model.value, 10);
17985                        break;
17986
17987                      case 'str':
17988                        model.type = Enums.ValueType.String;
17989                        model.value = utils.xmlDecode(model.value);
17990                        break;
17991
17992                      case 'inlineStr':
17993                        model.type = Enums.ValueType.String;
17994                        break;
17995
17996                      case 'b':
17997                        model.type = Enums.ValueType.Boolean;
17998                        model.value = parseInt(model.value, 10) !== 0;
17999                        break;
18000
18001                      case 'e':
18002                        model.type = Enums.ValueType.Error;
18003                        model.value = {
18004                          error: model.value
18005                        };
18006                        break;
18007
18008                      default:
18009                        model.type = Enums.ValueType.Number;
18010                        model.value = parseFloat(model.value);
18011                        break;
18012                    }
18013                  } else if (model.styleId) {
18014                    model.type = Enums.ValueType.Null;
18015                  } else {
18016                    model.type = Enums.ValueType.Merge;
18017                  }
18018
18019                  return false;
18020                }
18021
18022              case 'f':
18023              case 'v':
18024              case 'is':
18025                this.currentNode = undefined;
18026                return true;
18027
18028              case 't':
18029                if (this.parser) {
18030                  this.parser.parseClose(name);
18031                  return true;
18032                }
18033
18034                this.currentNode = undefined;
18035                return true;
18036
18037              case 'r':
18038                this.model.value = this.model.value || {};
18039                this.model.value.richText = this.model.value.richText || [];
18040                this.model.value.richText.push(this.parser.model);
18041                this.parser = undefined;
18042                this.currentNode = undefined;
18043                return true;
18044
18045              default:
18046                if (this.parser) {
18047                  this.parser.parseClose(name);
18048                  return true;
18049                }
18050
18051                return false;
18052            }
18053          }
18054        }, {
18055          key: "reconcile",
18056          value: function reconcile(model, options) {
18057            var style = model.styleId && options.styles && options.styles.getStyleModel(model.styleId);
18058
18059            if (style) {
18060              model.style = style;
18061            }
18062
18063            if (model.styleId !== undefined) {
18064              model.styleId = undefined;
18065            }
18066
18067            switch (model.type) {
18068              case Enums.ValueType.String:
18069                if (typeof model.value === 'number') {
18070                  if (options.sharedStrings) {
18071                    model.value = options.sharedStrings.getString(model.value);
18072                  }
18073                }
18074
18075                if (model.value.richText) {
18076                  model.type = Enums.ValueType.RichText;
18077                }
18078
18079                break;
18080
18081              case Enums.ValueType.Number:
18082                if (style && utils.isDateFmt(style.numFmt)) {
18083                  model.type = Enums.ValueType.Date;
18084                  model.value = utils.excelToDate(model.value, options.date1904);
18085                }
18086
18087                break;
18088
18089              case Enums.ValueType.Formula:
18090                if (model.result !== undefined && style && utils.isDateFmt(style.numFmt)) {
18091                  model.result = utils.excelToDate(model.result, options.date1904);
18092                }
18093
18094                if (model.shareType === 'shared') {
18095                  if (model.ref) {
18096                    // master
18097                    options.formulae[model.si] = model.address;
18098                  } else {
18099                    // slave
18100                    model.sharedFormula = options.formulae[model.si];
18101                    delete model.shareType;
18102                  }
18103
18104                  delete model.si;
18105                }
18106
18107                break;
18108
18109              default:
18110                break;
18111            } // look for hyperlink
18112
18113
18114            var hyperlink = options.hyperlinkMap[model.address];
18115
18116            if (hyperlink) {
18117              if (model.type === Enums.ValueType.Formula) {
18118                model.text = model.result;
18119                model.result = undefined;
18120              } else {
18121                model.text = model.value;
18122                model.value = undefined;
18123              }
18124
18125              model.type = Enums.ValueType.Hyperlink;
18126              model.hyperlink = hyperlink;
18127            }
18128
18129            var comment = options.commentsMap && options.commentsMap[model.address];
18130
18131            if (comment) {
18132              model.comment = comment;
18133            }
18134          }
18135        }, {
18136          key: "tag",
18137          get: function get() {
18138            return 'c';
18139          }
18140        }]);
18141
18142        return CellXform;
18143      }(BaseXform);
18144
18145      module.exports = CellXform;
18146    }, {
18147      "../../../doc/enums": 7,
18148      "../../../doc/range": 10,
18149      "../../../utils/utils": 24,
18150      "../base-xform": 29,
18151      "../strings/rich-text-xform": 119
18152    }],
18153    71: [function (require, module, exports) {
18154      "use strict";
18155
18156      function _typeof(obj) {
18157        "@babel/helpers - typeof";
18158
18159        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
18160          _typeof = function _typeof(obj) {
18161            return typeof obj;
18162          };
18163        } else {
18164          _typeof = function _typeof(obj) {
18165            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
18166          };
18167        }
18168
18169        return _typeof(obj);
18170      }
18171
18172      function _classCallCheck(instance, Constructor) {
18173        if (!(instance instanceof Constructor)) {
18174          throw new TypeError("Cannot call a class as a function");
18175        }
18176      }
18177
18178      function _defineProperties(target, props) {
18179        for (var i = 0; i < props.length; i++) {
18180          var descriptor = props[i];
18181          descriptor.enumerable = descriptor.enumerable || false;
18182          descriptor.configurable = true;
18183          if ("value" in descriptor) descriptor.writable = true;
18184          Object.defineProperty(target, descriptor.key, descriptor);
18185        }
18186      }
18187
18188      function _createClass(Constructor, protoProps, staticProps) {
18189        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
18190        if (staticProps) _defineProperties(Constructor, staticProps);
18191        return Constructor;
18192      }
18193
18194      function _inherits(subClass, superClass) {
18195        if (typeof superClass !== "function" && superClass !== null) {
18196          throw new TypeError("Super expression must either be null or a function");
18197        }
18198
18199        subClass.prototype = Object.create(superClass && superClass.prototype, {
18200          constructor: {
18201            value: subClass,
18202            writable: true,
18203            configurable: true
18204          }
18205        });
18206        if (superClass) _setPrototypeOf(subClass, superClass);
18207      }
18208
18209      function _setPrototypeOf(o, p) {
18210        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
18211          o.__proto__ = p;
18212          return o;
18213        };
18214
18215        return _setPrototypeOf(o, p);
18216      }
18217
18218      function _createSuper(Derived) {
18219        return function () {
18220          var Super = _getPrototypeOf(Derived),
18221              result;
18222
18223          if (_isNativeReflectConstruct()) {
18224            var NewTarget = _getPrototypeOf(this).constructor;
18225
18226            result = Reflect.construct(Super, arguments, NewTarget);
18227          } else {
18228            result = Super.apply(this, arguments);
18229          }
18230
18231          return _possibleConstructorReturn(this, result);
18232        };
18233      }
18234
18235      function _possibleConstructorReturn(self, call) {
18236        if (call && (_typeof(call) === "object" || typeof call === "function")) {
18237          return call;
18238        }
18239
18240        return _assertThisInitialized(self);
18241      }
18242
18243      function _assertThisInitialized(self) {
18244        if (self === void 0) {
18245          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
18246        }
18247
18248        return self;
18249      }
18250
18251      function _isNativeReflectConstruct() {
18252        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
18253        if (Reflect.construct.sham) return false;
18254        if (typeof Proxy === "function") return true;
18255
18256        try {
18257          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
18258          return true;
18259        } catch (e) {
18260          return false;
18261        }
18262      }
18263
18264      function _getPrototypeOf(o) {
18265        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
18266          return o.__proto__ || Object.getPrototypeOf(o);
18267        };
18268        return _getPrototypeOf(o);
18269      }
18270
18271      var BaseXform = require('../../base-xform');
18272
18273      var CfIconExtXform = /*#__PURE__*/function (_BaseXform) {
18274        _inherits(CfIconExtXform, _BaseXform);
18275
18276        var _super = _createSuper(CfIconExtXform);
18277
18278        function CfIconExtXform() {
18279          _classCallCheck(this, CfIconExtXform);
18280
18281          return _super.apply(this, arguments);
18282        }
18283
18284        _createClass(CfIconExtXform, [{
18285          key: "render",
18286          value: function render(xmlStream, model) {
18287            xmlStream.leafNode(this.tag, {
18288              iconSet: model.iconSet,
18289              iconId: model.iconId
18290            });
18291          }
18292        }, {
18293          key: "parseOpen",
18294          value: function parseOpen(_ref) {
18295            var attributes = _ref.attributes;
18296            this.model = {
18297              iconSet: attributes.iconSet,
18298              iconId: BaseXform.toIntValue(attributes.iconId)
18299            };
18300          }
18301        }, {
18302          key: "parseClose",
18303          value: function parseClose(name) {
18304            return name !== this.tag;
18305          }
18306        }, {
18307          key: "tag",
18308          get: function get() {
18309            return 'x14:cfIcon';
18310          }
18311        }]);
18312
18313        return CfIconExtXform;
18314      }(BaseXform);
18315
18316      module.exports = CfIconExtXform;
18317    }, {
18318      "../../base-xform": 29
18319    }],
18320    72: [function (require, module, exports) {
18321      "use strict";
18322
18323      function _typeof(obj) {
18324        "@babel/helpers - typeof";
18325
18326        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
18327          _typeof = function _typeof(obj) {
18328            return typeof obj;
18329          };
18330        } else {
18331          _typeof = function _typeof(obj) {
18332            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
18333          };
18334        }
18335
18336        return _typeof(obj);
18337      }
18338
18339      function _classCallCheck(instance, Constructor) {
18340        if (!(instance instanceof Constructor)) {
18341          throw new TypeError("Cannot call a class as a function");
18342        }
18343      }
18344
18345      function _defineProperties(target, props) {
18346        for (var i = 0; i < props.length; i++) {
18347          var descriptor = props[i];
18348          descriptor.enumerable = descriptor.enumerable || false;
18349          descriptor.configurable = true;
18350          if ("value" in descriptor) descriptor.writable = true;
18351          Object.defineProperty(target, descriptor.key, descriptor);
18352        }
18353      }
18354
18355      function _createClass(Constructor, protoProps, staticProps) {
18356        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
18357        if (staticProps) _defineProperties(Constructor, staticProps);
18358        return Constructor;
18359      }
18360
18361      function _inherits(subClass, superClass) {
18362        if (typeof superClass !== "function" && superClass !== null) {
18363          throw new TypeError("Super expression must either be null or a function");
18364        }
18365
18366        subClass.prototype = Object.create(superClass && superClass.prototype, {
18367          constructor: {
18368            value: subClass,
18369            writable: true,
18370            configurable: true
18371          }
18372        });
18373        if (superClass) _setPrototypeOf(subClass, superClass);
18374      }
18375
18376      function _setPrototypeOf(o, p) {
18377        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
18378          o.__proto__ = p;
18379          return o;
18380        };
18381
18382        return _setPrototypeOf(o, p);
18383      }
18384
18385      function _createSuper(Derived) {
18386        return function () {
18387          var Super = _getPrototypeOf(Derived),
18388              result;
18389
18390          if (_isNativeReflectConstruct()) {
18391            var NewTarget = _getPrototypeOf(this).constructor;
18392
18393            result = Reflect.construct(Super, arguments, NewTarget);
18394          } else {
18395            result = Super.apply(this, arguments);
18396          }
18397
18398          return _possibleConstructorReturn(this, result);
18399        };
18400      }
18401
18402      function _possibleConstructorReturn(self, call) {
18403        if (call && (_typeof(call) === "object" || typeof call === "function")) {
18404          return call;
18405        }
18406
18407        return _assertThisInitialized(self);
18408      }
18409
18410      function _assertThisInitialized(self) {
18411        if (self === void 0) {
18412          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
18413        }
18414
18415        return self;
18416      }
18417
18418      function _isNativeReflectConstruct() {
18419        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
18420        if (Reflect.construct.sham) return false;
18421        if (typeof Proxy === "function") return true;
18422
18423        try {
18424          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
18425          return true;
18426        } catch (e) {
18427          return false;
18428        }
18429      }
18430
18431      function _getPrototypeOf(o) {
18432        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
18433          return o.__proto__ || Object.getPrototypeOf(o);
18434        };
18435        return _getPrototypeOf(o);
18436      }
18437
18438      var _require = require('uuid'),
18439          uuidv4 = _require.v4;
18440
18441      var BaseXform = require('../../base-xform');
18442
18443      var CompositeXform = require('../../composite-xform');
18444
18445      var DatabarExtXform = require('./databar-ext-xform');
18446
18447      var IconSetExtXform = require('./icon-set-ext-xform');
18448
18449      var extIcons = {
18450        '3Triangles': true,
18451        '3Stars': true,
18452        '5Boxes': true
18453      };
18454
18455      var CfRuleExtXform = /*#__PURE__*/function (_CompositeXform) {
18456        _inherits(CfRuleExtXform, _CompositeXform);
18457
18458        var _super = _createSuper(CfRuleExtXform);
18459
18460        function CfRuleExtXform() {
18461          var _this;
18462
18463          _classCallCheck(this, CfRuleExtXform);
18464
18465          _this = _super.call(this);
18466          _this.map = {
18467            'x14:dataBar': _this.databarXform = new DatabarExtXform(),
18468            'x14:iconSet': _this.iconSetXform = new IconSetExtXform()
18469          };
18470          return _this;
18471        }
18472
18473        _createClass(CfRuleExtXform, [{
18474          key: "prepare",
18475          value: function prepare(model) {
18476            if (CfRuleExtXform.isExt(model)) {
18477              model.x14Id = "{".concat(uuidv4(), "}").toUpperCase();
18478            }
18479          }
18480        }, {
18481          key: "render",
18482          value: function render(xmlStream, model) {
18483            if (!CfRuleExtXform.isExt(model)) {
18484              return;
18485            }
18486
18487            switch (model.type) {
18488              case 'dataBar':
18489                this.renderDataBar(xmlStream, model);
18490                break;
18491
18492              case 'iconSet':
18493                this.renderIconSet(xmlStream, model);
18494                break;
18495            }
18496          }
18497        }, {
18498          key: "renderDataBar",
18499          value: function renderDataBar(xmlStream, model) {
18500            xmlStream.openNode(this.tag, {
18501              type: 'dataBar',
18502              id: model.x14Id
18503            });
18504            this.databarXform.render(xmlStream, model);
18505            xmlStream.closeNode();
18506          }
18507        }, {
18508          key: "renderIconSet",
18509          value: function renderIconSet(xmlStream, model) {
18510            xmlStream.openNode(this.tag, {
18511              type: 'iconSet',
18512              priority: model.priority,
18513              id: model.x14Id || "{".concat(uuidv4(), "}")
18514            });
18515            this.iconSetXform.render(xmlStream, model);
18516            xmlStream.closeNode();
18517          }
18518        }, {
18519          key: "createNewModel",
18520          value: function createNewModel(_ref) {
18521            var attributes = _ref.attributes;
18522            return {
18523              type: attributes.type,
18524              x14Id: attributes.id,
18525              priority: BaseXform.toIntValue(attributes.priority)
18526            };
18527          }
18528        }, {
18529          key: "onParserClose",
18530          value: function onParserClose(name, parser) {
18531            Object.assign(this.model, parser.model);
18532          }
18533        }, {
18534          key: "tag",
18535          get: function get() {
18536            return 'x14:cfRule';
18537          }
18538        }], [{
18539          key: "isExt",
18540          value: function isExt(rule) {
18541            // is this rule primitive?
18542            if (rule.type === 'dataBar') {
18543              return DatabarExtXform.isExt(rule);
18544            }
18545
18546            if (rule.type === 'iconSet') {
18547              if (rule.custom || extIcons[rule.iconSet]) {
18548                return true;
18549              }
18550            }
18551
18552            return false;
18553          }
18554        }]);
18555
18556        return CfRuleExtXform;
18557      }(CompositeXform);
18558
18559      module.exports = CfRuleExtXform;
18560    }, {
18561      "../../base-xform": 29,
18562      "../../composite-xform": 45,
18563      "./databar-ext-xform": 76,
18564      "./icon-set-ext-xform": 78,
18565      "uuid": 502
18566    }],
18567    73: [function (require, module, exports) {
18568      "use strict";
18569
18570      function _typeof(obj) {
18571        "@babel/helpers - typeof";
18572
18573        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
18574          _typeof = function _typeof(obj) {
18575            return typeof obj;
18576          };
18577        } else {
18578          _typeof = function _typeof(obj) {
18579            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
18580          };
18581        }
18582
18583        return _typeof(obj);
18584      }
18585
18586      function _classCallCheck(instance, Constructor) {
18587        if (!(instance instanceof Constructor)) {
18588          throw new TypeError("Cannot call a class as a function");
18589        }
18590      }
18591
18592      function _defineProperties(target, props) {
18593        for (var i = 0; i < props.length; i++) {
18594          var descriptor = props[i];
18595          descriptor.enumerable = descriptor.enumerable || false;
18596          descriptor.configurable = true;
18597          if ("value" in descriptor) descriptor.writable = true;
18598          Object.defineProperty(target, descriptor.key, descriptor);
18599        }
18600      }
18601
18602      function _createClass(Constructor, protoProps, staticProps) {
18603        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
18604        if (staticProps) _defineProperties(Constructor, staticProps);
18605        return Constructor;
18606      }
18607
18608      function _inherits(subClass, superClass) {
18609        if (typeof superClass !== "function" && superClass !== null) {
18610          throw new TypeError("Super expression must either be null or a function");
18611        }
18612
18613        subClass.prototype = Object.create(superClass && superClass.prototype, {
18614          constructor: {
18615            value: subClass,
18616            writable: true,
18617            configurable: true
18618          }
18619        });
18620        if (superClass) _setPrototypeOf(subClass, superClass);
18621      }
18622
18623      function _setPrototypeOf(o, p) {
18624        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
18625          o.__proto__ = p;
18626          return o;
18627        };
18628
18629        return _setPrototypeOf(o, p);
18630      }
18631
18632      function _createSuper(Derived) {
18633        return function () {
18634          var Super = _getPrototypeOf(Derived),
18635              result;
18636
18637          if (_isNativeReflectConstruct()) {
18638            var NewTarget = _getPrototypeOf(this).constructor;
18639
18640            result = Reflect.construct(Super, arguments, NewTarget);
18641          } else {
18642            result = Super.apply(this, arguments);
18643          }
18644
18645          return _possibleConstructorReturn(this, result);
18646        };
18647      }
18648
18649      function _possibleConstructorReturn(self, call) {
18650        if (call && (_typeof(call) === "object" || typeof call === "function")) {
18651          return call;
18652        }
18653
18654        return _assertThisInitialized(self);
18655      }
18656
18657      function _assertThisInitialized(self) {
18658        if (self === void 0) {
18659          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
18660        }
18661
18662        return self;
18663      }
18664
18665      function _isNativeReflectConstruct() {
18666        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
18667        if (Reflect.construct.sham) return false;
18668        if (typeof Proxy === "function") return true;
18669
18670        try {
18671          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
18672          return true;
18673        } catch (e) {
18674          return false;
18675        }
18676      }
18677
18678      function _getPrototypeOf(o) {
18679        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
18680          return o.__proto__ || Object.getPrototypeOf(o);
18681        };
18682        return _getPrototypeOf(o);
18683      }
18684
18685      var CompositeXform = require('../../composite-xform');
18686
18687      var FExtXform = require('./f-ext-xform');
18688
18689      var CfvoExtXform = /*#__PURE__*/function (_CompositeXform) {
18690        _inherits(CfvoExtXform, _CompositeXform);
18691
18692        var _super = _createSuper(CfvoExtXform);
18693
18694        function CfvoExtXform() {
18695          var _this;
18696
18697          _classCallCheck(this, CfvoExtXform);
18698
18699          _this = _super.call(this);
18700          _this.map = {
18701            'xm:f': _this.fExtXform = new FExtXform()
18702          };
18703          return _this;
18704        }
18705
18706        _createClass(CfvoExtXform, [{
18707          key: "render",
18708          value: function render(xmlStream, model) {
18709            xmlStream.openNode(this.tag, {
18710              type: model.type
18711            });
18712
18713            if (model.value !== undefined) {
18714              this.fExtXform.render(xmlStream, model.value);
18715            }
18716
18717            xmlStream.closeNode();
18718          }
18719        }, {
18720          key: "createNewModel",
18721          value: function createNewModel(node) {
18722            return {
18723              type: node.attributes.type
18724            };
18725          }
18726        }, {
18727          key: "onParserClose",
18728          value: function onParserClose(name, parser) {
18729            switch (name) {
18730              case 'xm:f':
18731                this.model.value = parser.model ? parseFloat(parser.model) : 0;
18732                break;
18733            }
18734          }
18735        }, {
18736          key: "tag",
18737          get: function get() {
18738            return 'x14:cfvo';
18739          }
18740        }]);
18741
18742        return CfvoExtXform;
18743      }(CompositeXform);
18744
18745      module.exports = CfvoExtXform;
18746    }, {
18747      "../../composite-xform": 45,
18748      "./f-ext-xform": 77
18749    }],
18750    74: [function (require, module, exports) {
18751      "use strict";
18752
18753      function _typeof(obj) {
18754        "@babel/helpers - typeof";
18755
18756        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
18757          _typeof = function _typeof(obj) {
18758            return typeof obj;
18759          };
18760        } else {
18761          _typeof = function _typeof(obj) {
18762            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
18763          };
18764        }
18765
18766        return _typeof(obj);
18767      }
18768
18769      function _classCallCheck(instance, Constructor) {
18770        if (!(instance instanceof Constructor)) {
18771          throw new TypeError("Cannot call a class as a function");
18772        }
18773      }
18774
18775      function _defineProperties(target, props) {
18776        for (var i = 0; i < props.length; i++) {
18777          var descriptor = props[i];
18778          descriptor.enumerable = descriptor.enumerable || false;
18779          descriptor.configurable = true;
18780          if ("value" in descriptor) descriptor.writable = true;
18781          Object.defineProperty(target, descriptor.key, descriptor);
18782        }
18783      }
18784
18785      function _createClass(Constructor, protoProps, staticProps) {
18786        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
18787        if (staticProps) _defineProperties(Constructor, staticProps);
18788        return Constructor;
18789      }
18790
18791      function _inherits(subClass, superClass) {
18792        if (typeof superClass !== "function" && superClass !== null) {
18793          throw new TypeError("Super expression must either be null or a function");
18794        }
18795
18796        subClass.prototype = Object.create(superClass && superClass.prototype, {
18797          constructor: {
18798            value: subClass,
18799            writable: true,
18800            configurable: true
18801          }
18802        });
18803        if (superClass) _setPrototypeOf(subClass, superClass);
18804      }
18805
18806      function _setPrototypeOf(o, p) {
18807        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
18808          o.__proto__ = p;
18809          return o;
18810        };
18811
18812        return _setPrototypeOf(o, p);
18813      }
18814
18815      function _createSuper(Derived) {
18816        return function () {
18817          var Super = _getPrototypeOf(Derived),
18818              result;
18819
18820          if (_isNativeReflectConstruct()) {
18821            var NewTarget = _getPrototypeOf(this).constructor;
18822
18823            result = Reflect.construct(Super, arguments, NewTarget);
18824          } else {
18825            result = Super.apply(this, arguments);
18826          }
18827
18828          return _possibleConstructorReturn(this, result);
18829        };
18830      }
18831
18832      function _possibleConstructorReturn(self, call) {
18833        if (call && (_typeof(call) === "object" || typeof call === "function")) {
18834          return call;
18835        }
18836
18837        return _assertThisInitialized(self);
18838      }
18839
18840      function _assertThisInitialized(self) {
18841        if (self === void 0) {
18842          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
18843        }
18844
18845        return self;
18846      }
18847
18848      function _isNativeReflectConstruct() {
18849        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
18850        if (Reflect.construct.sham) return false;
18851        if (typeof Proxy === "function") return true;
18852
18853        try {
18854          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
18855          return true;
18856        } catch (e) {
18857          return false;
18858        }
18859      }
18860
18861      function _getPrototypeOf(o) {
18862        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
18863          return o.__proto__ || Object.getPrototypeOf(o);
18864        };
18865        return _getPrototypeOf(o);
18866      }
18867
18868      var CompositeXform = require('../../composite-xform');
18869
18870      var SqRefExtXform = require('./sqref-ext-xform');
18871
18872      var CfRuleExtXform = require('./cf-rule-ext-xform');
18873
18874      var ConditionalFormattingExtXform = /*#__PURE__*/function (_CompositeXform) {
18875        _inherits(ConditionalFormattingExtXform, _CompositeXform);
18876
18877        var _super = _createSuper(ConditionalFormattingExtXform);
18878
18879        function ConditionalFormattingExtXform() {
18880          var _this;
18881
18882          _classCallCheck(this, ConditionalFormattingExtXform);
18883
18884          _this = _super.call(this);
18885          _this.map = {
18886            'xm:sqref': _this.sqRef = new SqRefExtXform(),
18887            'x14:cfRule': _this.cfRule = new CfRuleExtXform()
18888          };
18889          return _this;
18890        }
18891
18892        _createClass(ConditionalFormattingExtXform, [{
18893          key: "prepare",
18894          value: function prepare(model, options) {
18895            var _this2 = this;
18896
18897            model.rules.forEach(function (rule) {
18898              _this2.cfRule.prepare(rule, options);
18899            });
18900          }
18901        }, {
18902          key: "render",
18903          value: function render(xmlStream, model) {
18904            var _this3 = this;
18905
18906            if (!model.rules.some(CfRuleExtXform.isExt)) {
18907              return;
18908            }
18909
18910            xmlStream.openNode(this.tag, {
18911              'xmlns:xm': 'http://schemas.microsoft.com/office/excel/2006/main'
18912            });
18913            model.rules.filter(CfRuleExtXform.isExt).forEach(function (rule) {
18914              return _this3.cfRule.render(xmlStream, rule);
18915            }); // for some odd reason, Excel needs the <xm:sqref> node to be after the rules
18916
18917            this.sqRef.render(xmlStream, model.ref);
18918            xmlStream.closeNode();
18919          }
18920        }, {
18921          key: "createNewModel",
18922          value: function createNewModel() {
18923            return {
18924              rules: []
18925            };
18926          }
18927        }, {
18928          key: "onParserClose",
18929          value: function onParserClose(name, parser) {
18930            switch (name) {
18931              case 'xm:sqref':
18932                this.model.ref = parser.model;
18933                break;
18934
18935              case 'x14:cfRule':
18936                this.model.rules.push(parser.model);
18937                break;
18938            }
18939          }
18940        }, {
18941          key: "tag",
18942          get: function get() {
18943            return 'x14:conditionalFormatting';
18944          }
18945        }]);
18946
18947        return ConditionalFormattingExtXform;
18948      }(CompositeXform);
18949
18950      module.exports = ConditionalFormattingExtXform;
18951    }, {
18952      "../../composite-xform": 45,
18953      "./cf-rule-ext-xform": 72,
18954      "./sqref-ext-xform": 79
18955    }],
18956    75: [function (require, module, exports) {
18957      "use strict";
18958
18959      function _typeof(obj) {
18960        "@babel/helpers - typeof";
18961
18962        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
18963          _typeof = function _typeof(obj) {
18964            return typeof obj;
18965          };
18966        } else {
18967          _typeof = function _typeof(obj) {
18968            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
18969          };
18970        }
18971
18972        return _typeof(obj);
18973      }
18974
18975      function _classCallCheck(instance, Constructor) {
18976        if (!(instance instanceof Constructor)) {
18977          throw new TypeError("Cannot call a class as a function");
18978        }
18979      }
18980
18981      function _defineProperties(target, props) {
18982        for (var i = 0; i < props.length; i++) {
18983          var descriptor = props[i];
18984          descriptor.enumerable = descriptor.enumerable || false;
18985          descriptor.configurable = true;
18986          if ("value" in descriptor) descriptor.writable = true;
18987          Object.defineProperty(target, descriptor.key, descriptor);
18988        }
18989      }
18990
18991      function _createClass(Constructor, protoProps, staticProps) {
18992        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
18993        if (staticProps) _defineProperties(Constructor, staticProps);
18994        return Constructor;
18995      }
18996
18997      function _inherits(subClass, superClass) {
18998        if (typeof superClass !== "function" && superClass !== null) {
18999          throw new TypeError("Super expression must either be null or a function");
19000        }
19001
19002        subClass.prototype = Object.create(superClass && superClass.prototype, {
19003          constructor: {
19004            value: subClass,
19005            writable: true,
19006            configurable: true
19007          }
19008        });
19009        if (superClass) _setPrototypeOf(subClass, superClass);
19010      }
19011
19012      function _setPrototypeOf(o, p) {
19013        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
19014          o.__proto__ = p;
19015          return o;
19016        };
19017
19018        return _setPrototypeOf(o, p);
19019      }
19020
19021      function _createSuper(Derived) {
19022        return function () {
19023          var Super = _getPrototypeOf(Derived),
19024              result;
19025
19026          if (_isNativeReflectConstruct()) {
19027            var NewTarget = _getPrototypeOf(this).constructor;
19028
19029            result = Reflect.construct(Super, arguments, NewTarget);
19030          } else {
19031            result = Super.apply(this, arguments);
19032          }
19033
19034          return _possibleConstructorReturn(this, result);
19035        };
19036      }
19037
19038      function _possibleConstructorReturn(self, call) {
19039        if (call && (_typeof(call) === "object" || typeof call === "function")) {
19040          return call;
19041        }
19042
19043        return _assertThisInitialized(self);
19044      }
19045
19046      function _assertThisInitialized(self) {
19047        if (self === void 0) {
19048          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
19049        }
19050
19051        return self;
19052      }
19053
19054      function _isNativeReflectConstruct() {
19055        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
19056        if (Reflect.construct.sham) return false;
19057        if (typeof Proxy === "function") return true;
19058
19059        try {
19060          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
19061          return true;
19062        } catch (e) {
19063          return false;
19064        }
19065      }
19066
19067      function _getPrototypeOf(o) {
19068        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
19069          return o.__proto__ || Object.getPrototypeOf(o);
19070        };
19071        return _getPrototypeOf(o);
19072      }
19073
19074      var CompositeXform = require('../../composite-xform');
19075
19076      var CfRuleExtXform = require('./cf-rule-ext-xform');
19077
19078      var ConditionalFormattingExtXform = require('./conditional-formatting-ext-xform');
19079
19080      var ConditionalFormattingsExtXform = /*#__PURE__*/function (_CompositeXform) {
19081        _inherits(ConditionalFormattingsExtXform, _CompositeXform);
19082
19083        var _super = _createSuper(ConditionalFormattingsExtXform);
19084
19085        function ConditionalFormattingsExtXform() {
19086          var _this;
19087
19088          _classCallCheck(this, ConditionalFormattingsExtXform);
19089
19090          _this = _super.call(this);
19091          _this.map = {
19092            'x14:conditionalFormatting': _this.cfXform = new ConditionalFormattingExtXform()
19093          };
19094          return _this;
19095        }
19096
19097        _createClass(ConditionalFormattingsExtXform, [{
19098          key: "hasContent",
19099          value: function hasContent(model) {
19100            if (model.hasExtContent === undefined) {
19101              model.hasExtContent = model.some(function (cf) {
19102                return cf.rules.some(CfRuleExtXform.isExt);
19103              });
19104            }
19105
19106            return model.hasExtContent;
19107          }
19108        }, {
19109          key: "prepare",
19110          value: function prepare(model, options) {
19111            var _this2 = this;
19112
19113            model.forEach(function (cf) {
19114              _this2.cfXform.prepare(cf, options);
19115            });
19116          }
19117        }, {
19118          key: "render",
19119          value: function render(xmlStream, model) {
19120            var _this3 = this;
19121
19122            if (this.hasContent(model)) {
19123              xmlStream.openNode(this.tag);
19124              model.forEach(function (cf) {
19125                return _this3.cfXform.render(xmlStream, cf);
19126              });
19127              xmlStream.closeNode();
19128            }
19129          }
19130        }, {
19131          key: "createNewModel",
19132          value: function createNewModel() {
19133            return [];
19134          }
19135        }, {
19136          key: "onParserClose",
19137          value: function onParserClose(name, parser) {
19138            // model is array of conditional formatting objects
19139            this.model.push(parser.model);
19140          }
19141        }, {
19142          key: "tag",
19143          get: function get() {
19144            return 'x14:conditionalFormattings';
19145          }
19146        }]);
19147
19148        return ConditionalFormattingsExtXform;
19149      }(CompositeXform);
19150
19151      module.exports = ConditionalFormattingsExtXform;
19152    }, {
19153      "../../composite-xform": 45,
19154      "./cf-rule-ext-xform": 72,
19155      "./conditional-formatting-ext-xform": 74
19156    }],
19157    76: [function (require, module, exports) {
19158      "use strict";
19159
19160      function _typeof(obj) {
19161        "@babel/helpers - typeof";
19162
19163        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
19164          _typeof = function _typeof(obj) {
19165            return typeof obj;
19166          };
19167        } else {
19168          _typeof = function _typeof(obj) {
19169            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
19170          };
19171        }
19172
19173        return _typeof(obj);
19174      }
19175
19176      function _slicedToArray(arr, i) {
19177        return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
19178      }
19179
19180      function _nonIterableRest() {
19181        throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
19182      }
19183
19184      function _unsupportedIterableToArray(o, minLen) {
19185        if (!o) return;
19186        if (typeof o === "string") return _arrayLikeToArray(o, minLen);
19187        var n = Object.prototype.toString.call(o).slice(8, -1);
19188        if (n === "Object" && o.constructor) n = o.constructor.name;
19189        if (n === "Map" || n === "Set") return Array.from(n);
19190        if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
19191      }
19192
19193      function _arrayLikeToArray(arr, len) {
19194        if (len == null || len > arr.length) len = arr.length;
19195
19196        for (var i = 0, arr2 = new Array(len); i < len; i++) {
19197          arr2[i] = arr[i];
19198        }
19199
19200        return arr2;
19201      }
19202
19203      function _iterableToArrayLimit(arr, i) {
19204        if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
19205        var _arr = [];
19206        var _n = true;
19207        var _d = false;
19208        var _e = undefined;
19209
19210        try {
19211          for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
19212            _arr.push(_s.value);
19213
19214            if (i && _arr.length === i) break;
19215          }
19216        } catch (err) {
19217          _d = true;
19218          _e = err;
19219        } finally {
19220          try {
19221            if (!_n && _i["return"] != null) _i["return"]();
19222          } finally {
19223            if (_d) throw _e;
19224          }
19225        }
19226
19227        return _arr;
19228      }
19229
19230      function _arrayWithHoles(arr) {
19231        if (Array.isArray(arr)) return arr;
19232      }
19233
19234      function _classCallCheck(instance, Constructor) {
19235        if (!(instance instanceof Constructor)) {
19236          throw new TypeError("Cannot call a class as a function");
19237        }
19238      }
19239
19240      function _defineProperties(target, props) {
19241        for (var i = 0; i < props.length; i++) {
19242          var descriptor = props[i];
19243          descriptor.enumerable = descriptor.enumerable || false;
19244          descriptor.configurable = true;
19245          if ("value" in descriptor) descriptor.writable = true;
19246          Object.defineProperty(target, descriptor.key, descriptor);
19247        }
19248      }
19249
19250      function _createClass(Constructor, protoProps, staticProps) {
19251        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
19252        if (staticProps) _defineProperties(Constructor, staticProps);
19253        return Constructor;
19254      }
19255
19256      function _inherits(subClass, superClass) {
19257        if (typeof superClass !== "function" && superClass !== null) {
19258          throw new TypeError("Super expression must either be null or a function");
19259        }
19260
19261        subClass.prototype = Object.create(superClass && superClass.prototype, {
19262          constructor: {
19263            value: subClass,
19264            writable: true,
19265            configurable: true
19266          }
19267        });
19268        if (superClass) _setPrototypeOf(subClass, superClass);
19269      }
19270
19271      function _setPrototypeOf(o, p) {
19272        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
19273          o.__proto__ = p;
19274          return o;
19275        };
19276
19277        return _setPrototypeOf(o, p);
19278      }
19279
19280      function _createSuper(Derived) {
19281        return function () {
19282          var Super = _getPrototypeOf(Derived),
19283              result;
19284
19285          if (_isNativeReflectConstruct()) {
19286            var NewTarget = _getPrototypeOf(this).constructor;
19287
19288            result = Reflect.construct(Super, arguments, NewTarget);
19289          } else {
19290            result = Super.apply(this, arguments);
19291          }
19292
19293          return _possibleConstructorReturn(this, result);
19294        };
19295      }
19296
19297      function _possibleConstructorReturn(self, call) {
19298        if (call && (_typeof(call) === "object" || typeof call === "function")) {
19299          return call;
19300        }
19301
19302        return _assertThisInitialized(self);
19303      }
19304
19305      function _assertThisInitialized(self) {
19306        if (self === void 0) {
19307          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
19308        }
19309
19310        return self;
19311      }
19312
19313      function _isNativeReflectConstruct() {
19314        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
19315        if (Reflect.construct.sham) return false;
19316        if (typeof Proxy === "function") return true;
19317
19318        try {
19319          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
19320          return true;
19321        } catch (e) {
19322          return false;
19323        }
19324      }
19325
19326      function _getPrototypeOf(o) {
19327        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
19328          return o.__proto__ || Object.getPrototypeOf(o);
19329        };
19330        return _getPrototypeOf(o);
19331      }
19332
19333      var BaseXform = require('../../base-xform');
19334
19335      var CompositeXform = require('../../composite-xform');
19336
19337      var ColorXform = require('../../style/color-xform');
19338
19339      var CfvoExtXform = require('./cfvo-ext-xform');
19340
19341      var DatabarExtXform = /*#__PURE__*/function (_CompositeXform) {
19342        _inherits(DatabarExtXform, _CompositeXform);
19343
19344        var _super = _createSuper(DatabarExtXform);
19345
19346        function DatabarExtXform() {
19347          var _this;
19348
19349          _classCallCheck(this, DatabarExtXform);
19350
19351          _this = _super.call(this);
19352          _this.map = {
19353            'x14:cfvo': _this.cfvoXform = new CfvoExtXform(),
19354            'x14:borderColor': _this.borderColorXform = new ColorXform('x14:borderColor'),
19355            'x14:negativeBorderColor': _this.negativeBorderColorXform = new ColorXform('x14:negativeBorderColor'),
19356            'x14:negativeFillColor': _this.negativeFillColorXform = new ColorXform('x14:negativeFillColor'),
19357            'x14:axisColor': _this.axisColorXform = new ColorXform('x14:axisColor')
19358          };
19359          return _this;
19360        }
19361
19362        _createClass(DatabarExtXform, [{
19363          key: "render",
19364          value: function render(xmlStream, model) {
19365            var _this2 = this;
19366
19367            xmlStream.openNode(this.tag, {
19368              minLength: BaseXform.toIntAttribute(model.minLength, 0, true),
19369              maxLength: BaseXform.toIntAttribute(model.maxLength, 100, true),
19370              border: BaseXform.toBoolAttribute(model.border, false),
19371              gradient: BaseXform.toBoolAttribute(model.gradient, true),
19372              negativeBarColorSameAsPositive: BaseXform.toBoolAttribute(model.negativeBarColorSameAsPositive, true),
19373              negativeBarBorderColorSameAsPositive: BaseXform.toBoolAttribute(model.negativeBarBorderColorSameAsPositive, true),
19374              axisPosition: BaseXform.toAttribute(model.axisPosition, 'auto'),
19375              direction: BaseXform.toAttribute(model.direction, 'leftToRight')
19376            });
19377            model.cfvo.forEach(function (cfvo) {
19378              _this2.cfvoXform.render(xmlStream, cfvo);
19379            });
19380            this.borderColorXform.render(xmlStream, model.borderColor);
19381            this.negativeBorderColorXform.render(xmlStream, model.negativeBorderColor);
19382            this.negativeFillColorXform.render(xmlStream, model.negativeFillColor);
19383            this.axisColorXform.render(xmlStream, model.axisColor);
19384            xmlStream.closeNode();
19385          }
19386        }, {
19387          key: "createNewModel",
19388          value: function createNewModel(_ref) {
19389            var attributes = _ref.attributes;
19390            return {
19391              cfvo: [],
19392              minLength: BaseXform.toIntValue(attributes.minLength, 0),
19393              maxLength: BaseXform.toIntValue(attributes.maxLength, 100),
19394              border: BaseXform.toBoolValue(attributes.border, false),
19395              gradient: BaseXform.toBoolValue(attributes.gradient, true),
19396              negativeBarColorSameAsPositive: BaseXform.toBoolValue(attributes.negativeBarColorSameAsPositive, true),
19397              negativeBarBorderColorSameAsPositive: BaseXform.toBoolValue(attributes.negativeBarBorderColorSameAsPositive, true),
19398              axisPosition: BaseXform.toStringValue(attributes.axisPosition, 'auto'),
19399              direction: BaseXform.toStringValue(attributes.direction, 'leftToRight')
19400            };
19401          }
19402        }, {
19403          key: "onParserClose",
19404          value: function onParserClose(name, parser) {
19405            var _name$split = name.split(':'),
19406                _name$split2 = _slicedToArray(_name$split, 2),
19407                prop = _name$split2[1];
19408
19409            switch (prop) {
19410              case 'cfvo':
19411                this.model.cfvo.push(parser.model);
19412                break;
19413
19414              default:
19415                this.model[prop] = parser.model;
19416                break;
19417            }
19418          }
19419        }, {
19420          key: "tag",
19421          get: function get() {
19422            return 'x14:dataBar';
19423          }
19424        }], [{
19425          key: "isExt",
19426          value: function isExt(rule) {
19427            // not all databars need ext
19428            // TODO: refine this
19429            return !rule.gradient;
19430          }
19431        }]);
19432
19433        return DatabarExtXform;
19434      }(CompositeXform);
19435
19436      module.exports = DatabarExtXform;
19437    }, {
19438      "../../base-xform": 29,
19439      "../../composite-xform": 45,
19440      "../../style/color-xform": 125,
19441      "./cfvo-ext-xform": 73
19442    }],
19443    77: [function (require, module, exports) {
19444      "use strict";
19445
19446      function _typeof(obj) {
19447        "@babel/helpers - typeof";
19448
19449        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
19450          _typeof = function _typeof(obj) {
19451            return typeof obj;
19452          };
19453        } else {
19454          _typeof = function _typeof(obj) {
19455            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
19456          };
19457        }
19458
19459        return _typeof(obj);
19460      }
19461
19462      function _classCallCheck(instance, Constructor) {
19463        if (!(instance instanceof Constructor)) {
19464          throw new TypeError("Cannot call a class as a function");
19465        }
19466      }
19467
19468      function _defineProperties(target, props) {
19469        for (var i = 0; i < props.length; i++) {
19470          var descriptor = props[i];
19471          descriptor.enumerable = descriptor.enumerable || false;
19472          descriptor.configurable = true;
19473          if ("value" in descriptor) descriptor.writable = true;
19474          Object.defineProperty(target, descriptor.key, descriptor);
19475        }
19476      }
19477
19478      function _createClass(Constructor, protoProps, staticProps) {
19479        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
19480        if (staticProps) _defineProperties(Constructor, staticProps);
19481        return Constructor;
19482      }
19483
19484      function _inherits(subClass, superClass) {
19485        if (typeof superClass !== "function" && superClass !== null) {
19486          throw new TypeError("Super expression must either be null or a function");
19487        }
19488
19489        subClass.prototype = Object.create(superClass && superClass.prototype, {
19490          constructor: {
19491            value: subClass,
19492            writable: true,
19493            configurable: true
19494          }
19495        });
19496        if (superClass) _setPrototypeOf(subClass, superClass);
19497      }
19498
19499      function _setPrototypeOf(o, p) {
19500        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
19501          o.__proto__ = p;
19502          return o;
19503        };
19504
19505        return _setPrototypeOf(o, p);
19506      }
19507
19508      function _createSuper(Derived) {
19509        return function () {
19510          var Super = _getPrototypeOf(Derived),
19511              result;
19512
19513          if (_isNativeReflectConstruct()) {
19514            var NewTarget = _getPrototypeOf(this).constructor;
19515
19516            result = Reflect.construct(Super, arguments, NewTarget);
19517          } else {
19518            result = Super.apply(this, arguments);
19519          }
19520
19521          return _possibleConstructorReturn(this, result);
19522        };
19523      }
19524
19525      function _possibleConstructorReturn(self, call) {
19526        if (call && (_typeof(call) === "object" || typeof call === "function")) {
19527          return call;
19528        }
19529
19530        return _assertThisInitialized(self);
19531      }
19532
19533      function _assertThisInitialized(self) {
19534        if (self === void 0) {
19535          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
19536        }
19537
19538        return self;
19539      }
19540
19541      function _isNativeReflectConstruct() {
19542        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
19543        if (Reflect.construct.sham) return false;
19544        if (typeof Proxy === "function") return true;
19545
19546        try {
19547          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
19548          return true;
19549        } catch (e) {
19550          return false;
19551        }
19552      }
19553
19554      function _getPrototypeOf(o) {
19555        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
19556          return o.__proto__ || Object.getPrototypeOf(o);
19557        };
19558        return _getPrototypeOf(o);
19559      }
19560
19561      var BaseXform = require('../../base-xform');
19562
19563      var FExtXform = /*#__PURE__*/function (_BaseXform) {
19564        _inherits(FExtXform, _BaseXform);
19565
19566        var _super = _createSuper(FExtXform);
19567
19568        function FExtXform() {
19569          _classCallCheck(this, FExtXform);
19570
19571          return _super.apply(this, arguments);
19572        }
19573
19574        _createClass(FExtXform, [{
19575          key: "render",
19576          value: function render(xmlStream, model) {
19577            xmlStream.leafNode(this.tag, null, model);
19578          }
19579        }, {
19580          key: "parseOpen",
19581          value: function parseOpen() {
19582            this.model = '';
19583          }
19584        }, {
19585          key: "parseText",
19586          value: function parseText(text) {
19587            this.model += text;
19588          }
19589        }, {
19590          key: "parseClose",
19591          value: function parseClose(name) {
19592            return name !== this.tag;
19593          }
19594        }, {
19595          key: "tag",
19596          get: function get() {
19597            return 'xm:f';
19598          }
19599        }]);
19600
19601        return FExtXform;
19602      }(BaseXform);
19603
19604      module.exports = FExtXform;
19605    }, {
19606      "../../base-xform": 29
19607    }],
19608    78: [function (require, module, exports) {
19609      "use strict";
19610
19611      function _typeof(obj) {
19612        "@babel/helpers - typeof";
19613
19614        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
19615          _typeof = function _typeof(obj) {
19616            return typeof obj;
19617          };
19618        } else {
19619          _typeof = function _typeof(obj) {
19620            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
19621          };
19622        }
19623
19624        return _typeof(obj);
19625      }
19626
19627      function _slicedToArray(arr, i) {
19628        return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
19629      }
19630
19631      function _nonIterableRest() {
19632        throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
19633      }
19634
19635      function _unsupportedIterableToArray(o, minLen) {
19636        if (!o) return;
19637        if (typeof o === "string") return _arrayLikeToArray(o, minLen);
19638        var n = Object.prototype.toString.call(o).slice(8, -1);
19639        if (n === "Object" && o.constructor) n = o.constructor.name;
19640        if (n === "Map" || n === "Set") return Array.from(n);
19641        if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
19642      }
19643
19644      function _arrayLikeToArray(arr, len) {
19645        if (len == null || len > arr.length) len = arr.length;
19646
19647        for (var i = 0, arr2 = new Array(len); i < len; i++) {
19648          arr2[i] = arr[i];
19649        }
19650
19651        return arr2;
19652      }
19653
19654      function _iterableToArrayLimit(arr, i) {
19655        if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
19656        var _arr = [];
19657        var _n = true;
19658        var _d = false;
19659        var _e = undefined;
19660
19661        try {
19662          for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
19663            _arr.push(_s.value);
19664
19665            if (i && _arr.length === i) break;
19666          }
19667        } catch (err) {
19668          _d = true;
19669          _e = err;
19670        } finally {
19671          try {
19672            if (!_n && _i["return"] != null) _i["return"]();
19673          } finally {
19674            if (_d) throw _e;
19675          }
19676        }
19677
19678        return _arr;
19679      }
19680
19681      function _arrayWithHoles(arr) {
19682        if (Array.isArray(arr)) return arr;
19683      }
19684
19685      function _classCallCheck(instance, Constructor) {
19686        if (!(instance instanceof Constructor)) {
19687          throw new TypeError("Cannot call a class as a function");
19688        }
19689      }
19690
19691      function _defineProperties(target, props) {
19692        for (var i = 0; i < props.length; i++) {
19693          var descriptor = props[i];
19694          descriptor.enumerable = descriptor.enumerable || false;
19695          descriptor.configurable = true;
19696          if ("value" in descriptor) descriptor.writable = true;
19697          Object.defineProperty(target, descriptor.key, descriptor);
19698        }
19699      }
19700
19701      function _createClass(Constructor, protoProps, staticProps) {
19702        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
19703        if (staticProps) _defineProperties(Constructor, staticProps);
19704        return Constructor;
19705      }
19706
19707      function _inherits(subClass, superClass) {
19708        if (typeof superClass !== "function" && superClass !== null) {
19709          throw new TypeError("Super expression must either be null or a function");
19710        }
19711
19712        subClass.prototype = Object.create(superClass && superClass.prototype, {
19713          constructor: {
19714            value: subClass,
19715            writable: true,
19716            configurable: true
19717          }
19718        });
19719        if (superClass) _setPrototypeOf(subClass, superClass);
19720      }
19721
19722      function _setPrototypeOf(o, p) {
19723        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
19724          o.__proto__ = p;
19725          return o;
19726        };
19727
19728        return _setPrototypeOf(o, p);
19729      }
19730
19731      function _createSuper(Derived) {
19732        return function () {
19733          var Super = _getPrototypeOf(Derived),
19734              result;
19735
19736          if (_isNativeReflectConstruct()) {
19737            var NewTarget = _getPrototypeOf(this).constructor;
19738
19739            result = Reflect.construct(Super, arguments, NewTarget);
19740          } else {
19741            result = Super.apply(this, arguments);
19742          }
19743
19744          return _possibleConstructorReturn(this, result);
19745        };
19746      }
19747
19748      function _possibleConstructorReturn(self, call) {
19749        if (call && (_typeof(call) === "object" || typeof call === "function")) {
19750          return call;
19751        }
19752
19753        return _assertThisInitialized(self);
19754      }
19755
19756      function _assertThisInitialized(self) {
19757        if (self === void 0) {
19758          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
19759        }
19760
19761        return self;
19762      }
19763
19764      function _isNativeReflectConstruct() {
19765        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
19766        if (Reflect.construct.sham) return false;
19767        if (typeof Proxy === "function") return true;
19768
19769        try {
19770          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
19771          return true;
19772        } catch (e) {
19773          return false;
19774        }
19775      }
19776
19777      function _getPrototypeOf(o) {
19778        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
19779          return o.__proto__ || Object.getPrototypeOf(o);
19780        };
19781        return _getPrototypeOf(o);
19782      }
19783
19784      var BaseXform = require('../../base-xform');
19785
19786      var CompositeXform = require('../../composite-xform');
19787
19788      var CfvoExtXform = require('./cfvo-ext-xform');
19789
19790      var CfIconExtXform = require('./cf-icon-ext-xform');
19791
19792      var IconSetExtXform = /*#__PURE__*/function (_CompositeXform) {
19793        _inherits(IconSetExtXform, _CompositeXform);
19794
19795        var _super = _createSuper(IconSetExtXform);
19796
19797        function IconSetExtXform() {
19798          var _this;
19799
19800          _classCallCheck(this, IconSetExtXform);
19801
19802          _this = _super.call(this);
19803          _this.map = {
19804            'x14:cfvo': _this.cfvoXform = new CfvoExtXform(),
19805            'x14:cfIcon': _this.cfIconXform = new CfIconExtXform()
19806          };
19807          return _this;
19808        }
19809
19810        _createClass(IconSetExtXform, [{
19811          key: "render",
19812          value: function render(xmlStream, model) {
19813            var _this2 = this;
19814
19815            xmlStream.openNode(this.tag, {
19816              iconSet: BaseXform.toStringAttribute(model.iconSet),
19817              reverse: BaseXform.toBoolAttribute(model.reverse, false),
19818              showValue: BaseXform.toBoolAttribute(model.showValue, true),
19819              custom: BaseXform.toBoolAttribute(model.icons, false)
19820            });
19821            model.cfvo.forEach(function (cfvo) {
19822              _this2.cfvoXform.render(xmlStream, cfvo);
19823            });
19824
19825            if (model.icons) {
19826              model.icons.forEach(function (icon, i) {
19827                icon.iconId = i;
19828
19829                _this2.cfIconXform.render(xmlStream, icon);
19830              });
19831            }
19832
19833            xmlStream.closeNode();
19834          }
19835        }, {
19836          key: "createNewModel",
19837          value: function createNewModel(_ref) {
19838            var attributes = _ref.attributes;
19839            return {
19840              cfvo: [],
19841              iconSet: BaseXform.toStringValue(attributes.iconSet, '3TrafficLights'),
19842              reverse: BaseXform.toBoolValue(attributes.reverse, false),
19843              showValue: BaseXform.toBoolValue(attributes.showValue, true)
19844            };
19845          }
19846        }, {
19847          key: "onParserClose",
19848          value: function onParserClose(name, parser) {
19849            var _name$split = name.split(':'),
19850                _name$split2 = _slicedToArray(_name$split, 2),
19851                prop = _name$split2[1];
19852
19853            switch (prop) {
19854              case 'cfvo':
19855                this.model.cfvo.push(parser.model);
19856                break;
19857
19858              case 'cfIcon':
19859                if (!this.model.icons) {
19860                  this.model.icons = [];
19861                }
19862
19863                this.model.icons.push(parser.model);
19864                break;
19865
19866              default:
19867                this.model[prop] = parser.model;
19868                break;
19869            }
19870          }
19871        }, {
19872          key: "tag",
19873          get: function get() {
19874            return 'x14:iconSet';
19875          }
19876        }]);
19877
19878        return IconSetExtXform;
19879      }(CompositeXform);
19880
19881      module.exports = IconSetExtXform;
19882    }, {
19883      "../../base-xform": 29,
19884      "../../composite-xform": 45,
19885      "./cf-icon-ext-xform": 71,
19886      "./cfvo-ext-xform": 73
19887    }],
19888    79: [function (require, module, exports) {
19889      "use strict";
19890
19891      function _typeof(obj) {
19892        "@babel/helpers - typeof";
19893
19894        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
19895          _typeof = function _typeof(obj) {
19896            return typeof obj;
19897          };
19898        } else {
19899          _typeof = function _typeof(obj) {
19900            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
19901          };
19902        }
19903
19904        return _typeof(obj);
19905      }
19906
19907      function _classCallCheck(instance, Constructor) {
19908        if (!(instance instanceof Constructor)) {
19909          throw new TypeError("Cannot call a class as a function");
19910        }
19911      }
19912
19913      function _defineProperties(target, props) {
19914        for (var i = 0; i < props.length; i++) {
19915          var descriptor = props[i];
19916          descriptor.enumerable = descriptor.enumerable || false;
19917          descriptor.configurable = true;
19918          if ("value" in descriptor) descriptor.writable = true;
19919          Object.defineProperty(target, descriptor.key, descriptor);
19920        }
19921      }
19922
19923      function _createClass(Constructor, protoProps, staticProps) {
19924        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
19925        if (staticProps) _defineProperties(Constructor, staticProps);
19926        return Constructor;
19927      }
19928
19929      function _inherits(subClass, superClass) {
19930        if (typeof superClass !== "function" && superClass !== null) {
19931          throw new TypeError("Super expression must either be null or a function");
19932        }
19933
19934        subClass.prototype = Object.create(superClass && superClass.prototype, {
19935          constructor: {
19936            value: subClass,
19937            writable: true,
19938            configurable: true
19939          }
19940        });
19941        if (superClass) _setPrototypeOf(subClass, superClass);
19942      }
19943
19944      function _setPrototypeOf(o, p) {
19945        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
19946          o.__proto__ = p;
19947          return o;
19948        };
19949
19950        return _setPrototypeOf(o, p);
19951      }
19952
19953      function _createSuper(Derived) {
19954        return function () {
19955          var Super = _getPrototypeOf(Derived),
19956              result;
19957
19958          if (_isNativeReflectConstruct()) {
19959            var NewTarget = _getPrototypeOf(this).constructor;
19960
19961            result = Reflect.construct(Super, arguments, NewTarget);
19962          } else {
19963            result = Super.apply(this, arguments);
19964          }
19965
19966          return _possibleConstructorReturn(this, result);
19967        };
19968      }
19969
19970      function _possibleConstructorReturn(self, call) {
19971        if (call && (_typeof(call) === "object" || typeof call === "function")) {
19972          return call;
19973        }
19974
19975        return _assertThisInitialized(self);
19976      }
19977
19978      function _assertThisInitialized(self) {
19979        if (self === void 0) {
19980          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
19981        }
19982
19983        return self;
19984      }
19985
19986      function _isNativeReflectConstruct() {
19987        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
19988        if (Reflect.construct.sham) return false;
19989        if (typeof Proxy === "function") return true;
19990
19991        try {
19992          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
19993          return true;
19994        } catch (e) {
19995          return false;
19996        }
19997      }
19998
19999      function _getPrototypeOf(o) {
20000        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
20001          return o.__proto__ || Object.getPrototypeOf(o);
20002        };
20003        return _getPrototypeOf(o);
20004      }
20005
20006      var BaseXform = require('../../base-xform');
20007
20008      var SqrefExtXform = /*#__PURE__*/function (_BaseXform) {
20009        _inherits(SqrefExtXform, _BaseXform);
20010
20011        var _super = _createSuper(SqrefExtXform);
20012
20013        function SqrefExtXform() {
20014          _classCallCheck(this, SqrefExtXform);
20015
20016          return _super.apply(this, arguments);
20017        }
20018
20019        _createClass(SqrefExtXform, [{
20020          key: "render",
20021          value: function render(xmlStream, model) {
20022            xmlStream.leafNode(this.tag, null, model);
20023          }
20024        }, {
20025          key: "parseOpen",
20026          value: function parseOpen() {
20027            this.model = '';
20028          }
20029        }, {
20030          key: "parseText",
20031          value: function parseText(text) {
20032            this.model += text;
20033          }
20034        }, {
20035          key: "parseClose",
20036          value: function parseClose(name) {
20037            return name !== this.tag;
20038          }
20039        }, {
20040          key: "tag",
20041          get: function get() {
20042            return 'xm:sqref';
20043          }
20044        }]);
20045
20046        return SqrefExtXform;
20047      }(BaseXform);
20048
20049      module.exports = SqrefExtXform;
20050    }, {
20051      "../../base-xform": 29
20052    }],
20053    80: [function (require, module, exports) {
20054      "use strict";
20055
20056      function _typeof(obj) {
20057        "@babel/helpers - typeof";
20058
20059        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
20060          _typeof = function _typeof(obj) {
20061            return typeof obj;
20062          };
20063        } else {
20064          _typeof = function _typeof(obj) {
20065            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
20066          };
20067        }
20068
20069        return _typeof(obj);
20070      }
20071
20072      function ownKeys(object, enumerableOnly) {
20073        var keys = Object.keys(object);
20074
20075        if (Object.getOwnPropertySymbols) {
20076          var symbols = Object.getOwnPropertySymbols(object);
20077          if (enumerableOnly) symbols = symbols.filter(function (sym) {
20078            return Object.getOwnPropertyDescriptor(object, sym).enumerable;
20079          });
20080          keys.push.apply(keys, symbols);
20081        }
20082
20083        return keys;
20084      }
20085
20086      function _objectSpread(target) {
20087        for (var i = 1; i < arguments.length; i++) {
20088          var source = arguments[i] != null ? arguments[i] : {};
20089
20090          if (i % 2) {
20091            ownKeys(Object(source), true).forEach(function (key) {
20092              _defineProperty(target, key, source[key]);
20093            });
20094          } else if (Object.getOwnPropertyDescriptors) {
20095            Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
20096          } else {
20097            ownKeys(Object(source)).forEach(function (key) {
20098              Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
20099            });
20100          }
20101        }
20102
20103        return target;
20104      }
20105
20106      function _defineProperty(obj, key, value) {
20107        if (key in obj) {
20108          Object.defineProperty(obj, key, {
20109            value: value,
20110            enumerable: true,
20111            configurable: true,
20112            writable: true
20113          });
20114        } else {
20115          obj[key] = value;
20116        }
20117
20118        return obj;
20119      }
20120
20121      function _classCallCheck(instance, Constructor) {
20122        if (!(instance instanceof Constructor)) {
20123          throw new TypeError("Cannot call a class as a function");
20124        }
20125      }
20126
20127      function _defineProperties(target, props) {
20128        for (var i = 0; i < props.length; i++) {
20129          var descriptor = props[i];
20130          descriptor.enumerable = descriptor.enumerable || false;
20131          descriptor.configurable = true;
20132          if ("value" in descriptor) descriptor.writable = true;
20133          Object.defineProperty(target, descriptor.key, descriptor);
20134        }
20135      }
20136
20137      function _createClass(Constructor, protoProps, staticProps) {
20138        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
20139        if (staticProps) _defineProperties(Constructor, staticProps);
20140        return Constructor;
20141      }
20142
20143      function _inherits(subClass, superClass) {
20144        if (typeof superClass !== "function" && superClass !== null) {
20145          throw new TypeError("Super expression must either be null or a function");
20146        }
20147
20148        subClass.prototype = Object.create(superClass && superClass.prototype, {
20149          constructor: {
20150            value: subClass,
20151            writable: true,
20152            configurable: true
20153          }
20154        });
20155        if (superClass) _setPrototypeOf(subClass, superClass);
20156      }
20157
20158      function _setPrototypeOf(o, p) {
20159        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
20160          o.__proto__ = p;
20161          return o;
20162        };
20163
20164        return _setPrototypeOf(o, p);
20165      }
20166
20167      function _createSuper(Derived) {
20168        return function () {
20169          var Super = _getPrototypeOf(Derived),
20170              result;
20171
20172          if (_isNativeReflectConstruct()) {
20173            var NewTarget = _getPrototypeOf(this).constructor;
20174
20175            result = Reflect.construct(Super, arguments, NewTarget);
20176          } else {
20177            result = Super.apply(this, arguments);
20178          }
20179
20180          return _possibleConstructorReturn(this, result);
20181        };
20182      }
20183
20184      function _possibleConstructorReturn(self, call) {
20185        if (call && (_typeof(call) === "object" || typeof call === "function")) {
20186          return call;
20187        }
20188
20189        return _assertThisInitialized(self);
20190      }
20191
20192      function _assertThisInitialized(self) {
20193        if (self === void 0) {
20194          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
20195        }
20196
20197        return self;
20198      }
20199
20200      function _isNativeReflectConstruct() {
20201        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
20202        if (Reflect.construct.sham) return false;
20203        if (typeof Proxy === "function") return true;
20204
20205        try {
20206          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
20207          return true;
20208        } catch (e) {
20209          return false;
20210        }
20211      }
20212
20213      function _getPrototypeOf(o) {
20214        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
20215          return o.__proto__ || Object.getPrototypeOf(o);
20216        };
20217        return _getPrototypeOf(o);
20218      }
20219
20220      var BaseXform = require('../../base-xform');
20221
20222      var CompositeXform = require('../../composite-xform');
20223
20224      var Range = require('../../../../doc/range');
20225
20226      var DatabarXform = require('./databar-xform');
20227
20228      var ExtLstRefXform = require('./ext-lst-ref-xform');
20229
20230      var FormulaXform = require('./formula-xform');
20231
20232      var ColorScaleXform = require('./color-scale-xform');
20233
20234      var IconSetXform = require('./icon-set-xform');
20235
20236      var extIcons = {
20237        '3Triangles': true,
20238        '3Stars': true,
20239        '5Boxes': true
20240      };
20241
20242      var getTextFormula = function getTextFormula(model) {
20243        if (model.formulae && model.formulae[0]) {
20244          return model.formulae[0];
20245        }
20246
20247        var range = new Range(model.ref);
20248        var tl = range.tl;
20249
20250        switch (model.operator) {
20251          case 'containsText':
20252            return "NOT(ISERROR(SEARCH(\"".concat(model.text, "\",").concat(tl, ")))");
20253
20254          case 'containsBlanks':
20255            return "LEN(TRIM(".concat(tl, "))=0");
20256
20257          case 'notContainsBlanks':
20258            return "LEN(TRIM(".concat(tl, "))>0");
20259
20260          case 'containsErrors':
20261            return "ISERROR(".concat(tl, ")");
20262
20263          case 'notContainsErrors':
20264            return "NOT(ISERROR(".concat(tl, "))");
20265
20266          default:
20267            return undefined;
20268        }
20269      };
20270
20271      var getTimePeriodFormula = function getTimePeriodFormula(model) {
20272        if (model.formulae && model.formulae[0]) {
20273          return model.formulae[0];
20274        }
20275
20276        var range = new Range(model.ref);
20277        var tl = range.tl;
20278
20279        switch (model.timePeriod) {
20280          case 'thisWeek':
20281            return "AND(TODAY()-ROUNDDOWN(".concat(tl, ",0)<=WEEKDAY(TODAY())-1,ROUNDDOWN(").concat(tl, ",0)-TODAY()<=7-WEEKDAY(TODAY()))");
20282
20283          case 'lastWeek':
20284            return "AND(TODAY()-ROUNDDOWN(".concat(tl, ",0)>=(WEEKDAY(TODAY())),TODAY()-ROUNDDOWN(").concat(tl, ",0)<(WEEKDAY(TODAY())+7))");
20285
20286          case 'nextWeek':
20287            return "AND(ROUNDDOWN(".concat(tl, ",0)-TODAY()>(7-WEEKDAY(TODAY())),ROUNDDOWN(").concat(tl, ",0)-TODAY()<(15-WEEKDAY(TODAY())))");
20288
20289          case 'yesterday':
20290            return "FLOOR(".concat(tl, ",1)=TODAY()-1");
20291
20292          case 'today':
20293            return "FLOOR(".concat(tl, ",1)=TODAY()");
20294
20295          case 'tomorrow':
20296            return "FLOOR(".concat(tl, ",1)=TODAY()+1");
20297
20298          case 'last7Days':
20299            return "AND(TODAY()-FLOOR(".concat(tl, ",1)<=6,FLOOR(").concat(tl, ",1)<=TODAY())");
20300
20301          case 'lastMonth':
20302            return "AND(MONTH(".concat(tl, ")=MONTH(EDATE(TODAY(),0-1)),YEAR(").concat(tl, ")=YEAR(EDATE(TODAY(),0-1)))");
20303
20304          case 'thisMonth':
20305            return "AND(MONTH(".concat(tl, ")=MONTH(TODAY()),YEAR(").concat(tl, ")=YEAR(TODAY()))");
20306
20307          case 'nextMonth':
20308            return "AND(MONTH(".concat(tl, ")=MONTH(EDATE(TODAY(),0+1)),YEAR(").concat(tl, ")=YEAR(EDATE(TODAY(),0+1)))");
20309
20310          default:
20311            return undefined;
20312        }
20313      };
20314
20315      var opType = function opType(attributes) {
20316        var type = attributes.type,
20317            operator = attributes.operator;
20318
20319        switch (type) {
20320          case 'containsText':
20321          case 'containsBlanks':
20322          case 'notContainsBlanks':
20323          case 'containsErrors':
20324          case 'notContainsErrors':
20325            return {
20326              type: 'containsText',
20327              operator: type
20328            };
20329
20330          default:
20331            return {
20332              type: type,
20333              operator: operator
20334            };
20335        }
20336      };
20337
20338      var CfRuleXform = /*#__PURE__*/function (_CompositeXform) {
20339        _inherits(CfRuleXform, _CompositeXform);
20340
20341        var _super = _createSuper(CfRuleXform);
20342
20343        function CfRuleXform() {
20344          var _this;
20345
20346          _classCallCheck(this, CfRuleXform);
20347
20348          _this = _super.call(this);
20349          _this.map = {
20350            dataBar: _this.databarXform = new DatabarXform(),
20351            extLst: _this.extLstRefXform = new ExtLstRefXform(),
20352            formula: _this.formulaXform = new FormulaXform(),
20353            colorScale: _this.colorScaleXform = new ColorScaleXform(),
20354            iconSet: _this.iconSetXform = new IconSetXform()
20355          };
20356          return _this;
20357        }
20358
20359        _createClass(CfRuleXform, [{
20360          key: "render",
20361          value: function render(xmlStream, model) {
20362            switch (model.type) {
20363              case 'expression':
20364                this.renderExpression(xmlStream, model);
20365                break;
20366
20367              case 'cellIs':
20368                this.renderCellIs(xmlStream, model);
20369                break;
20370
20371              case 'top10':
20372                this.renderTop10(xmlStream, model);
20373                break;
20374
20375              case 'aboveAverage':
20376                this.renderAboveAverage(xmlStream, model);
20377                break;
20378
20379              case 'dataBar':
20380                this.renderDataBar(xmlStream, model);
20381                break;
20382
20383              case 'colorScale':
20384                this.renderColorScale(xmlStream, model);
20385                break;
20386
20387              case 'iconSet':
20388                this.renderIconSet(xmlStream, model);
20389                break;
20390
20391              case 'containsText':
20392                this.renderText(xmlStream, model);
20393                break;
20394
20395              case 'timePeriod':
20396                this.renderTimePeriod(xmlStream, model);
20397                break;
20398            }
20399          }
20400        }, {
20401          key: "renderExpression",
20402          value: function renderExpression(xmlStream, model) {
20403            xmlStream.openNode(this.tag, {
20404              type: 'expression',
20405              dxfId: model.dxfId,
20406              priority: model.priority
20407            });
20408            this.formulaXform.render(xmlStream, model.formulae[0]);
20409            xmlStream.closeNode();
20410          }
20411        }, {
20412          key: "renderCellIs",
20413          value: function renderCellIs(xmlStream, model) {
20414            var _this2 = this;
20415
20416            xmlStream.openNode(this.tag, {
20417              type: 'cellIs',
20418              dxfId: model.dxfId,
20419              priority: model.priority,
20420              operator: model.operator
vendor: 4,451 bytes, lines 20421-20545
20421            });
20422            model.formulae.forEach(function (formula) {
20423              _this2.formulaXform.render(xmlStream, formula);
20424            });
20425            xmlStream.closeNode();
20426          }
20427        }, {
20428          key: "renderTop10",
20429          value: function renderTop10(xmlStream, model) {
20430            xmlStream.leafNode(this.tag, {
20431              type: 'top10',
20432              dxfId: model.dxfId,
20433              priority: model.priority,
20434              percent: BaseXform.toBoolAttribute(model.percent, false),
20435              bottom: BaseXform.toBoolAttribute(model.bottom, false),
20436              rank: BaseXform.toIntValue(model.rank, 10, true)
20437            });
20438          }
20439        }, {
20440          key: "renderAboveAverage",
20441          value: function renderAboveAverage(xmlStream, model) {
20442            xmlStream.leafNode(this.tag, {
20443              type: 'aboveAverage',
20444              dxfId: model.dxfId,
20445              priority: model.priority,
20446              aboveAverage: BaseXform.toBoolAttribute(model.aboveAverage, true)
20447            });
20448          }
20449        }, {
20450          key: "renderDataBar",
20451          value: function renderDataBar(xmlStream, model) {
20452            xmlStream.openNode(this.tag, {
20453              type: 'dataBar',
20454              priority: model.priority
20455            });
20456            this.databarXform.render(xmlStream, model);
20457            this.extLstRefXform.render(xmlStream, model);
20458            xmlStream.closeNode();
20459          }
20460        }, {
20461          key: "renderColorScale",
20462          value: function renderColorScale(xmlStream, model) {
20463            xmlStream.openNode(this.tag, {
20464              type: 'colorScale',
20465              priority: model.priority
20466            });
20467            this.colorScaleXform.render(xmlStream, model);
20468            xmlStream.closeNode();
20469          }
20470        }, {
20471          key: "renderIconSet",
20472          value: function renderIconSet(xmlStream, model) {
20473            // iconset is all primitive or all extLst
20474            if (!CfRuleXform.isPrimitive(model)) {
20475              return;
20476            }
20477
20478            xmlStream.openNode(this.tag, {
20479              type: 'iconSet',
20480              priority: model.priority
20481            });
20482            this.iconSetXform.render(xmlStream, model);
20483            xmlStream.closeNode();
20484          }
20485        }, {
20486          key: "renderText",
20487          value: function renderText(xmlStream, model) {
20488            xmlStream.openNode(this.tag, {
20489              type: model.operator,
20490              dxfId: model.dxfId,
20491              priority: model.priority,
20492              operator: BaseXform.toStringAttribute(model.operator, 'containsText')
20493            });
20494            var formula = getTextFormula(model);
20495
20496            if (formula) {
20497              this.formulaXform.render(xmlStream, formula);
20498            }
20499
20500            xmlStream.closeNode();
20501          }
20502        }, {
20503          key: "renderTimePeriod",
20504          value: function renderTimePeriod(xmlStream, model) {
20505            xmlStream.openNode(this.tag, {
20506              type: 'timePeriod',
20507              dxfId: model.dxfId,
20508              priority: model.priority,
20509              timePeriod: model.timePeriod
20510            });
20511            var formula = getTimePeriodFormula(model);
20512
20513            if (formula) {
20514              this.formulaXform.render(xmlStream, formula);
20515            }
20516
20517            xmlStream.closeNode();
20518          }
20519        }, {
20520          key: "createNewModel",
20521          value: function createNewModel(_ref) {
20522            var attributes = _ref.attributes;
20523            return _objectSpread(_objectSpread({}, opType(attributes)), {}, {
20524              dxfId: BaseXform.toIntValue(attributes.dxfId),
20525              priority: BaseXform.toIntValue(attributes.priority),
20526              timePeriod: attributes.timePeriod,
20527              percent: BaseXform.toBoolValue(attributes.percent),
20528              bottom: BaseXform.toBoolValue(attributes.bottom),
20529              rank: BaseXform.toIntValue(attributes.rank),
20530              aboveAverage: BaseXform.toBoolValue(attributes.aboveAverage)
20531            });
20532          }
20533        }, {
20534          key: "onParserClose",
20535          value: function onParserClose(name, parser) {
20536            switch (name) {
20537              case 'dataBar':
20538              case 'extLst':
20539              case 'colorScale':
20540              case 'iconSet':
20541                // merge parser model with ours
20542                Object.assign(this.model, parser.model);
20543                break;
20544
20545              case 'formula':
20546                // except - formula is a string and appends to formulae
20547                this.model.formulae = this.model.formulae || [];
20548                this.model.formulae.push(parser.model);
20549                break;
20550            }
20551          }
20552        }, {
20553          key: "tag",
20554          get: function get() {
20555            return 'cfRule';
20556          }
20557        }], [{
20558          key: "isPrimitive",
20559          value: function isPrimitive(rule) {
20560            // is this rule primitive?
20561            if (rule.type === 'iconSet') {
20562              if (rule.custom || extIcons[rule.iconSet]) {
20563                return false;
20564              }
20565            }
20566
20567            return true;
20568          }
20569        }]);
20570
20571        return CfRuleXform;
20572      }(CompositeXform);
20573
20574      module.exports = CfRuleXform;
20575    }, {
20576      "../../../../doc/range": 10,
20577      "../../base-xform": 29,
20578      "../../composite-xform": 45,
20579      "./color-scale-xform": 82,
20580      "./databar-xform": 85,
20581      "./ext-lst-ref-xform": 86,
20582      "./formula-xform": 87,
20583      "./icon-set-xform": 88
20584    }],
20585    81: [function (require, module, exports) {
20586      "use strict";
20587
20588      function _typeof(obj) {
20589        "@babel/helpers - typeof";
20590
20591        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
20592          _typeof = function _typeof(obj) {
20593            return typeof obj;
20594          };
20595        } else {
20596          _typeof = function _typeof(obj) {
20597            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
20598          };
20599        }
20600
20601        return _typeof(obj);
20602      }
20603
20604      function _classCallCheck(instance, Constructor) {
20605        if (!(instance instanceof Constructor)) {
20606          throw new TypeError("Cannot call a class as a function");
20607        }
20608      }
20609
20610      function _defineProperties(target, props) {
20611        for (var i = 0; i < props.length; i++) {
20612          var descriptor = props[i];
20613          descriptor.enumerable = descriptor.enumerable || false;
20614          descriptor.configurable = true;
20615          if ("value" in descriptor) descriptor.writable = true;
20616          Object.defineProperty(target, descriptor.key, descriptor);
20617        }
20618      }
20619
20620      function _createClass(Constructor, protoProps, staticProps) {
20621        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
20622        if (staticProps) _defineProperties(Constructor, staticProps);
20623        return Constructor;
20624      }
20625
20626      function _inherits(subClass, superClass) {
20627        if (typeof superClass !== "function" && superClass !== null) {
20628          throw new TypeError("Super expression must either be null or a function");
20629        }
20630
20631        subClass.prototype = Object.create(superClass && superClass.prototype, {
20632          constructor: {
20633            value: subClass,
20634            writable: true,
20635            configurable: true
20636          }
20637        });
20638        if (superClass) _setPrototypeOf(subClass, superClass);
20639      }
20640
20641      function _setPrototypeOf(o, p) {
20642        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
20643          o.__proto__ = p;
20644          return o;
20645        };
20646
20647        return _setPrototypeOf(o, p);
20648      }
20649
20650      function _createSuper(Derived) {
20651        return function () {
20652          var Super = _getPrototypeOf(Derived),
20653              result;
20654
20655          if (_isNativeReflectConstruct()) {
20656            var NewTarget = _getPrototypeOf(this).constructor;
20657
20658            result = Reflect.construct(Super, arguments, NewTarget);
20659          } else {
20660            result = Super.apply(this, arguments);
20661          }
20662
20663          return _possibleConstructorReturn(this, result);
20664        };
20665      }
20666
20667      function _possibleConstructorReturn(self, call) {
20668        if (call && (_typeof(call) === "object" || typeof call === "function")) {
20669          return call;
20670        }
20671
20672        return _assertThisInitialized(self);
20673      }
20674
20675      function _assertThisInitialized(self) {
20676        if (self === void 0) {
20677          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
20678        }
20679
20680        return self;
20681      }
20682
20683      function _isNativeReflectConstruct() {
20684        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
20685        if (Reflect.construct.sham) return false;
20686        if (typeof Proxy === "function") return true;
20687
20688        try {
20689          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
20690          return true;
20691        } catch (e) {
20692          return false;
20693        }
20694      }
20695
20696      function _getPrototypeOf(o) {
20697        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
20698          return o.__proto__ || Object.getPrototypeOf(o);
20699        };
20700        return _getPrototypeOf(o);
20701      }
20702
20703      var BaseXform = require('../../base-xform');
20704
20705      var CfvoXform = /*#__PURE__*/function (_BaseXform) {
20706        _inherits(CfvoXform, _BaseXform);
20707
20708        var _super = _createSuper(CfvoXform);
20709
20710        function CfvoXform() {
20711          _classCallCheck(this, CfvoXform);
20712
20713          return _super.apply(this, arguments);
20714        }
20715
20716        _createClass(CfvoXform, [{
20717          key: "render",
20718          value: function render(xmlStream, model) {
20719            xmlStream.leafNode(this.tag, {
20720              type: model.type,
20721              val: model.value
20722            });
20723          }
20724        }, {
20725          key: "parseOpen",
20726          value: function parseOpen(node) {
20727            this.model = {
20728              type: node.attributes.type,
20729              value: BaseXform.toFloatValue(node.attributes.val)
20730            };
20731          }
20732        }, {
20733          key: "parseClose",
20734          value: function parseClose(name) {
20735            return name !== this.tag;
20736          }
20737        }, {
20738          key: "tag",
20739          get: function get() {
20740            return 'cfvo';
20741          }
20742        }]);
20743
20744        return CfvoXform;
20745      }(BaseXform);
20746
20747      module.exports = CfvoXform;
20748    }, {
20749      "../../base-xform": 29
20750    }],
20751    82: [function (require, module, exports) {
20752      "use strict";
20753
20754      function _typeof(obj) {
20755        "@babel/helpers - typeof";
20756
20757        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
20758          _typeof = function _typeof(obj) {
20759            return typeof obj;
20760          };
20761        } else {
20762          _typeof = function _typeof(obj) {
20763            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
20764          };
20765        }
20766
20767        return _typeof(obj);
20768      }
20769
20770      function _classCallCheck(instance, Constructor) {
20771        if (!(instance instanceof Constructor)) {
20772          throw new TypeError("Cannot call a class as a function");
20773        }
20774      }
20775
20776      function _defineProperties(target, props) {
20777        for (var i = 0; i < props.length; i++) {
20778          var descriptor = props[i];
20779          descriptor.enumerable = descriptor.enumerable || false;
20780          descriptor.configurable = true;
20781          if ("value" in descriptor) descriptor.writable = true;
20782          Object.defineProperty(target, descriptor.key, descriptor);
20783        }
20784      }
20785
20786      function _createClass(Constructor, protoProps, staticProps) {
20787        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
20788        if (staticProps) _defineProperties(Constructor, staticProps);
20789        return Constructor;
20790      }
20791
20792      function _inherits(subClass, superClass) {
20793        if (typeof superClass !== "function" && superClass !== null) {
20794          throw new TypeError("Super expression must either be null or a function");
20795        }
20796
20797        subClass.prototype = Object.create(superClass && superClass.prototype, {
20798          constructor: {
20799            value: subClass,
20800            writable: true,
20801            configurable: true
20802          }
20803        });
20804        if (superClass) _setPrototypeOf(subClass, superClass);
20805      }
20806
20807      function _setPrototypeOf(o, p) {
20808        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
20809          o.__proto__ = p;
20810          return o;
20811        };
20812
20813        return _setPrototypeOf(o, p);
20814      }
20815
20816      function _createSuper(Derived) {
20817        return function () {
20818          var Super = _getPrototypeOf(Derived),
20819              result;
20820
20821          if (_isNativeReflectConstruct()) {
20822            var NewTarget = _getPrototypeOf(this).constructor;
20823
20824            result = Reflect.construct(Super, arguments, NewTarget);
20825          } else {
20826            result = Super.apply(this, arguments);
20827          }
20828
20829          return _possibleConstructorReturn(this, result);
20830        };
20831      }
20832
20833      function _possibleConstructorReturn(self, call) {
20834        if (call && (_typeof(call) === "object" || typeof call === "function")) {
20835          return call;
20836        }
20837
20838        return _assertThisInitialized(self);
20839      }
20840
20841      function _assertThisInitialized(self) {
20842        if (self === void 0) {
20843          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
20844        }
20845
20846        return self;
20847      }
20848
20849      function _isNativeReflectConstruct() {
20850        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
20851        if (Reflect.construct.sham) return false;
20852        if (typeof Proxy === "function") return true;
20853
20854        try {
20855          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
20856          return true;
20857        } catch (e) {
20858          return false;
20859        }
20860      }
20861
20862      function _getPrototypeOf(o) {
20863        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
20864          return o.__proto__ || Object.getPrototypeOf(o);
20865        };
20866        return _getPrototypeOf(o);
20867      }
20868
20869      var CompositeXform = require('../../composite-xform');
20870
20871      var ColorXform = require('../../style/color-xform');
20872
20873      var CfvoXform = require('./cfvo-xform');
20874
20875      var ColorScaleXform = /*#__PURE__*/function (_CompositeXform) {
20876        _inherits(ColorScaleXform, _CompositeXform);
20877
20878        var _super = _createSuper(ColorScaleXform);
20879
20880        function ColorScaleXform() {
20881          var _this;
20882
20883          _classCallCheck(this, ColorScaleXform);
20884
20885          _this = _super.call(this);
20886          _this.map = {
20887            cfvo: _this.cfvoXform = new CfvoXform(),
20888            color: _this.colorXform = new ColorXform()
20889          };
20890          return _this;
20891        }
20892
20893        _createClass(ColorScaleXform, [{
20894          key: "render",
20895          value: function render(xmlStream, model) {
20896            var _this2 = this;
20897
20898            xmlStream.openNode(this.tag);
20899            model.cfvo.forEach(function (cfvo) {
20900              _this2.cfvoXform.render(xmlStream, cfvo);
20901            });
20902            model.color.forEach(function (color) {
20903              _this2.colorXform.render(xmlStream, color);
20904            });
20905            xmlStream.closeNode();
20906          }
20907        }, {
20908          key: "createNewModel",
20909          value: function createNewModel(node) {
20910            return {
20911              cfvo: [],
20912              color: []
20913            };
20914          }
20915        }, {
20916          key: "onParserClose",
20917          value: function onParserClose(name, parser) {
20918            this.model[name].push(parser.model);
20919          }
20920        }, {
20921          key: "tag",
20922          get: function get() {
20923            return 'colorScale';
20924          }
20925        }]);
20926
20927        return ColorScaleXform;
20928      }(CompositeXform);
20929
20930      module.exports = ColorScaleXform;
20931    }, {
20932      "../../composite-xform": 45,
20933      "../../style/color-xform": 125,
20934      "./cfvo-xform": 81
20935    }],
20936    83: [function (require, module, exports) {
20937      "use strict";
20938
20939      function _typeof(obj) {
20940        "@babel/helpers - typeof";
20941
20942        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
20943          _typeof = function _typeof(obj) {
20944            return typeof obj;
20945          };
20946        } else {
20947          _typeof = function _typeof(obj) {
20948            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
20949          };
20950        }
20951
20952        return _typeof(obj);
20953      }
20954
20955      function _classCallCheck(instance, Constructor) {
20956        if (!(instance instanceof Constructor)) {
20957          throw new TypeError("Cannot call a class as a function");
20958        }
20959      }
20960
20961      function _defineProperties(target, props) {
20962        for (var i = 0; i < props.length; i++) {
20963          var descriptor = props[i];
20964          descriptor.enumerable = descriptor.enumerable || false;
20965          descriptor.configurable = true;
20966          if ("value" in descriptor) descriptor.writable = true;
20967          Object.defineProperty(target, descriptor.key, descriptor);
20968        }
20969      }
20970
20971      function _createClass(Constructor, protoProps, staticProps) {
20972        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
20973        if (staticProps) _defineProperties(Constructor, staticProps);
20974        return Constructor;
20975      }
20976
20977      function _inherits(subClass, superClass) {
20978        if (typeof superClass !== "function" && superClass !== null) {
20979          throw new TypeError("Super expression must either be null or a function");
20980        }
20981
20982        subClass.prototype = Object.create(superClass && superClass.prototype, {
20983          constructor: {
20984            value: subClass,
20985            writable: true,
20986            configurable: true
20987          }
20988        });
20989        if (superClass) _setPrototypeOf(subClass, superClass);
20990      }
20991
20992      function _setPrototypeOf(o, p) {
20993        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
20994          o.__proto__ = p;
20995          return o;
20996        };
20997
20998        return _setPrototypeOf(o, p);
20999      }
21000
21001      function _createSuper(Derived) {
21002        return function () {
21003          var Super = _getPrototypeOf(Derived),
21004              result;
21005
21006          if (_isNativeReflectConstruct()) {
21007            var NewTarget = _getPrototypeOf(this).constructor;
21008
21009            result = Reflect.construct(Super, arguments, NewTarget);
21010          } else {
21011            result = Super.apply(this, arguments);
21012          }
21013
21014          return _possibleConstructorReturn(this, result);
21015        };
21016      }
21017
21018      function _possibleConstructorReturn(self, call) {
21019        if (call && (_typeof(call) === "object" || typeof call === "function")) {
21020          return call;
21021        }
21022
21023        return _assertThisInitialized(self);
21024      }
21025
21026      function _assertThisInitialized(self) {
21027        if (self === void 0) {
21028          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
21029        }
21030
21031        return self;
21032      }
21033
21034      function _isNativeReflectConstruct() {
21035        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
21036        if (Reflect.construct.sham) return false;
21037        if (typeof Proxy === "function") return true;
21038
21039        try {
21040          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
21041          return true;
21042        } catch (e) {
21043          return false;
21044        }
21045      }
21046
21047      function _getPrototypeOf(o) {
21048        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
21049          return o.__proto__ || Object.getPrototypeOf(o);
21050        };
21051        return _getPrototypeOf(o);
21052      }
21053
21054      var CompositeXform = require('../../composite-xform');
21055
21056      var CfRuleXform = require('./cf-rule-xform');
21057
21058      var ConditionalFormattingXform = /*#__PURE__*/function (_CompositeXform) {
21059        _inherits(ConditionalFormattingXform, _CompositeXform);
21060
21061        var _super = _createSuper(ConditionalFormattingXform);
21062
21063        function ConditionalFormattingXform() {
21064          var _this;
21065
21066          _classCallCheck(this, ConditionalFormattingXform);
21067
21068          _this = _super.call(this);
21069          _this.map = {
21070            cfRule: new CfRuleXform()
21071          };
21072          return _this;
21073        }
21074
21075        _createClass(ConditionalFormattingXform, [{
21076          key: "render",
21077          value: function render(xmlStream, model) {
21078            var _this2 = this; // if there are no primitive rules, exit now
21079
21080
21081            if (!model.rules.some(CfRuleXform.isPrimitive)) {
21082              return;
21083            }
21084
21085            xmlStream.openNode(this.tag, {
21086              sqref: model.ref
21087            });
21088            model.rules.forEach(function (rule) {
21089              if (CfRuleXform.isPrimitive(rule)) {
21090                rule.ref = model.ref;
21091
21092                _this2.map.cfRule.render(xmlStream, rule);
21093              }
21094            });
21095            xmlStream.closeNode();
21096          }
21097        }, {
21098          key: "createNewModel",
21099          value: function createNewModel(_ref) {
21100            var attributes = _ref.attributes;
21101            return {
21102              ref: attributes.sqref,
21103              rules: []
21104            };
21105          }
21106        }, {
21107          key: "onParserClose",
21108          value: function onParserClose(name, parser) {
21109            this.model.rules.push(parser.model);
21110          }
21111        }, {
21112          key: "tag",
21113          get: function get() {
21114            return 'conditionalFormatting';
21115          }
21116        }]);
21117
21118        return ConditionalFormattingXform;
21119      }(CompositeXform);
21120
21121      module.exports = ConditionalFormattingXform;
21122    }, {
21123      "../../composite-xform": 45,
21124      "./cf-rule-xform": 80
21125    }],
21126    84: [function (require, module, exports) {
21127      "use strict";
21128
21129      function _typeof(obj) {
21130        "@babel/helpers - typeof";
21131
21132        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
21133          _typeof = function _typeof(obj) {
21134            return typeof obj;
21135          };
21136        } else {
21137          _typeof = function _typeof(obj) {
21138            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
21139          };
21140        }
21141
21142        return _typeof(obj);
21143      }
21144
21145      function _toConsumableArray(arr) {
21146        return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
21147      }
21148
21149      function _nonIterableSpread() {
21150        throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
21151      }
21152
21153      function _unsupportedIterableToArray(o, minLen) {
21154        if (!o) return;
21155        if (typeof o === "string") return _arrayLikeToArray(o, minLen);
21156        var n = Object.prototype.toString.call(o).slice(8, -1);
21157        if (n === "Object" && o.constructor) n = o.constructor.name;
21158        if (n === "Map" || n === "Set") return Array.from(n);
21159        if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
21160      }
21161
21162      function _iterableToArray(iter) {
21163        if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
21164      }
21165
21166      function _arrayWithoutHoles(arr) {
21167        if (Array.isArray(arr)) return _arrayLikeToArray(arr);
21168      }
21169
21170      function _arrayLikeToArray(arr, len) {
21171        if (len == null || len > arr.length) len = arr.length;
21172
21173        for (var i = 0, arr2 = new Array(len); i < len; i++) {
21174          arr2[i] = arr[i];
21175        }
21176
21177        return arr2;
21178      }
21179
21180      function _classCallCheck(instance, Constructor) {
21181        if (!(instance instanceof Constructor)) {
21182          throw new TypeError("Cannot call a class as a function");
21183        }
21184      }
21185
21186      function _defineProperties(target, props) {
21187        for (var i = 0; i < props.length; i++) {
21188          var descriptor = props[i];
21189          descriptor.enumerable = descriptor.enumerable || false;
21190          descriptor.configurable = true;
21191          if ("value" in descriptor) descriptor.writable = true;
21192          Object.defineProperty(target, descriptor.key, descriptor);
21193        }
21194      }
21195
21196      function _createClass(Constructor, protoProps, staticProps) {
21197        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
21198        if (staticProps) _defineProperties(Constructor, staticProps);
21199        return Constructor;
21200      }
21201
21202      function _inherits(subClass, superClass) {
21203        if (typeof superClass !== "function" && superClass !== null) {
21204          throw new TypeError("Super expression must either be null or a function");
21205        }
21206
21207        subClass.prototype = Object.create(superClass && superClass.prototype, {
21208          constructor: {
21209            value: subClass,
21210            writable: true,
21211            configurable: true
21212          }
21213        });
21214        if (superClass) _setPrototypeOf(subClass, superClass);
21215      }
21216
21217      function _setPrototypeOf(o, p) {
21218        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
21219          o.__proto__ = p;
21220          return o;
21221        };
21222
21223        return _setPrototypeOf(o, p);
21224      }
21225
21226      function _createSuper(Derived) {
21227        return function () {
21228          var Super = _getPrototypeOf(Derived),
21229              result;
21230
21231          if (_isNativeReflectConstruct()) {
21232            var NewTarget = _getPrototypeOf(this).constructor;
21233
21234            result = Reflect.construct(Super, arguments, NewTarget);
21235          } else {
21236            result = Super.apply(this, arguments);
21237          }
21238
21239          return _possibleConstructorReturn(this, result);
21240        };
21241      }
21242
21243      function _possibleConstructorReturn(self, call) {
21244        if (call && (_typeof(call) === "object" || typeof call === "function")) {
21245          return call;
21246        }
21247
21248        return _assertThisInitialized(self);
21249      }
21250
21251      function _assertThisInitialized(self) {
21252        if (self === void 0) {
21253          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
21254        }
21255
21256        return self;
21257      }
21258
21259      function _isNativeReflectConstruct() {
21260        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
21261        if (Reflect.construct.sham) return false;
21262        if (typeof Proxy === "function") return true;
21263
21264        try {
21265          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
21266          return true;
21267        } catch (e) {
21268          return false;
21269        }
21270      }
21271
21272      function _getPrototypeOf(o) {
21273        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
21274          return o.__proto__ || Object.getPrototypeOf(o);
21275        };
21276        return _getPrototypeOf(o);
21277      }
21278
21279      var BaseXform = require('../../base-xform');
21280
21281      var ConditionalFormattingXform = require('./conditional-formatting-xform');
21282
21283      var ConditionalFormattingsXform = /*#__PURE__*/function (_BaseXform) {
21284        _inherits(ConditionalFormattingsXform, _BaseXform);
21285
21286        var _super = _createSuper(ConditionalFormattingsXform);
21287
21288        function ConditionalFormattingsXform() {
21289          var _this;
21290
21291          _classCallCheck(this, ConditionalFormattingsXform);
21292
21293          _this = _super.call(this);
21294          _this.cfXform = new ConditionalFormattingXform();
21295          return _this;
21296        }
21297
21298        _createClass(ConditionalFormattingsXform, [{
21299          key: "reset",
21300          value: function reset() {
21301            this.model = [];
21302          }
21303        }, {
21304          key: "prepare",
21305          value: function prepare(model, options) {
21306            // ensure each rule has a priority value
21307            var nextPriority = model.reduce(function (p, cf) {
21308              return Math.max.apply(Math, [p].concat(_toConsumableArray(cf.rules.map(function (rule) {
21309                return rule.priority || 0;
21310              }))));
21311            }, 1);
21312            model.forEach(function (cf) {
vendor: 1,757 bytes, lines 21313-21376
21313              cf.rules.forEach(function (rule) {
21314                if (!rule.priority) {
21315                  rule.priority = nextPriority++;
21316                }
21317
21318                if (rule.style) {
21319                  rule.dxfId = options.styles.addDxfStyle(rule.style);
21320                }
21321              });
21322            });
21323          }
21324        }, {
21325          key: "render",
21326          value: function render(xmlStream, model) {
21327            var _this2 = this;
21328
21329            model.forEach(function (cf) {
21330              _this2.cfXform.render(xmlStream, cf);
21331            });
21332          }
21333        }, {
21334          key: "parseOpen",
21335          value: function parseOpen(node) {
21336            if (this.parser) {
21337              this.parser.parseOpen(node);
21338              return true;
21339            }
21340
21341            switch (node.name) {
21342              case 'conditionalFormatting':
21343                this.parser = this.cfXform;
21344                this.parser.parseOpen(node);
21345                return true;
21346
21347              default:
21348                return false;
21349            }
21350          }
21351        }, {
21352          key: "parseText",
21353          value: function parseText(text) {
21354            if (this.parser) {
21355              this.parser.parseText(text);
21356            }
21357          }
21358        }, {
21359          key: "parseClose",
21360          value: function parseClose(name) {
21361            if (this.parser) {
21362              if (!this.parser.parseClose(name)) {
21363                this.model.push(this.parser.model);
21364                this.parser = undefined;
21365                return false;
21366              }
21367
21368              return true;
21369            }
21370
21371            return false;
21372          }
21373        }, {
21374          key: "reconcile",
21375          value: function reconcile(model, options) {
21376            model.forEach(function (cf) {
21377              cf.rules.forEach(function (rule) {
21378                if (rule.dxfId !== undefined) {
21379                  rule.style = options.styles.getDxfStyle(rule.dxfId);
21380                  delete rule.dxfId;
21381                }
21382              });
21383            });
21384          }
21385        }, {
21386          key: "tag",
21387          get: function get() {
21388            return 'conditionalFormatting';
21389          }
21390        }]);
21391
21392        return ConditionalFormattingsXform;
21393      }(BaseXform);
21394
21395      module.exports = ConditionalFormattingsXform;
21396    }, {
21397      "../../base-xform": 29,
21398      "./conditional-formatting-xform": 83
21399    }],
21400    85: [function (require, module, exports) {
21401      "use strict";
21402
21403      function _typeof(obj) {
21404        "@babel/helpers - typeof";
21405
21406        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
21407          _typeof = function _typeof(obj) {
21408            return typeof obj;
21409          };
21410        } else {
21411          _typeof = function _typeof(obj) {
21412            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
21413          };
21414        }
21415
21416        return _typeof(obj);
21417      }
21418
21419      function _classCallCheck(instance, Constructor) {
21420        if (!(instance instanceof Constructor)) {
21421          throw new TypeError("Cannot call a class as a function");
21422        }
21423      }
21424
21425      function _defineProperties(target, props) {
21426        for (var i = 0; i < props.length; i++) {
21427          var descriptor = props[i];
21428          descriptor.enumerable = descriptor.enumerable || false;
21429          descriptor.configurable = true;
21430          if ("value" in descriptor) descriptor.writable = true;
21431          Object.defineProperty(target, descriptor.key, descriptor);
21432        }
21433      }
21434
21435      function _createClass(Constructor, protoProps, staticProps) {
21436        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
21437        if (staticProps) _defineProperties(Constructor, staticProps);
21438        return Constructor;
21439      }
21440
21441      function _inherits(subClass, superClass) {
21442        if (typeof superClass !== "function" && superClass !== null) {
21443          throw new TypeError("Super expression must either be null or a function");
21444        }
21445
21446        subClass.prototype = Object.create(superClass && superClass.prototype, {
21447          constructor: {
21448            value: subClass,
21449            writable: true,
21450            configurable: true
21451          }
21452        });
21453        if (superClass) _setPrototypeOf(subClass, superClass);
21454      }
21455
21456      function _setPrototypeOf(o, p) {
21457        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
21458          o.__proto__ = p;
21459          return o;
21460        };
21461
21462        return _setPrototypeOf(o, p);
21463      }
21464
21465      function _createSuper(Derived) {
21466        return function () {
21467          var Super = _getPrototypeOf(Derived),
21468              result;
21469
21470          if (_isNativeReflectConstruct()) {
21471            var NewTarget = _getPrototypeOf(this).constructor;
21472
21473            result = Reflect.construct(Super, arguments, NewTarget);
21474          } else {
21475            result = Super.apply(this, arguments);
21476          }
21477
21478          return _possibleConstructorReturn(this, result);
21479        };
21480      }
21481
21482      function _possibleConstructorReturn(self, call) {
21483        if (call && (_typeof(call) === "object" || typeof call === "function")) {
21484          return call;
21485        }
21486
21487        return _assertThisInitialized(self);
21488      }
21489
21490      function _assertThisInitialized(self) {
21491        if (self === void 0) {
21492          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
21493        }
21494
21495        return self;
21496      }
21497
21498      function _isNativeReflectConstruct() {
21499        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
21500        if (Reflect.construct.sham) return false;
21501        if (typeof Proxy === "function") return true;
21502
21503        try {
21504          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
21505          return true;
21506        } catch (e) {
21507          return false;
21508        }
21509      }
21510
21511      function _getPrototypeOf(o) {
21512        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
21513          return o.__proto__ || Object.getPrototypeOf(o);
21514        };
21515        return _getPrototypeOf(o);
21516      }
21517
21518      var CompositeXform = require('../../composite-xform');
21519
21520      var ColorXform = require('../../style/color-xform');
21521
21522      var CfvoXform = require('./cfvo-xform');
21523
21524      var DatabarXform = /*#__PURE__*/function (_CompositeXform) {
21525        _inherits(DatabarXform, _CompositeXform);
21526
21527        var _super = _createSuper(DatabarXform);
21528
21529        function DatabarXform() {
21530          var _this;
21531
21532          _classCallCheck(this, DatabarXform);
21533
21534          _this = _super.call(this);
21535          _this.map = {
21536            cfvo: _this.cfvoXform = new CfvoXform(),
21537            color: _this.colorXform = new ColorXform()
21538          };
21539          return _this;
21540        }
21541
21542        _createClass(DatabarXform, [{
21543          key: "render",
21544          value: function render(xmlStream, model) {
21545            var _this2 = this;
21546
21547            xmlStream.openNode(this.tag);
21548            model.cfvo.forEach(function (cfvo) {
21549              _this2.cfvoXform.render(xmlStream, cfvo);
21550            });
21551            this.colorXform.render(xmlStream, model.color);
21552            xmlStream.closeNode();
21553          }
21554        }, {
21555          key: "createNewModel",
21556          value: function createNewModel() {
21557            return {
21558              cfvo: []
21559            };
21560          }
21561        }, {
21562          key: "onParserClose",
21563          value: function onParserClose(name, parser) {
21564            switch (name) {
21565              case 'cfvo':
21566                this.model.cfvo.push(parser.model);
21567                break;
21568
21569              case 'color':
21570                this.model.color = parser.model;
21571                break;
21572            }
21573          }
21574        }, {
21575          key: "tag",
21576          get: function get() {
21577            return 'dataBar';
21578          }
21579        }]);
21580
21581        return DatabarXform;
21582      }(CompositeXform);
21583
21584      module.exports = DatabarXform;
21585    }, {
21586      "../../composite-xform": 45,
21587      "../../style/color-xform": 125,
21588      "./cfvo-xform": 81
21589    }],
21590    86: [function (require, module, exports) {
21591      "use strict";
21592
21593      function _typeof(obj) {
21594        "@babel/helpers - typeof";
21595
21596        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
21597          _typeof = function _typeof(obj) {
21598            return typeof obj;
21599          };
21600        } else {
21601          _typeof = function _typeof(obj) {
21602            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
21603          };
21604        }
21605
21606        return _typeof(obj);
21607      }
21608
21609      function _classCallCheck(instance, Constructor) {
21610        if (!(instance instanceof Constructor)) {
21611          throw new TypeError("Cannot call a class as a function");
21612        }
21613      }
21614
21615      function _defineProperties(target, props) {
21616        for (var i = 0; i < props.length; i++) {
21617          var descriptor = props[i];
21618          descriptor.enumerable = descriptor.enumerable || false;
21619          descriptor.configurable = true;
21620          if ("value" in descriptor) descriptor.writable = true;
21621          Object.defineProperty(target, descriptor.key, descriptor);
21622        }
21623      }
21624
21625      function _createClass(Constructor, protoProps, staticProps) {
21626        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
21627        if (staticProps) _defineProperties(Constructor, staticProps);
21628        return Constructor;
21629      }
21630
21631      function _inherits(subClass, superClass) {
21632        if (typeof superClass !== "function" && superClass !== null) {
21633          throw new TypeError("Super expression must either be null or a function");
21634        }
21635
21636        subClass.prototype = Object.create(superClass && superClass.prototype, {
21637          constructor: {
21638            value: subClass,
21639            writable: true,
21640            configurable: true
21641          }
21642        });
21643        if (superClass) _setPrototypeOf(subClass, superClass);
21644      }
21645
21646      function _setPrototypeOf(o, p) {
21647        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
21648          o.__proto__ = p;
21649          return o;
21650        };
21651
21652        return _setPrototypeOf(o, p);
21653      }
21654
21655      function _createSuper(Derived) {
21656        return function () {
21657          var Super = _getPrototypeOf(Derived),
21658              result;
21659
21660          if (_isNativeReflectConstruct()) {
21661            var NewTarget = _getPrototypeOf(this).constructor;
21662
21663            result = Reflect.construct(Super, arguments, NewTarget);
21664          } else {
21665            result = Super.apply(this, arguments);
21666          }
21667
21668          return _possibleConstructorReturn(this, result);
21669        };
21670      }
21671
21672      function _possibleConstructorReturn(self, call) {
21673        if (call && (_typeof(call) === "object" || typeof call === "function")) {
21674          return call;
21675        }
21676
21677        return _assertThisInitialized(self);
21678      }
21679
21680      function _assertThisInitialized(self) {
21681        if (self === void 0) {
21682          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
21683        }
21684
21685        return self;
21686      }
21687
21688      function _isNativeReflectConstruct() {
21689        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
21690        if (Reflect.construct.sham) return false;
21691        if (typeof Proxy === "function") return true;
21692
21693        try {
21694          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
21695          return true;
21696        } catch (e) {
21697          return false;
21698        }
21699      }
21700
21701      function _getPrototypeOf(o) {
21702        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
21703          return o.__proto__ || Object.getPrototypeOf(o);
21704        };
21705        return _getPrototypeOf(o);
21706      }
21707      /* eslint-disable max-classes-per-file */
21708
21709
21710      var BaseXform = require('../../base-xform');
21711
21712      var CompositeXform = require('../../composite-xform');
21713
21714      var X14IdXform = /*#__PURE__*/function (_BaseXform) {
21715        _inherits(X14IdXform, _BaseXform);
21716
21717        var _super = _createSuper(X14IdXform);
21718
21719        function X14IdXform() {
21720          _classCallCheck(this, X14IdXform);
21721
21722          return _super.apply(this, arguments);
21723        }
21724
21725        _createClass(X14IdXform, [{
21726          key: "render",
21727          value: function render(xmlStream, model) {
21728            xmlStream.leafNode(this.tag, null, model);
21729          }
21730        }, {
21731          key: "parseOpen",
21732          value: function parseOpen() {
21733            this.model = '';
21734          }
21735        }, {
21736          key: "parseText",
21737          value: function parseText(text) {
21738            this.model += text;
21739          }
21740        }, {
21741          key: "parseClose",
21742          value: function parseClose(name) {
21743            return name !== this.tag;
21744          }
21745        }, {
21746          key: "tag",
21747          get: function get() {
21748            return 'x14:id';
21749          }
21750        }]);
21751
21752        return X14IdXform;
21753      }(BaseXform);
21754
21755      var ExtXform = /*#__PURE__*/function (_CompositeXform) {
21756        _inherits(ExtXform, _CompositeXform);
21757
21758        var _super2 = _createSuper(ExtXform);
21759
21760        function ExtXform() {
21761          var _this;
21762
21763          _classCallCheck(this, ExtXform);
21764
21765          _this = _super2.call(this);
21766          _this.map = {
21767            'x14:id': _this.idXform = new X14IdXform()
21768          };
21769          return _this;
21770        }
21771
21772        _createClass(ExtXform, [{
21773          key: "render",
21774          value: function render(xmlStream, model) {
21775            xmlStream.openNode(this.tag, {
21776              uri: '{B025F937-C7B1-47D3-B67F-A62EFF666E3E}',
21777              'xmlns:x14': 'http://schemas.microsoft.com/office/spreadsheetml/2009/9/main'
21778            });
21779            this.idXform.render(xmlStream, model.x14Id);
21780            xmlStream.closeNode();
21781          }
21782        }, {
21783          key: "createNewModel",
21784          value: function createNewModel() {
21785            return {};
21786          }
21787        }, {
21788          key: "onParserClose",
21789          value: function onParserClose(name, parser) {
21790            this.model.x14Id = parser.model;
21791          }
21792        }, {
21793          key: "tag",
21794          get: function get() {
21795            return 'ext';
21796          }
21797        }]);
21798
21799        return ExtXform;
21800      }(CompositeXform);
21801
21802      var ExtLstRefXform = /*#__PURE__*/function (_CompositeXform2) {
21803        _inherits(ExtLstRefXform, _CompositeXform2);
21804
21805        var _super3 = _createSuper(ExtLstRefXform);
21806
21807        function ExtLstRefXform() {
21808          var _this2;
21809
21810          _classCallCheck(this, ExtLstRefXform);
21811
21812          _this2 = _super3.call(this);
21813          _this2.map = {
21814            ext: new ExtXform()
21815          };
21816          return _this2;
21817        }
21818
21819        _createClass(ExtLstRefXform, [{
21820          key: "render",
21821          value: function render(xmlStream, model) {
21822            xmlStream.openNode(this.tag);
21823            this.map.ext.render(xmlStream, model);
21824            xmlStream.closeNode();
21825          }
21826        }, {
21827          key: "createNewModel",
21828          value: function createNewModel() {
21829            return {};
21830          }
21831        }, {
21832          key: "onParserClose",
21833          value: function onParserClose(name, parser) {
21834            Object.assign(this.model, parser.model);
21835          }
21836        }, {
21837          key: "tag",
21838          get: function get() {
21839            return 'extLst';
21840          }
21841        }]);
21842
21843        return ExtLstRefXform;
21844      }(CompositeXform);
21845
21846      module.exports = ExtLstRefXform;
21847    }, {
21848      "../../base-xform": 29,
21849      "../../composite-xform": 45
21850    }],
21851    87: [function (require, module, exports) {
21852      "use strict";
21853
21854      function _typeof(obj) {
21855        "@babel/helpers - typeof";
21856
21857        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
21858          _typeof = function _typeof(obj) {
21859            return typeof obj;
21860          };
21861        } else {
21862          _typeof = function _typeof(obj) {
21863            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
21864          };
21865        }
21866
21867        return _typeof(obj);
21868      }
21869
21870      function _classCallCheck(instance, Constructor) {
21871        if (!(instance instanceof Constructor)) {
21872          throw new TypeError("Cannot call a class as a function");
21873        }
21874      }
21875
21876      function _defineProperties(target, props) {
21877        for (var i = 0; i < props.length; i++) {
21878          var descriptor = props[i];
21879          descriptor.enumerable = descriptor.enumerable || false;
21880          descriptor.configurable = true;
21881          if ("value" in descriptor) descriptor.writable = true;
21882          Object.defineProperty(target, descriptor.key, descriptor);
21883        }
21884      }
21885
21886      function _createClass(Constructor, protoProps, staticProps) {
21887        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
21888        if (staticProps) _defineProperties(Constructor, staticProps);
21889        return Constructor;
21890      }
21891
21892      function _inherits(subClass, superClass) {
21893        if (typeof superClass !== "function" && superClass !== null) {
21894          throw new TypeError("Super expression must either be null or a function");
21895        }
21896
21897        subClass.prototype = Object.create(superClass && superClass.prototype, {
21898          constructor: {
21899            value: subClass,
21900            writable: true,
21901            configurable: true
21902          }
21903        });
21904        if (superClass) _setPrototypeOf(subClass, superClass);
21905      }
21906
21907      function _setPrototypeOf(o, p) {
21908        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
21909          o.__proto__ = p;
21910          return o;
21911        };
21912
21913        return _setPrototypeOf(o, p);
21914      }
21915
21916      function _createSuper(Derived) {
21917        return function () {
21918          var Super = _getPrototypeOf(Derived),
21919              result;
21920
21921          if (_isNativeReflectConstruct()) {
21922            var NewTarget = _getPrototypeOf(this).constructor;
21923
21924            result = Reflect.construct(Super, arguments, NewTarget);
21925          } else {
21926            result = Super.apply(this, arguments);
21927          }
21928
21929          return _possibleConstructorReturn(this, result);
21930        };
21931      }
21932
21933      function _possibleConstructorReturn(self, call) {
21934        if (call && (_typeof(call) === "object" || typeof call === "function")) {
21935          return call;
21936        }
21937
21938        return _assertThisInitialized(self);
21939      }
21940
21941      function _assertThisInitialized(self) {
21942        if (self === void 0) {
21943          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
21944        }
21945
21946        return self;
21947      }
21948
21949      function _isNativeReflectConstruct() {
21950        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
21951        if (Reflect.construct.sham) return false;
21952        if (typeof Proxy === "function") return true;
21953
21954        try {
21955          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
21956          return true;
21957        } catch (e) {
21958          return false;
21959        }
21960      }
21961
21962      function _getPrototypeOf(o) {
21963        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
21964          return o.__proto__ || Object.getPrototypeOf(o);
21965        };
21966        return _getPrototypeOf(o);
21967      }
21968
21969      var BaseXform = require('../../base-xform');
21970
21971      var FormulaXform = /*#__PURE__*/function (_BaseXform) {
21972        _inherits(FormulaXform, _BaseXform);
21973
21974        var _super = _createSuper(FormulaXform);
21975
21976        function FormulaXform() {
21977          _classCallCheck(this, FormulaXform);
21978
21979          return _super.apply(this, arguments);
21980        }
21981
21982        _createClass(FormulaXform, [{
21983          key: "render",
21984          value: function render(xmlStream, model) {
21985            xmlStream.leafNode(this.tag, null, model);
21986          }
21987        }, {
21988          key: "parseOpen",
21989          value: function parseOpen() {
21990            this.model = '';
21991          }
21992        }, {
21993          key: "parseText",
21994          value: function parseText(text) {
21995            this.model += text;
21996          }
21997        }, {
21998          key: "parseClose",
21999          value: function parseClose(name) {
22000            return name !== this.tag;
22001          }
22002        }, {
22003          key: "tag",
22004          get: function get() {
22005            return 'formula';
22006          }
22007        }]);
22008
22009        return FormulaXform;
22010      }(BaseXform);
22011
22012      module.exports = FormulaXform;
22013    }, {
22014      "../../base-xform": 29
22015    }],
22016    88: [function (require, module, exports) {
22017      "use strict";
22018
22019      function _typeof(obj) {
22020        "@babel/helpers - typeof";
22021
22022        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
22023          _typeof = function _typeof(obj) {
22024            return typeof obj;
22025          };
22026        } else {
22027          _typeof = function _typeof(obj) {
22028            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
22029          };
22030        }
22031
22032        return _typeof(obj);
22033      }
22034
22035      function _classCallCheck(instance, Constructor) {
22036        if (!(instance instanceof Constructor)) {
22037          throw new TypeError("Cannot call a class as a function");
22038        }
22039      }
22040
22041      function _defineProperties(target, props) {
22042        for (var i = 0; i < props.length; i++) {
22043          var descriptor = props[i];
22044          descriptor.enumerable = descriptor.enumerable || false;
22045          descriptor.configurable = true;
22046          if ("value" in descriptor) descriptor.writable = true;
22047          Object.defineProperty(target, descriptor.key, descriptor);
22048        }
22049      }
22050
22051      function _createClass(Constructor, protoProps, staticProps) {
22052        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
22053        if (staticProps) _defineProperties(Constructor, staticProps);
22054        return Constructor;
22055      }
22056
22057      function _inherits(subClass, superClass) {
22058        if (typeof superClass !== "function" && superClass !== null) {
22059          throw new TypeError("Super expression must either be null or a function");
22060        }
22061
22062        subClass.prototype = Object.create(superClass && superClass.prototype, {
22063          constructor: {
22064            value: subClass,
22065            writable: true,
22066            configurable: true
22067          }
22068        });
22069        if (superClass) _setPrototypeOf(subClass, superClass);
22070      }
22071
22072      function _setPrototypeOf(o, p) {
22073        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
22074          o.__proto__ = p;
22075          return o;
22076        };
22077
22078        return _setPrototypeOf(o, p);
22079      }
22080
22081      function _createSuper(Derived) {
22082        return function () {
22083          var Super = _getPrototypeOf(Derived),
22084              result;
22085
22086          if (_isNativeReflectConstruct()) {
22087            var NewTarget = _getPrototypeOf(this).constructor;
22088
22089            result = Reflect.construct(Super, arguments, NewTarget);
22090          } else {
22091            result = Super.apply(this, arguments);
22092          }
22093
22094          return _possibleConstructorReturn(this, result);
22095        };
22096      }
22097
22098      function _possibleConstructorReturn(self, call) {
22099        if (call && (_typeof(call) === "object" || typeof call === "function")) {
22100          return call;
22101        }
22102
22103        return _assertThisInitialized(self);
22104      }
22105
22106      function _assertThisInitialized(self) {
22107        if (self === void 0) {
22108          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
22109        }
22110
22111        return self;
22112      }
22113
22114      function _isNativeReflectConstruct() {
22115        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
22116        if (Reflect.construct.sham) return false;
22117        if (typeof Proxy === "function") return true;
22118
22119        try {
22120          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
22121          return true;
22122        } catch (e) {
22123          return false;
22124        }
22125      }
22126
22127      function _getPrototypeOf(o) {
22128        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
22129          return o.__proto__ || Object.getPrototypeOf(o);
22130        };
22131        return _getPrototypeOf(o);
22132      }
22133
22134      var BaseXform = require('../../base-xform');
22135
22136      var CompositeXform = require('../../composite-xform');
22137
22138      var CfvoXform = require('./cfvo-xform');
22139
22140      var IconSetXform = /*#__PURE__*/function (_CompositeXform) {
22141        _inherits(IconSetXform, _CompositeXform);
22142
22143        var _super = _createSuper(IconSetXform);
22144
22145        function IconSetXform() {
22146          var _this;
22147
22148          _classCallCheck(this, IconSetXform);
22149
22150          _this = _super.call(this);
22151          _this.map = {
22152            cfvo: _this.cfvoXform = new CfvoXform()
22153          };
22154          return _this;
22155        }
22156
22157        _createClass(IconSetXform, [{
22158          key: "render",
22159          value: function render(xmlStream, model) {
22160            var _this2 = this;
22161
22162            xmlStream.openNode(this.tag, {
22163              iconSet: BaseXform.toStringAttribute(model.iconSet, '3TrafficLights'),
22164              reverse: BaseXform.toBoolAttribute(model.reverse, false),
22165              showValue: BaseXform.toBoolAttribute(model.showValue, true)
22166            });
22167            model.cfvo.forEach(function (cfvo) {
22168              _this2.cfvoXform.render(xmlStream, cfvo);
22169            });
22170            xmlStream.closeNode();
22171          }
22172        }, {
22173          key: "createNewModel",
22174          value: function createNewModel(_ref) {
22175            var attributes = _ref.attributes;
22176            return {
22177              iconSet: BaseXform.toStringValue(attributes.iconSet, '3TrafficLights'),
22178              reverse: BaseXform.toBoolValue(attributes.reverse),
22179              showValue: BaseXform.toBoolValue(attributes.showValue),
22180              cfvo: []
22181            };
22182          }
22183        }, {
22184          key: "onParserClose",
22185          value: function onParserClose(name, parser) {
22186            this.model[name].push(parser.model);
22187          }
22188        }, {
22189          key: "tag",
22190          get: function get() {
22191            return 'iconSet';
22192          }
22193        }]);
22194
22195        return IconSetXform;
22196      }(CompositeXform);
22197
22198      module.exports = IconSetXform;
22199    }, {
22200      "../../base-xform": 29,
22201      "../../composite-xform": 45,
22202      "./cfvo-xform": 81
22203    }],
22204    89: [function (require, module, exports) {
22205      "use strict";
22206
22207      function _typeof(obj) {
22208        "@babel/helpers - typeof";
22209
22210        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
22211          _typeof = function _typeof(obj) {
22212            return typeof obj;
22213          };
22214        } else {
22215          _typeof = function _typeof(obj) {
22216            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
22217          };
22218        }
22219
22220        return _typeof(obj);
22221      }
22222
22223      function _classCallCheck(instance, Constructor) {
22224        if (!(instance instanceof Constructor)) {
22225          throw new TypeError("Cannot call a class as a function");
22226        }
22227      }
22228
22229      function _defineProperties(target, props) {
22230        for (var i = 0; i < props.length; i++) {
22231          var descriptor = props[i];
22232          descriptor.enumerable = descriptor.enumerable || false;
22233          descriptor.configurable = true;
22234          if ("value" in descriptor) descriptor.writable = true;
22235          Object.defineProperty(target, descriptor.key, descriptor);
22236        }
22237      }
22238
22239      function _createClass(Constructor, protoProps, staticProps) {
22240        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
22241        if (staticProps) _defineProperties(Constructor, staticProps);
22242        return Constructor;
22243      }
22244
22245      function _inherits(subClass, superClass) {
22246        if (typeof superClass !== "function" && superClass !== null) {
22247          throw new TypeError("Super expression must either be null or a function");
22248        }
22249
22250        subClass.prototype = Object.create(superClass && superClass.prototype, {
22251          constructor: {
22252            value: subClass,
22253            writable: true,
22254            configurable: true
22255          }
22256        });
22257        if (superClass) _setPrototypeOf(subClass, superClass);
22258      }
22259
22260      function _setPrototypeOf(o, p) {
22261        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
22262          o.__proto__ = p;
22263          return o;
22264        };
22265
22266        return _setPrototypeOf(o, p);
22267      }
22268
22269      function _createSuper(Derived) {
22270        return function () {
22271          var Super = _getPrototypeOf(Derived),
22272              result;
22273
22274          if (_isNativeReflectConstruct()) {
22275            var NewTarget = _getPrototypeOf(this).constructor;
22276
22277            result = Reflect.construct(Super, arguments, NewTarget);
22278          } else {
22279            result = Super.apply(this, arguments);
22280          }
22281
22282          return _possibleConstructorReturn(this, result);
22283        };
22284      }
22285
22286      function _possibleConstructorReturn(self, call) {
22287        if (call && (_typeof(call) === "object" || typeof call === "function")) {
22288          return call;
22289        }
22290
22291        return _assertThisInitialized(self);
22292      }
22293
22294      function _assertThisInitialized(self) {
22295        if (self === void 0) {
22296          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
22297        }
22298
22299        return self;
22300      }
22301
22302      function _isNativeReflectConstruct() {
22303        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
22304        if (Reflect.construct.sham) return false;
22305        if (typeof Proxy === "function") return true;
22306
22307        try {
22308          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
22309          return true;
22310        } catch (e) {
22311          return false;
22312        }
22313      }
22314
22315      function _getPrototypeOf(o) {
22316        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
22317          return o.__proto__ || Object.getPrototypeOf(o);
22318        };
22319        return _getPrototypeOf(o);
22320      }
22321
22322      var BaseXform = require('../base-xform');
22323
22324      var ColXform = /*#__PURE__*/function (_BaseXform) {
22325        _inherits(ColXform, _BaseXform);
22326
22327        var _super = _createSuper(ColXform);
22328
22329        function ColXform() {
22330          _classCallCheck(this, ColXform);
22331
22332          return _super.apply(this, arguments);
22333        }
22334
22335        _createClass(ColXform, [{
22336          key: "prepare",
22337          value: function prepare(model, options) {
22338            var styleId = options.styles.addStyleModel(model.style || {});
22339
22340            if (styleId) {
22341              model.styleId = styleId;
22342            }
22343          }
22344        }, {
22345          key: "render",
22346          value: function render(xmlStream, model) {
22347            xmlStream.openNode('col');
22348            xmlStream.addAttribute('min', model.min);
22349            xmlStream.addAttribute('max', model.max);
22350
22351            if (model.width) {
22352              xmlStream.addAttribute('width', model.width);
22353            }
22354
22355            if (model.styleId) {
22356              xmlStream.addAttribute('style', model.styleId);
22357            }
22358
22359            if (model.hidden) {
22360              xmlStream.addAttribute('hidden', '1');
22361            }
22362
22363            if (model.bestFit) {
22364              xmlStream.addAttribute('bestFit', '1');
22365            }
22366
22367            if (model.outlineLevel) {
22368              xmlStream.addAttribute('outlineLevel', model.outlineLevel);
22369            }
22370
22371            if (model.collapsed) {
22372              xmlStream.addAttribute('collapsed', '1');
22373            }
22374
22375            xmlStream.addAttribute('customWidth', '1');
22376            xmlStream.closeNode();
22377          }
22378        }, {
22379          key: "parseOpen",
22380          value: function parseOpen(node) {
22381            if (node.name === 'col') {
22382              var model = this.model = {
22383                min: parseInt(node.attributes.min || '0', 10),
22384                max: parseInt(node.attributes.max || '0', 10),
22385                width: node.attributes.width === undefined ? undefined : parseFloat(node.attributes.width || '0')
22386              };
22387
22388              if (node.attributes.style) {
22389                model.styleId = parseInt(node.attributes.style, 10);
22390              }
22391
22392              if (node.attributes.hidden === true || node.attributes.hidden === 'true' || node.attributes.hidden === 1 || node.attributes.hidden === '1') {
22393                model.hidden = true;
22394              }
22395
22396              if (node.attributes.bestFit) {
22397                model.bestFit = true;
22398              }
22399
22400              if (node.attributes.outlineLevel) {
22401                model.outlineLevel = parseInt(node.attributes.outlineLevel, 10);
22402              }
22403
22404              if (node.attributes.collapsed) {
22405                model.collapsed = true;
22406              }
22407
22408              return true;
22409            }
22410
22411            return false;
22412          }
22413        }, {
22414          key: "parseText",
22415          value: function parseText() {}
22416        }, {
22417          key: "parseClose",
22418          value: function parseClose() {
22419            return false;
22420          }
22421        }, {
22422          key: "reconcile",
22423          value: function reconcile(model, options) {
22424            // reconcile column styles
22425            if (model.styleId) {
22426              model.style = options.styles.getStyleModel(model.styleId);
22427            }
22428          }
22429        }, {
22430          key: "tag",
22431          get: function get() {
22432            return 'col';
22433          }
22434        }]);
22435
22436        return ColXform;
22437      }(BaseXform);
22438
22439      module.exports = ColXform;
22440    }, {
22441      "../base-xform": 29
22442    }],
22443    90: [function (require, module, exports) {
22444      "use strict";
22445
22446      function _typeof(obj) {
22447        "@babel/helpers - typeof";
22448
22449        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
22450          _typeof = function _typeof(obj) {
22451            return typeof obj;
22452          };
22453        } else {
22454          _typeof = function _typeof(obj) {
22455            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
22456          };
22457        }
22458
22459        return _typeof(obj);
22460      }
22461
22462      function _classCallCheck(instance, Constructor) {
22463        if (!(instance instanceof Constructor)) {
22464          throw new TypeError("Cannot call a class as a function");
22465        }
22466      }
22467
22468      function _defineProperties(target, props) {
22469        for (var i = 0; i < props.length; i++) {
22470          var descriptor = props[i];
22471          descriptor.enumerable = descriptor.enumerable || false;
22472          descriptor.configurable = true;
22473          if ("value" in descriptor) descriptor.writable = true;
22474          Object.defineProperty(target, descriptor.key, descriptor);
22475        }
22476      }
22477
22478      function _createClass(Constructor, protoProps, staticProps) {
22479        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
22480        if (staticProps) _defineProperties(Constructor, staticProps);
22481        return Constructor;
22482      }
22483
22484      function _inherits(subClass, superClass) {
22485        if (typeof superClass !== "function" && superClass !== null) {
22486          throw new TypeError("Super expression must either be null or a function");
22487        }
22488
22489        subClass.prototype = Object.create(superClass && superClass.prototype, {
22490          constructor: {
22491            value: subClass,
22492            writable: true,
22493            configurable: true
22494          }
22495        });
22496        if (superClass) _setPrototypeOf(subClass, superClass);
22497      }
22498
22499      function _setPrototypeOf(o, p) {
22500        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
22501          o.__proto__ = p;
22502          return o;
22503        };
22504
22505        return _setPrototypeOf(o, p);
22506      }
22507
22508      function _createSuper(Derived) {
22509        return function () {
22510          var Super = _getPrototypeOf(Derived),
22511              result;
22512
22513          if (_isNativeReflectConstruct()) {
22514            var NewTarget = _getPrototypeOf(this).constructor;
22515
22516            result = Reflect.construct(Super, arguments, NewTarget);
22517          } else {
22518            result = Super.apply(this, arguments);
22519          }
22520
22521          return _possibleConstructorReturn(this, result);
22522        };
22523      }
22524
22525      function _possibleConstructorReturn(self, call) {
22526        if (call && (_typeof(call) === "object" || typeof call === "function")) {
22527          return call;
22528        }
22529
22530        return _assertThisInitialized(self);
22531      }
22532
22533      function _assertThisInitialized(self) {
22534        if (self === void 0) {
22535          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
22536        }
22537
22538        return self;
22539      }
22540
22541      function _isNativeReflectConstruct() {
22542        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
22543        if (Reflect.construct.sham) return false;
22544        if (typeof Proxy === "function") return true;
22545
22546        try {
22547          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
22548          return true;
22549        } catch (e) {
22550          return false;
22551        }
22552      }
22553
22554      function _getPrototypeOf(o) {
22555        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
22556          return o.__proto__ || Object.getPrototypeOf(o);
22557        };
22558        return _getPrototypeOf(o);
22559      }
22560
22561      function ownKeys(object, enumerableOnly) {
22562        var keys = Object.keys(object);
22563
22564        if (Object.getOwnPropertySymbols) {
22565          var symbols = Object.getOwnPropertySymbols(object);
22566          if (enumerableOnly) symbols = symbols.filter(function (sym) {
22567            return Object.getOwnPropertyDescriptor(object, sym).enumerable;
22568          });
22569          keys.push.apply(keys, symbols);
22570        }
22571
22572        return keys;
22573      }
22574
22575      function _objectSpread(target) {
22576        for (var i = 1; i < arguments.length; i++) {
22577          var source = arguments[i] != null ? arguments[i] : {};
22578
22579          if (i % 2) {
22580            ownKeys(Object(source), true).forEach(function (key) {
22581              _defineProperty(target, key, source[key]);
22582            });
22583          } else if (Object.getOwnPropertyDescriptors) {
22584            Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
22585          } else {
22586            ownKeys(Object(source)).forEach(function (key) {
22587              Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
22588            });
22589          }
22590        }
22591
22592        return target;
22593      }
22594
22595      function _defineProperty(obj, key, value) {
22596        if (key in obj) {
22597          Object.defineProperty(obj, key, {
22598            value: value,
22599            enumerable: true,
22600            configurable: true,
22601            writable: true
22602          });
22603        } else {
22604          obj[key] = value;
22605        }
22606
22607        return obj;
22608      }
22609
22610      var _ = require('../../../utils/under-dash');
22611
22612      var utils = require('../../../utils/utils');
22613
22614      var colCache = require('../../../utils/col-cache');
22615
22616      var BaseXform = require('../base-xform');
22617
22618      var Range = require('../../../doc/range');
22619
22620      function assign(definedName, attributes, name, defaultValue) {
22621        var value = attributes[name];
22622
22623        if (value !== undefined) {
22624          definedName[name] = value;
22625        } else if (defaultValue !== undefined) {
22626          definedName[name] = defaultValue;
22627        }
22628      }
22629
22630      function parseBool(value) {
22631        switch (value) {
22632          case '1':
22633          case 'true':
22634            return true;
22635
22636          default:
22637            return false;
22638        }
22639      }
22640
22641      function assignBool(definedName, attributes, name, defaultValue) {
22642        var value = attributes[name];
22643
22644        if (value !== undefined) {
22645          definedName[name] = parseBool(value);
22646        } else if (defaultValue !== undefined) {
22647          definedName[name] = defaultValue;
22648        }
22649      }
22650
22651      function optimiseDataValidations(model) {
22652        // Squeeze alike data validations together into rectangular ranges
22653        // to reduce file size and speed up Excel load time
22654        var dvList = _.map(model, function (dataValidation, address) {
22655          return {
22656            address: address,
22657            dataValidation: dataValidation,
22658            marked: false
22659          };
22660        }).sort(function (a, b) {
22661          return _.strcmp(a.address, b.address);
22662        });
22663
22664        var dvMap = _.keyBy(dvList, 'address');
22665
22666        var matchCol = function matchCol(addr, height, col) {
22667          for (var i = 0; i < height; i++) {
22668            var otherAddress = colCache.encodeAddress(addr.row + i, col);
22669
22670            if (!model[otherAddress] || !_.isEqual(model[addr.address], model[otherAddress])) {
22671              return false;
22672            }
22673          }
22674
22675          return true;
22676        };
22677
22678        return dvList.map(function (dv) {
22679          if (!dv.marked) {
22680            var addr = colCache.decodeAddress(dv.address); // iterate downwards - finding matching cells
22681
22682            var height = 1;
22683            var otherAddress = colCache.encodeAddress(addr.row + height, addr.col);
22684
22685            while (model[otherAddress] && _.isEqual(dv.dataValidation, model[otherAddress])) {
22686              height++;
22687              otherAddress = colCache.encodeAddress(addr.row + height, addr.col);
22688            } // iterate rightwards...
22689
22690
22691            var width = 1;
22692
22693            while (matchCol(addr, height, addr.col + width)) {
22694              width++;
22695            } // mark all included addresses
22696
22697
22698            for (var i = 0; i < height; i++) {
22699              for (var j = 0; j < width; j++) {
22700                otherAddress = colCache.encodeAddress(addr.row + i, addr.col + j);
22701                dvMap[otherAddress].marked = true;
22702              }
22703            }
22704
22705            if (height > 1 || width > 1) {
22706              var bottom = addr.row + (height - 1);
22707              var right = addr.col + (width - 1);
22708              return _objectSpread(_objectSpread({}, dv.dataValidation), {}, {
22709                sqref: "".concat(dv.address, ":").concat(colCache.encodeAddress(bottom, right))
22710              });
22711            }
22712
22713            return _objectSpread(_objectSpread({}, dv.dataValidation), {}, {
22714              sqref: dv.address
22715            });
22716          }
22717
22718          return null;
22719        }
vendor: 4,568 bytes, lines 22719-22851
22719).filter(Boolean);
22720      }
22721
22722      var DataValidationsXform = /*#__PURE__*/function (_BaseXform) {
22723        _inherits(DataValidationsXform, _BaseXform);
22724
22725        var _super = _createSuper(DataValidationsXform);
22726
22727        function DataValidationsXform() {
22728          _classCallCheck(this, DataValidationsXform);
22729
22730          return _super.apply(this, arguments);
22731        }
22732
22733        _createClass(DataValidationsXform, [{
22734          key: "render",
22735          value: function render(xmlStream, model) {
22736            var optimizedModel = optimiseDataValidations(model);
22737
22738            if (optimizedModel.length) {
22739              xmlStream.openNode('dataValidations', {
22740                count: optimizedModel.length
22741              });
22742              optimizedModel.forEach(function (value) {
22743                xmlStream.openNode('dataValidation');
22744
22745                if (value.type !== 'any') {
22746                  xmlStream.addAttribute('type', value.type);
22747
22748                  if (value.operator && value.type !== 'list' && value.operator !== 'between') {
22749                    xmlStream.addAttribute('operator', value.operator);
22750                  }
22751
22752                  if (value.allowBlank) {
22753                    xmlStream.addAttribute('allowBlank', '1');
22754                  }
22755                }
22756
22757                if (value.showInputMessage) {
22758                  xmlStream.addAttribute('showInputMessage', '1');
22759                }
22760
22761                if (value.promptTitle) {
22762                  xmlStream.addAttribute('promptTitle', value.promptTitle);
22763                }
22764
22765                if (value.prompt) {
22766                  xmlStream.addAttribute('prompt', value.prompt);
22767                }
22768
22769                if (value.showErrorMessage) {
22770                  xmlStream.addAttribute('showErrorMessage', '1');
22771                }
22772
22773                if (value.errorStyle) {
22774                  xmlStream.addAttribute('errorStyle', value.errorStyle);
22775                }
22776
22777                if (value.errorTitle) {
22778                  xmlStream.addAttribute('errorTitle', value.errorTitle);
22779                }
22780
22781                if (value.error) {
22782                  xmlStream.addAttribute('error', value.error);
22783                }
22784
22785                xmlStream.addAttribute('sqref', value.sqref);
22786                (value.formulae || []).forEach(function (formula, index) {
22787                  xmlStream.openNode("formula".concat(index + 1));
22788
22789                  if (value.type === 'date') {
22790                    xmlStream.writeText(utils.dateToExcel(new Date(formula)));
22791                  } else {
22792                    xmlStream.writeText(formula);
22793                  }
22794
22795                  xmlStream.closeNode();
22796                });
22797                xmlStream.closeNode();
22798              });
22799              xmlStream.closeNode();
22800            }
22801          }
22802        }, {
22803          key: "parseOpen",
22804          value: function parseOpen(node) {
22805            switch (node.name) {
22806              case 'dataValidations':
22807                this.model = {};
22808                return true;
22809
22810              case 'dataValidation':
22811                {
22812                  this._address = node.attributes.sqref;
22813                  var dataValidation = {
22814                    type: node.attributes.type || 'any',
22815                    formulae: []
22816                  };
22817
22818                  if (node.attributes.type) {
22819                    assignBool(dataValidation, node.attributes, 'allowBlank');
22820                  }
22821
22822                  assignBool(dataValidation, node.attributes, 'showInputMessage');
22823                  assignBool(dataValidation, node.attributes, 'showErrorMessage');
22824
22825                  switch (dataValidation.type) {
22826                    case 'any':
22827                    case 'list':
22828                    case 'custom':
22829                      break;
22830
22831                    default:
22832                      assign(dataValidation, node.attributes, 'operator', 'between');
22833                      break;
22834                  }
22835
22836                  assign(dataValidation, node.attributes, 'promptTitle');
22837                  assign(dataValidation, node.attributes, 'prompt');
22838                  assign(dataValidation, node.attributes, 'errorStyle');
22839                  assign(dataValidation, node.attributes, 'errorTitle');
22840                  assign(dataValidation, node.attributes, 'error');
22841                  this._dataValidation = dataValidation;
22842                  return true;
22843                }
22844
22845              case 'formula1':
22846              case 'formula2':
22847                this._formula = [];
22848                return true;
22849
22850              default:
22851                return false;
22852            }
22853          }
22854        }, {
22855          key: "parseText",
22856          value: function parseText(text) {
22857            if (this._formula) {
22858              this._formula.push(text);
22859            }
22860          }
22861        }, {
22862          key: "parseClose",
22863          value: function parseClose(name) {
22864            var _this = this;
22865
22866            switch (name) {
22867              case 'dataValidations':
22868                return false;
22869
22870              case 'dataValidation':
22871                {
22872                  if (!this._dataValidation.formulae || !this._dataValidation.formulae.length) {
22873                    delete this._dataValidation.formulae;
22874                    delete this._dataValidation.operator;
22875                  } // The four known cases: 1. E4:L9 N4:U9  2.E4 L9  3. N4:U9  4. E4
22876
22877
22878                  var list = this._address.split(/\s+/g) || [];
22879                  list.forEach(function (addr) {
22880                    if (addr.includes(':')) {
22881                      var range = new Range(addr);
22882                      range.forEachAddress(function (address) {
22883                        _this.model[address] = _this._dataValidation;
22884                      });
22885                    } else {
22886                      _this.model[addr] = _this._dataValidation;
22887                    }
22888                  });
22889                  return true;
22890                }
22891
22892              case 'formula1':
22893              case 'formula2':
22894                {
22895                  var formula = this._formula.join('');
22896
22897                  switch (this._dataValidation.type) {
22898                    case 'whole':
22899                    case 'textLength':
22900                      formula = parseInt(formula, 10);
22901                      break;
22902
22903                    case 'decimal':
22904                      formula = parseFloat(formula);
22905                      break;
22906
22907                    case 'date':
22908                      formula = utils.excelToDate(parseFloat(formula));
22909                      break;
22910
22911                    default:
22912                      break;
22913                  }
22914
22915                  this._dataValidation.formulae.push(formula);
22916
22917                  this._formula = undefined;
22918                  return true;
22919                }
22920
22921              default:
22922                return true;
22923            }
22924          }
22925        }, {
22926          key: "tag",
22927          get: function get() {
22928            return 'dataValidations';
22929          }
22930        }]);
22931
22932        return DataValidationsXform;
22933      }(BaseXform);
22934
22935      module.exports = DataValidationsXform;
22936    }, {
22937      "../../../doc/range": 10,
22938      "../../../utils/col-cache": 17,
22939      "../../../utils/under-dash": 23,
22940      "../../../utils/utils": 24,
22941      "../base-xform": 29
22942    }],
22943    91: [function (require, module, exports) {
22944      "use strict";
22945
22946      function _typeof(obj) {
22947        "@babel/helpers - typeof";
22948
22949        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
22950          _typeof = function _typeof(obj) {
22951            return typeof obj;
22952          };
22953        } else {
22954          _typeof = function _typeof(obj) {
22955            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
22956          };
22957        }
22958
22959        return _typeof(obj);
22960      }
22961
22962      function _classCallCheck(instance, Constructor) {
22963        if (!(instance instanceof Constructor)) {
22964          throw new TypeError("Cannot call a class as a function");
22965        }
22966      }
22967
22968      function _defineProperties(target, props) {
22969        for (var i = 0; i < props.length; i++) {
22970          var descriptor = props[i];
22971          descriptor.enumerable = descriptor.enumerable || false;
22972          descriptor.configurable = true;
22973          if ("value" in descriptor) descriptor.writable = true;
22974          Object.defineProperty(target, descriptor.key, descriptor);
22975        }
22976      }
22977
22978      function _createClass(Constructor, protoProps, staticProps) {
22979        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
22980        if (staticProps) _defineProperties(Constructor, staticProps);
22981        return Constructor;
22982      }
22983
22984      function _inherits(subClass, superClass) {
22985        if (typeof superClass !== "function" && superClass !== null) {
22986          throw new TypeError("Super expression must either be null or a function");
22987        }
22988
22989        subClass.prototype = Object.create(superClass && superClass.prototype, {
22990          constructor: {
22991            value: subClass,
22992            writable: true,
22993            configurable: true
22994          }
22995        });
22996        if (superClass) _setPrototypeOf(subClass, superClass);
22997      }
22998
22999      function _setPrototypeOf(o, p) {
23000        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
23001          o.__proto__ = p;
23002          return o;
23003        };
23004
23005        return _setPrototypeOf(o, p);
23006      }
23007
23008      function _createSuper(Derived) {
23009        return function () {
23010          var Super = _getPrototypeOf(Derived),
23011              result;
23012
23013          if (_isNativeReflectConstruct()) {
23014            var NewTarget = _getPrototypeOf(this).constructor;
23015
23016            result = Reflect.construct(Super, arguments, NewTarget);
23017          } else {
23018            result = Super.apply(this, arguments);
23019          }
23020
23021          return _possibleConstructorReturn(this, result);
23022        };
23023      }
23024
23025      function _possibleConstructorReturn(self, call) {
23026        if (call && (_typeof(call) === "object" || typeof call === "function")) {
23027          return call;
23028        }
23029
23030        return _assertThisInitialized(self);
23031      }
23032
23033      function _assertThisInitialized(self) {
23034        if (self === void 0) {
23035          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
23036        }
23037
23038        return self;
23039      }
23040
23041      function _isNativeReflectConstruct() {
23042        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
23043        if (Reflect.construct.sham) return false;
23044        if (typeof Proxy === "function") return true;
23045
23046        try {
23047          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
23048          return true;
23049        } catch (e) {
23050          return false;
23051        }
23052      }
23053
23054      function _getPrototypeOf(o) {
23055        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
23056          return o.__proto__ || Object.getPrototypeOf(o);
23057        };
23058        return _getPrototypeOf(o);
23059      }
23060
23061      var BaseXform = require('../base-xform');
23062
23063      var DimensionXform = /*#__PURE__*/function (_BaseXform) {
23064        _inherits(DimensionXform, _BaseXform);
23065
23066        var _super = _createSuper(DimensionXform);
23067
23068        function DimensionXform() {
23069          _classCallCheck(this, DimensionXform);
23070
23071          return _super.apply(this, arguments);
23072        }
23073
23074        _createClass(DimensionXform, [{
23075          key: "render",
23076          value: function render(xmlStream, model) {
23077            if (model) {
23078              xmlStream.leafNode('dimension', {
23079                ref: model
23080              });
23081            }
23082          }
23083        }, {
23084          key: "parseOpen",
23085          value: function parseOpen(node) {
23086            if (node.name === 'dimension') {
23087              this.model = node.attributes.ref;
23088              return true;
23089            }
23090
23091            return false;
23092          }
23093        }, {
23094          key: "parseText",
23095          value: function parseText() {}
23096        }, {
23097          key: "parseClose",
23098          value: function parseClose() {
23099            return false;
23100          }
23101        }, {
23102          key: "tag",
23103          get: function get() {
23104            return 'dimension';
23105          }
23106        }]);
23107
23108        return DimensionXform;
23109      }(BaseXform);
23110
23111      module.exports = DimensionXform;
23112    }, {
23113      "../base-xform": 29
23114    }],
23115    92: [function (require, module, exports) {
23116      "use strict";
23117
23118      function _typeof(obj) {
23119        "@babel/helpers - typeof";
23120
23121        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
23122          _typeof = function _typeof(obj) {
23123            return typeof obj;
23124          };
23125        } else {
23126          _typeof = function _typeof(obj) {
23127            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
23128          };
23129        }
23130
23131        return _typeof(obj);
23132      }
23133
23134      function _classCallCheck(instance, Constructor) {
23135        if (!(instance instanceof Constructor)) {
23136          throw new TypeError("Cannot call a class as a function");
23137        }
23138      }
23139
23140      function _defineProperties(target, props) {
23141        for (var i = 0; i < props.length; i++) {
23142          var descriptor = props[i];
23143          descriptor.enumerable = descriptor.enumerable || false;
23144          descriptor.configurable = true;
23145          if ("value" in descriptor) descriptor.writable = true;
23146          Object.defineProperty(target, descriptor.key, descriptor);
23147        }
23148      }
23149
23150      function _createClass(Constructor, protoProps, staticProps) {
23151        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
23152        if (staticProps) _defineProperties(Constructor, staticProps);
23153        return Constructor;
23154      }
23155
23156      function _inherits(subClass, superClass) {
23157        if (typeof superClass !== "function" && superClass !== null) {
23158          throw new TypeError("Super expression must either be null or a function");
23159        }
23160
23161        subClass.prototype = Object.create(superClass && superClass.prototype, {
23162          constructor: {
23163            value: subClass,
23164            writable: true,
23165            configurable: true
23166          }
23167        });
23168        if (superClass) _setPrototypeOf(subClass, superClass);
23169      }
23170
23171      function _setPrototypeOf(o, p) {
23172        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
23173          o.__proto__ = p;
23174          return o;
23175        };
23176
23177        return _setPrototypeOf(o, p);
23178      }
23179
23180      function _createSuper(Derived) {
23181        return function () {
23182          var Super = _getPrototypeOf(Derived),
23183              result;
23184
23185          if (_isNativeReflectConstruct()) {
23186            var NewTarget = _getPrototypeOf(this).constructor;
23187
23188            result = Reflect.construct(Super, arguments, NewTarget);
23189          } else {
23190            result = Super.apply(this, arguments);
23191          }
23192
23193          return _possibleConstructorReturn(this, result);
23194        };
23195      }
23196
23197      function _possibleConstructorReturn(self, call) {
23198        if (call && (_typeof(call) === "object" || typeof call === "function")) {
23199          return call;
23200        }
23201
23202        return _assertThisInitialized(self);
23203      }
23204
23205      function _assertThisInitialized(self) {
23206        if (self === void 0) {
23207          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
23208        }
23209
23210        return self;
23211      }
23212
23213      function _isNativeReflectConstruct() {
23214        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
23215        if (Reflect.construct.sham) return false;
23216        if (typeof Proxy === "function") return true;
23217
23218        try {
23219          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
23220          return true;
23221        } catch (e) {
23222          return false;
23223        }
23224      }
23225
23226      function _getPrototypeOf(o) {
23227        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
23228          return o.__proto__ || Object.getPrototypeOf(o);
23229        };
23230        return _getPrototypeOf(o);
23231      }
23232
23233      var BaseXform = require('../base-xform');
23234
23235      var DrawingXform = /*#__PURE__*/function (_BaseXform) {
23236        _inherits(DrawingXform, _BaseXform);
23237
23238        var _super = _createSuper(DrawingXform);
23239
23240        function DrawingXform() {
23241          _classCallCheck(this, DrawingXform);
23242
23243          return _super.apply(this, arguments);
23244        }
23245
23246        _createClass(DrawingXform, [{
23247          key: "render",
23248          value: function render(xmlStream, model) {
23249            if (model) {
23250              xmlStream.leafNode(this.tag, {
23251                'r:id': model.rId
23252              });
23253            }
23254          }
23255        }, {
23256          key: "parseOpen",
23257          value: function parseOpen(node) {
23258            switch (node.name) {
23259              case this.tag:
23260                this.model = {
23261                  rId: node.attributes['r:id']
23262                };
23263                return true;
23264
23265              default:
23266                return false;
23267            }
23268          }
23269        }, {
23270          key: "parseText",
23271          value: function parseText() {}
23272        }, {
23273          key: "parseClose",
23274          value: function parseClose() {
23275            return false;
23276          }
23277        }, {
23278          key: "tag",
23279          get: function get() {
23280            return 'drawing';
23281          }
23282        }]);
23283
23284        return DrawingXform;
23285      }(BaseXform);
23286
23287      module.exports = DrawingXform;
23288    }, {
23289      "../base-xform": 29
23290    }],
23291    93: [function (require, module, exports) {
23292      "use strict";
23293
23294      function _typeof(obj) {
23295        "@babel/helpers - typeof";
23296
23297        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
23298          _typeof = function _typeof(obj) {
23299            return typeof obj;
23300          };
23301        } else {
23302          _typeof = function _typeof(obj) {
23303            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
23304          };
23305        }
23306
23307        return _typeof(obj);
23308      }
23309
23310      function _classCallCheck(instance, Constructor) {
23311        if (!(instance instanceof Constructor)) {
23312          throw new TypeError("Cannot call a class as a function");
23313        }
23314      }
23315
23316      function _defineProperties(target, props) {
23317        for (var i = 0; i < props.length; i++) {
23318          var descriptor = props[i];
23319          descriptor.enumerable = descriptor.enumerable || false;
23320          descriptor.configurable = true;
23321          if ("value" in descriptor) descriptor.writable = true;
23322          Object.defineProperty(target, descriptor.key, descriptor);
23323        }
23324      }
23325
23326      function _createClass(Constructor, protoProps, staticProps) {
23327        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
23328        if (staticProps) _defineProperties(Constructor, staticProps);
23329        return Constructor;
23330      }
23331
23332      function _inherits(subClass, superClass) {
23333        if (typeof superClass !== "function" && superClass !== null) {
23334          throw new TypeError("Super expression must either be null or a function");
23335        }
23336
23337        subClass.prototype = Object.create(superClass && superClass.prototype, {
23338          constructor: {
23339            value: subClass,
23340            writable: true,
23341            configurable: true
23342          }
23343        });
23344        if (superClass) _setPrototypeOf(subClass, superClass);
23345      }
23346
23347      function _setPrototypeOf(o, p) {
23348        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
23349          o.__proto__ = p;
23350          return o;
23351        };
23352
23353        return _setPrototypeOf(o, p);
23354      }
23355
23356      function _createSuper(Derived) {
23357        return function () {
23358          var Super = _getPrototypeOf(Derived),
23359              result;
23360
23361          if (_isNativeReflectConstruct()) {
23362            var NewTarget = _getPrototypeOf(this).constructor;
23363
23364            result = Reflect.construct(Super, arguments, NewTarget);
23365          } else {
23366            result = Super.apply(this, arguments);
23367          }
23368
23369          return _possibleConstructorReturn(this, result);
23370        };
23371      }
23372
23373      function _possibleConstructorReturn(self, call) {
23374        if (call && (_typeof(call) === "object" || typeof call === "function")) {
23375          return call;
23376        }
23377
23378        return _assertThisInitialized(self);
23379      }
23380
23381      function _assertThisInitialized(self) {
23382        if (self === void 0) {
23383          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
23384        }
23385
23386        return self;
23387      }
23388
23389      function _isNativeReflectConstruct() {
23390        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
23391        if (Reflect.construct.sham) return false;
23392        if (typeof Proxy === "function") return true;
23393
23394        try {
23395          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
23396          return true;
23397        } catch (e) {
23398          return false;
23399        }
23400      }
23401
23402      function _getPrototypeOf(o) {
23403        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
23404          return o.__proto__ || Object.getPrototypeOf(o);
23405        };
23406        return _getPrototypeOf(o);
23407      }
23408      /* eslint-disable max-classes-per-file */
23409
23410
23411      var CompositeXform = require('../composite-xform');
23412
23413      var ConditionalFormattingsExt = require('./cf-ext/conditional-formattings-ext-xform');
23414
23415      var ExtXform = /*#__PURE__*/function (_CompositeXform) {
23416        _inherits(ExtXform, _CompositeXform);
23417
23418        var _super = _createSuper(ExtXform);
23419
23420        function ExtXform() {
23421          var _this;
23422
23423          _classCallCheck(this, ExtXform);
23424
23425          _this = _super.call(this);
23426          _this.map = {
23427            'x14:conditionalFormattings': _this.conditionalFormattings = new ConditionalFormattingsExt()
23428          };
23429          return _this;
23430        }
23431
23432        _createClass(ExtXform, [{
23433          key: "hasContent",
23434          value: function hasContent(model) {
23435            return this.conditionalFormattings.hasContent(model.conditionalFormattings);
23436          }
23437        }, {
23438          key: "prepare",
23439          value: function prepare(model, options) {
23440            this.conditionalFormattings.prepare(model.conditionalFormattings, options);
23441          }
23442        }, {
23443          key: "render",
23444          value: function render(xmlStream, model) {
23445            xmlStream.openNode('ext', {
23446              uri: '{78C0D931-6437-407d-A8EE-F0AAD7539E65}',
23447              'xmlns:x14': 'http://schemas.microsoft.com/office/spreadsheetml/2009/9/main'
23448            });
23449            this.conditionalFormattings.render(xmlStream, model.conditionalFormattings);
23450            xmlStream.closeNode();
23451          }
23452        }, {
23453          key: "createNewModel",
23454          value: function createNewModel() {
23455            return {};
23456          }
23457        }, {
23458          key: "onParserClose",
23459          value: function onParserClose(name, parser) {
23460            this.model[name] = parser.model;
23461          }
23462        }, {
23463          key: "tag",
23464          get: function get() {
23465            return 'ext';
23466          }
23467        }]);
23468
23469        return ExtXform;
23470      }(CompositeXform);
23471
23472      var ExtLstXform = /*#__PURE__*/function (_CompositeXform2) {
23473        _inherits(ExtLstXform, _CompositeXform2);
23474
23475        var _super2 = _createSuper(ExtLstXform);
23476
23477        function ExtLstXform() {
23478          var _this2;
23479
23480          _classCallCheck(this, ExtLstXform);
23481
23482          _this2 = _super2.call(this);
23483          _this2.map = {
23484            ext: _this2.ext = new ExtXform()
23485          };
23486          return _this2;
23487        }
23488
23489        _createClass(ExtLstXform, [{
23490          key: "prepare",
23491          value: function prepare(model, options) {
23492            this.ext.prepare(model, options);
23493          }
23494        }, {
23495          key: "hasContent",
23496          value: function hasContent(model) {
23497            return this.ext.hasContent(model);
23498          }
23499        }, {
23500          key: "render",
23501          value: function render(xmlStream, model) {
23502            if (!this.hasContent(model)) {
23503              return;
23504            }
23505
23506            xmlStream.openNode('extLst');
23507            this.ext.render(xmlStream, model);
23508            xmlStream.closeNode();
23509          }
23510        }, {
23511          key: "createNewModel",
23512          value: function createNewModel() {
23513            return {};
23514          }
23515        }, {
23516          key: "onParserClose",
23517          value: function onParserClose(name, parser) {
23518            Object.assign(this.model, parser.model);
23519          }
23520        }, {
23521          key: "tag",
23522          get: function get() {
23523            return 'extLst';
23524          }
23525        }]);
23526
23527        return ExtLstXform;
23528      }(CompositeXform);
23529
23530      module.exports = ExtLstXform;
23531    }, {
23532      "../composite-xform": 45,
23533      "./cf-ext/conditional-formattings-ext-xform": 75
23534    }],
23535    94: [function (require, module, exports) {
23536      "use strict";
23537
23538      function _typeof(obj) {
23539        "@babel/helpers - typeof";
23540
23541        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
23542          _typeof = function _typeof(obj) {
23543            return typeof obj;
23544          };
23545        } else {
23546          _typeof = function _typeof(obj) {
23547            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
23548          };
23549        }
23550
23551        return _typeof(obj);
23552      }
23553
23554      function _classCallCheck(instance, Constructor) {
23555        if (!(instance instanceof Constructor)) {
23556          throw new TypeError("Cannot call a class as a function");
23557        }
23558      }
23559
23560      function _defineProperties(target, props) {
23561        for (var i = 0; i < props.length; i++) {
23562          var descriptor = props[i];
23563          descriptor.enumerable = descriptor.enumerable || false;
23564          descriptor.configurable = true;
23565          if ("value" in descriptor) descriptor.writable = true;
23566          Object.defineProperty(target, descriptor.key, descriptor);
23567        }
23568      }
23569
23570      function _createClass(Constructor, protoProps, staticProps) {
23571        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
23572        if (staticProps) _defineProperties(Constructor, staticProps);
23573        return Constructor;
23574      }
23575
23576      function _inherits(subClass, superClass) {
23577        if (typeof superClass !== "function" && superClass !== null) {
23578          throw new TypeError("Super expression must either be null or a function");
23579        }
23580
23581        subClass.prototype = Object.create(superClass && superClass.prototype, {
23582          constructor: {
23583            value: subClass,
23584            writable: true,
23585            configurable: true
23586          }
23587        });
23588        if (superClass) _setPrototypeOf(subClass, superClass);
23589      }
23590
23591      function _setPrototypeOf(o, p) {
23592        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
23593          o.__proto__ = p;
23594          return o;
23595        };
23596
23597        return _setPrototypeOf(o, p);
23598      }
23599
23600      function _createSuper(Derived) {
23601        return function () {
23602          var Super = _getPrototypeOf(Derived),
23603              result;
23604
23605          if (_isNativeReflectConstruct()) {
23606            var NewTarget = _getPrototypeOf(this).constructor;
23607
23608            result = Reflect.construct(Super, arguments, NewTarget);
23609          } else {
23610            result = Super.apply(this, arguments);
23611          }
23612
23613          return _possibleConstructorReturn(this, result);
23614        };
23615      }
23616
23617      function _possibleConstructorReturn(self, call) {
23618        if (call && (_typeof(call) === "object" || typeof call === "function")) {
23619          return call;
23620        }
23621
23622        return _assertThisInitialized(self);
23623      }
23624
23625      function _assertThisInitialized(self) {
23626        if (self === void 0) {
23627          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
23628        }
23629
23630        return self;
23631      }
23632
23633      function _isNativeReflectConstruct() {
23634        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
23635        if (Reflect.construct.sham) return false;
23636        if (typeof Proxy === "function") return true;
23637
23638        try {
23639          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
23640          return true;
23641        } catch (e) {
23642          return false;
23643        }
23644      }
23645
23646      function _getPrototypeOf(o) {
23647        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
23648          return o.__proto__ || Object.getPrototypeOf(o);
23649        };
23650        return _getPrototypeOf(o);
23651      }
23652
23653      var BaseXform = require('../base-xform');
23654
23655      var HeaderFooterXform = /*#__PURE__*/function (_BaseXform) {
23656        _inherits(HeaderFooterXform, _BaseXform);
23657
23658        var _super = _createSuper(HeaderFooterXform);
23659
23660        function HeaderFooterXform() {
23661          _classCallCheck(this, HeaderFooterXform);
23662
23663          return _super.apply(this, arguments);
23664        }
23665
23666        _createClass(HeaderFooterXform, [{
23667          key: "render",
23668          value: function render(xmlStream, model) {
23669            if (model) {
23670              xmlStream.addRollback();
23671              var createTag = false;
vendor: 4,373 bytes, lines 23672-23813
23672              xmlStream.openNode('headerFooter');
23673
23674              if (model.differentFirst) {
23675                xmlStream.addAttribute('differentFirst', '1');
23676                createTag = true;
23677              }
23678
23679              if (model.differentOddEven) {
23680                xmlStream.addAttribute('differentOddEven', '1');
23681                createTag = true;
23682              }
23683
23684              if (model.oddHeader && typeof model.oddHeader === 'string') {
23685                xmlStream.leafNode('oddHeader', null, model.oddHeader);
23686                createTag = true;
23687              }
23688
23689              if (model.oddFooter && typeof model.oddFooter === 'string') {
23690                xmlStream.leafNode('oddFooter', null, model.oddFooter);
23691                createTag = true;
23692              }
23693
23694              if (model.evenHeader && typeof model.evenHeader === 'string') {
23695                xmlStream.leafNode('evenHeader', null, model.evenHeader);
23696                createTag = true;
23697              }
23698
23699              if (model.evenFooter && typeof model.evenFooter === 'string') {
23700                xmlStream.leafNode('evenFooter', null, model.evenFooter);
23701                createTag = true;
23702              }
23703
23704              if (model.firstHeader && typeof model.firstHeader === 'string') {
23705                xmlStream.leafNode('firstHeader', null, model.firstHeader);
23706                createTag = true;
23707              }
23708
23709              if (model.firstFooter && typeof model.firstFooter === 'string') {
23710                xmlStream.leafNode('firstFooter', null, model.firstFooter);
23711                createTag = true;
23712              }
23713
23714              if (createTag) {
23715                xmlStream.closeNode();
23716                xmlStream.commit();
23717              } else {
23718                xmlStream.rollback();
23719              }
23720            }
23721          }
23722        }, {
23723          key: "parseOpen",
23724          value: function parseOpen(node) {
23725            switch (node.name) {
23726              case 'headerFooter':
23727                this.model = {};
23728
23729                if (node.attributes.differentFirst) {
23730                  this.model.differentFirst = parseInt(node.attributes.differentFirst, 0) === 1;
23731                }
23732
23733                if (node.attributes.differentOddEven) {
23734                  this.model.differentOddEven = parseInt(node.attributes.differentOddEven, 0) === 1;
23735                }
23736
23737                return true;
23738
23739              case 'oddHeader':
23740                this.currentNode = 'oddHeader';
23741                return true;
23742
23743              case 'oddFooter':
23744                this.currentNode = 'oddFooter';
23745                return true;
23746
23747              case 'evenHeader':
23748                this.currentNode = 'evenHeader';
23749                return true;
23750
23751              case 'evenFooter':
23752                this.currentNode = 'evenFooter';
23753                return true;
23754
23755              case 'firstHeader':
23756                this.currentNode = 'firstHeader';
23757                return true;
23758
23759              case 'firstFooter':
23760                this.currentNode = 'firstFooter';
23761                return true;
23762
23763              default:
23764                return false;
23765            }
23766          }
23767        }, {
23768          key: "parseText",
23769          value: function parseText(text) {
23770            switch (this.currentNode) {
23771              case 'oddHeader':
23772                this.model.oddHeader = text;
23773                break;
23774
23775              case 'oddFooter':
23776                this.model.oddFooter = text;
23777                break;
23778
23779              case 'evenHeader':
23780                this.model.evenHeader = text;
23781                break;
23782
23783              case 'evenFooter':
23784                this.model.evenFooter = text;
23785                break;
23786
23787              case 'firstHeader':
23788                this.model.firstHeader = text;
23789                break;
23790
23791              case 'firstFooter':
23792                this.model.firstFooter = text;
23793                break;
23794
23795              default:
23796                break;
23797            }
23798          }
23799        }, {
23800          key: "parseClose",
23801          value: function parseClose() {
23802            switch (this.currentNode) {
23803              case 'oddHeader':
23804              case 'oddFooter':
23805              case 'evenHeader':
23806              case 'evenFooter':
23807              case 'firstHeader':
23808              case 'firstFooter':
23809                this.currentNode = undefined;
23810                return true;
23811
23812              default:
23813                return false;
23814            }
23815          }
23816        }, {
23817          key: "tag",
23818          get: function get() {
23819            return 'headerFooter';
23820          }
23821        }]);
23822
23823        return HeaderFooterXform;
23824      }(BaseXform);
23825
23826      module.exports = HeaderFooterXform;
23827    }, {
23828      "../base-xform": 29
23829    }],
23830    95: [function (require, module, exports) {
23831      "use strict";
23832
23833      function _typeof(obj) {
23834        "@babel/helpers - typeof";
23835
23836        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
23837          _typeof = function _typeof(obj) {
23838            return typeof obj;
23839          };
23840        } else {
23841          _typeof = function _typeof(obj) {
23842            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
23843          };
23844        }
23845
23846        return _typeof(obj);
23847      }
23848
23849      function _classCallCheck(instance, Constructor) {
23850        if (!(instance instanceof Constructor)) {
23851          throw new TypeError("Cannot call a class as a function");
23852        }
23853      }
23854
23855      function _defineProperties(target, props) {
23856        for (var i = 0; i < props.length; i++) {
23857          var descriptor = props[i];
23858          descriptor.enumerable = descriptor.enumerable || false;
23859          descriptor.configurable = true;
23860          if ("value" in descriptor) descriptor.writable = true;
23861          Object.defineProperty(target, descriptor.key, descriptor);
23862        }
23863      }
23864
23865      function _createClass(Constructor, protoProps, staticProps) {
23866        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
23867        if (staticProps) _defineProperties(Constructor, staticProps);
23868        return Constructor;
23869      }
23870
23871      function _inherits(subClass, superClass) {
23872        if (typeof superClass !== "function" && superClass !== null) {
23873          throw new TypeError("Super expression must either be null or a function");
23874        }
23875
23876        subClass.prototype = Object.create(superClass && superClass.prototype, {
23877          constructor: {
23878            value: subClass,
23879            writable: true,
23880            configurable: true
23881          }
23882        });
23883        if (superClass) _setPrototypeOf(subClass, superClass);
23884      }
23885
23886      function _setPrototypeOf(o, p) {
23887        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
23888          o.__proto__ = p;
23889          return o;
23890        };
23891
23892        return _setPrototypeOf(o, p);
23893      }
23894
23895      function _createSuper(Derived) {
23896        return function () {
23897          var Super = _getPrototypeOf(Derived),
23898              result;
23899
23900          if (_isNativeReflectConstruct()) {
23901            var NewTarget = _getPrototypeOf(this).constructor;
23902
23903            result = Reflect.construct(Super, arguments, NewTarget);
23904          } else {
23905            result = Super.apply(this, arguments);
23906          }
23907
23908          return _possibleConstructorReturn(this, result);
23909        };
23910      }
23911
23912      function _possibleConstructorReturn(self, call) {
23913        if (call && (_typeof(call) === "object" || typeof call === "function")) {
23914          return call;
23915        }
23916
23917        return _assertThisInitialized(self);
23918      }
23919
23920      function _assertThisInitialized(self) {
23921        if (self === void 0) {
23922          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
23923        }
23924
23925        return self;
23926      }
23927
23928      function _isNativeReflectConstruct() {
23929        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
23930        if (Reflect.construct.sham) return false;
23931        if (typeof Proxy === "function") return true;
23932
23933        try {
23934          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
23935          return true;
23936        } catch (e) {
23937          return false;
23938        }
23939      }
23940
23941      function _getPrototypeOf(o) {
23942        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
23943          return o.__proto__ || Object.getPrototypeOf(o);
23944        };
23945        return _getPrototypeOf(o);
23946      }
23947
23948      var BaseXform = require('../base-xform');
23949
23950      var HyperlinkXform = /*#__PURE__*/function (_BaseXform) {
23951        _inherits(HyperlinkXform, _BaseXform);
23952
23953        var _super = _createSuper(HyperlinkXform);
23954
23955        function HyperlinkXform() {
23956          _classCallCheck(this, HyperlinkXform);
23957
23958          return _super.apply(this, arguments);
23959        }
23960
23961        _createClass(HyperlinkXform, [{
23962          key: "render",
23963          value: function render(xmlStream, model) {
23964            xmlStream.leafNode('hyperlink', {
23965              ref: model.address,
23966              'r:id': model.rId,
23967              tooltip: model.tooltip
23968            });
23969          }
23970        }, {
23971          key: "parseOpen",
23972          value: function parseOpen(node) {
23973            if (node.name === 'hyperlink') {
23974              this.model = {
23975                address: node.attributes.ref,
23976                rId: node.attributes['r:id'],
23977                tooltip: node.attributes.tooltip
23978              };
23979              return true;
23980            }
23981
23982            return false;
23983          }
23984        }, {
23985          key: "parseText",
23986          value: function parseText() {}
23987        }, {
23988          key: "parseClose",
23989          value: function parseClose() {
23990            return false;
23991          }
23992        }, {
23993          key: "tag",
23994          get: function get() {
23995            return 'hyperlink';
23996          }
23997        }]);
23998
23999        return HyperlinkXform;
24000      }(BaseXform);
24001
24002      module.exports = HyperlinkXform;
24003    }, {
24004      "../base-xform": 29
24005    }],
24006    96: [function (require, module, exports) {
24007      "use strict";
24008
24009      function _typeof(obj) {
24010        "@babel/helpers - typeof";
24011
24012        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
24013          _typeof = function _typeof(obj) {
24014            return typeof obj;
24015          };
24016        } else {
24017          _typeof = function _typeof(obj) {
24018            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
24019          };
24020        }
24021
24022        return _typeof(obj);
24023      }
24024
24025      function _classCallCheck(instance, Constructor) {
24026        if (!(instance instanceof Constructor)) {
24027          throw new TypeError("Cannot call a class as a function");
24028        }
24029      }
24030
24031      function _defineProperties(target, props) {
24032        for (var i = 0; i < props.length; i++) {
24033          var descriptor = props[i];
24034          descriptor.enumerable = descriptor.enumerable || false;
24035          descriptor.configurable = true;
24036          if ("value" in descriptor) descriptor.writable = true;
24037          Object.defineProperty(target, descriptor.key, descriptor);
24038        }
24039      }
24040
24041      function _createClass(Constructor, protoProps, staticProps) {
24042        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
24043        if (staticProps) _defineProperties(Constructor, staticProps);
24044        return Constructor;
24045      }
24046
24047      function _inherits(subClass, superClass) {
24048        if (typeof superClass !== "function" && superClass !== null) {
24049          throw new TypeError("Super expression must either be null or a function");
24050        }
24051
24052        subClass.prototype = Object.create(superClass && superClass.prototype, {
24053          constructor: {
24054            value: subClass,
24055            writable: true,
24056            configurable: true
24057          }
24058        });
24059        if (superClass) _setPrototypeOf(subClass, superClass);
24060      }
24061
24062      function _setPrototypeOf(o, p) {
24063        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
24064          o.__proto__ = p;
24065          return o;
24066        };
24067
24068        return _setPrototypeOf(o, p);
24069      }
24070
24071      function _createSuper(Derived) {
24072        return function () {
24073          var Super = _getPrototypeOf(Derived),
24074              result;
24075
24076          if (_isNativeReflectConstruct()) {
24077            var NewTarget = _getPrototypeOf(this).constructor;
24078
24079            result = Reflect.construct(Super, arguments, NewTarget);
24080          } else {
24081            result = Super.apply(this, arguments);
24082          }
24083
24084          return _possibleConstructorReturn(this, result);
24085        };
24086      }
24087
24088      function _possibleConstructorReturn(self, call) {
24089        if (call && (_typeof(call) === "object" || typeof call === "function")) {
24090          return call;
24091        }
24092
24093        return _assertThisInitialized(self);
24094      }
24095
24096      function _assertThisInitialized(self) {
24097        if (self === void 0) {
24098          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
24099        }
24100
24101        return self;
24102      }
24103
24104      function _isNativeReflectConstruct() {
24105        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
24106        if (Reflect.construct.sham) return false;
24107        if (typeof Proxy === "function") return true;
24108
24109        try {
24110          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
24111          return true;
24112        } catch (e) {
24113          return false;
24114        }
24115      }
24116
24117      function _getPrototypeOf(o) {
24118        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
24119          return o.__proto__ || Object.getPrototypeOf(o);
24120        };
24121        return _getPrototypeOf(o);
24122      }
24123
24124      var BaseXform = require('../base-xform');
24125
24126      var MergeCellXform = /*#__PURE__*/function (_BaseXform) {
24127        _inherits(MergeCellXform, _BaseXform);
24128
24129        var _super = _createSuper(MergeCellXform);
24130
24131        function MergeCellXform() {
24132          _classCallCheck(this, MergeCellXform);
24133
24134          return _super.apply(this, arguments);
24135        }
24136
24137        _createClass(MergeCellXform, [{
24138          key: "render",
24139          value: function render(xmlStream, model) {
24140            xmlStream.leafNode('mergeCell', {
24141              ref: model
24142            });
24143          }
24144        }, {
24145          key: "parseOpen",
24146          value: function parseOpen(node) {
24147            if (node.name === 'mergeCell') {
24148              this.model = node.attributes.ref;
24149              return true;
24150            }
24151
24152            return false;
24153          }
24154        }, {
24155          key: "parseText",
24156          value: function parseText() {}
24157        }, {
24158          key: "parseClose",
24159          value: function parseClose() {
24160            return false;
24161          }
24162        }, {
24163          key: "tag",
24164          get: function get() {
24165            return 'mergeCell';
24166          }
24167        }]);
24168
24169        return MergeCellXform;
24170      }(BaseXform);
24171
24172      module.exports = MergeCellXform;
24173    }, {
24174      "../base-xform": 29
24175    }],
24176    97: [function (require, module, exports) {
24177      "use strict";
24178
24179      function _classCallCheck(instance, Constructor) {
24180        if (!(instance instanceof Constructor)) {
24181          throw new TypeError("Cannot call a class as a function");
24182        }
24183      }
24184
24185      function _defineProperties(target, props) {
24186        for (var i = 0; i < props.length; i++) {
24187          var descriptor = props[i];
24188          descriptor.enumerable = descriptor.enumerable || false;
24189          descriptor.configurable = true;
24190          if ("value" in descriptor) descriptor.writable = true;
24191          Object.defineProperty(target, descriptor.key, descriptor);
24192        }
24193      }
24194
24195      function _createClass(Constructor, protoProps, staticProps) {
24196        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
24197        if (staticProps) _defineProperties(Constructor, staticProps);
24198        return Constructor;
24199      }
24200
24201      var _ = require('../../../utils/under-dash');
24202
24203      var Range = require('../../../doc/range');
24204
24205      var colCache = require('../../../utils/col-cache');
24206
24207      var Enums = require('../../../doc/enums');
24208
24209      var Merges = /*#__PURE__*/function () {
24210        function Merges() {
24211          _classCallCheck(this, Merges); // optional mergeCells is array of ranges (like the xml)
24212
24213
24214          this.merges = {};
24215        }
24216
24217        _createClass(Merges, [{
24218          key: "add",
24219          value: function add(merge) {
24220            // merge is {address, master}
24221            if (this.merges[merge.master]) {
24222              this.merges[merge.master].expandToAddress(merge.address);
24223            } else {
24224              var range = "".concat(merge.master, ":").concat(merge.address);
24225              this.merges[merge.master] = new Range(range);
24226            }
24227          }
24228        }, {
24229          key: "reconcile",
24230          value: function reconcile(mergeCells, rows) {
24231            // reconcile merge list with merge cells
24232            _.each(mergeCells, function (merge) {
24233              var dimensions = colCache.decode(merge);
24234
24235              for (var i = dimensions.top; i <= dimensions.bottom; i++) {
24236                var row = rows[i - 1];
24237
24238                for (var j = dimensions.left; j <= dimensions.right; j++) {
24239                  var cell = row.cells[j - 1];
24240
24241                  if (!cell) {
24242                    // nulls are not included in document - so if master cell has no value - add a null one here
24243                    row.cells[j] = {
24244                      type: Enums.ValueType.Null,
24245                      address: colCache.encodeAddress(i, j)
24246                    };
24247                  } else if (cell.type === Enums.ValueType.Merge) {
24248                    cell.master = dimensions.tl;
24249                  }
24250                }
24251              }
24252            });
24253          }
24254        }, {
24255          key: "getMasterAddress",
24256          value: function getMasterAddress(address) {
24257            // if address has been merged, return its master's address. Assumes reconcile has been called
24258            var range = this.hash[address];
24259            return range && range.tl;
24260          }
24261        }, {
24262          key: "mergeCells",
24263          get: function get() {
24264            return _.map(this.merges, function (merge) {
24265              return merge.range;
24266            });
24267          }
24268        }]);
24269
24270        return Merges;
24271      }();
24272
24273      module.exports = Merges;
24274    }, {
24275      "../../../doc/enums": 7,
24276      "../../../doc/range": 10,
24277      "../../../utils/col-cache": 17,
24278      "../../../utils/under-dash": 23
24279    }],
24280    98: [function (require, module, exports) {
24281      "use strict";
24282
24283      function _typeof(obj) {
24284        "@babel/helpers - typeof";
24285
24286        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
24287          _typeof = function _typeof(obj) {
24288            return typeof obj;
24289          };
24290        } else {
24291          _typeof = function _typeof(obj) {
24292            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
24293          };
24294        }
24295
24296        return _typeof(obj);
24297      }
24298
24299      function _classCallCheck(instance, Constructor) {
24300        if (!(instance instanceof Constructor)) {
24301          throw new TypeError("Cannot call a class as a function");
24302        }
24303      }
24304
24305      function _defineProperties(target, props) {
24306        for (var i = 0; i < props.length; i++) {
24307          var descriptor = props[i];
24308          descriptor.enumerable = descriptor.enumerable || false;
24309          descriptor.configurable = true;
24310          if ("value" in descriptor) descriptor.writable = true;
24311          Object.defineProperty(target, descriptor.key, descriptor);
24312        }
24313      }
24314
24315      function _createClass(Constructor, protoProps, staticProps) {
24316        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
24317        if (staticProps) _defineProperties(Constructor, staticProps);
24318        return Constructor;
24319      }
24320
24321      function _inherits(subClass, superClass) {
24322        if (typeof superClass !== "function" && superClass !== null) {
24323          throw new TypeError("Super expression must either be null or a function");
24324        }
24325
24326        subClass.prototype = Object.create(superClass && superClass.prototype, {
24327          constructor: {
24328            value: subClass,
24329            writable: true,
24330            configurable: true
24331          }
24332        });
24333        if (superClass) _setPrototypeOf(subClass, superClass);
24334      }
24335
24336      function _setPrototypeOf(o, p) {
24337        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
24338          o.__proto__ = p;
24339          return o;
24340        };
24341
24342        return _setPrototypeOf(o, p);
24343      }
24344
24345      function _createSuper(Derived) {
24346        return function () {
24347          var Super = _getPrototypeOf(Derived),
24348              result;
24349
24350          if (_isNativeReflectConstruct()) {
24351            var NewTarget = _getPrototypeOf(this).constructor;
24352
24353            result = Reflect.construct(Super, arguments, NewTarget);
24354          } else {
24355            result = Super.apply(this, arguments);
24356          }
24357
24358          return _possibleConstructorReturn(this, result);
24359        };
24360      }
24361
24362      function _possibleConstructorReturn(self, call) {
24363        if (call && (_typeof(call) === "object" || typeof call === "function")) {
24364          return call;
24365        }
24366
24367        return _assertThisInitialized(self);
24368      }
24369
24370      function _assertThisInitialized(self) {
24371        if (self === void 0) {
24372          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
24373        }
24374
24375        return self;
24376      }
24377
24378      function _isNativeReflectConstruct() {
24379        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
24380        if (Reflect.construct.sham) return false;
24381        if (typeof Proxy === "function") return true;
24382
24383        try {
24384          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
24385          return true;
24386        } catch (e) {
24387          return false;
24388        }
24389      }
24390
24391      function _getPrototypeOf(o) {
24392        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
24393          return o.__proto__ || Object.getPrototypeOf(o);
24394        };
24395        return _getPrototypeOf(o);
24396      }
24397
24398      var BaseXform = require('../base-xform');
24399
24400      var isDefined = function isDefined(attr) {
24401        return typeof attr !== 'undefined';
24402      };
24403
24404      var OutlinePropertiesXform = /*#__PURE__*/function (_BaseXform) {
24405        _inherits(OutlinePropertiesXform, _BaseXform);
24406
24407        var _super = _createSuper(OutlinePropertiesXform);
24408
24409        function OutlinePropertiesXform() {
24410          _classCallCheck(this, OutlinePropertiesXform);
24411
24412          return _super.apply(this, arguments);
24413        }
24414
24415        _createClass(OutlinePropertiesXform, [{
24416          key: "render",
24417          value: function render(xmlStream, model) {
24418            if (model && (isDefined(model.summaryBelow) || isDefined(model.summaryRight))) {
24419              xmlStream.leafNode(this.tag, {
24420                summaryBelow: isDefined(model.summaryBelow) ? Number(model.summaryBelow) : undefined,
24421                summaryRight: isDefined(model.summaryRight) ? Number(model.summaryRight) : undefined
24422              });
24423              return true;
24424            }
24425
24426            return false;
24427          }
24428        }, {
24429          key: "parseOpen",
24430          value: function parseOpen(node) {
24431            if (node.name === this.tag) {
24432              this.model = {
24433                summaryBelow: isDefined(node.attributes.summaryBelow) ? Boolean(Number(node.attributes.summaryBelow)) : undefined,
24434                summaryRight: isDefined(node.attributes.summaryRight) ? Boolean(Number(node.attributes.summaryRight)) : undefined
24435              };
24436              return true;
24437            }
24438
24439            return false;
24440          }
24441        }, {
24442          key: "parseText",
24443          value: function parseText() {}
24444        }, {
24445          key: "parseClose",
24446          value: function parseClose() {
24447            return false;
24448          }
24449        }, {
24450          key: "tag",
24451          get: function get() {
24452            return 'outlinePr';
24453          }
24454        }]);
24455
24456        return OutlinePropertiesXform;
24457      }(BaseXform);
24458
24459      module.exports = OutlinePropertiesXform;
24460    }, {
24461      "../base-xform": 29
24462    }],
24463    99: [function (require, module, exports) {
24464      "use strict";
24465
24466      function _typeof(obj) {
24467        "@babel/helpers - typeof";
24468
24469        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
24470          _typeof = function _typeof(obj) {
24471            return typeof obj;
24472          };
24473        } else {
24474          _typeof = function _typeof(obj) {
24475            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
24476          };
24477        }
24478
24479        return _typeof(obj);
24480      }
24481
24482      function _classCallCheck(instance, Constructor) {
24483        if (!(instance instanceof Constructor)) {
24484          throw new TypeError("Cannot call a class as a function");
24485        }
24486      }
24487
24488      function _defineProperties(target, props) {
24489        for (var i = 0; i < props.length; i++) {
24490          var descriptor = props[i];
24491          descriptor.enumerable = descriptor.enumerable || false;
24492          descriptor.configurable = true;
24493          if ("value" in descriptor) descriptor.writable = true;
24494          Object.defineProperty(target, descriptor.key, descriptor);
24495        }
24496      }
24497
24498      function _createClass(Constructor, protoProps, staticProps) {
24499        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
24500        if (staticProps) _defineProperties(Constructor, staticProps);
24501        return Constructor;
24502      }
24503
24504      function _inherits(subClass, superClass) {
24505        if (typeof superClass !== "function" && superClass !== null) {
24506          throw new TypeError("Super expression must either be null or a function");
24507        }
24508
24509        subClass.prototype = Object.create(superClass && superClass.prototype, {
24510          constructor: {
24511            value: subClass,
24512            writable: true,
24513            configurable: true
24514          }
24515        });
24516        if (superClass) _setPrototypeOf(subClass, superClass);
24517      }
24518
24519      function _setPrototypeOf(o, p) {
24520        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
24521          o.__proto__ = p;
24522          return o;
24523        };
24524
24525        return _setPrototypeOf(o, p);
24526      }
24527
24528      function _createSuper(Derived) {
24529        return function () {
24530          var Super = _getPrototypeOf(Derived),
24531              result;
24532
24533          if (_isNativeReflectConstruct()) {
24534            var NewTarget = _getPrototypeOf(this).constructor;
24535
24536            result = Reflect.construct(Super, arguments, NewTarget);
24537          } else {
24538            result = Super.apply(this, arguments);
24539          }
24540
24541          return _possibleConstructorReturn(this, result);
24542        };
24543      }
24544
24545      function _possibleConstructorReturn(self, call) {
24546        if (call && (_typeof(call) === "object" || typeof call === "function")) {
24547          return call;
24548        }
24549
24550        return _assertThisInitialized(self);
24551      }
24552
24553      function _assertThisInitialized(self) {
24554        if (self === void 0) {
24555          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
24556        }
24557
24558        return self;
24559      }
24560
24561      function _isNativeReflectConstruct() {
24562        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
24563        if (Reflect.construct.sham) return false;
24564        if (typeof Proxy === "function") return true;
24565
24566        try {
24567          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
24568          return true;
24569        } catch (e) {
24570          return false;
24571        }
24572      }
24573
24574      function _getPrototypeOf(o) {
24575        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
24576          return o.__proto__ || Object.getPrototypeOf(o);
24577        };
24578        return _getPrototypeOf(o);
24579      }
24580
24581      var BaseXform = require('../base-xform');
24582
24583      var PageBreaksXform = /*#__PURE__*/function (_BaseXform) {
24584        _inherits(PageBreaksXform, _BaseXform);
24585
24586        var _super = _createSuper(PageBreaksXform);
24587
24588        function PageBreaksXform() {
24589          _classCallCheck(this, PageBreaksXform);
24590
24591          return _super.apply(this, arguments);
24592        }
24593
24594        _createClass(PageBreaksXform, [{
24595          key: "render",
24596          value: function render(xmlStream, model) {
24597            xmlStream.leafNode('brk', model);
24598          }
24599        }, {
24600          key: "parseOpen",
24601          value: function parseOpen(node) {
24602            if (node.name === 'brk') {
24603              this.model = node.attributes.ref;
24604              return true;
24605            }
24606
24607            return false;
24608          }
24609        }, {
24610          key: "parseText",
24611          value: function parseText() {}
24612        }, {
24613          key: "parseClose",
24614          value: function parseClose() {
24615            return false;
24616          }
24617        }, {
24618          key: "tag",
24619          get: function get() {
24620            return 'brk';
24621          }
24622        }]);
24623
24624        return PageBreaksXform;
24625      }(BaseXform);
24626
24627      module.exports = PageBreaksXform;
24628    }, {
24629      "../base-xform": 29
24630    }],
24631    100: [function (require, module, exports) {
24632      "use strict";
24633
24634      function _typeof(obj) {
24635        "@babel/helpers - typeof";
24636
24637        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
24638          _typeof = function _typeof(obj) {
24639            return typeof obj;
24640          };
24641        } else {
24642          _typeof = function _typeof(obj) {
24643            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
24644          };
24645        }
24646
24647        return _typeof(obj);
24648      }
24649
24650      function _classCallCheck(instance, Constructor) {
24651        if (!(instance instanceof Constructor)) {
24652          throw new TypeError("Cannot call a class as a function");
24653        }
24654      }
24655
24656      function _defineProperties(target, props) {
24657        for (var i = 0; i < props.length; i++) {
24658          var descriptor = props[i];
24659          descriptor.enumerable = descriptor.enumerable || false;
24660          descriptor.configurable = true;
24661          if ("value" in descriptor) descriptor.writable = true;
24662          Object.defineProperty(target, descriptor.key, descriptor);
24663        }
24664      }
24665
24666      function _createClass(Constructor, protoProps, staticProps) {
24667        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
24668        if (staticProps) _defineProperties(Constructor, staticProps);
24669        return Constructor;
24670      }
24671
24672      function _inherits(subClass, superClass) {
24673        if (typeof superClass !== "function" && superClass !== null) {
24674          throw new TypeError("Super expression must either be null or a function");
24675        }
24676
24677        subClass.prototype = Object.create(superClass && superClass.prototype, {
24678          constructor: {
24679            value: subClass,
24680            writable: true,
24681            configurable: true
24682          }
24683        });
24684        if (superClass) _setPrototypeOf(subClass, superClass);
24685      }
24686
24687      function _setPrototypeOf(o, p) {
24688        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
24689          o.__proto__ = p;
24690          return o;
24691        };
24692
24693        return _setPrototypeOf(o, p);
24694      }
24695
24696      function _createSuper(Derived) {
24697        return function () {
24698          var Super = _getPrototypeOf(Derived),
24699              result;
24700
24701          if (_isNativeReflectConstruct()) {
24702            var NewTarget = _getPrototypeOf(this).constructor;
24703
24704            result = Reflect.construct(Super, arguments, NewTarget);
24705          } else {
24706            result = Super.apply(this, arguments);
24707          }
24708
24709          return _possibleConstructorReturn(this, result);
24710        };
24711      }
24712
24713      function _possibleConstructorReturn(self, call) {
24714        if (call && (_typeof(call) === "object" || typeof call === "function")) {
24715          return call;
24716        }
24717
24718        return _assertThisInitialized(self);
24719      }
24720
24721      function _assertThisInitialized(self) {
24722        if (self === void 0) {
24723          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
24724        }
24725
24726        return self;
24727      }
24728
24729      function _isNativeReflectConstruct() {
24730        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
24731        if (Reflect.construct.sham) return false;
24732        if (typeof Proxy === "function") return true;
24733
24734        try {
24735          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
24736          return true;
24737        } catch (e) {
24738          return false;
24739        }
24740      }
24741
24742      function _getPrototypeOf(o) {
24743        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
24744          return o.__proto__ || Object.getPrototypeOf(o);
24745        };
24746        return _getPrototypeOf(o);
24747      }
24748
24749      var _ = require('../../../utils/under-dash');
24750
24751      var BaseXform = require('../base-xform');
24752
24753      var PageMarginsXform = /*#__PURE__*/function (_BaseXform) {
24754        _inherits(PageMarginsXform, _BaseXform);
24755
24756        var _super = _createSuper(PageMarginsXform);
24757
24758        function PageMarginsXform() {
24759          _classCallCheck(this, PageMarginsXform);
24760
24761          return _super.apply(this, arguments);
24762        }
24763
24764        _createClass(PageMarginsXform, [{
24765          key: "render",
24766          value: function render(xmlStream, model) {
24767            if (model) {
24768              var attributes = {
24769                left: model.left,
24770                right: model.right,
24771                top: model.top,
24772                bottom: model.bottom,
24773                header: model.header,
24774                footer: model.footer
24775              };
24776
24777              if (_.some(attributes, function (value) {
24778                return value !== undefined;
24779              })) {
24780                xmlStream.leafNode(this.tag, attributes);
24781              }
24782            }
24783          }
24784        }, {
24785          key: "parseOpen",
24786          value: function parseOpen(node) {
24787            switch (node.name) {
24788              case this.tag:
24789                this.model = {
24790                  left: parseFloat(node.attributes.left || 0.7),
24791                  right: parseFloat(node.attributes.right || 0.7),
24792                  top: parseFloat(node.attributes.top || 0.75),
24793                  bottom: parseFloat(node.attributes.bottom || 0.75),
24794                  header: parseFloat(node.attributes.header || 0.3),
24795                  footer: parseFloat(node.attributes.footer || 0.3)
24796                };
24797                return true;
24798
24799              default:
24800                return false;
24801            }
24802          }
24803        }, {
24804          key: "parseText",
24805          value: function parseText() {}
24806        }, {
24807          key: "parseClose",
24808          value: function parseClose() {
24809            return false;
24810          }
24811        }, {
24812          key: "tag",
24813          get: function get() {
24814            return 'pageMargins';
24815          }
24816        }]);
24817
24818        return PageMarginsXform;
24819      }(BaseXform);
24820
24821      module.exports = PageMarginsXform;
24822    }, {
24823      "../../../utils/under-dash": 23,
24824      "../base-xform": 29
24825    }],
24826    101: [function (require, module, exports) {
24827      "use strict";
24828
24829      function _typeof(obj) {
24830        "@babel/helpers - typeof";
24831
24832        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
24833          _typeof = function _typeof(obj) {
24834            return typeof obj;
24835          };
24836        } else {
24837          _typeof = function _typeof(obj) {
24838            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
24839          };
24840        }
24841
24842        return _typeof(obj);
24843      }
24844
24845      function _classCallCheck(instance, Constructor) {
24846        if (!(instance instanceof Constructor)) {
24847          throw new TypeError("Cannot call a class as a function");
24848        }
24849      }
24850
24851      function _defineProperties(target, props) {
24852        for (var i = 0; i < props.length; i++) {
24853          var descriptor = props[i];
24854          descriptor.enumerable = descriptor.enumerable || false;
24855          descriptor.configurable = true;
24856          if ("value" in descriptor) descriptor.writable = true;
24857          Object.defineProperty(target, descriptor.key, descriptor);
24858        }
24859      }
24860
24861      function _createClass(Constructor, protoProps, staticProps) {
24862        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
24863        if (staticProps) _defineProperties(Constructor, staticProps);
24864        return Constructor;
24865      }
24866
24867      function _inherits(subClass, superClass) {
24868        if (typeof superClass !== "function" && superClass !== null) {
24869          throw new TypeError("Super expression must either be null or a function");
24870        }
24871
24872        subClass.prototype = Object.create(superClass && superClass.prototype, {
24873          constructor: {
24874            value: subClass,
24875            writable: true,
24876            configurable: true
24877          }
24878        });
24879        if (superClass) _setPrototypeOf(subClass, superClass);
24880      }
24881
24882      function _setPrototypeOf(o, p) {
24883        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
24884          o.__proto__ = p;
24885          return o;
24886        };
24887
24888        return _setPrototypeOf(o, p);
24889      }
24890
24891      function _createSuper(Derived) {
24892        return function () {
24893          var Super = _getPrototypeOf(Derived),
24894              result;
24895
24896          if (_isNativeReflectConstruct()) {
24897            var NewTarget = _getPrototypeOf(this).constructor;
24898
24899            result = Reflect.construct(Super, arguments, NewTarget);
24900          } else {
24901            result = Super.apply(this, arguments);
24902          }
24903
24904          return _possibleConstructorReturn(this, result);
24905        };
24906      }
24907
24908      function _possibleConstructorReturn(self, call) {
24909        if (call && (_typeof(call) === "object" || typeof call === "function")) {
24910          return call;
24911        }
24912
24913        return _assertThisInitialized(self);
24914      }
24915
24916      function _assertThisInitialized(self) {
24917        if (self === void 0) {
24918          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
24919        }
24920
24921        return self;
24922      }
24923
24924      function _isNativeReflectConstruct() {
24925        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
24926        if (Reflect.construct.sham) return false;
24927        if (typeof Proxy === "function") return true;
24928
24929        try {
24930          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
24931          return true;
24932        } catch (e) {
24933          return false;
24934        }
24935      }
24936
24937      function _getPrototypeOf(o) {
24938        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
24939          return o.__proto__ || Object.getPrototypeOf(o);
24940        };
24941        return _getPrototypeOf(o);
24942      }
24943
24944      var BaseXform = require('../base-xform');
24945
24946      var PageSetupPropertiesXform = /*#__PURE__*/function (_BaseXform) {
24947        _inherits(PageSetupPropertiesXform, _BaseXform);
24948
24949        var _super = _createSuper(PageSetupPropertiesXform);
24950
24951        function PageSetupPropertiesXform() {
24952          _classCallCheck(this, PageSetupPropertiesXform);
24953
24954          return _super.apply(this, arguments);
24955        }
24956
24957        _createClass(PageSetupPropertiesXform, [{
24958          key: "render",
24959          value: function render(xmlStream, model) {
24960            if (model && model.fitToPage) {
24961              xmlStream.leafNode(this.tag, {
24962                fitToPage: model.fitToPage ? '1' : undefined
24963              });
24964              return true;
24965            }
24966
24967            return false;
24968          }
24969        }, {
24970          key: "parseOpen",
24971          value: function parseOpen(node) {
24972            if (node.name === this.tag) {
24973              this.model = {
24974                fitToPage: node.attributes.fitToPage === '1'
24975              };
24976              return true;
24977            }
24978
24979            return false;
24980          }
24981        }, {
24982          key: "parseText",
24983          value: function parseText() {}
24984        }, {
24985          key: "parseClose",
24986          value: function parseClose() {
24987            return false;
24988          }
24989        }, {
24990          key: "tag",
24991          get: function get() {
24992            return 'pageSetUpPr';
24993          }
24994        }]);
24995
24996        return PageSetupPropertiesXform;
24997      }(BaseXform);
24998
24999      module.exports = PageSetupPropertiesXform;
25000    }, {
25001      "../base-xform": 29
25002    }],
25003    102: [function (require, module, exports) {
25004      "use strict";
25005
25006      function _typeof(obj) {
25007        "@babel/helpers - typeof";
25008
25009        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
25010          _typeof = function _typeof(obj) {
25011            return typeof obj;
25012          };
25013        } else {
25014          _typeof = function _typeof(obj) {
25015            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
25016          };
25017        }
25018
25019        return _typeof(obj);
25020      }
25021
25022      function _classCallCheck(instance, Constructor) {
25023        if (!(instance instanceof Constructor)) {
25024          throw new TypeError("Cannot call a class as a function");
25025        }
25026      }
25027
25028      function _defineProperties(target, props) {
25029        for (var i = 0; i < props.length; i++) {
25030          var descriptor = props[i];
25031          descriptor.enumerable = descriptor.enumerable || false;
25032          descriptor.configurable = true;
25033          if ("value" in descriptor) descriptor.writable = true;
25034          Object.defineProperty(target, descriptor.key, descriptor);
25035        }
25036      }
25037
25038      function _createClass(Constructor, protoProps, staticProps) {
25039        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
25040        if (staticProps) _defineProperties(Constructor, staticProps);
25041        return Constructor;
25042      }
25043
25044      function _inherits(subClass, superClass) {
25045        if (typeof superClass !== "function" && superClass !== null) {
25046          throw new TypeError("Super expression must either be null or a function");
25047        }
25048
25049        subClass.prototype = Object.create(superClass && superClass.prototype, {
25050          constructor: {
25051            value: subClass,
25052            writable: true,
25053            configurable: true
25054          }
25055        });
25056        if (superClass) _setPrototypeOf(subClass, superClass);
25057      }
25058
25059      function _setPrototypeOf(o, p) {
25060        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
25061          o.__proto__ = p;
25062          return o;
25063        };
25064
25065        return _setPrototypeOf(o, p);
25066      }
25067
25068      function _createSuper(Derived) {
25069        return function () {
25070          var Super = _getPrototypeOf(Derived),
25071              result;
25072
25073          if (_isNativeReflectConstruct()) {
25074            var NewTarget = _getPrototypeOf(this).constructor;
25075
25076            result = Reflect.construct(Super, arguments, NewTarget);
25077          } else {
25078            result = Super.apply(this, arguments);
25079          }
25080
25081          return _possibleConstructorReturn(this, result);
25082        };
25083      }
25084
25085      function _possibleConstructorReturn(self, call) {
25086        if (call && (_typeof(call) === "object" || typeof call === "function")) {
25087          return call;
25088        }
25089
25090        return _assertThisInitialized(self);
25091      }
25092
25093      function _assertThisInitialized(self) {
25094        if (self === void 0) {
25095          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
25096        }
25097
25098        return self;
25099      }
25100
25101      function _isNativeReflectConstruct() {
25102        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
25103        if (Reflect.construct.sham) return false;
25104        if (typeof Proxy === "function") return true;
25105
25106        try {
25107          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
25108          return true;
25109        } catch (e) {
25110          return false;
25111        }
25112      }
25113
25114      function _getPrototypeOf(o) {
25115        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
25116          return o.__proto__ || Object.getPrototypeOf(o);
25117        };
25118        return _getPrototypeOf(o);
25119      }
25120
25121      var _ = require('../../../utils/under-dash');
25122
25123      var BaseXform = require('../base-xform');
25124
25125      function booleanToXml(model) {
25126        return model ? '1' : undefined;
25127      }
25128
25129      function pageOrderToXml(model) {
25130        switch (model) {
25131          case 'overThenDown':
25132            return model;
25133
25134          default:
25135            return undefined;
25136        }
25137      }
25138
25139      function cellCommentsToXml(model) {
25140        switch (model) {
25141          case 'atEnd':
25142          case 'asDisplyed':
25143            return model;
25144
25145          default:
25146            return undefined;
25147        }
25148      }
25149
25150      function errorsToXml(model) {
25151        switch (model) {
25152          case 'dash':
25153          case 'blank':
25154          case 'NA':
25155            return model;
25156
25157          default:
25158            return undefined;
25159        }
25160      }
25161
25162      function pageSizeToModel(value) {
25163        return value !== undefined ? parseInt(value, 10) : undefined;
25164      }
25165
25166      var PageSetupXform = /*#__PURE__*/function (_BaseXform) {
25167        _inherits(PageSetupXform, _BaseXform);
25168
25169        var _super = _createSuper(PageSetupXform);
25170
25171        function PageSetupXform() {
25172          _classCallCheck(this, PageSetupXform);
25173
25174          return _super.apply(this, arguments);
25175        }
25176
25177        _createClass(PageSetupXform, [{
25178          key: "render",
25179          value: function render(xmlStream, model) {
25180            if (model) {
25181              var attributes = {
25182                paperSize: model.paperSize,
25183                orientation: model.orientation,
25184                horizontalDpi: model.horizontalDpi,
25185                verticalDpi: model.verticalDpi,
25186                pageOrder: pageOrderToXml(model.pageOrder),
25187                blackAndWhite: booleanToXml(model.blackAndWhite),
25188                draft: booleanToXml(model.draft),
25189                cellComments: cellCommentsToXml(model.cellComments),
25190                errors: errorsToXml(model.errors),
25191                scale: model.scale,
25192                fitToWidth: model.fitToWidth,
25193                fitToHeight: model.fitToHeight,
25194                firstPageNumber: model.firstPageNumber,
25195                useFirstPageNumber: booleanToXml(model.firstPageNumber),
25196                usePrinterDefaults: booleanToXml(model.usePrinterDefaults),
25197                copies: model.copies
25198              };
25199
25200              if (_.some(attributes, function (value) {
25201                return value !== undefined;
25202              })) {
25203                xmlStream.leafNode(this.tag, attributes);
25204              }
25205            }
25206          }
25207        }, {
25208          key: "parseOpen",
25209          value: function parseOpen(node) {
25210            switch (node.name) {
25211              case this.tag:
25212                this.model = {
25213                  paperSize: pageSizeToModel(node.attributes.paperSize),
25214                  orientation: node.attributes.orientation || 'portrait',
25215                  horizontalDpi: parseInt(node.attributes.horizontalDpi || '4294967295', 10),
25216                  verticalDpi: parseInt(node.attributes.verticalDpi || '4294967295', 10),
25217                  pageOrder: node.attributes.pageOrder || 'downThenOver',
25218                  blackAndWhite: node.attributes.blackAndWhite === '1',
25219                  draft: node.attributes.draft === '1',
25220                  cellComments: node.attributes.cellComments || 'None',
25221                  errors: node.attributes.errors || 'displayed',
25222                  scale: parseInt(node.attributes.scale || '100', 10),
25223                  fitToWidth: parseInt(node.attributes.fitToWidth || '1', 10),
25224                  fitToHeight: parseInt(node.attributes.fitToHeight || '1', 10),
25225                  firstPageNumber: parseInt(node.attributes.firstPageNumber || '1', 10),
25226                  useFirstPageNumber: node.attributes.useFirstPageNumber === '1',
25227                  usePrinterDefaults: node.attributes.usePrinterDefaults === '1',
25228                  copies: parseInt(node.attributes.copies || '1', 10)
25229                };
25230                return true;
25231
25232              default:
25233                return false;
25234            }
25235          }
25236        }, {
25237          key: "parseText",
25238          value: function parseText() {}
25239        }, {
25240          key: "parseClose",
25241          value: function parseClose() {
25242            return false;
25243          }
25244        }, {
25245          key: "tag",
25246          get: function get() {
25247            return 'pageSetup';
25248          }
25249        }]);
25250
25251        return PageSetupXform;
25252      }(BaseXform);
25253
25254      module.exports = PageSetupXform;
25255    }, {
25256      "../../../utils/under-dash": 23,
25257      "../base-xform": 29
25258    }],
25259    103: [function (require, module, exports) {
25260      "use strict";
25261
25262      function _typeof(obj) {
25263        "@babel/helpers - typeof";
25264
25265        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
25266          _typeof = function _typeof(obj) {
25267            return typeof obj;
25268          };
25269        } else {
25270          _typeof = function _typeof(obj) {
25271            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
25272          };
25273        }
25274
25275        return _typeof(obj);
25276      }
25277
25278      function _classCallCheck(instance, Constructor) {
25279        if (!(instance instanceof Constructor)) {
25280          throw new TypeError("Cannot call a class as a function");
25281        }
25282      }
25283
25284      function _defineProperties(target, props) {
25285        for (var i = 0; i < props.length; i++) {
25286          var descriptor = props[i];
25287          descriptor.enumerable = descriptor.enumerable || false;
25288          descriptor.configurable = true;
25289          if ("value" in descriptor) descriptor.writable = true;
25290          Object.defineProperty(target, descriptor.key, descriptor);
25291        }
25292      }
25293
25294      function _createClass(Constructor, protoProps, staticProps) {
25295        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
25296        if (staticProps) _defineProperties(Constructor, staticProps);
25297        return Constructor;
25298      }
25299
25300      function _inherits(subClass, superClass) {
25301        if (typeof superClass !== "function" && superClass !== null) {
25302          throw new TypeError("Super expression must either be null or a function");
25303        }
25304
25305        subClass.prototype = Object.create(superClass && superClass.prototype, {
25306          constructor: {
25307            value: subClass,
25308            writable: true,
25309            configurable: true
25310          }
25311        });
25312        if (superClass) _setPrototypeOf(subClass, superClass);
25313      }
25314
25315      function _setPrototypeOf(o, p) {
25316        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
25317          o.__proto__ = p;
25318          return o;
25319        };
25320
25321        return _setPrototypeOf(o, p);
25322      }
25323
25324      function _createSuper(Derived) {
25325        return function () {
25326          var Super = _getPrototypeOf(Derived),
25327              result;
25328
25329          if (_isNativeReflectConstruct()) {
25330            var NewTarget = _getPrototypeOf(this).constructor;
25331
25332            result = Reflect.construct(Super, arguments, NewTarget);
25333          } else {
25334            result = Super.apply(this, arguments);
25335          }
25336
25337          return _possibleConstructorReturn(this, result);
25338        };
25339      }
25340
25341      function _possibleConstructorReturn(self, call) {
25342        if (call && (_typeof(call) === "object" || typeof call === "function")) {
25343          return call;
25344        }
25345
25346        return _assertThisInitialized(self);
25347      }
25348
25349      function _assertThisInitialized(self) {
25350        if (self === void 0) {
25351          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
25352        }
25353
25354        return self;
25355      }
25356
25357      function _isNativeReflectConstruct() {
25358        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
25359        if (Reflect.construct.sham) return false;
25360        if (typeof Proxy === "function") return true;
25361
25362        try {
25363          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
25364          return true;
25365        } catch (e) {
25366          return false;
25367        }
25368      }
25369
25370      function _getPrototypeOf(o) {
25371        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o
25371) {
25372          return o.__proto__ || Object.getPrototypeOf(o);
25373        };
25374        return _getPrototypeOf(o);
25375      }
25376
25377      var BaseXform = require('../base-xform');
25378
25379      var PictureXform = /*#__PURE__*/function (_BaseXform) {
25380        _inherits(PictureXform, _BaseXform);
25381
25382        var _super = _createSuper(PictureXform);
25383
25384        function PictureXform() {
25385          _classCallCheck(this, PictureXform);
25386
25387          return _super.apply(this, arguments);
25388        }
25389
25390        _createClass(PictureXform, [{
25391          key: "render",
25392          value: function render(xmlStream, model) {
25393            if (model) {
25394              xmlStream.leafNode(this.tag, {
25395                'r:id': model.rId
25396              });
25397            }
25398          }
25399        }, {
25400          key: "parseOpen",
25401          value: function parseOpen(node) {
25402            switch (node.name) {
25403              case this.tag:
25404                this.model = {
25405                  rId: node.attributes['r:id']
25406                };
25407                return true;
25408
25409              default:
25410                return false;
25411            }
25412          }
25413        }, {
25414          key: "parseText",
25415          value: function parseText() {}
25416        }, {
25417          key: "parseClose",
25418          value: function parseClose() {
25419            return false;
25420          }
25421        }, {
25422          key: "tag",
25423          get: function get() {
25424            return 'picture';
25425          }
25426        }]);
25427
25428        return PictureXform;
25429      }(BaseXform);
25430
25431      module.exports = PictureXform;
25432    }, {
25433      "../base-xform": 29
25434    }],
25435    104: [function (require, module, exports) {
25436      "use strict";
25437
25438      function _typeof(obj) {
25439        "@babel/helpers - typeof";
25440
25441        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
25442          _typeof = function _typeof(obj) {
25443            return typeof obj;
25444          };
25445        } else {
25446          _typeof = function _typeof(obj) {
25447            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
25448          };
25449        }
25450
25451        return _typeof(obj);
25452      }
25453
25454      function _classCallCheck(instance, Constructor) {
25455        if (!(instance instanceof Constructor)) {
25456          throw new TypeError("Cannot call a class as a function");
25457        }
25458      }
25459
25460      function _defineProperties(target, props) {
25461        for (var i = 0; i < props.length; i++) {
25462          var descriptor = props[i];
25463          descriptor.enumerable = descriptor.enumerable || false;
25464          descriptor.configurable = true;
25465          if ("value" in descriptor) descriptor.writable = true;
25466          Object.defineProperty(target, descriptor.key, descriptor);
25467        }
25468      }
25469
25470      function _createClass(Constructor, protoProps, staticProps) {
25471        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
25472        if (staticProps) _defineProperties(Constructor, staticProps);
25473        return Constructor;
25474      }
25475
25476      function _inherits(subClass, superClass) {
25477        if (typeof superClass !== "function" && superClass !== null) {
25478          throw new TypeError("Super expression must either be null or a function");
25479        }
25480
25481        subClass.prototype = Object.create(superClass && superClass.prototype, {
25482          constructor: {
25483            value: subClass,
25484            writable: true,
25485            configurable: true
25486          }
25487        });
25488        if (superClass) _setPrototypeOf(subClass, superClass);
25489      }
25490
25491      function _setPrototypeOf(o, p) {
25492        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
25493          o.__proto__ = p;
25494          return o;
25495        };
25496
25497        return _setPrototypeOf(o, p);
25498      }
25499
25500      function _createSuper(Derived) {
25501        return function () {
25502          var Super = _getPrototypeOf(Derived),
25503              result;
25504
25505          if (_isNativeReflectConstruct()) {
25506            var NewTarget = _getPrototypeOf(this).constructor;
25507
25508            result = Reflect.construct(Super, arguments, NewTarget);
25509          } else {
25510            result = Super.apply(this, arguments);
25511          }
25512
25513          return _possibleConstructorReturn(this, result);
25514        };
25515      }
25516
25517      function _possibleConstructorReturn(self, call) {
25518        if (call && (_typeof(call) === "object" || typeof call === "function")) {
25519          return call;
25520        }
25521
25522        return _assertThisInitialized(self);
25523      }
25524
25525      function _assertThisInitialized(self) {
25526        if (self === void 0) {
25527          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
25528        }
25529
25530        return self;
25531      }
25532
25533      function _isNativeReflectConstruct() {
25534        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
25535        if (Reflect.construct.sham) return false;
25536        if (typeof Proxy === "function") return true;
25537
25538        try {
25539          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
25540          return true;
25541        } catch (e) {
25542          return false;
25543        }
25544      }
25545
25546      function _getPrototypeOf(o) {
25547        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
25548          return o.__proto__ || Object.getPrototypeOf(o);
25549        };
25550        return _getPrototypeOf(o);
25551      }
25552
25553      var _ = require('../../../utils/under-dash');
25554
25555      var BaseXform = require('../base-xform');
25556
25557      function booleanToXml(model) {
25558        return model ? '1' : undefined;
25559      }
25560
25561      var PrintOptionsXform = /*#__PURE__*/function (_BaseXform) {
25562        _inherits(PrintOptionsXform, _BaseXform);
25563
25564        var _super = _createSuper(PrintOptionsXform);
25565
25566        function PrintOptionsXform() {
25567          _classCallCheck(this, PrintOptionsXform);
25568
25569          return _super.apply(this, arguments);
25570        }
25571
25572        _createClass(PrintOptionsXform, [{
25573          key: "render",
25574          value: function render(xmlStream, model) {
25575            if (model) {
25576              var attributes = {
25577                headings: booleanToXml(model.showRowColHeaders),
25578                gridLines: booleanToXml(model.showGridLines),
25579                horizontalCentered: booleanToXml(model.horizontalCentered),
25580                verticalCentered: booleanToXml(model.verticalCentered)
25581              };
25582
25583              if (_.some(attributes, function (value) {
25584                return value !== undefined;
25585              })) {
25586                xmlStream.leafNode(this.tag, attributes);
25587              }
25588            }
25589          }
25590        }, {
25591          key: "parseOpen",
25592          value: function parseOpen(node) {
25593            switch (node.name) {
25594              case this.tag:
25595                this.model = {
25596                  showRowColHeaders: node.attributes.headings === '1',
25597                  showGridLines: node.attributes.gridLines === '1',
25598                  horizontalCentered: node.attributes.horizontalCentered === '1',
25599                  verticalCentered: node.attributes.verticalCentered === '1'
25600                };
25601                return true;
25602
25603              default:
25604                return false;
25605            }
25606          }
25607        }, {
25608          key: "parseText",
25609          value: function parseText() {}
25610        }, {
25611          key: "parseClose",
25612          value: function parseClose() {
25613            return false;
25614          }
25615        }, {
25616          key: "tag",
25617          get: function get() {
25618            return 'printOptions';
25619          }
25620        }]);
25621
25622        return PrintOptionsXform;
25623      }(BaseXform);
25624
25625      module.exports = PrintOptionsXform;
25626    }, {
25627      "../../../utils/under-dash": 23,
25628      "../base-xform": 29
25629    }],
25630    105: [function (require, module, exports) {
25631      'use strict';
25632
25633      function _typeof(obj) {
25634        "@babel/helpers - typeof";
25635
25636        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
25637          _typeof = function _typeof(obj) {
25638            return typeof obj;
25639          };
25640        } else {
25641          _typeof = function _typeof(obj) {
25642            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
25643          };
25644        }
25645
25646        return _typeof(obj);
25647      }
25648
25649      function _classCallCheck(instance, Constructor) {
25650        if (!(instance instanceof Constructor)) {
25651          throw new TypeError("Cannot call a class as a function");
25652        }
25653      }
25654
25655      function _defineProperties(target, props) {
25656        for (var i = 0; i < props.length; i++) {
25657          var descriptor = props[i];
25658          descriptor.enumerable = descriptor.enumerable || false;
25659          descriptor.configurable = true;
25660          if ("value" in descriptor) descriptor.writable = true;
25661          Object.defineProperty(target, descriptor.key, descriptor);
25662        }
25663      }
25664
25665      function _createClass(Constructor, protoProps, staticProps) {
25666        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
25667        if (staticProps) _defineProperties(Constructor, staticProps);
25668        return Constructor;
25669      }
25670
25671      function _inherits(subClass, superClass) {
25672        if (typeof superClass !== "function" && superClass !== null) {
25673          throw new TypeError("Super expression must either be null or a function");
25674        }
25675
25676        subClass.prototype = Object.create(superClass && superClass.prototype, {
25677          constructor: {
25678            value: subClass,
25679            writable: true,
25680            configurable: true
25681          }
25682        });
25683        if (superClass) _setPrototypeOf(subClass, superClass);
25684      }
25685
25686      function _setPrototypeOf(o, p) {
25687        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
25688          o.__proto__ = p;
25689          return o;
25690        };
25691
25692        return _setPrototypeOf(o, p);
25693      }
25694
25695      function _createSuper(Derived) {
25696        return function () {
25697          var Super = _getPrototypeOf(Derived),
25698              result;
25699
25700          if (_isNativeReflectConstruct()) {
25701            var NewTarget = _getPrototypeOf(this).constructor;
25702
25703            result = Reflect.construct(Super, arguments, NewTarget);
25704          } else {
25705            result = Super.apply(this, arguments);
25706          }
25707
25708          return _possibleConstructorReturn(this, result);
25709        };
25710      }
25711
25712      function _possibleConstructorReturn(self, call) {
25713        if (call && (_typeof(call) === "object" || typeof call === "function")) {
25714          return call;
25715        }
25716
25717        return _assertThisInitialized(self);
25718      }
25719
25720      function _assertThisInitialized(self) {
25721        if (self === void 0) {
25722          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
25723        }
25724
25725        return self;
25726      }
25727
25728      function _isNativeReflectConstruct() {
25729        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
25730        if (Reflect.construct.sham) return false;
25731        if (typeof Proxy === "function") return true;
25732
25733        try {
25734          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
25735          return true;
25736        } catch (e) {
25737          return false;
25738        }
25739      }
25740
25741      function _getPrototypeOf(o) {
25742        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
25743          return o.__proto__ || Object.getPrototypeOf(o);
25744        };
25745        return _getPrototypeOf(o);
25746      }
25747
25748      var PageBreaksXform = require('./page-breaks-xform');
25749
25750      var ListXform = require('../list-xform');
25751
25752      var RowBreaksXform = /*#__PURE__*/function (_ListXform) {
25753        _inherits(RowBreaksXform, _ListXform);
25754
25755        var _super = _createSuper(RowBreaksXform);
25756
25757        function RowBreaksXform() {
25758          _classCallCheck(this, RowBreaksXform);
25759
25760          var options = {
25761            tag: 'rowBreaks',
25762            count: true,
25763            childXform: new PageBreaksXform()
25764          };
25765          return _super.call(this, options);
25766        } // get tag() { return 'rowBreaks'; }
25767
25768
25769        _createClass(RowBreaksXform, [{
25770          key: "render",
25771          value: function render(xmlStream, model) {
25772            if (model && model.length) {
25773              xmlStream.openNode(this.tag, this.$);
25774
25775              if (this.count) {
25776                xmlStream.addAttribute(this.$count, model.length);
25777                xmlStream.addAttribute('manualBreakCount', model.length);
25778              }
25779
25780              var childXform = this.childXform;
25781              model.forEach(function (childModel) {
25782                childXform.render(xmlStream, childModel);
25783              });
25784              xmlStream.closeNode();
25785            } else if (this.empty) {
25786              xmlStream.leafNode(this.tag);
25787            }
25788          }
25789        }]);
25790
25791        return RowBreaksXform;
25792      }(ListXform);
25793
25794      module.exports = RowBreaksXform;
25795    }, {
25796      "../list-xform": 68,
25797      "./page-breaks-xform": 99
25798    }],
25799    106: [function (require, module, exports) {
25800      "use strict";
25801
25802      function _typeof(obj) {
25803        "@babel/helpers - typeof";
25804
25805        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
25806          _typeof = function _typeof(obj) {
25807            return typeof obj;
25808          };
25809        } else {
25810          _typeof = function _typeof(obj) {
25811            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
25812          };
25813        }
25814
25815        return _typeof(obj);
25816      }
25817
25818      function _classCallCheck(instance, Constructor) {
25819        if (!(instance instanceof Constructor)) {
25820          throw new TypeError("Cannot call a class as a function");
25821        }
25822      }
25823
25824      function _defineProperties(target, props) {
25825        for (var i = 0; i < props.length; i++) {
25826          var descriptor = props[i];
25827          descriptor.enumerable = descriptor.enumerable || false;
25828          descriptor.configurable = true;
25829          if ("value" in descriptor) descriptor.writable = true;
25830          Object.defineProperty(target, descriptor.key, descriptor);
25831        }
25832      }
25833
25834      function _createClass(Constructor, protoProps, staticProps) {
25835        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
25836        if (staticProps) _defineProperties(Constructor, staticProps);
25837        return Constructor;
25838      }
25839
25840      function _inherits(subClass, superClass) {
25841        if (typeof superClass !== "function" && superClass !== null) {
25842          throw new TypeError("Super expression must either be null or a function");
25843        }
25844
25845        subClass.prototype = Object.create(superClass && superClass.prototype, {
25846          constructor: {
25847            value: subClass,
25848            writable: true,
25849            configurable: true
25850          }
25851        });
25852        if (superClass) _setPrototypeOf(subClass, superClass);
25853      }
25854
25855      function _setPrototypeOf(o, p) {
25856        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
25857          o.__proto__ = p;
25858          return o;
25859        };
25860
25861        return _setPrototypeOf(o, p);
25862      }
25863
25864      function _createSuper(Derived) {
25865        return function () {
25866          var Super = _getPrototypeOf(Derived),
25867              result;
25868
25869          if (_isNativeReflectConstruct()) {
25870            var NewTarget = _getPrototypeOf(this).constructor;
25871
25872            result = Reflect.construct(Super, arguments, NewTarget);
25873          } else {
25874            result = Super.apply(this, arguments);
25875          }
25876
25877          return _possibleConstructorReturn(this, result);
25878        };
25879      }
25880
25881      function _possibleConstructorReturn(self, call) {
25882        if (call && (_typeof(call) === "object" || typeof call === "function")) {
25883          return call;
25884        }
25885
25886        return _assertThisInitialized(self);
25887      }
25888
25889      function _assertThisInitialized(self) {
25890        if (self === void 0) {
25891          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
25892        }
25893
25894        return self;
25895      }
25896
25897      function _isNativeReflectConstruct() {
25898        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
25899        if (Reflect.construct.sham) return false;
25900        if (typeof Proxy === "function") return true;
25901
25902        try {
25903          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
25904          return true;
25905        } catch (e) {
25906          return false;
25907        }
25908      }
25909
25910      function _getPrototypeOf(o) {
25911        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
25912          return o.__proto__ || Object.getPrototypeOf(o);
25913        };
25914        return _getPrototypeOf(o);
25915      }
25916
25917      var BaseXform = require('../base-xform');
25918
25919      var CellXform = require('./cell-xform');
25920
25921      var RowXform = /*#__PURE__*/function (_BaseXform) {
25922        _inherits(RowXform, _BaseXform);
25923
25924        var _super = _createSuper(RowXform);
25925
25926        function RowXform(options) {
25927          var _this;
25928
25929          _classCallCheck(this, RowXform);
25930
25931          _this = _super.call(this);
25932          _this.maxItems = options && options.maxItems;
25933          _this.map = {
25934            c: new CellXform()
25935          };
25936          return _this;
25937        }
25938
25939        _createClass(RowXform, [{
25940          key: "prepare",
25941          value: function prepare(model, options) {
25942            var styleId = options.styles.addStyleModel(model.style);
25943
25944            if (styleId) {
25945              model.styleId = styleId;
25946            }
25947
25948            var cellXform = this.map.c;
25949            model.cells.forEach(function (cellModel) {
25950              cellXform.prepare(cellModel, options);
25951            });
25952          }
25953        }, {
25954          key: "render",
25955          value: function render(xmlStream, model, options) {
25956            xmlStream.openNode('row');
25957            xmlStream.addAttribute('r', model.number);
25958
25959            if (model.height) {
25960              xmlStream.addAttribute('ht', model.height);
25961              xmlStream.addAttribute('customHeight', '1');
25962            }
25963
25964            if (model.hidden) {
25965              xmlStream.addAttribute('hidden', '1');
25966            }
25967
25968            if (model.min > 0 && model.max > 0 && model.min <= model.max) {
25969              xmlStream.addAttribute('spans', "".concat(model.min, ":").concat(model.max));
25970            }
25971
25972            if (model.styleId) {
25973              xmlStream.addAttribute('s', model.styleId);
25974              xmlStream.addAttribute('customFormat', '1');
25975            }
25976
25977            xmlStream.addAttribute('x14ac:dyDescent', '0.25');
25978
25979            if (model.outlineLevel) {
25980              xmlStream.addAttribute('outlineLevel', model.outlineLevel);
25981            }
25982
25983            if (model.collapsed) {
25984              xmlStream.addAttribute('collapsed', '1');
25985            }
25986
25987            var cellXform = this.map.c;
25988            model.cells.forEach(function (cellModel) {
25989              cellXform.render(xmlStream, cellModel, options);
25990            });
25991            xmlStream.closeNode();
25992          }
25993        }, {
25994          key: "parseOpen",
25995          value: function parseOpen(node) {
25996            if (this.parser) {
25997              this.parser.parseOpen(node);
25998              return true;
25999            }
26000
26001            if (node.name === 'row') {
26002              this.numRowsSeen += 1;
26003              var spans = node.attributes.spans ? node.attributes.spans.split(':').map(function (span) {
26004                return parseInt(span, 10);
26005              }) : [undefined, undefined];
26006              var model = this.model = {
26007                number: parseInt(node.attributes.r, 10),
26008                min: spans[0],
26009                max: spans[1],
26010                cells: []
26011              };
26012
26013              if (node.attributes.s) {
26014                model.styleId = parseInt(node.attributes.s, 10);
26015              }
26016
26017              if (node.attributes.hidden === true || node.attributes.hidden === 'true' || node.attributes.hidden === 1 || node.attributes.hidden === '1') {
26018                model.hidden = true;
26019              }
26020
26021              if (node.attributes.bestFit) {
26022                model.bestFit = true;
26023              }
26024
26025              if (node.attributes.ht) {
26026                model.height = parseFloat(node.attributes.ht);
26027              }
26028
26029              if (node.attributes.outlineLevel) {
26030                model.outlineLevel = parseInt(node.attributes.outlineLevel, 10);
26031              }
26032
26033              if (node.attributes.collapsed) {
26034                model.collapsed = true;
26035              }
26036
26037              return true;
26038            }
26039
26040            this.parser = this.map[node.name];
26041
26042            if (this.parser) {
26043              this.parser.parseOpen(node);
26044              return true;
26045            }
26046
26047            return false;
26048          }
26049        }, {
26050          key: "parseText",
26051          value: function parseText(text) {
26052            if (this.parser) {
26053              this.parser.parseText(text);
26054            }
26055          }
26056        }, {
26057          key: "parseClose",
26058          value: function parseClose(name) {
26059            if (this.parser) {
26060              if (!this.parser.parseClose(name)) {
26061                this.model.cells.push(this.parser.model);
26062
26063                if (this.maxItems && this.model.cells.length > this.maxItems) {
26064                  throw new Error("Max column count (".concat(this.maxItems, ") exceeded"));
26065                }
26066
26067                this.parser = undefined;
26068              }
26069
26070              return true;
26071            }
26072
26073            return false;
26074          }
26075        }, {
26076          key: "reconcile",
26077          value: function reconcile(model, options) {
26078            model.style = model.styleId ? options.styles.getStyleModel(model.styleId) : {};
26079
26080            if (model.styleId !== undefined) {
26081              model.styleId = undefined;
26082            }
26083
26084            var cellXform = this.map.c;
26085            model.cells.forEach(function (cellModel) {
26086              cellXform.reconcile(cellModel, options);
26087            });
26088          }
26089        }, {
26090          key: "tag",
26091          get: function get() {
26092            return 'row';
26093          }
26094        }]);
26095
26096        return RowXform;
26097      }(BaseXform);
26098
26099      module.exports = RowXform;
26100    }, {
26101      "../base-xform": 29,
26102      "./cell-xform": 70
26103    }],
26104    107: [function (require, module, exports) {
26105      "use strict";
26106
26107      function _typeof(obj) {
26108        "@babel/helpers - typeof";
26109
26110        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
26111          _typeof = function _typeof(obj) {
26112            return typeof obj;
26113          };
26114        } else {
26115          _typeof = function _typeof(obj) {
26116            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
26117          };
26118        }
26119
26120        return _typeof(obj);
26121      }
26122
26123      function _classCallCheck(instance, Constructor) {
26124        if (!(instance instanceof Constructor)) {
26125          throw new TypeError("Cannot call a class as a function");
26126        }
26127      }
26128
26129      function _defineProperties(target, props) {
26130        for (var i = 0; i < props.length; i++) {
26131          var descriptor = props[i];
26132          descriptor.enumerable = descriptor.enumerable || false;
26133          descriptor.configurable = true;
26134          if ("value" in descriptor) descriptor.writable = true;
26135          Object.defineProperty(target, descriptor.key, descriptor);
26136        }
26137      }
26138
26139      function _createClass(Constructor, protoProps, staticProps) {
26140        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
26141        if (staticProps) _defineProperties(Constructor, staticProps);
26142        return Constructor;
26143      }
26144
26145      function _inherits(subClass, superClass) {
26146        if (typeof superClass !== "function" && superClass !== null) {
26147          throw new TypeError("Super expression must either be null or a function");
26148        }
26149
26150        subClass.prototype = Object.create(superClass && superClass.prototype, {
26151          constructor: {
26152            value: subClass,
26153            writable: true,
26154            configurable: true
26155          }
26156        });
26157        if (superClass) _setPrototypeOf(subClass, superClass);
26158      }
26159
26160      function _setPrototypeOf(o, p) {
26161        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
26162          o.__proto__ = p;
26163          return o;
26164        };
26165
26166        return _setPrototypeOf(o, p);
26167      }
26168
26169      function _createSuper(Derived) {
26170        return function () {
26171          var Super = _getPrototypeOf(Derived),
26172              result;
26173
26174          if (_isNativeReflectConstruct()) {
26175            var NewTarget = _getPrototypeOf(this).constructor;
26176
26177            result = Reflect.construct(Super, arguments, NewTarget);
26178          } else {
26179            result = Super.apply(this, arguments);
26180          }
26181
26182          return _possibleConstructorReturn(this, result);
26183        };
26184      }
26185
26186      function _possibleConstructorReturn(self, call) {
26187        if (call && (_typeof(call) === "object" || typeof call === "function")) {
26188          return call;
26189        }
26190
26191        return _assertThisInitialized(self);
26192      }
26193
26194      function _assertThisInitialized(self) {
26195        if (self === void 0) {
26196          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
26197        }
26198
26199        return self;
26200      }
26201
26202      function _isNativeReflectConstruct() {
26203        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
26204        if (Reflect.construct.sham) return false;
26205        if (typeof Proxy === "function") return true;
26206
26207        try {
26208          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
26209          return true;
26210        } catch (e) {
26211          return false;
26212        }
26213      }
26214
26215      function _getPrototypeOf(o) {
26216        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
26217          return o.__proto__ || Object.getPrototypeOf(o);
26218        };
26219        return _getPrototypeOf(o);
26220      }
26221
26222      var _ = require('../../../utils/under-dash');
26223
26224      var BaseXform = require('../base-xform');
26225
26226      var SheetFormatPropertiesXform = /*#__PURE__*/function (_BaseXform) {
26227        _inherits(SheetFormatPropertiesXform, _BaseXform);
26228
26229        var _super = _createSuper(SheetFormatPropertiesXform);
26230
26231        function SheetFormatPropertiesXform() {
26232          _classCallCheck(this, SheetFormatPropertiesXform);
26233
26234          return _super.apply(this, arguments);
26235        }
26236
26237        _createClass(SheetFormatPropertiesXform, [{
26238          key: "render",
26239          value: function render(xmlStream, model) {
26240            if (model) {
26241              var attributes = {
26242                defaultRowHeight: model.defaultRowHeight,
26243                outlineLevelRow: model.outlineLevelRow,
26244                outlineLevelCol: model.outlineLevelCol,
26245                'x14ac:dyDescent': model.dyDescent
26246              };
26247
26248              if (model.defaultColWidth) {
26249                attributes.defaultColWidth = model.defaultColWidth;
26250              } // default value for 'defaultRowHeight' is 15, this should not be 'custom'
26251
26252
26253              if (!model.defaultRowHeight || model.defaultRowHeight !== 15) {
26254                attributes.customHeight = '1';
26255              }
26256
26257              if (_.some(attributes, function (value) {
26258                return value !== undefined;
26259              })) {
26260                xmlStream.leafNode('sheetFormatPr', attributes);
26261              }
26262            }
26263          }
26264        }, {
26265          key: "parseOpen",
26266          value: function parseOpen(node) {
26267            if (node.name === 'sheetFormatPr') {
26268              this.model = {
26269                defaultRowHeight: parseFloat(node.attributes.defaultRowHeight || '0'),
26270                dyDescent: parseFloat(node.attributes['x14ac:dyDescent'] || '0'),
26271                outlineLevelRow: parseInt(node.attributes.outlineLevelRow || '0', 10),
26272                outlineLevelCol: parseInt(node.attributes.outlineLevelCol || '0', 10)
26273              };
26274
26275              if (node.attributes.defaultColWidth) {
26276                this.model.defaultColWidth = parseFloat(node.attributes.defaultColWidth);
26277              }
26278
26279              return true;
26280            }
26281
26282            return false;
26283          }
26284        }, {
26285          key: "parseText",
26286          value: function parseText() {}
26287        }, {
26288          key: "parseClose",
26289          value: function parseClose() {
26290            return false;
26291          }
26292        }, {
26293          key: "tag",
26294          get: function get() {
26295            return 'sheetFormatPr';
26296          }
26297        }]);
26298
26299        return SheetFormatPropertiesXform;
26300      }(BaseXform);
26301
26302      module.exports = SheetFormatPropertiesXform;
26303    }, {
26304      "../../../utils/under-dash": 23,
26305      "../base-xform": 29
26306    }],
26307    108: [function (require, module, exports) {
26308      "use strict";
26309
26310      function _typeof(obj) {
26311        "@babel/helpers - typeof";
26312
26313        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
26314          _typeof = function _typeof(obj) {
26315            return typeof obj;
26316          };
26317        } else {
26318          _typeof = function _typeof(obj) {
26319            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
26320          };
26321        }
26322
26323        return _typeof(obj);
26324      }
26325
26326      function _classCallCheck(instance, Constructor) {
26327        if (!(instance instanceof Constructor)) {
26328          throw new TypeError("Cannot call a class as a function");
26329        }
26330      }
26331
26332      function _defineProperties(target, props) {
26333        for (var i = 0; i < props.length; i++) {
26334          var descriptor = props[i];
26335          descriptor.enumerable = descriptor.enumerable || false;
26336          descriptor.configurable = true;
26337          if ("value" in descriptor) descriptor.writable = true;
26338          Object.defineProperty(target, descriptor.key, descriptor);
26339        }
26340      }
26341
26342      function _createClass(Constructor, protoProps, staticProps) {
26343        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
26344        if (staticProps) _defineProperties(Constructor, staticProps);
26345        return Constructor;
26346      }
26347
26348      function _inherits(subClass, superClass) {
26349        if (typeof superClass !== "function" && superClass !== null) {
26350          throw new TypeError("Super expression must either be null or a function");
26351        }
26352
26353        subClass.prototype = Object.create(superClass && superClass.prototype, {
26354          constructor: {
26355            value: subClass,
26356            writable: true,
26357            configurable: true
26358          }
26359        });
26360        if (superClass) _setPrototypeOf(subClass, superClass);
26361      }
26362
26363      function _setPrototypeOf(o, p) {
26364        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
26365          o.__proto__ = p;
26366          return o;
26367        };
26368
26369        return _setPrototypeOf(o, p);
26370      }
26371
26372      function _createSuper(Derived) {
26373        return function () {
26374          var Super = _getPrototypeOf(Derived),
26375              result;
26376
26377          if (_isNativeReflectConstruct()) {
26378            var NewTarget = _getPrototypeOf(this).constructor;
26379
26380            result = Reflect.construct(Super, arguments, NewTarget);
26381          } else {
26382            result = Super.apply(this, arguments);
26383          }
26384
26385          return _possibleConstructorReturn(this, result);
26386        };
26387      }
26388
26389      function _possibleConstructorReturn(self, call) {
26390        if (call && (_typeof(call) === "object" || typeof call === "function")) {
26391          return call;
26392        }
26393
26394        return _assertThisInitialized(self);
26395      }
26396
26397      function _assertThisInitialized(self) {
26398        if (self === void 0) {
26399          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
26400        }
26401
26402        return self;
26403      }
26404
26405      function _isNativeReflectConstruct() {
26406        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
26407        if (Reflect.construct.sham) return false;
26408        if (typeof Proxy === "function") return true;
26409
26410        try {
26411          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
26412          return true;
26413        } catch (e) {
26414          return false;
26415        }
26416      }
26417
26418      function _getPrototypeOf(o) {
26419        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
26420          return o.__proto__ || Object.getPrototypeOf(o);
26421        };
26422        return _getPrototypeOf(o);
26423      }
26424
26425      var BaseXform = require('../base-xform');
26426
26427      var ColorXform = require('../style/color-xform');
26428
26429      var PageSetupPropertiesXform = require('./page-setup-properties-xform');
26430
26431      var OutlinePropertiesXform = require('./outline-properties-xform');
26432
26433      var SheetPropertiesXform = /*#__PURE__*/function (_BaseXform) {
26434        _inherits(SheetPropertiesXform, _BaseXform);
26435
26436        var _super = _createSuper(SheetPropertiesXform);
26437
26438        function SheetPropertiesXform() {
26439          var _this;
26440
26441          _classCallCheck(this, SheetPropertiesXform);
26442
26443          _this = _super.call(this);
26444          _this.map = {
26445            tabColor: new ColorXform('tabColor'),
26446            pageSetUpPr: new PageSetupPropertiesXform(),
26447            outlinePr: new OutlinePropertiesXform()
26448          };
26449          return _this;
26450        }
26451
26452        _createClass(SheetPropertiesXform, [{
26453          key: "render",
26454          value: function render(xmlStream, model) {
26455            if (model) {
26456              xmlStream.addRollback();
26457              xmlStream.openNode('sheetPr');
26458              var inner = false;
26459              inner = this.map.tabColor.render(xmlStream, model.tabColor) || inner;
26460              inner = this.map.pageSetUpPr.render(xmlStream, model.pageSetup) || inner;
26461              inner = this.map.outlinePr.render(xmlStream, model.outlineProperties) || inner;
26462
26463              if (inner) {
26464                xmlStream.closeNode();
26465                xmlStream.commit();
26466              } else {
26467                xmlStream.rollback();
26468              }
26469            }
26470          }
26471        }, {
26472          key: "parseOpen",
26473          value: function parseOpen(node) {
26474            if (this.parser) {
26475              this.parser.parseOpen(node);
26476              return true;
26477            }
26478
26479            if (node.name === this.tag) {
26480              this.reset();
26481              return true;
26482            }
26483
26484            if (this.map[node.name]) {
26485              this.parser = this.map[node.name];
26486              this.parser.parseOpen(node);
26487              return true;
26488            }
26489
26490            return false;
26491          }
26492        }, {
26493          key: "parseText",
26494          value: function parseText(text) {
26495            if (this.parser) {
26496              this.parser.parseText(text);
26497              return true;
26498            }
26499
26500            return false;
26501          }
26502        }, {
26503          key: "parseClose",
26504          value: function parseClose(name) {
26505            if (this.parser) {
26506              if (!this.parser.parseClose(name)) {
26507                this.parser = undefined;
26508              }
26509
26510              return true;
26511            }
26512
26513            if (this.map.tabColor.model || this.map.pageSetUpPr.model || this.map.outlinePr.model) {
26514              this.model = {};
26515
26516              if (this.map.tabColor.model) {
26517                this.model.tabColor = this.map.tabColor.model;
26518              }
26519
26520              if (this.map.pageSetUpPr.model) {
26521                this.model.pageSetup = this.map.pageSetUpPr.model;
26522              }
26523
26524              if (this.map.outlinePr.model) {
26525                this.model.outlineProperties = this.map.outlinePr.model;
26526              }
26527            } else {
26528              this.model = null;
26529            }
26530
26531            return false;
26532          }
26533        }, {
26534          key: "tag",
26535          get: function get() {
26536            return 'sheetPr';
26537          }
26538        }]);
26539
26540        return SheetPropertiesXform;
26541      }(BaseXform);
26542
26543      module.exports = SheetPropertiesXform;
26544    }, {
26545      "../base-xform": 29,
26546      "../style/color-xform": 125,
26547      "./outline-properties-xform": 98,
26548      "./page-setup-properties-xform": 101
26549    }],
26550    109: [function (require, module, exports) {
26551      "use strict";
26552
26553      function _typeof(obj) {
26554        "@babel/helpers - typeof";
26555
26556        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
26557          _typeof = function _typeof(obj) {
26558            return typeof obj;
26559          };
26560        } else {
26561          _typeof = function _typeof(obj) {
26562            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
26563          };
26564        }
26565
26566        return _typeof(obj);
26567      }
26568
26569      function _classCallCheck(instance, Constructor) {
26570        if (!(instance instanceof Constructor)) {
26571          throw new TypeError("Cannot call a class as a function");
26572        }
26573      }
26574
26575      function _defineProperties(target, props) {
26576        for (var i = 0; i < props.length; i++) {
26577          var descriptor = props[i];
26578          descriptor.enumerable = descriptor.enumerable || false;
26579          descriptor.configurable = true;
26580          if ("value" in descriptor) descriptor.writable = true;
26581          Object.defineProperty(target, descriptor.key, descriptor);
26582        }
26583      }
26584
26585      function _createClass(Constructor, protoProps, staticProps) {
26586        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
26587        if (staticProps) _defineProperties(Constructor, staticProps);
26588        return Constructor;
26589      }
26590
26591      function _inherits(subClass, superClass) {
26592        if (typeof superClass !== "function" && superClass !== null) {
26593          throw new TypeError("Super expression must either be null or a function");
26594        }
26595
26596        subClass.prototype = Object.create(superClass && superClass.prototype, {
26597          constructor: {
26598            value: subClass,
26599            writable: true,
26600            configurable: true
26601          }
26602        });
26603        if (superClass) _setPrototypeOf(subClass, superClass);
26604      }
26605
26606      function _setPrototypeOf(o, p) {
26607        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
26608          o.__proto__ = p;
26609          return o;
26610        };
26611
26612        return _setPrototypeOf(o, p);
26613      }
26614
26615      function _createSuper(Derived) {
26616        return function () {
26617          var Super = _getPrototypeOf(Derived),
26618              result;
26619
26620          if (_isNativeReflectConstruct()) {
26621            var NewTarget = _getPrototypeOf(this).constructor;
26622
26623            result = Reflect.construct(Super, arguments, NewTarget);
26624          } else {
26625            result = Super.apply(this, arguments);
26626          }
26627
26628          return _possibleConstructorReturn(this, result);
26629        };
26630      }
26631
26632      function _possibleConstructorReturn(self, call) {
26633        if (call && (_typeof(call) === "object" || typeof call === "function")) {
26634          return call;
26635        }
26636
26637        return _assertThisInitialized(self);
26638      }
26639
26640      function _assertThisInitialized(self) {
26641        if (self === void 0) {
26642          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
26643        }
26644
26645        return self;
26646      }
26647
26648      function _isNativeReflectConstruct() {
26649        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
26650        if (Reflect.construct.sham) return false;
26651        if (typeof Proxy === "function") return true;
26652
26653        try {
26654          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
26655          return true;
26656        } catch (e) {
26657          return false;
26658        }
26659      }
26660
26661      function _getPrototypeOf(o) {
26662        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
26663          return o.__proto__ || Object.getPrototypeOf(o);
26664        };
26665        return _getPrototypeOf(o);
26666      }
26667
26668      var _ = require('../../../utils/under-dash');
26669
26670      var BaseXform = require('../base-xform');
26671
26672      function booleanToXml(model, value) {
26673        return model ? value : undefined;
26674      }
26675
26676      function xmlToBoolean(value, equals) {
26677        return value === equals ? true : undefined;
26678      }
26679
26680      var SheetProtectionXform = /*#__PURE__*/function (_BaseXform) {
26681        _inherits(SheetProtectionXform, _BaseXform);
26682
26683        var _super = _createSuper(SheetProtectionXform);
26684
26685        function SheetProtectionXform() {
26686          _classCallCheck(this, SheetProtectionXform);
26687
26688          return _super.apply(this, arguments);
26689        }
26690
26691        _createClass(SheetProtectionXform, [{
26692          key: "render",
26693          value: function render(xmlStream, model) {
26694            if (model) {
26695              var attributes = {
26696                sheet: booleanToXml(model.sheet, '1'),
26697                selectLockedCells: model.selectLockedCells === false ? '1' : undefined,
26698                selectUnlockedCells: model.selectUnlockedCells === false ? '1' : undefined,
26699                formatCells: booleanToXml(model.formatCells, '0'),
26700                formatColumns: booleanToXml(model.formatColumns, '0'),
26701                formatRows: booleanToXml(model.formatRows, '0'),
26702                insertColumns: booleanToXml(model.insertColumns, '0'),
26703                insertRows: booleanToXml(model.insertRows, '0'),
26704                insertHyperlinks: booleanToXml(model.insertHyperlinks, '0'),
26705                deleteColumns: booleanToXml(model.deleteColumns, '0'),
26706                deleteRows: booleanToXml(model.deleteRows, '0'),
26707                sort: booleanToXml(model.sort, '0'),
26708                autoFilter: booleanToXml(model.autoFilter, '0'),
26709                pivotTables: booleanToXml(model.pivotTables, '0')
26710              };
26711
26712              if (model.sheet) {
26713                attributes.algorithmName = model.algorithmName;
26714                attributes.hashValue = model.hashValue;
26715                attributes.saltValue = model.saltValue;
26716                attributes.spinCount = model.spinCount;
26717                attributes.objects = booleanToXml(model.objects === false, '1');
26718                attributes.scenarios = booleanToXml(model.scenarios === false, '1');
26719              }
26720
26721              if (_.some(attributes, function (value) {
26722                return value !== undefined;
26723              })) {
26724                xmlStream.leafNode(this.tag, attributes);
26725              }
26726            }
26727          }
26728        }, {
26729          key: "parseOpen",
26730          value: function parseOpen(node) {
26731            switch (node.name) {
26732              case this.tag:
26733                this.model = {
26734                  sheet: xmlToBoolean(node.attributes.sheet, '1'),
26735                  objects: node.attributes.objects === '1' ? false : undefined,
26736                  scenarios: node.attributes.scenarios === '1' ? false : undefined,
26737                  selectLockedCells: node.attributes.selectLockedCells === '1' ? false : undefined,
26738                  selectUnlockedCells: node.attributes.selectUnlockedCells === '1' ? false : undefined,
26739                  formatCells: xmlToBoolean(node.attributes.formatCells, '0'),
26740                  formatColumns: xmlToBoolean(node.attributes.formatColumns, '0'),
26741                  formatRows: xmlToBoolean(node.attributes.formatRows, '0'),
26742                  insertColumns: xmlToBoolean(node.attributes.insertColumns, '0'),
26743                  insertRows: xmlToBoolean(node.attributes.insertRows, '0'),
26744                  insertHyperlinks: xmlToBoolean(node.attributes.insertHyperlinks, '0'),
26745                  deleteColumns: xmlToBoolean(node.attributes.deleteColumns, '0'),
26746                  deleteRows: xmlToBoolean(node.attributes.deleteRows, '0'),
26747                  sort: xmlToBoolean(node.attributes.sort, '0'),
26748                  autoFilter: xmlToBoolean(node.attributes.autoFilter, '0'),
26749                  pivotTables: xmlToBoolean(node.attributes.pivotTables, '0')
26750                };
26751
26752                if (node.attributes.algorithmName) {
26753                  this.model.algorithmName = node.attributes.algorithmName;
26754                  this.model.hashValue = node.attributes.hashValue;
26755                  this.model.saltValue = node.attributes.saltValue;
26756                  this.model.spinCount = parseInt(node.attributes.spinCount, 10);
26757                }
26758
26759                return true;
26760
26761              default:
26762                return false;
26763            }
26764          }
26765        }, {
26766          key: "parseText",
26767          value: function parseText() {}
26768        }, {
26769          key: "parseClose",
26770          value: function parseClose() {
26771            return false;
26772          }
26773        }, {
26774          key: "tag",
26775          get: function get() {
26776            return 'sheetProtection';
26777          }
26778        }]);
26779
26780        return SheetProtectionXform;
26781      }(BaseXform);
26782
26783      module.exports = SheetProtectionXform;
26784    }, {
26785      "../../../utils/under-dash": 23,
26786      "../base-xform": 29
26787    }],
26788    110: [function (require, module, exports) {
26789      "use strict";
26790
26791      function _typeof(obj) {
26792        "@babel/helpers - typeof";
26793
26794        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
26795          _typeof = function _typeof(obj) {
26796            return typeof obj;
26797          };
26798        } else {
26799          _typeof = function _typeof(obj) {
26800            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
26801          };
26802        }
26803
26804        return _typeof(obj);
26805      }
26806
26807      function _classCallCheck(instance, Constructor) {
26808        if (!(instance instanceof Constructor)) {
26809          throw new TypeError("Cannot call a class as a function");
26810        }
26811      }
26812
26813      function _defineProperties(target, props) {
26814        for (var i = 0; i < props.length; i++) {
26815          var descriptor = props[i];
26816          descriptor.enumerable = descriptor.enumerable || false;
26817          descriptor.configurable = true;
26818          if ("value" in descriptor) descriptor.writable = true;
26819          Object.defineProperty(target, descriptor.key, descriptor);
26820        }
26821      }
26822
26823      function _createClass(Constructor, protoProps, staticProps) {
26824        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
26825        if (staticProps) _defineProperties(Constructor, staticProps);
26826        return Constructor;
26827      }
26828
26829      function _inherits(subClass, superClass) {
26830        if (typeof superClass !== "function" && superClass !== null) {
26831          throw new TypeError("Super expression must either be null or a function");
26832        }
26833
26834        subClass.prototype = Object.create(superClass && superClass.prototype, {
26835          constructor: {
26836            value: subClass,
26837            writable: true,
26838            configurable: true
26839          }
26840        });
26841        if (superClass) _setPrototypeOf(subClass, superClass);
26842      }
26843
26844      function _setPrototypeOf(o, p) {
26845        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
26846          o.__proto__ = p;
26847          return o;
26848        };
26849
26850        return _setPrototypeOf(o, p);
26851      }
26852
26853      function _createSuper(Derived) {
26854        return function () {
26855          var Super = _getPrototypeOf(Derived),
26856              result;
26857
26858          if (_isNativeReflectConstruct()) {
26859            var NewTarget = _getPrototypeOf(this).constructor;
26860
26861            result = Reflect.construct(Super, arguments, NewTarget);
26862          } else {
26863            result = Super.apply(this, arguments);
26864          }
26865
26866          return _possibleConstructorReturn(this, result);
26867        };
26868      }
26869
26870      function _possibleConstructorReturn(self, call) {
26871        if (call && (_typeof(call) === "object" || typeof call === "function")) {
26872          return call;
26873        }
26874
26875        return _assertThisInitialized(self);
26876      }
26877
26878      function _assertThisInitialized(self) {
26879        if (self === void 0) {
26880          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
26881        }
26882
26883        return self;
26884      }
26885
26886      function _isNativeReflectConstruct() {
26887        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
26888        if (Reflect.construct.sham) return false;
26889        if (typeof Proxy === "function") return true;
26890
26891        try {
26892          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
26893          return true;
26894        } catch (e) {
26895          return false;
26896        }
26897      }
26898
26899      function _getPrototypeOf(o) {
26900        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o
vendor: 5,510 bytes, lines 26900-27054
26900) {
26901          return o.__proto__ || Object.getPrototypeOf(o);
26902        };
26903        return _getPrototypeOf(o);
26904      }
26905
26906      var colCache = require('../../../utils/col-cache');
26907
26908      var BaseXform = require('../base-xform');
26909
26910      var VIEW_STATES = {
26911        frozen: 'frozen',
26912        frozenSplit: 'frozen',
26913        split: 'split'
26914      };
26915
26916      var SheetViewXform = /*#__PURE__*/function (_BaseXform) {
26917        _inherits(SheetViewXform, _BaseXform);
26918
26919        var _super = _createSuper(SheetViewXform);
26920
26921        function SheetViewXform() {
26922          _classCallCheck(this, SheetViewXform);
26923
26924          return _super.apply(this, arguments);
26925        }
26926
26927        _createClass(SheetViewXform, [{
26928          key: "prepare",
26929          value: function prepare(model) {
26930            switch (model.state) {
26931              case 'frozen':
26932              case 'split':
26933                break;
26934
26935              default:
26936                model.state = 'normal';
26937                break;
26938            }
26939          }
26940        }, {
26941          key: "render",
26942          value: function render(xmlStream, model) {
26943            xmlStream.openNode('sheetView', {
26944              workbookViewId: model.workbookViewId || 0
26945            });
26946
26947            var add = function add(name, value, included) {
26948              if (included) {
26949                xmlStream.addAttribute(name, value);
26950              }
26951            };
26952
26953            add('rightToLeft', '1', model.rightToLeft === true);
26954            add('tabSelected', '1', model.tabSelected);
26955            add('showRuler', '0', model.showRuler === false);
26956            add('showRowColHeaders', '0', model.showRowColHeaders === false);
26957            add('showGridLines', '0', model.showGridLines === false);
26958            add('zoomScale', model.zoomScale, model.zoomScale);
26959            add('zoomScaleNormal', model.zoomScaleNormal, model.zoomScaleNormal);
26960            add('view', model.style, model.style);
26961            var topLeftCell;
26962            var xSplit;
26963            var ySplit;
26964            var activePane;
26965
26966            switch (model.state) {
26967              case 'frozen':
26968                xSplit = model.xSplit || 0;
26969                ySplit = model.ySplit || 0;
26970                topLeftCell = model.topLeftCell || colCache.getAddress(ySplit + 1, xSplit + 1).address;
26971                activePane = model.xSplit && model.ySplit && 'bottomRight' || model.xSplit && 'topRight' || 'bottomLeft';
26972                xmlStream.leafNode('pane', {
26973                  xSplit: model.xSplit || undefined,
26974                  ySplit: model.ySplit || undefined,
26975                  topLeftCell: topLeftCell,
26976                  activePane: activePane,
26977                  state: 'frozen'
26978                });
26979                xmlStream.leafNode('selection', {
26980                  pane: activePane,
26981                  activeCell: model.activeCell,
26982                  sqref: model.activeCell
26983                });
26984                break;
26985
26986              case 'split':
26987                if (model.activePane === 'topLeft') {
26988                  model.activePane = undefined;
26989                }
26990
26991                xmlStream.leafNode('pane', {
26992                  xSplit: model.xSplit || undefined,
26993                  ySplit: model.ySplit || undefined,
26994                  topLeftCell: model.topLeftCell,
26995                  activePane: model.activePane
26996                });
26997                xmlStream.leafNode('selection', {
26998                  pane: model.activePane,
26999                  activeCell: model.activeCell,
27000                  sqref: model.activeCell
27001                });
27002                break;
27003
27004              case 'normal':
27005                if (model.activeCell) {
27006                  xmlStream.leafNode('selection', {
27007                    activeCell: model.activeCell,
27008                    sqref: model.activeCell
27009                  });
27010                }
27011
27012                break;
27013
27014              default:
27015                break;
27016            }
27017
27018            xmlStream.closeNode();
27019          }
27020        }, {
27021          key: "parseOpen",
27022          value: function parseOpen(node) {
27023            switch (node.name) {
27024              case 'sheetView':
27025                this.sheetView = {
27026                  workbookViewId: parseInt(node.attributes.workbookViewId, 10),
27027                  rightToLeft: node.attributes.rightToLeft === '1',
27028                  tabSelected: node.attributes.tabSelected === '1',
27029                  showRuler: !(node.attributes.showRuler === '0'),
27030                  showRowColHeaders: !(node.attributes.showRowColHeaders === '0'),
27031                  showGridLines: !(node.attributes.showGridLines === '0'),
27032                  zoomScale: parseInt(node.attributes.zoomScale || '100', 10),
27033                  zoomScaleNormal: parseInt(node.attributes.zoomScaleNormal || '100', 10),
27034                  style: node.attributes.view
27035                };
27036                this.pane = undefined;
27037                this.selections = {};
27038                return true;
27039
27040              case 'pane':
27041                this.pane = {
27042                  xSplit: parseInt(node.attributes.xSplit || '0', 10),
27043                  ySplit: parseInt(node.attributes.ySplit || '0', 10),
27044                  topLeftCell: node.attributes.topLeftCell,
27045                  activePane: node.attributes.activePane || 'topLeft',
27046                  state: node.attributes.state
27047                };
27048                return true;
27049
27050              case 'selection':
27051                {
27052                  var name = node.attributes.pane || 'topLeft';
27053                  this.selections[name] = {
27054                    pane: name,
27055                    activeCell: node.attributes.activeCell
27056                  };
27057                  return true;
27058                }
27059
27060              default:
27061                return false;
27062            }
27063          }
27064        }, {
27065          key: "parseText",
27066          value: function parseText() {}
27067        }, {
27068          key: "parseClose",
27069          value: function parseClose(name) {
27070            var model;
27071            var selection;
27072
27073            switch (name) {
27074              case 'sheetView':
27075                if (this.sheetView && this.pane) {
27076                  model = this.model = {
27077                    workbookViewId: this.sheetView.workbookViewId,
27078                    rightToLeft: this.sheetView.rightToLeft,
27079                    state: VIEW_STATES[this.pane.state] || 'split',
27080                    // split is default
27081                    xSplit: this.pane.xSplit,
27082                    ySplit: this.pane.ySplit,
27083                    topLeftCell: this.pane.topLeftCell,
27084                    showRuler: this.sheetView.showRuler,
27085                    showRowColHeaders: this.sheetView.showRowColHeaders,
27086                    showGridLines: this.sheetView.showGridLines,
27087                    zoomScale: this.sheetView.zoomScale,
27088                    zoomScaleNormal: this.sheetView.zoomScaleNormal
27089                  };
27090
27091                  if (this.model.state === 'split') {
27092                    model.activePane = this.pane.activePane;
27093                  }
27094
27095                  selection = this.selections[this.pane.activePane];
27096
27097                  if (selection && selection.activeCell) {
27098                    model.activeCell = selection.activeCell;
27099                  }
27100
27101                  if (this.sheetView.style) {
27102                    model.style = this.sheetView.style;
27103                  }
27104                } else {
27105                  model = this.model = {
27106                    workbookViewId: this.sheetView.workbookViewId,
27107                    rightToLeft: this.sheetView.rightToLeft,
27108                    state: 'normal',
27109                    showRuler: this.sheetView.showRuler,
27110                    showRowColHeaders: this.sheetView.showRowColHeaders,
27111                    showGridLines: this.sheetView.showGridLines,
27112                    zoomScale: this.sheetView.zoomScale,
27113                    zoomScaleNormal: this.sheetView.zoomScaleNormal
27114                  };
27115                  selection = this.selections.topLeft;
27116
27117                  if (selection && selection.activeCell) {
27118                    model.activeCell = selection.activeCell;
27119                  }
27120
27121                  if (this.sheetView.style) {
27122                    model.style = this.sheetView.style;
27123                  }
27124                }
27125
27126                return false;
27127
27128              default:
27129                return true;
27130            }
27131          }
27132        }, {
27133          key: "reconcile",
27134          value: function reconcile() {}
27135        }, {
27136          key: "tag",
27137          get: function get() {
27138            return 'sheetView';
27139          }
27140        }]);
27141
27142        return SheetViewXform;
27143      }(BaseXform);
27144
27145      module.exports = SheetViewXform;
27146    }, {
27147      "../../../utils/col-cache": 17,
27148      "../base-xform": 29
27149    }],
27150    111: [function (require, module, exports) {
27151      "use strict";
27152
27153      function _typeof(obj) {
27154        "@babel/helpers - typeof";
27155
27156        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
27157          _typeof = function _typeof(obj) {
27158            return typeof obj;
27159          };
27160        } else {
27161          _typeof = function _typeof(obj) {
27162            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
27163          };
27164        }
27165
27166        return _typeof(obj);
27167      }
27168
27169      function _classCallCheck(instance, Constructor) {
27170        if (!(instance instanceof Constructor)) {
27171          throw new TypeError("Cannot call a class as a function");
27172        }
27173      }
27174
27175      function _defineProperties(target, props) {
27176        for (var i = 0; i < props.length; i++) {
27177          var descriptor = props[i];
27178          descriptor.enumerable = descriptor.enumerable || false;
27179          descriptor.configurable = true;
27180          if ("value" in descriptor) descriptor.writable = true;
27181          Object.defineProperty(target, descriptor.key, descriptor);
27182        }
27183      }
27184
27185      function _createClass(Constructor, protoProps, staticProps) {
27186        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
27187        if (staticProps) _defineProperties(Constructor, staticProps);
27188        return Constructor;
27189      }
27190
27191      function _inherits(subClass, superClass) {
27192        if (typeof superClass !== "function" && superClass !== null) {
27193          throw new TypeError("Super expression must either be null or a function");
27194        }
27195
27196        subClass.prototype = Object.create(superClass && superClass.prototype, {
27197          constructor: {
27198            value: subClass,
27199            writable: true,
27200            configurable: true
27201          }
27202        });
27203        if (superClass) _setPrototypeOf(subClass, superClass);
27204      }
27205
27206      function _setPrototypeOf(o, p) {
27207        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
27208          o.__proto__ = p;
27209          return o;
27210        };
27211
27212        return _setPrototypeOf(o, p);
27213      }
27214
27215      function _createSuper(Derived) {
27216        return function () {
27217          var Super = _getPrototypeOf(Derived),
27218              result;
27219
27220          if (_isNativeReflectConstruct()) {
27221            var NewTarget = _getPrototypeOf(this).constructor;
27222
27223            result = Reflect.construct(Super, arguments, NewTarget);
27224          } else {
27225            result = Super.apply(this, arguments);
27226          }
27227
27228          return _possibleConstructorReturn(this, result);
27229        };
27230      }
27231
27232      function _possibleConstructorReturn(self, call) {
27233        if (call && (_typeof(call) === "object" || typeof call === "function")) {
27234          return call;
27235        }
27236
27237        return _assertThisInitialized(self);
27238      }
27239
27240      function _assertThisInitialized(self) {
27241        if (self === void 0) {
27242          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
27243        }
27244
27245        return self;
27246      }
27247
27248      function _isNativeReflectConstruct() {
27249        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
27250        if (Reflect.construct.sham) return false;
27251        if (typeof Proxy === "function") return true;
27252
27253        try {
27254          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
27255          return true;
27256        } catch (e) {
27257          return false;
27258        }
27259      }
27260
27261      function _getPrototypeOf(o) {
27262        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
27263          return o.__proto__ || Object.getPrototypeOf(o);
27264        };
27265        return _getPrototypeOf(o);
27266      }
27267
27268      var BaseXform = require('../base-xform');
27269
27270      var TablePartXform = /*#__PURE__*/function (_BaseXform) {
27271        _inherits(TablePartXform, _BaseXform);
27272
27273        var _super = _createSuper(TablePartXform);
27274
27275        function TablePartXform() {
27276          _classCallCheck(this, TablePartXform);
27277
27278          return _super.apply(this, arguments);
27279        }
27280
27281        _createClass(TablePartXform, [{
27282          key: "render",
27283          value: function render(xmlStream, model) {
27284            if (model) {
27285              xmlStream.leafNode(this.tag, {
27286                'r:id': model.rId
27287              });
27288            }
27289          }
27290        }, {
27291          key: "parseOpen",
27292          value: function parseOpen(node) {
27293            switch (node.name) {
27294              case this.tag:
27295                this.model = {
27296                  rId: node.attributes['r:id']
27297                };
27298                return true;
27299
27300              default:
27301                return false;
27302            }
27303          }
27304        }, {
27305          key: "parseText",
27306          value: function parseText() {}
27307        }, {
27308          key: "parseClose",
27309          value: function parseClose() {
27310            return false;
27311          }
27312        }, {
27313          key: "tag",
27314          get: function get() {
27315            return 'tablePart';
27316          }
27317        }]);
27318
27319        return TablePartXform;
27320      }(BaseXform);
27321
27322      module.exports = TablePartXform;
27323    }, {
27324      "../base-xform": 29
27325    }],
27326    112: [function (require, module, exports) {
27327      "use strict";
27328
27329      function _typeof(obj) {
27330        "@babel/helpers - typeof";
27331
27332        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
27333          _typeof = function _typeof(obj) {
27334            return typeof obj;
27335          };
27336        } else {
27337          _typeof = function _typeof(obj) {
27338            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
27339          };
27340        }
27341
27342        return _typeof(obj);
27343      }
27344
27345      function _classCallCheck(instance, Constructor) {
27346        if (!(instance instanceof Constructor)) {
27347          throw new TypeError("Cannot call a class as a function");
27348        }
27349      }
27350
27351      function _defineProperties(target, props) {
27352        for (var i = 0; i < props.length; i++) {
27353          var descriptor = props[i];
27354          descriptor.enumerable = descriptor.enumerable || false;
27355          descriptor.configurable = true;
27356          if ("value" in descriptor) descriptor.writable = true;
27357          Object.defineProperty(target, descriptor.key, descriptor);
27358        }
27359      }
27360
27361      function _createClass(Constructor, protoProps, staticProps) {
27362        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
27363        if (staticProps) _defineProperties(Constructor, staticProps);
27364        return Constructor;
27365      }
27366
27367      function _inherits(subClass, superClass) {
27368        if (typeof superClass !== "function" && superClass !== null) {
27369          throw new TypeError("Super expression must either be null or a function");
27370        }
27371
27372        subClass.prototype = Object.create(superClass && superClass.prototype, {
27373          constructor: {
27374            value: subClass,
27375            writable: true,
27376            configurable: true
27377          }
27378        });
27379        if (superClass) _setPrototypeOf(subClass, superClass);
27380      }
27381
27382      function _setPrototypeOf(o, p) {
27383        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
27384          o.__proto__ = p;
27385          return o;
27386        };
27387
27388        return _setPrototypeOf(o, p);
27389      }
27390
27391      function _createSuper(Derived) {
27392        return function () {
27393          var Super = _getPrototypeOf(Derived),
27394              result;
27395
27396          if (_isNativeReflectConstruct()) {
27397            var NewTarget = _getPrototypeOf(this).constructor;
27398
27399            result = Reflect.construct(Super, arguments, NewTarget);
27400          } else {
27401            result = Super.apply(this, arguments);
27402          }
27403
27404          return _possibleConstructorReturn(this, result);
27405        };
27406      }
27407
27408      function _possibleConstructorReturn(self, call) {
27409        if (call && (_typeof(call) === "object" || typeof call === "function")) {
27410          return call;
27411        }
27412
27413        return _assertThisInitialized(self);
27414      }
27415
27416      function _assertThisInitialized(self) {
27417        if (self === void 0) {
27418          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
27419        }
27420
27421        return self;
27422      }
27423
27424      function _isNativeReflectConstruct() {
27425        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
27426        if (Reflect.construct.sham) return false;
27427        if (typeof Proxy === "function") return true;
27428
27429        try {
27430          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
27431          return true;
27432        } catch (e) {
27433          return false;
27434        }
27435      }
27436
27437      function _getPrototypeOf(o) {
27438        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
27439          return o.__proto__ || Object.getPrototypeOf(o);
27440        };
27441        return _getPrototypeOf(o);
27442      }
27443
27444      var _ = require('../../../utils/under-dash');
27445
27446      var colCache = require('../../../utils/col-cache');
27447
27448      var XmlStream = require('../../../utils/xml-stream');
27449
27450      var RelType = require('../../rel-type');
27451
27452      var Merges = require('./merges');
27453
27454      var BaseXform = require('../base-xform');
27455
27456      var ListXform = require('../list-xform');
27457
27458      var RowXform = require('./row-xform');
27459
27460      var ColXform = require('./col-xform');
27461
27462      var DimensionXform = require('./dimension-xform');
27463
27464      var HyperlinkXform = require('./hyperlink-xform');
27465
27466      var MergeCellXform = require('./merge-cell-xform');
27467
27468      var DataValidationsXform = require('./data-validations-xform');
27469
27470      var SheetPropertiesXform = require('./sheet-properties-xform');
27471
27472      var SheetFormatPropertiesXform = require('./sheet-format-properties-xform');
27473
27474      var SheetViewXform = require('./sheet-view-xform');
27475
27476      var SheetProtectionXform = require('./sheet-protection-xform');
27477
27478      var PageMarginsXform = require('./page-margins-xform');
27479
27480      var PageSetupXform = require('./page-setup-xform');
27481
27482      var PrintOptionsXform = require('./print-options-xform');
27483
27484      var AutoFilterXform = require('./auto-filter-xform');
27485
27486      var PictureXform = require('./picture-xform');
27487
27488      var DrawingXform = require('./drawing-xform');
27489
27490      var TablePartXform = require('./table-part-xform');
27491
27492      var RowBreaksXform = require('./row-breaks-xform');
27493
27494      var HeaderFooterXform = require('./header-footer-xform');
27495
27496      var ConditionalFormattingsXform = require('./cf/conditional-formattings-xform');
27497
27498      var ExtListXform = require('./ext-lst-xform');
27499
27500      var mergeRule = function mergeRule(rule, extRule) {
27501        Object.keys(extRule).forEach(function (key) {
27502          var value = rule[key];
27503          var extValue = extRule[key];
27504
27505          if (value === undefined && extValue !== undefined) {
27506            rule[key] = extValue;
27507          }
27508        });
27509      };
27510
27511      var mergeConditionalFormattings = function mergeConditionalFormattings(model, extModel) {
27512        // conditional formattings are rendered in worksheet.conditionalFormatting and also in
27513        // worksheet.extLst.ext.x14:conditionalFormattings
27514        // some (e.g. dataBar) are even spread across both!
27515        if (!extModel || !extModel.length) {
27516          return model;
27517        }
27518
27519        if (!model || !model.length) {
27520          return extModel;
27521        } // index model rules by x14Id
27522
27523
27524        var cfMap = {};
27525        var ruleMap = {};
27526        model.forEach(function (cf) {
27527          cfMap[cf.ref] = cf;
vendor: 4,864 bytes, lines 27528-27673
27528          cf.rules.forEach(function (rule) {
27529            var x14Id = rule.x14Id;
27530
27531            if (x14Id) {
27532              ruleMap[x14Id] = rule;
27533            }
27534          });
27535        });
27536        extModel.forEach(function (extCf) {
27537          extCf.rules.forEach(function (extRule) {
27538            var rule = ruleMap[extRule.x14Id];
27539
27540            if (rule) {
27541              // merge with matching rule
27542              mergeRule(rule, extRule);
27543            } else if (cfMap[extCf.ref]) {
27544              // reuse existing cf ref
27545              cfMap[extCf.ref].rules.push(extRule);
27546            } else {
27547              // create new cf
27548              model.push({
27549                ref: extCf.ref,
27550                rules: [extRule]
27551              });
27552            }
27553          });
27554        }); // need to cope with rules in extModel that don't exist in model
27555
27556        return model;
27557      };
27558
27559      var WorkSheetXform = /*#__PURE__*/function (_BaseXform) {
27560        _inherits(WorkSheetXform, _BaseXform);
27561
27562        var _super = _createSuper(WorkSheetXform);
27563
27564        function WorkSheetXform(options) {
27565          var _this;
27566
27567          _classCallCheck(this, WorkSheetXform);
27568
27569          _this = _super.call(this);
27570
27571          var _ref = options || {},
27572              maxRows = _ref.maxRows,
27573              maxCols = _ref.maxCols;
27574
27575          _this.map = {
27576            sheetPr: new SheetPropertiesXform(),
27577            dimension: new DimensionXform(),
27578            sheetViews: new ListXform({
27579              tag: 'sheetViews',
27580              count: false,
27581              childXform: new SheetViewXform()
27582            }),
27583            sheetFormatPr: new SheetFormatPropertiesXform(),
27584            cols: new ListXform({
27585              tag: 'cols',
27586              count: false,
27587              childXform: new ColXform()
27588            }),
27589            sheetData: new ListXform({
27590              tag: 'sheetData',
27591              count: false,
27592              empty: true,
27593              childXform: new RowXform({
27594                maxItems: maxCols
27595              }),
27596              maxItems: maxRows
27597            }),
27598            autoFilter: new AutoFilterXform(),
27599            mergeCells: new ListXform({
27600              tag: 'mergeCells',
27601              count: true,
27602              childXform: new MergeCellXform()
27603            }),
27604            rowBreaks: new RowBreaksXform(),
27605            hyperlinks: new ListXform({
27606              tag: 'hyperlinks',
27607              count: false,
27608              childXform: new HyperlinkXform()
27609            }),
27610            pageMargins: new PageMarginsXform(),
27611            dataValidations: new DataValidationsXform(),
27612            pageSetup: new PageSetupXform(),
27613            headerFooter: new HeaderFooterXform(),
27614            printOptions: new PrintOptionsXform(),
27615            picture: new PictureXform(),
27616            drawing: new DrawingXform(),
27617            sheetProtection: new SheetProtectionXform(),
27618            tableParts: new ListXform({
27619              tag: 'tableParts',
27620              count: true,
27621              childXform: new TablePartXform()
27622            }),
27623            conditionalFormatting: new ConditionalFormattingsXform(),
27624            extLst: new ExtListXform()
27625          };
27626          return _this;
27627        }
27628
27629        _createClass(WorkSheetXform, [{
27630          key: "prepare",
27631          value: function prepare(model, options) {
27632            var _this2 = this;
27633
27634            options.merges = new Merges();
27635            model.hyperlinks = options.hyperlinks = [];
27636            model.comments = options.comments = [];
27637            options.formulae = {};
27638            options.siFormulae = 0;
27639            this.map.cols.prepare(model.cols, options);
27640            this.map.sheetData.prepare(model.rows, options);
27641            this.map.conditionalFormatting.prepare(model.conditionalFormattings, options);
27642            model.mergeCells = options.merges.mergeCells; // prepare relationships
27643
27644            var rels = model.rels = [];
27645
27646            function nextRid(r) {
27647              return "rId".concat(r.length + 1);
27648            }
27649
27650            model.hyperlinks.forEach(function (hyperlink) {
27651              var rId = nextRid(rels);
27652              hyperlink.rId = rId;
27653              rels.push({
27654                Id: rId,
27655                Type: RelType.Hyperlink,
27656                Target: hyperlink.target,
27657                TargetMode: 'External'
27658              });
27659            }); // prepare comment relationships
27660
27661            if (model.comments.length > 0) {
27662              var comment = {
27663                Id: nextRid(rels),
27664                Type: RelType.Comments,
27665                Target: "../comments".concat(model.id, ".xml")
27666              };
27667              rels.push(comment);
27668              var vmlDrawing = {
27669                Id: nextRid(rels),
27670                Type: RelType.VmlDrawing,
27671                Target: "../drawings/vmlDrawing".concat(model.id, ".vml")
27672              };
27673              rels.push(vmlDrawing);
vendor: 16,077 bytes, lines 27674-28074
27674              model.comments.forEach(function (item) {
27675                item.refAddress = colCache.decodeAddress(item.ref);
27676              });
27677              options.commentRefs.push({
27678                commentName: "comments".concat(model.id),
27679                vmlDrawing: "vmlDrawing".concat(model.id)
27680              });
27681            }
27682
27683            var drawingRelsHash = [];
27684            var bookImage;
27685            model.media.forEach(function (medium) {
27686              if (medium.type === 'background') {
27687                var rId = nextRid(rels);
27688                bookImage = options.media[medium.imageId];
27689                rels.push({
27690                  Id: rId,
27691                  Type: RelType.Image,
27692                  Target: "../media/".concat(bookImage.name, ".").concat(bookImage.extension)
27693                });
27694                model.background = {
27695                  rId: rId
27696                };
27697                model.image = options.media[medium.imageId];
27698              } else if (medium.type === 'image') {
27699                var drawing = model.drawing;
27700                bookImage = options.media[medium.imageId];
27701
27702                if (!drawing) {
27703                  drawing = model.drawing = {
27704                    rId: nextRid(rels),
27705                    name: "drawing".concat(++options.drawingsCount),
27706                    anchors: [],
27707                    rels: []
27708                  };
27709                  options.drawings.push(drawing);
27710                  rels.push({
27711                    Id: drawing.rId,
27712                    Type: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing',
27713                    Target: "../drawings/".concat(drawing.name, ".xml")
27714                  });
27715                }
27716
27717                var rIdImage = _this2.preImageId === medium.imageId ? drawingRelsHash[medium.imageId] : drawingRelsHash[drawing.rels.length];
27718
27719                if (!rIdImage) {
27720                  rIdImage = nextRid(drawing.rels);
27721                  drawingRelsHash[drawing.rels.length] = rIdImage;
27722                  drawing.rels.push({
27723                    Id: rIdImage,
27724                    Type: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image',
27725                    Target: "../media/".concat(bookImage.name, ".").concat(bookImage.extension)
27726                  });
27727                }
27728
27729                var anchor = {
27730                  picture: {
27731                    rId: rIdImage
27732                  },
27733                  range: medium.range
27734                };
27735
27736                if (medium.hyperlinks && medium.hyperlinks.hyperlink) {
27737                  var rIdHyperLink = nextRid(drawing.rels);
27738                  drawingRelsHash[drawing.rels.length] = rIdHyperLink;
27739                  anchor.picture.hyperlinks = {
27740                    tooltip: medium.hyperlinks.tooltip,
27741                    rId: rIdHyperLink
27742                  };
27743                  drawing.rels.push({
27744                    Id: rIdHyperLink,
27745                    Type: RelType.Hyperlink,
27746                    Target: medium.hyperlinks.hyperlink,
27747                    TargetMode: 'External'
27748                  });
27749                }
27750
27751                _this2.preImageId = medium.imageId;
27752                drawing.anchors.push(anchor);
27753              }
27754            }); // prepare tables
27755
27756            model.tables.forEach(function (table) {
27757              // relationships
27758              var rId = nextRid(rels);
27759              table.rId = rId;
27760              rels.push({
27761                Id: rId,
27762                Type: RelType.Table,
27763                Target: "../tables/".concat(table.target)
27764              }); // dynamic styles
27765
27766              table.columns.forEach(function (column) {
27767                var style = column.style;
27768
27769                if (style) {
27770                  column.dxfId = options.styles.addDxfStyle(style);
27771                }
27772              });
27773            }); // prepare ext items
27774
27775            this.map.extLst.prepare(model, options);
27776          }
27777        }, {
27778          key: "render",
27779          value: function render(xmlStream, model) {
27780            xmlStream.openXml(XmlStream.StdDocAttributes);
27781            xmlStream.openNode('worksheet', WorkSheetXform.WORKSHEET_ATTRIBUTES);
27782            var sheetFormatPropertiesModel = model.properties ? {
27783              defaultRowHeight: model.properties.defaultRowHeight,
27784              dyDescent: model.properties.dyDescent,
27785              outlineLevelCol: model.properties.outlineLevelCol,
27786              outlineLevelRow: model.properties.outlineLevelRow
27787            } : undefined;
27788
27789            if (model.properties && model.properties.defaultColWidth) {
27790              sheetFormatPropertiesModel.defaultColWidth = model.properties.defaultColWidth;
27791            }
27792
27793            var sheetPropertiesModel = {
27794              outlineProperties: model.properties && model.properties.outlineProperties,
27795              tabColor: model.properties && model.properties.tabColor,
27796              pageSetup: model.pageSetup && model.pageSetup.fitToPage ? {
27797                fitToPage: model.pageSetup.fitToPage
27798              } : undefined
27799            };
27800            var pageMarginsModel = model.pageSetup && model.pageSetup.margins;
27801            var printOptionsModel = {
27802              showRowColHeaders: model.pageSetup && model.pageSetup.showRowColHeaders,
27803              showGridLines: model.pageSetup && model.pageSetup.showGridLines,
27804              horizontalCentered: model.pageSetup && model.pageSetup.horizontalCentered,
27805              verticalCentered: model.pageSetup && model.pageSetup.verticalCentered
27806            };
27807            var sheetProtectionModel = model.sheetProtection;
27808            this.map.sheetPr.render(xmlStream, sheetPropertiesModel);
27809            this.map.dimension.render(xmlStream, model.dimensions);
27810            this.map.sheetViews.render(xmlStream, model.views);
27811            this.map.sheetFormatPr.render(xmlStream, sheetFormatPropertiesModel);
27812            this.map.cols.render(xmlStream, model.cols);
27813            this.map.sheetData.render(xmlStream, model.rows);
27814            this.map.sheetProtection.render(xmlStream, sheetProtectionModel); // Note: must be after sheetData and before autoFilter
27815
27816            this.map.autoFilter.render(xmlStream, model.autoFilter);
27817            this.map.mergeCells.render(xmlStream, model.mergeCells);
27818            this.map.conditionalFormatting.render(xmlStream, model.conditionalFormattings); // Note: must be before dataValidations
27819
27820            this.map.dataValidations.render(xmlStream, model.dataValidations); // For some reason hyperlinks have to be after the data validations
27821
27822            this.map.hyperlinks.render(xmlStream, model.hyperlinks);
27823            this.map.printOptions.render(xmlStream, printOptionsModel); // Note: must be before pageMargins
27824
27825            this.map.pageMargins.render(xmlStream, pageMarginsModel);
27826            this.map.pageSetup.render(xmlStream, model.pageSetup);
27827            this.map.headerFooter.render(xmlStream, model.headerFooter);
27828            this.map.rowBreaks.render(xmlStream, model.rowBreaks);
27829            this.map.drawing.render(xmlStream, model.drawing); // Note: must be after rowBreaks
27830
27831            this.map.picture.render(xmlStream, model.background); // Note: must be after drawing
27832
27833            this.map.tableParts.render(xmlStream, model.tables);
27834            this.map.extLst.render(xmlStream, model);
27835
27836            if (model.rels) {
27837              // add a <legacyDrawing /> node for each comment
27838              model.rels.forEach(function (rel) {
27839                if (rel.Type === RelType.VmlDrawing) {
27840                  xmlStream.leafNode('legacyDrawing', {
27841                    'r:id': rel.Id
27842                  });
27843                }
27844              });
27845            }
27846
27847            xmlStream.closeNode();
27848          }
27849        }, {
27850          key: "parseOpen",
27851          value: function parseOpen(node) {
27852            if (this.parser) {
27853              this.parser.parseOpen(node);
27854              return true;
27855            }
27856
27857            if (node.name === 'worksheet') {
27858              _.each(this.map, function (xform) {
27859                xform.reset();
27860              });
27861
27862              return true;
27863            }
27864
27865            this.parser = this.map[node.name];
27866
27867            if (this.parser) {
27868              this.parser.parseOpen(node);
27869            }
27870
27871            return true;
27872          }
27873        }, {
27874          key: "parseText",
27875          value: function parseText(text) {
27876            if (this.parser) {
27877              this.parser.parseText(text);
27878            }
27879          }
27880        }, {
27881          key: "parseClose",
27882          value: function parseClose(name) {
27883            if (this.parser) {
27884              if (!this.parser.parseClose(name)) {
27885                this.parser = undefined;
27886              }
27887
27888              return true;
27889            }
27890
27891            switch (name) {
27892              case 'worksheet':
27893                {
27894                  var properties = this.map.sheetFormatPr.model || {};
27895
27896                  if (this.map.sheetPr.model && this.map.sheetPr.model.tabColor) {
27897                    properties.tabColor = this.map.sheetPr.model.tabColor;
27898                  }
27899
27900                  if (this.map.sheetPr.model && this.map.sheetPr.model.outlineProperties) {
27901                    properties.outlineProperties = this.map.sheetPr.model.outlineProperties;
27902                  }
27903
27904                  var sheetProperties = {
27905                    fitToPage: this.map.sheetPr.model && this.map.sheetPr.model.pageSetup && this.map.sheetPr.model.pageSetup.fitToPage || false,
27906                    margins: this.map.pageMargins.model
27907                  };
27908                  var pageSetup = Object.assign(sheetProperties, this.map.pageSetup.model, this.map.printOptions.model);
27909                  var conditionalFormattings = mergeConditionalFormattings(this.map.conditionalFormatting.model, this.map.extLst.model && this.map.extLst.model['x14:conditionalFormattings']);
27910                  this.model = {
27911                    dimensions: this.map.dimension.model,
27912                    cols: this.map.cols.model,
27913                    rows: this.map.sheetData.model,
27914                    mergeCells: this.map.mergeCells.model,
27915                    hyperlinks: this.map.hyperlinks.model,
27916                    dataValidations: this.map.dataValidations.model,
27917                    properties: properties,
27918                    views: this.map.sheetViews.model,
27919                    pageSetup: pageSetup,
27920                    headerFooter: this.map.headerFooter.model,
27921                    background: this.map.picture.model,
27922                    drawing: this.map.drawing.model,
27923                    tables: this.map.tableParts.model,
27924                    conditionalFormattings: conditionalFormattings
27925                  };
27926
27927                  if (this.map.autoFilter.model) {
27928                    this.model.autoFilter = this.map.autoFilter.model;
27929                  }
27930
27931                  if (this.map.sheetProtection.model) {
27932                    this.model.sheetProtection = this.map.sheetProtection.model;
27933                  }
27934
27935                  return false;
27936                }
27937
27938              default:
27939                // not quite sure how we get here!
27940                return true;
27941            }
27942          }
27943        }, {
27944          key: "reconcile",
27945          value: function reconcile(model, options) {
27946            // options.merges = new Merges();
27947            // options.merges.reconcile(model.mergeCells, model.rows);
27948            var rels = (model.relationships || []).reduce(function (h, rel) {
27949              h[rel.Id] = rel;
27950
27951              if (rel.Type === RelType.Comments) {
27952                model.comments = options.comments[rel.Target].comments;
27953              }
27954
27955              if (rel.Type === RelType.VmlDrawing && model.comments && model.comments.length) {
27956                var vmlComment = options.vmlDrawings[rel.Target].comments;
27957                model.comments.forEach(function (comment, index) {
27958                  comment.note = Object.assign({}, comment.note, vmlComment[index]);
27959                });
27960              }
27961
27962              return h;
27963            }, {});
27964            options.commentsMap = (model.comments || []).reduce(function (h, comment) {
27965              if (comment.ref) {
27966                h[comment.ref] = comment;
27967              }
27968
27969              return h;
27970            }, {});
27971            options.hyperlinkMap = (model.hyperlinks || []).reduce(function (h, hyperlink) {
27972              if (hyperlink.rId) {
27973                h[hyperlink.address] = rels[hyperlink.rId].Target;
27974              }
27975
27976              return h;
27977            }, {});
27978            options.formulae = {}; // compact the rows and cells
27979
27980            model.rows = model.rows && model.rows.filter(Boolean) || [];
27981            model.rows.forEach(function (row) {
27982              row.cells = row.cells && row.cells.filter(Boolean) || [];
27983            });
27984            this.map.cols.reconcile(model.cols, options);
27985            this.map.sheetData.reconcile(model.rows, options);
27986            this.map.conditionalFormatting.reconcile(model.conditionalFormattings, options);
27987            model.media = [];
27988
27989            if (model.drawing) {
27990              var drawingRel = rels[model.drawing.rId];
27991              var match = drawingRel.Target.match(/\/drawings\/([a-zA-Z0-9]+)[.][a-zA-Z]{3,4}$/);
27992
27993              if (match) {
27994                var drawingName = match[1];
27995                var drawing = options.drawings[drawingName];
27996                drawing.anchors.forEach(function (anchor) {
27997                  if (anchor.medium) {
27998                    var image = {
27999                      type: 'image',
28000                      imageId: anchor.medium.index,
28001                      range: anchor.range,
28002                      hyperlinks: anchor.picture.hyperlinks
28003                    };
28004                    model.media.push(image);
28005                  }
28006                });
28007              }
28008            }
28009
28010            var backgroundRel = model.background && rels[model.background.rId];
28011
28012            if (backgroundRel) {
28013              var target = backgroundRel.Target.split('/media/')[1];
28014              var imageId = options.mediaIndex && options.mediaIndex[target];
28015
28016              if (imageId !== undefined) {
28017                model.media.push({
28018                  type: 'background',
28019                  imageId: imageId
28020                });
28021              }
28022            }
28023
28024            model.tables = (model.tables || []).map(function (tablePart) {
28025              var rel = rels[tablePart.rId];
28026              return options.tables[rel.Target];
28027            });
28028            delete model.relationships;
28029            delete model.hyperlinks;
28030            delete model.comments;
28031          }
28032        }]);
28033
28034        return WorkSheetXform;
28035      }(BaseXform);
28036
28037      WorkSheetXform.WORKSHEET_ATTRIBUTES = {
28038        xmlns: 'http://schemas.openxmlformats.org/spreadsheetml/2006/main',
28039        'xmlns:r': 'http://schemas.openxmlformats.org/officeDocument/2006/relationships',
28040        'xmlns:mc': 'http://schemas.openxmlformats.org/markup-compatibility/2006',
28041        'mc:Ignorable': 'x14ac',
28042        'xmlns:x14ac': 'http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac'
28043      };
28044      module.exports = WorkSheetXform;
28045    }, {
28046      "../../../utils/col-cache": 17,
28047      "../../../utils/under-dash": 23,
28048      "../../../utils/xml-stream": 25,
28049      "../../rel-type": 28,
28050      "../base-xform": 29,
28051      "../list-xform": 68,
28052      "./auto-filter-xform": 69,
28053      "./cf/conditional-formattings-xform": 84,
28054      "./col-xform": 89,
28055      "./data-validations-xform": 90,
28056      "./dimension-xform": 91,
28057      "./drawing-xform": 92,
28058      "./ext-lst-xform": 93,
28059      "./header-footer-xform": 94,
28060      "./hyperlink-xform": 95,
28061      "./merge-cell-xform": 96,
28062      "./merges": 97,
28063      "./page-margins-xform": 100,
28064      "./page-setup-xform": 102,
28065      "./picture-xform": 103,
28066      "./print-options-xform": 104,
28067      "./row-breaks-xform": 105,
28068      "./row-xform": 106,
28069      "./sheet-format-properties-xform": 107,
28070      "./sheet-properties-xform": 108,
28071      "./sheet-protection-xform": 109,
28072      "./sheet-view-xform": 110,
28073      "./table-part-xform": 111
28074    }],
28075    113: [function (require, module, exports) {
28076      "use strict";
28077
28078      function _typeof(obj) {
28079        "@babel/helpers - typeof";
28080
28081        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
28082          _typeof = function _typeof(obj) {
28083            return typeof obj;
28084          };
28085        } else {
28086          _typeof = function _typeof(obj) {
28087            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
28088          };
28089        }
28090
28091        return _typeof(obj);
28092      }
28093
28094      function _classCallCheck(instance, Constructor) {
28095        if (!(instance instanceof Constructor)) {
28096          throw new TypeError("Cannot call a class as a function");
28097        }
28098      }
28099
28100      function _defineProperties(target, props) {
28101        for (var i = 0; i < props.length; i++) {
28102          var descriptor = props[i];
28103          descriptor.enumerable = descriptor.enumerable || false;
28104          descriptor.configurable = true;
28105          if ("value" in descriptor) descriptor.writable = true;
28106          Object.defineProperty(target, descriptor.key, descriptor);
28107        }
28108      }
28109
28110      function _createClass(Constructor, protoProps, staticProps) {
28111        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
28112        if (staticProps) _defineProperties(Constructor, staticProps);
28113        return Constructor;
28114      }
28115
28116      function _inherits(subClass, superClass) {
28117        if (typeof superClass !== "function" && superClass !== null) {
28118          throw new TypeError("Super expression must either be null or a function");
28119        }
28120
28121        subClass.prototype = Object.create(superClass && superClass.prototype, {
28122          constructor: {
28123            value: subClass,
28124            writable: true,
28125            configurable: true
28126          }
28127        });
28128        if (superClass) _setPrototypeOf(subClass, superClass);
28129      }
28130
28131      function _setPrototypeOf(o, p) {
28132        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
28133          o.__proto__ = p;
28134          return o;
28135        };
28136
28137        return _setPrototypeOf(o, p);
28138      }
28139
28140      function _createSuper(Derived) {
28141        return function () {
28142          var Super = _getPrototypeOf(Derived),
28143              result;
28144
28145          if (_isNativeReflectConstruct()) {
28146            var NewTarget = _getPrototypeOf(this).constructor;
28147
28148            result = Reflect.construct(Super, arguments, NewTarget);
28149          } else {
28150            result = Super.apply(this, arguments);
28151          }
28152
28153          return _possibleConstructorReturn(this, result);
28154        };
28155      }
28156
28157      function _possibleConstructorReturn(self, call) {
28158        if (call && (_typeof(call) === "object" || typeof call === "function")) {
28159          return call;
28160        }
28161
28162        return _assertThisInitialized(self);
28163      }
28164
28165      function _assertThisInitialized(self) {
28166        if (self === void 0) {
28167          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
28168        }
28169
28170        return self;
28171      }
28172
28173      function _isNativeReflectConstruct() {
28174        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
28175        if (Reflect.construct.sham) return false;
28176        if (typeof Proxy === "function") return true;
28177
28178        try {
28179          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
28180          return true;
28181        } catch (e) {
28182          return false;
28183        }
28184      }
28185
28186      function _getPrototypeOf(o) {
28187        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
28188          return o.__proto__ || Object.getPrototypeOf(o);
28189        };
28190        return _getPrototypeOf(o);
28191      }
28192
28193      var BaseXform = require('../base-xform');
28194
28195      var BooleanXform = /*#__PURE__*/function (_BaseXform) {
28196        _inherits(BooleanXform, _BaseXform);
28197
28198        var _super = _createSuper(BooleanXform);
28199
28200        function BooleanXform(options) {
28201          var _this;
28202
28203          _classCallCheck(this, BooleanXform);
28204
28205          _this = _super.call(this);
28206          _this.tag = options.tag;
28207          _this.attr = options.attr;
28208          return _this;
28209        }
28210
28211        _createClass(BooleanXform, [{
28212          key: "render",
28213          value: function render(xmlStream, model) {
28214            if (model) {
28215              xmlStream.openNode(this.tag);
28216              xmlStream.closeNode();
28217            }
28218          }
28219        }, {
28220          key: "parseOpen",
28221          value: function parseOpen(node) {
28222            if (node.name === this.tag) {
28223              this.model = true;
28224            }
28225          }
28226        }, {
28227          key: "parseText",
28228          value: function parseText() {}
28229        }, {
28230          key: "parseClose",
28231          value: function parseClose() {
28232            return false;
28233          }
28234        }]);
28235
28236        return BooleanXform;
28237      }(BaseXform);
28238
28239      module.exports = BooleanXform;
28240    }, {
28241      "../base-xform": 29
28242    }],
28243    114: [function (require, module, exports) {
28244      "use strict";
28245
28246      function _typeof(obj) {
28247        "@babel/helpers - typeof";
28248
28249        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
28250          _typeof = function _typeof(obj) {
28251            return typeof obj;
28252          };
28253        } else {
28254          _typeof = function _typeof(obj) {
28255            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
28256          };
28257        }
28258
28259        return _typeof(obj);
28260      }
28261
28262      function _classCallCheck(instance, Constructor) {
28263        if (!(instance instanceof Constructor)) {
28264          throw new TypeError("Cannot call a class as a function");
28265        }
28266      }
28267
28268      function _defineProperties(target, props) {
28269        for (var i = 0; i < props.length; i++) {
28270          var descriptor = props[i];
28271          descriptor.enumerable = descriptor.enumerable || false;
28272          descriptor.configurable = true;
28273          if ("value" in descriptor) descriptor.writable = true;
28274          Object.defineProperty(target, descriptor.key, descriptor);
28275        }
28276      }
28277
28278      function _createClass(Constructor, protoProps, staticProps) {
28279        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
28280        if (staticProps) _defineProperties(Constructor, staticProps);
28281        return Constructor;
28282      }
28283
28284      function _inherits(subClass, superClass) {
28285        if (typeof superClass !== "function" && superClass !== null) {
28286          throw new TypeError("Super expression must either be null or a function");
28287        }
28288
28289        subClass.prototype = Object.create(superClass && superClass.prototype, {
28290          constructor: {
28291            value: subClass,
28292            writable: true,
28293            configurable: true
28294          }
28295        });
28296        if (superClass) _setPrototypeOf(subClass, superClass);
28297      }
28298
28299      function _setPrototypeOf(o, p) {
28300        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
28301          o.__proto__ = p;
28302          return o;
28303        };
28304
28305        return _setPrototypeOf(o, p);
28306      }
28307
28308      function _createSuper(Derived) {
28309        return function () {
28310          var Super = _getPrototypeOf(Derived),
28311              result;
28312
28313          if (_isNativeReflectConstruct()) {
28314            var NewTarget = _getPrototypeOf(this).constructor;
28315
28316            result = Reflect.construct(Super, arguments, NewTarget);
28317          } else {
28318            result = Super.apply(this, arguments);
28319          }
28320
28321          return _possibleConstructorReturn(this, result);
28322        };
28323      }
28324
28325      function _possibleConstructorReturn(self, call) {
28326        if (call && (_typeof(call) === "object" || typeof call === "function")) {
28327          return call;
28328        }
28329
28330        return _assertThisInitialized(self);
28331      }
28332
28333      function _assertThisInitialized(self) {
28334        if (self === void 0) {
28335          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
28336        }
28337
28338        return self;
28339      }
28340
28341      function _isNativeReflectConstruct() {
28342        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
28343        if (Reflect.construct.sham) return false;
28344        if (typeof Proxy === "function") return true;
28345
28346        try {
28347          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
28348          return true;
28349        } catch (e) {
28350          return false;
28351        }
28352      }
28353
28354      function _getPrototypeOf(o) {
28355        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
28356          return o.__proto__ || Object.getPrototypeOf(o);
28357        };
28358        return _getPrototypeOf(o);
28359      }
28360
28361      var BaseXform = require('../base-xform');
28362
28363      var DateXform = /*#__PURE__*/function (_BaseXform) {
28364        _inherits(DateXform, _BaseXform);
28365
28366        var _super = _createSuper(DateXform);
28367
28368        function DateXform(options) {
28369          var _this;
28370
28371          _classCallCheck(this, DateXform);
28372
28373          _this = _super.call(this);
28374          _this.tag = options.tag;
28375          _this.attr = options.attr;
28376          _this.attrs = options.attrs;
28377
28378          _this._format = options.format || function (dt) {
28379            try {
28380              if (Number.isNaN(dt.getTime())) return '';
28381              return dt.toISOString();
28382            } catch (e) {
28383              return '';
28384            }
28385          };
28386
28387          _this._parse = options.parse || function (str) {
28388            return new Date(str);
28389          };
28390
28391          return _this;
28392        }
28393
28394        _createClass(DateXform, [{
28395          key: "render",
28396          value: function render(xmlStream, model) {
28397            if (model) {
28398              xmlStream.openNode(this.tag);
28399
28400              if (this.attrs) {
28401                xmlStream.addAttributes(this.attrs);
28402              }
28403
28404              if (this.attr) {
28405                xmlStream.addAttribute(this.attr, this._format(model));
28406              } else {
28407                xmlStream.writeText(this._format(model));
28408              }
28409
28410              xmlStream.closeNode();
28411            }
28412          }
28413        }, {
28414          key: "parseOpen",
28415          value: function parseOpen(node) {
28416            if (node.name === this.tag) {
28417              if (this.attr) {
28418                this.model = this._parse(node.attributes[this.attr]);
28419              } else {
28420                this.text = [];
28421              }
28422            }
28423          }
28424        }, {
28425          key: "parseText",
28426          value: function parseText(text) {
28427            if (!this.attr) {
28428              this.text.push(text);
28429            }
28430          }
28431        }, {
28432          key: "parseClose",
28433          value: function parseClose() {
28434            if (!this.attr) {
28435              this.model = this._parse(this.text.join(''));
28436            }
28437
28438            return false;
28439          }
28440        }]);
28441
28442        return DateXform;
28443      }(BaseXform);
28444
28445      module.exports = DateXform;
28446    }, {
28447      "../base-xform": 29
28448    }],
28449    115: [function (require, module, exports) {
28450      "use strict";
28451
28452      function _typeof(obj) {
28453        "@babel/helpers - typeof";
28454
28455        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
28456          _typeof = function _typeof(obj) {
28457            return typeof obj;
28458          };
28459        } else {
28460          _typeof = function _typeof(obj) {
28461            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
28462          };
28463        }
28464
28465        return _typeof(obj);
28466      }
28467
28468      function _classCallCheck(instance, Constructor) {
28469        if (!(instance instanceof Constructor)) {
28470          throw new TypeError("Cannot call a class as a function");
28471        }
28472      }
28473
28474      function _defineProperties(target, props) {
28475        for (var i = 0; i < props.length; i++) {
28476          var descriptor = props[i];
28477          descriptor.enumerable = descriptor.enumerable || false;
28478          descriptor.configurable = true;
28479          if ("value" in descriptor) descriptor.writable = true;
28480          Object.defineProperty(target, descriptor.key, descriptor);
28481        }
28482      }
28483
28484      function _createClass(Constructor, protoProps, staticProps) {
28485        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
28486        if (staticProps) _defineProperties(Constructor, staticProps);
28487        return Constructor;
28488      }
28489
28490      function _inherits(subClass, superClass) {
28491        if (typeof superClass !== "function" && superClass !== null) {
28492          throw new TypeError("Super expression must either be null or a function");
28493        }
28494
28495        subClass.prototype = Object.create(superClass && superClass.prototype, {
28496          constructor: {
28497            value: subClass,
28498            writable: true,
28499            configurable: true
28500          }
28501        });
28502        if (superClass) _setPrototypeOf(subClass, superClass);
28503      }
28504
28505      function _setPrototypeOf(o, p) {
28506        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
28507          o.__proto__ = p;
28508          return o;
28509        };
28510
28511        return _setPrototypeOf(o, p);
28512      }
28513
28514      function _createSuper(Derived) {
28515        return function () {
28516          var Super = _getPrototypeOf(Derived),
28517              result;
28518
28519          if (_isNativeReflectConstruct()) {
28520            var NewTarget = _getPrototypeOf(this).constructor;
28521
28522            result = Reflect.construct(Super, arguments, NewTarget);
28523          } else {
28524            result = Super.apply(this, arguments);
28525          }
28526
28527          return _possibleConstructorReturn(this, result);
28528        };
28529      }
28530
28531      function _possibleConstructorReturn(self, call) {
28532        if (call && (_typeof(call) === "object" || typeof call === "function")) {
28533          return call;
28534        }
28535
28536        return _assertThisInitialized(self);
28537      }
28538
28539      function _assertThisInitialized(self) {
28540        if (self === void 0) {
28541          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
28542        }
28543
28544        return self;
28545      }
28546
28547      function _isNativeReflectConstruct() {
28548        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
28549        if (Reflect.construct.sham) return false;
28550        if (typeof Proxy === "function") return true;
28551
28552        try {
28553          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
28554          return true;
28555        } catch (e) {
28556          return false;
28557        }
28558      }
28559
28560      function _getPrototypeOf(o) {
28561        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
28562          return o.__proto__ || Object.getPrototypeOf(o);
28563        };
28564        return _getPrototypeOf(o);
28565      }
28566
28567      var BaseXform = require('../base-xform');
28568
28569      var IntegerXform = /*#__PURE__*/function (_BaseXform) {
28570        _inherits(IntegerXform, _BaseXform);
28571
28572        var _super = _createSuper(IntegerXform);
28573
28574        function IntegerXform(options) {
28575          var _this;
28576
28577          _classCallCheck(this, IntegerXform);
28578
28579          _this = _super.call(this);
28580          _this.tag = options.tag;
28581          _this.attr = options.attr;
28582          _this.attrs = options.attrs; // option to render zero
28583
28584          _this.zero = options.zero;
28585          return _this;
28586        }
28587
28588        _createClass(IntegerXform, [{
28589          key: "render",
28590          value: function render(xmlStream, model) {
28591            // int is different to float in that zero is not rendered
28592            if (model || this.zero) {
28593              xmlStream.openNode(this.tag);
28594
28595              if (this.attrs) {
28596                xmlStream.addAttributes(this.attrs);
28597              }
28598
28599              if (this.attr) {
28600                xmlStream.addAttribute(this.attr, model);
28601              } else {
28602                xmlStream.writeText(model);
28603              }
28604
28605              xmlStream.closeNode();
28606            }
28607          }
28608        }, {
28609          key: "parseOpen",
28610          value: function parseOpen(node) {
28611            if (node.name === this.tag) {
28612              if (this.attr) {
28613                this.model = parseInt(node.attributes[this.attr], 10);
28614              } else {
28615                this.text = [];
28616              }
28617
28618              return true;
28619            }
28620
28621            return false;
28622          }
28623        }, {
28624          key: "parseText",
28625          value: function parseText(text) {
28626            if (!this.attr) {
28627              this.text.push(text);
28628            }
28629          }
28630        }, {
28631          key: "parseClose",
28632          value: function parseClose() {
28633            if (!this.attr) {
28634              this.model = parseInt(this.text.join('') || 0, 10);
28635            }
28636
28637            return false;
28638          }
28639        }]);
28640
28641        return IntegerXform;
28642      }(BaseXform);
28643
28644      module.exports = IntegerXform;
28645    }, {
28646      "../base-xform": 29
28647    }],
28648    116: [function (require, module, exports) {
28649      "use strict";
28650
28651      function _typeof(obj) {
28652        "@babel/helpers - typeof";
28653
28654        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
28655          _typeof = function _typeof(obj) {
28656            return typeof obj;
28657          };
28658        } else {
28659          _typeof = function _typeof(obj) {
28660            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
28661          };
28662        }
28663
28664        return _typeof(obj);
28665      }
28666
28667      function _classCallCheck(instance, Constructor) {
28668        if (!(instance instanceof Constructor)) {
28669          throw new TypeError("Cannot call a class as a function");
28670        }
28671      }
28672
28673      function _defineProperties(target, props) {
28674        for (var i = 0; i < props.length; i++) {
28675          var descriptor = props[i];
28676          descriptor.enumerable = descriptor.enumerable || false;
28677          descriptor.configurable = true;
28678          if ("value" in descriptor) descriptor.writable = true;
28679          Object.defineProperty(target, descriptor.key, descriptor);
28680        }
28681      }
28682
28683      function _createClass(Constructor, protoProps, staticProps) {
28684        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
28685        if (staticProps) _defineProperties(Constructor, staticProps);
28686        return Constructor;
28687      }
28688
28689      function _inherits(subClass, superClass) {
28690        if (typeof superClass !== "function" && superClass !== null) {
28691          throw new TypeError("Super expression must either be null or a function");
28692        }
28693
28694        subClass.prototype = Object.create(superClass && superClass.prototype, {
28695          constructor: {
28696            value: subClass,
28697            writable: true,
28698            configurable: true
28699          }
28700        });
28701        if (superClass) _setPrototypeOf(subClass, superClass);
28702      }
28703
28704      function _setPrototypeOf(o, p) {
28705        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
28706          o.__proto__ = p;
28707          return o;
28708        };
28709
28710        return _setPrototypeOf(o, p);
28711      }
28712
28713      function _createSuper(Derived) {
28714        return function () {
28715          var Super = _getPrototypeOf(Derived),
28716              result;
28717
28718          if (_isNativeReflectConstruct()) {
28719            var NewTarget = _getPrototypeOf(this).constructor;
28720
28721            result = Reflect.construct(Super, arguments, NewTarget);
28722          } else {
28723            result = Super.apply(this, arguments);
28724          }
28725
28726          return _possibleConstructorReturn(this, result);
28727        };
28728      }
28729
28730      function _possibleConstructorReturn(self, call) {
28731        if (call && (_typeof(call) === "object" || typeof call === "function")) {
28732          return call;
28733        }
28734
28735        return _assertThisInitialized(self);
28736      }
28737
28738      function _assertThisInitialized(self) {
28739        if (self === void 0) {
28740          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
28741        }
28742
28743        return self;
28744      }
28745
28746      function _isNativeReflectConstruct() {
28747        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
28748        if (Reflect.construct.sham) return false;
28749        if (typeof Proxy === "function") return true;
28750
28751        try {
28752          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
28753          return true;
28754        } catch (e) {
28755          return false;
28756        }
28757      }
28758
28759      function _getPrototypeOf(o) {
28760        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o
28760) {
28761          return o.__proto__ || Object.getPrototypeOf(o);
28762        };
28763        return _getPrototypeOf(o);
28764      }
28765
28766      var BaseXform = require('../base-xform');
28767
28768      var StringXform = /*#__PURE__*/function (_BaseXform) {
28769        _inherits(StringXform, _BaseXform);
28770
28771        var _super = _createSuper(StringXform);
28772
28773        function StringXform(options) {
28774          var _this;
28775
28776          _classCallCheck(this, StringXform);
28777
28778          _this = _super.call(this);
28779          _this.tag = options.tag;
28780          _this.attr = options.attr;
28781          _this.attrs = options.attrs;
28782          return _this;
28783        }
28784
28785        _createClass(StringXform, [{
28786          key: "render",
28787          value: function render(xmlStream, model) {
28788            if (model !== undefined) {
28789              xmlStream.openNode(this.tag);
28790
28791              if (this.attrs) {
28792                xmlStream.addAttributes(this.attrs);
28793              }
28794
28795              if (this.attr) {
28796                xmlStream.addAttribute(this.attr, model);
28797              } else {
28798                xmlStream.writeText(model);
28799              }
28800
28801              xmlStream.closeNode();
28802            }
28803          }
28804        }, {
28805          key: "parseOpen",
28806          value: function parseOpen(node) {
28807            if (node.name === this.tag) {
28808              if (this.attr) {
28809                this.model = node.attributes[this.attr];
28810              } else {
28811                this.text = [];
28812              }
28813            }
28814          }
28815        }, {
28816          key: "parseText",
28817          value: function parseText(text) {
28818            if (!this.attr) {
28819              this.text.push(text);
28820            }
28821          }
28822        }, {
28823          key: "parseClose",
28824          value: function parseClose() {
28825            if (!this.attr) {
28826              this.model = this.text.join('');
28827            }
28828
28829            return false;
28830          }
28831        }]);
28832
28833        return StringXform;
28834      }(BaseXform);
28835
28836      module.exports = StringXform;
28837    }, {
28838      "../base-xform": 29
28839    }],
28840    117: [function (require, module, exports) {
28841      "use strict";
28842
28843      function _typeof(obj) {
28844        "@babel/helpers - typeof";
28845
28846        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
28847          _typeof = function _typeof(obj) {
28848            return typeof obj;
28849          };
28850        } else {
28851          _typeof = function _typeof(obj) {
28852            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
28853          };
28854        }
28855
28856        return _typeof(obj);
28857      }
28858
28859      function _classCallCheck(instance, Constructor) {
28860        if (!(instance instanceof Constructor)) {
28861          throw new TypeError("Cannot call a class as a function");
28862        }
28863      }
28864
28865      function _defineProperties(target, props) {
28866        for (var i = 0; i < props.length; i++) {
28867          var descriptor = props[i];
28868          descriptor.enumerable = descriptor.enumerable || false;
28869          descriptor.configurable = true;
28870          if ("value" in descriptor) descriptor.writable = true;
28871          Object.defineProperty(target, descriptor.key, descriptor);
28872        }
28873      }
28874
28875      function _createClass(Constructor, protoProps, staticProps) {
28876        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
28877        if (staticProps) _defineProperties(Constructor, staticProps);
28878        return Constructor;
28879      }
28880
28881      function _inherits(subClass, superClass) {
28882        if (typeof superClass !== "function" && superClass !== null) {
28883          throw new TypeError("Super expression must either be null or a function");
28884        }
28885
28886        subClass.prototype = Object.create(superClass && superClass.prototype, {
28887          constructor: {
28888            value: subClass,
28889            writable: true,
28890            configurable: true
28891          }
28892        });
28893        if (superClass) _setPrototypeOf(subClass, superClass);
28894      }
28895
28896      function _setPrototypeOf(o, p) {
28897        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
28898          o.__proto__ = p;
28899          return o;
28900        };
28901
28902        return _setPrototypeOf(o, p);
28903      }
28904
28905      function _createSuper(Derived) {
28906        return function () {
28907          var Super = _getPrototypeOf(Derived),
28908              result;
28909
28910          if (_isNativeReflectConstruct()) {
28911            var NewTarget = _getPrototypeOf(this).constructor;
28912
28913            result = Reflect.construct(Super, arguments, NewTarget);
28914          } else {
28915            result = Super.apply(this, arguments);
28916          }
28917
28918          return _possibleConstructorReturn(this, result);
28919        };
28920      }
28921
28922      function _possibleConstructorReturn(self, call) {
28923        if (call && (_typeof(call) === "object" || typeof call === "function")) {
28924          return call;
28925        }
28926
28927        return _assertThisInitialized(self);
28928      }
28929
28930      function _assertThisInitialized(self) {
28931        if (self === void 0) {
28932          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
28933        }
28934
28935        return self;
28936      }
28937
28938      function _isNativeReflectConstruct() {
28939        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
28940        if (Reflect.construct.sham) return false;
28941        if (typeof Proxy === "function") return true;
28942
28943        try {
28944          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
28945          return true;
28946        } catch (e) {
28947          return false;
28948        }
28949      }
28950
28951      function _getPrototypeOf(o) {
28952        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
28953          return o.__proto__ || Object.getPrototypeOf(o);
28954        };
28955        return _getPrototypeOf(o);
28956      }
28957
28958      var BaseXform = require('./base-xform');
28959
28960      var XmlStream = require('../../utils/xml-stream'); // const model = {
28961      //   tag: 'name',
28962      //   $: {attr: 'value'},
28963      //   c: [
28964      //     { tag: 'child' }
28965      //   ],
28966      //   t: 'some text'
28967      // };
28968
28969
28970      function build(xmlStream, model) {
28971        xmlStream.openNode(model.tag, model.$);
28972
28973        if (model.c) {
28974          model.c.forEach(function (child) {
28975            build(xmlStream, child);
28976          });
28977        }
28978
28979        if (model.t) {
28980          xmlStream.writeText(model.t);
28981        }
28982
28983        xmlStream.closeNode();
28984      }
28985
28986      var StaticXform = /*#__PURE__*/function (_BaseXform) {
28987        _inherits(StaticXform, _BaseXform);
28988
28989        var _super = _createSuper(StaticXform);
28990
28991        function StaticXform(model) {
28992          var _this;
28993
28994          _classCallCheck(this, StaticXform);
28995
28996          _this = _super.call(this); // This class is an optimisation for static (unimportant and unchanging) xml
28997          // It is stateless - apart from its static model and so can be used as a singleton
28998          // Being stateless - it will only track entry to and exit from it's root xml tag during parsing and nothing else
28999          // Known issues:
29000          //    since stateless - parseOpen always returns true. Parent xform must know when to start using this xform
29001          //    if the root tag is recursive, the parsing will behave unpredictably
29002
29003          _this._model = model;
29004          return _this;
29005        }
29006
29007        _createClass(StaticXform, [{
29008          key: "render",
29009          value: function render(xmlStream) {
29010            if (!this._xml) {
29011              var stream = new XmlStream();
29012              build(stream, this._model);
29013              this._xml = stream.xml;
29014            }
29015
29016            xmlStream.writeXml(this._xml);
29017          }
29018        }, {
29019          key: "parseOpen",
29020          value: function parseOpen() {
29021            return true;
29022          }
29023        }, {
29024          key: "parseText",
29025          value: function parseText() {}
29026        }, {
29027          key: "parseClose",
29028          value: function parseClose(name) {
29029            switch (name) {
29030              case this._model.tag:
29031                return false;
29032
29033              default:
29034                return true;
29035            }
29036          }
29037        }]);
29038
29039        return StaticXform;
29040      }(BaseXform);
29041
29042      module.exports = StaticXform;
29043    }, {
29044      "../../utils/xml-stream": 25,
29045      "./base-xform": 29
29046    }],
29047    118: [function (require, module, exports) {
29048      "use strict";
29049
29050      function _typeof(obj) {
29051        "@babel/helpers - typeof";
29052
29053        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
29054          _typeof = function _typeof(obj) {
29055            return typeof obj;
29056          };
29057        } else {
29058          _typeof = function _typeof(obj) {
29059            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
29060          };
29061        }
29062
29063        return _typeof(obj);
29064      }
29065
29066      function _classCallCheck(instance, Constructor) {
29067        if (!(instance instanceof Constructor)) {
29068          throw new TypeError("Cannot call a class as a function");
29069        }
29070      }
29071
29072      function _defineProperties(target, props) {
29073        for (var i = 0; i < props.length; i++) {
29074          var descriptor = props[i];
29075          descriptor.enumerable = descriptor.enumerable || false;
29076          descriptor.configurable = true;
29077          if ("value" in descriptor) descriptor.writable = true;
29078          Object.defineProperty(target, descriptor.key, descriptor);
29079        }
29080      }
29081
29082      function _createClass(Constructor, protoProps, staticProps) {
29083        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
29084        if (staticProps) _defineProperties(Constructor, staticProps);
29085        return Constructor;
29086      }
29087
29088      function _inherits(subClass, superClass) {
29089        if (typeof superClass !== "function" && superClass !== null) {
29090          throw new TypeError("Super expression must either be null or a function");
29091        }
29092
29093        subClass.prototype = Object.create(superClass && superClass.prototype, {
29094          constructor: {
29095            value: subClass,
29096            writable: true,
29097            configurable: true
29098          }
29099        });
29100        if (superClass) _setPrototypeOf(subClass, superClass);
29101      }
29102
29103      function _setPrototypeOf(o, p) {
29104        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
29105          o.__proto__ = p;
29106          return o;
29107        };
29108
29109        return _setPrototypeOf(o, p);
29110      }
29111
29112      function _createSuper(Derived) {
29113        return function () {
29114          var Super = _getPrototypeOf(Derived),
29115              result;
29116
29117          if (_isNativeReflectConstruct()) {
29118            var NewTarget = _getPrototypeOf(this).constructor;
29119
29120            result = Reflect.construct(Super, arguments, NewTarget);
29121          } else {
29122            result = Super.apply(this, arguments);
29123          }
29124
29125          return _possibleConstructorReturn(this, result);
29126        };
29127      }
29128
29129      function _possibleConstructorReturn(self, call) {
29130        if (call && (_typeof(call) === "object" || typeof call === "function")) {
29131          return call;
29132        }
29133
29134        return _assertThisInitialized(self);
29135      }
29136
29137      function _assertThisInitialized(self) {
29138        if (self === void 0) {
29139          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
29140        }
29141
29142        return self;
29143      }
29144
29145      function _isNativeReflectConstruct() {
29146        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
29147        if (Reflect.construct.sham) return false;
29148        if (typeof Proxy === "function") return true;
29149
29150        try {
29151          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
29152          return true;
29153        } catch (e) {
29154          return false;
29155        }
29156      }
29157
29158      function _getPrototypeOf(o) {
29159        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
29160          return o.__proto__ || Object.getPrototypeOf(o);
29161        };
29162        return _getPrototypeOf(o);
29163      }
29164
29165      var TextXform = require('./text-xform');
29166
29167      var RichTextXform = require('./rich-text-xform');
29168
29169      var BaseXform = require('../base-xform'); // <rPh sb="0" eb="1">
29170      //   <t>(its pronounciation in KATAKANA)</t>
29171      // </rPh>
29172
29173
29174      var PhoneticTextXform = /*#__PURE__*/function (_BaseXform) {
29175        _inherits(PhoneticTextXform, _BaseXform);
29176
29177        var _super = _createSuper(PhoneticTextXform);
29178
29179        function PhoneticTextXform() {
29180          var _this;
29181
29182          _classCallCheck(this, PhoneticTextXform);
29183
29184          _this = _super.call(this);
29185          _this.map = {
29186            r: new RichTextXform(),
29187            t: new TextXform()
29188          };
29189          return _this;
29190        }
29191
29192        _createClass(PhoneticTextXform, [{
29193          key: "render",
29194          value: function render(xmlStream, model) {
29195            xmlStream.openNode(this.tag, {
29196              sb: model.sb || 0,
29197              eb: model.eb || 0
29198            });
29199
29200            if (model && model.hasOwnProperty('richText') && model.richText) {
29201              var r = this.map.r;
29202              model.richText.forEach(function (text) {
29203                r.render(xmlStream, text);
29204              });
29205            } else if (model) {
29206              this.map.t.render(xmlStream, model.text);
29207            }
29208
29209            xmlStream.closeNode();
29210          }
29211        }, {
29212          key: "parseOpen",
29213          value: function parseOpen(node) {
29214            var name = node.name;
29215
29216            if (this.parser) {
29217              this.parser.parseOpen(node);
29218              return true;
29219            }
29220
29221            if (name === this.tag) {
29222              this.model = {
29223                sb: parseInt(node.attributes.sb, 10),
29224                eb: parseInt(node.attributes.eb, 10)
29225              };
29226              return true;
29227            }
29228
29229            this.parser = this.map[name];
29230
29231            if (this.parser) {
29232              this.parser.parseOpen(node);
29233              return true;
29234            }
29235
29236            return false;
29237          }
29238        }, {
29239          key: "parseText",
29240          value: function parseText(text) {
29241            if (this.parser) {
29242              this.parser.parseText(text);
29243            }
29244          }
29245        }, {
29246          key: "parseClose",
29247          value: function parseClose(name) {
29248            if (this.parser) {
29249              if (!this.parser.parseClose(name)) {
29250                switch (name) {
29251                  case 'r':
29252                    {
29253                      var rt = this.model.richText;
29254
29255                      if (!rt) {
29256                        rt = this.model.richText = [];
29257                      }
29258
29259                      rt.push(this.parser.model);
29260                      break;
29261                    }
29262
29263                  case 't':
29264                    this.model.text = this.parser.model;
29265                    break;
29266
29267                  default:
29268                    break;
29269                }
29270
29271                this.parser = undefined;
29272              }
29273
29274              return true;
29275            }
29276
29277            switch (name) {
29278              case this.tag:
29279                return false;
29280
29281              default:
29282                return true;
29283            }
29284          }
29285        }, {
29286          key: "tag",
29287          get: function get() {
29288            return 'rPh';
29289          }
29290        }]);
29291
29292        return PhoneticTextXform;
29293      }(BaseXform);
29294
29295      module.exports = PhoneticTextXform;
29296    }, {
29297      "../base-xform": 29,
29298      "./rich-text-xform": 119,
29299      "./text-xform": 122
29300    }],
29301    119: [function (require, module, exports) {
29302      "use strict";
29303
29304      function _typeof(obj) {
29305        "@babel/helpers - typeof";
29306
29307        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
29308          _typeof = function _typeof(obj) {
29309            return typeof obj;
29310          };
29311        } else {
29312          _typeof = function _typeof(obj) {
29313            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
29314          };
29315        }
29316
29317        return _typeof(obj);
29318      }
29319
29320      function _classCallCheck(instance, Constructor) {
29321        if (!(instance instanceof Constructor)) {
29322          throw new TypeError("Cannot call a class as a function");
29323        }
29324      }
29325
29326      function _defineProperties(target, props) {
29327        for (var i = 0; i < props.length; i++) {
29328          var descriptor = props[i];
29329          descriptor.enumerable = descriptor.enumerable || false;
29330          descriptor.configurable = true;
29331          if ("value" in descriptor) descriptor.writable = true;
29332          Object.defineProperty(target, descriptor.key, descriptor);
29333        }
29334      }
29335
29336      function _createClass(Constructor, protoProps, staticProps) {
29337        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
29338        if (staticProps) _defineProperties(Constructor, staticProps);
29339        return Constructor;
29340      }
29341
29342      function _inherits(subClass, superClass) {
29343        if (typeof superClass !== "function" && superClass !== null) {
29344          throw new TypeError("Super expression must either be null or a function");
29345        }
29346
29347        subClass.prototype = Object.create(superClass && superClass.prototype, {
29348          constructor: {
29349            value: subClass,
29350            writable: true,
29351            configurable: true
29352          }
29353        });
29354        if (superClass) _setPrototypeOf(subClass, superClass);
29355      }
29356
29357      function _setPrototypeOf(o, p) {
29358        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
29359          o.__proto__ = p;
29360          return o;
29361        };
29362
29363        return _setPrototypeOf(o, p);
29364      }
29365
29366      function _createSuper(Derived) {
29367        return function () {
29368          var Super = _getPrototypeOf(Derived),
29369              result;
29370
29371          if (_isNativeReflectConstruct()) {
29372            var NewTarget = _getPrototypeOf(this).constructor;
29373
29374            result = Reflect.construct(Super, arguments, NewTarget);
29375          } else {
29376            result = Super.apply(this, arguments);
29377          }
29378
29379          return _possibleConstructorReturn(this, result);
29380        };
29381      }
29382
29383      function _possibleConstructorReturn(self, call) {
29384        if (call && (_typeof(call) === "object" || typeof call === "function")) {
29385          return call;
29386        }
29387
29388        return _assertThisInitialized(self);
29389      }
29390
29391      function _assertThisInitialized(self) {
29392        if (self === void 0) {
29393          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
29394        }
29395
29396        return self;
29397      }
29398
29399      function _isNativeReflectConstruct() {
29400        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
29401        if (Reflect.construct.sham) return false;
29402        if (typeof Proxy === "function") return true;
29403
29404        try {
29405          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
29406          return true;
29407        } catch (e) {
29408          return false;
29409        }
29410      }
29411
29412      function _getPrototypeOf(o) {
29413        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
29414          return o.__proto__ || Object.getPrototypeOf(o);
29415        };
29416        return _getPrototypeOf(o);
29417      }
29418
29419      var TextXform = require('./text-xform');
29420
29421      var FontXform = require('../style/font-xform');
29422
29423      var BaseXform = require('../base-xform'); // <r>
29424      //   <rPr>
29425      //     <sz val="11"/>
29426      //     <color theme="1" tint="5"/>
29427      //     <rFont val="Calibri"/>
29428      //     <family val="2"/>
29429      //     <scheme val="minor"/>
29430      //   </rPr>
29431      //   <t xml:space="preserve"> is </t>
29432      // </r>
29433
29434
29435      var RichTextXform = /*#__PURE__*/function (_BaseXform) {
29436        _inherits(RichTextXform, _BaseXform);
29437
29438        var _super = _createSuper(RichTextXform);
29439
29440        function RichTextXform(model) {
29441          var _this;
29442
29443          _classCallCheck(this, RichTextXform);
29444
29445          _this = _super.call(this);
29446          _this.model = model;
29447          return _this;
29448        }
29449
29450        _createClass(RichTextXform, [{
29451          key: "render",
29452          value: function render(xmlStream, model) {
29453            model = model || this.model;
29454            xmlStream.openNode('r');
29455
29456            if (model.font) {
29457              this.fontXform.render(xmlStream, model.font);
29458            }
29459
29460            this.textXform.render(xmlStream, model.text);
29461            xmlStream.closeNode();
29462          }
29463        }, {
29464          key: "parseOpen",
29465          value: function parseOpen(node) {
29466            if (this.parser) {
29467              this.parser.parseOpen(node);
29468              return true;
29469            }
29470
29471            switch (node.name) {
29472              case 'r':
29473                this.model = {};
29474                return true;
29475
29476              case 't':
29477                this.parser = this.textXform;
29478                this.parser.parseOpen(node);
29479                return true;
29480
29481              case 'rPr':
29482                this.parser = this.fontXform;
29483                this.parser.parseOpen(node);
29484                return true;
29485
29486              default:
29487                return false;
29488            }
29489          }
29490        }, {
29491          key: "parseText",
29492          value: function parseText(text) {
29493            if (this.parser) {
29494              this.parser.parseText(text);
29495            }
29496          }
29497        }, {
29498          key: "parseClose",
29499          value: function parseClose(name) {
29500            switch (name) {
29501              case 'r':
29502                return false;
29503
29504              case 't':
29505                this.model.text = this.parser.model;
29506                this.parser = undefined;
29507                return true;
29508
29509              case 'rPr':
29510                this.model.font = this.parser.model;
29511                this.parser = undefined;
29512                return true;
29513
29514              default:
29515                if (this.parser) {
29516                  this.parser.parseClose(name);
29517                }
29518
29519                return true;
29520            }
29521          }
29522        }, {
29523          key: "tag",
29524          get: function get() {
29525            return 'r';
29526          }
29527        }, {
29528          key: "textXform",
29529          get: function get() {
29530            return this._textXform || (this._textXform = new TextXform());
29531          }
29532        }, {
29533          key: "fontXform",
29534          get: function get() {
29535            return this._fontXform || (this._fontXform = new FontXform(RichTextXform.FONT_OPTIONS));
29536          }
29537        }]);
29538
29539        return RichTextXform;
29540      }(BaseXform);
29541
29542      RichTextXform.FONT_OPTIONS = {
29543        tagName: 'rPr',
29544        fontNameTag: 'rFont'
29545      };
29546      module.exports = RichTextXform;
29547    }, {
29548      "../base-xform": 29,
29549      "../style/font-xform": 128,
29550      "./text-xform": 122
29551    }],
29552    120: [function (require, module, exports) {
29553      "use strict";
29554
29555      function _typeof(obj) {
29556        "@babel/helpers - typeof";
29557
29558        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
29559          _typeof = function _typeof(obj) {
29560            return typeof obj;
29561          };
29562        } else {
29563          _typeof = function _typeof(obj) {
29564            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
29565          };
29566        }
29567
29568        return _typeof(obj);
29569      }
29570
29571      function _classCallCheck(instance, Constructor) {
29572        if (!(instance instanceof Constructor)) {
29573          throw new TypeError("Cannot call a class as a function");
29574        }
29575      }
29576
29577      function _defineProperties(target, props) {
29578        for (var i = 0; i < props.length; i++) {
29579          var descriptor = props[i];
29580          descriptor.enumerable = descriptor.enumerable || false;
29581          descriptor.configurable = true;
29582          if ("value" in descriptor) descriptor.writable = true;
29583          Object.defineProperty(target, descriptor.key, descriptor);
29584        }
29585      }
29586
29587      function _createClass(Constructor, protoProps, staticProps) {
29588        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
29589        if (staticProps) _defineProperties(Constructor, staticProps);
29590        return Constructor;
29591      }
29592
29593      function _inherits(subClass, superClass) {
29594        if (typeof superClass !== "function" && superClass !== null) {
29595          throw new TypeError("Super expression must either be null or a function");
29596        }
29597
29598        subClass.prototype = Object.create(superClass && superClass.prototype, {
29599          constructor: {
29600            value: subClass,
29601            writable: true,
29602            configurable: true
29603          }
29604        });
29605        if (superClass) _setPrototypeOf(subClass, superClass);
29606      }
29607
29608      function _setPrototypeOf(o, p) {
29609        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
29610          o.__proto__ = p;
29611          return o;
29612        };
29613
29614        return _setPrototypeOf(o, p);
29615      }
29616
29617      function _createSuper(Derived) {
29618        return function () {
29619          var Super = _getPrototypeOf(Derived),
29620              result;
29621
29622          if (_isNativeReflectConstruct()) {
29623            var NewTarget = _getPrototypeOf(this).constructor;
29624
29625            result = Reflect.construct(Super, arguments, NewTarget);
29626          } else {
29627            result = Super.apply(this, arguments);
29628          }
29629
29630          return _possibleConstructorReturn(this, result);
29631        };
29632      }
29633
29634      function _possibleConstructorReturn(self, call) {
29635        if (call && (_typeof(call) === "object" || typeof call === "function")) {
29636          return call;
29637        }
29638
29639        return _assertThisInitialized(self);
29640      }
29641
29642      function _assertThisInitialized(self) {
29643        if (self === void 0) {
29644          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
29645        }
29646
29647        return self;
29648      }
29649
29650      function _isNativeReflectConstruct() {
29651        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
29652        if (Reflect.construct.sham) return false;
29653        if (typeof Proxy === "function") return true;
29654
29655        try {
29656          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
29657          return true;
29658        } catch (e) {
29659          return false;
29660        }
29661      }
29662
29663      function _getPrototypeOf(o) {
29664        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
29665          return o.__proto__ || Object.getPrototypeOf(o);
29666        };
29667        return _getPrototypeOf(o);
29668      }
29669
29670      var TextXform = require('./text-xform');
29671
29672      var RichTextXform = require('./rich-text-xform');
29673
29674      var PhoneticTextXform = require('./phonetic-text-xform');
29675
29676      var BaseXform = require('../base-xform'); // <si>
29677      //   <r></r><r></r>...
29678      // </si>
29679      // <si>
29680      //   <t></t>
29681      // </si>
29682
29683
29684      var SharedStringXform = /*#__PURE__*/function (_BaseXform) {
29685        _inherits(SharedStringXform, _BaseXform);
29686
29687        var _super = _createSuper(SharedStringXform);
29688
29689        function SharedStringXform(model) {
29690          var _this;
29691
29692          _classCallCheck(this, SharedStringXform);
29693
29694          _this = _super.call(this);
29695          _this.model = model;
29696          _this.map = {
29697            r: new RichTextXform(),
29698            t: new TextXform(),
29699            rPh: new PhoneticTextXform()
29700          };
29701          return _this;
29702        }
29703
29704        _createClass(SharedStringXform, [{
29705          key: "render",
29706          value: function render(xmlStream, model) {
29707            var _this2 = this;
29708
29709            xmlStream.openNode(this.tag);
29710
29711            if (model && model.hasOwnProperty('richText') && model.richText) {
29712              if (model.richText.length) {
29713                model.richText.forEach(function (text) {
29714                  _this2.map.r.render(xmlStream, text);
29715                });
29716              } else {
29717                this.map.t.render(xmlStream, '');
29718              }
29719            } else if (model !== undefined && model !== null) {
29720              this.map.t.render(xmlStream, model);
29721            }
29722
29723            xmlStream.closeNode();
29724          }
29725        }, {
29726          key: "parseOpen",
29727          value: function parseOpen(node) {
29728            var name = node.name;
29729
29730            if (this.parser) {
29731              this.parser.parseOpen(node);
29732              return true;
29733            }
29734
29735            if (name === this.tag) {
29736              this.model = {};
29737              return true;
29738            }
29739
29740            this.parser = this.map[name];
29741
29742            if (this.parser) {
29743              this.parser.parseOpen(node);
29744              return true;
29745            }
29746
29747            return false;
29748          }
29749        }, {
29750          key: "parseText",
29751          value: function parseText(text) {
29752            if (this.parser) {
29753              this.parser.parseText(text);
29754            }
29755          }
29756        }, {
29757          key: "parseClose",
29758          value: function parseClose(name) {
29759            if (this.parser) {
29760              if (!this.parser.parseClose(name)) {
29761                switch (name) {
29762                  case 'r':
29763                    {
29764                      var rt = this.model.richText;
29765
29766                      if (!rt) {
29767                        rt = this.model.richText = [];
29768                      }
29769
29770                      rt.push(this.parser.model);
29771                      break;
29772                    }
29773
29774                  case 't':
29775                    this.model = this.parser.model;
29776                    break;
29777
29778                  default:
29779                    break;
29780                }
29781
29782                this.parser = undefined;
29783              }
29784
29785              return true;
29786            }
29787
29788            switch (name) {
29789              case this.tag:
29790                return false;
29791
29792              default:
29793                return true;
29794            }
29795          }
29796        }, {
29797          key: "tag",
29798          get: function get() {
29799            return 'si';
29800          }
29801        }]);
29802
29803        return SharedStringXform;
29804      }(BaseXform);
29805
29806      module.exports = SharedStringXform;
29807    }, {
29808      "../base-xform": 29,
29809      "./phonetic-text-xform": 118,
29810      "./rich-text-xform": 119,
29811      "./text-xform": 122
29812    }],
29813    121: [function (require, module, exports) {
29814      "use strict";
29815
29816      function _typeof(obj) {
29817        "@babel/helpers - typeof";
29818
29819        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
29820          _typeof = function _typeof(obj) {
29821            return typeof obj;
29822          };
29823        } else {
29824          _typeof = function _typeof(obj) {
29825            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
29826          };
29827        }
29828
29829        return _typeof(obj);
29830      }
29831
29832      function _classCallCheck(instance, Constructor) {
29833        if (!(instance instanceof Constructor)) {
29834          throw new TypeError("Cannot call a class as a function");
29835        }
29836      }
29837
29838      function _defineProperties(target, props) {
29839        for (var i = 0; i < props.length; i++) {
29840          var descriptor = props[i];
29841          descriptor.enumerable = descriptor.enumerable || false;
29842          descriptor.configurable = true;
29843          if ("value" in descriptor) descriptor.writable = true;
29844          Object.defineProperty(target, descriptor.key, descriptor);
29845        }
29846      }
29847
29848      function _createClass(Constructor, protoProps, staticProps) {
29849        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
29850        if (staticProps) _defineProperties(Constructor, staticProps);
29851        return Constructor;
29852      }
29853
29854      function _inherits(subClass, superClass) {
29855        if (typeof superClass !== "function" && superClass !== null) {
29856          throw new TypeError("Super expression must either be null or a function");
29857        }
29858
29859        subClass.prototype = Object.create(superClass && superClass.prototype, {
29860          constructor: {
29861            value: subClass,
29862            writable: true,
29863            configurable: true
29864          }
29865        });
29866        if (superClass) _setPrototypeOf(subClass, superClass);
29867      }
29868
29869      function _setPrototypeOf(o, p) {
29870        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
29871          o.__proto__ = p;
29872          return o;
29873        };
29874
29875        return _setPrototypeOf(o, p);
29876      }
29877
29878      function _createSuper(Derived) {
29879        return function () {
29880          var Super = _getPrototypeOf(Derived),
29881              result;
29882
29883          if (_isNativeReflectConstruct()) {
29884            var NewTarget = _getPrototypeOf(this).constructor;
29885
29886            result = Reflect.construct(Super, arguments, NewTarget);
29887          } else {
29888            result = Super.apply(this, arguments);
29889          }
29890
29891          return _possibleConstructorReturn(this, result);
29892        };
29893      }
29894
29895      function _possibleConstructorReturn(self, call) {
29896        if (call && (_typeof(call) === "object" || typeof call === "function")) {
29897          return call;
29898        }
29899
29900        return _assertThisInitialized(self);
29901      }
29902
29903      function _assertThisInitialized(self) {
29904        if (self === void 0) {
29905          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
29906        }
29907
29908        return self;
29909      }
29910
29911      function _isNativeReflectConstruct() {
29912        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
29913        if (Reflect.construct.sham) return false;
29914        if (typeof Proxy === "function") return true;
29915
29916        try {
29917          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
29918          return true;
29919        } catch (e) {
29920          return false;
29921        }
29922      }
29923
29924      function _getPrototypeOf(o) {
29925        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
29926          return o.__proto__ || Object.getPrototypeOf(o);
29927        };
29928        return _getPrototypeOf(o);
29929      }
29930
29931      var XmlStream = require('../../../utils/xml-stream');
29932
29933      var BaseXform = require('../base-xform');
29934
29935      var SharedStringXform = require('./shared-string-xform');
29936
29937      var SharedStringsXform = /*#__PURE__*/function (_BaseXform) {
29938        _inherits(SharedStringsXform, _BaseXform);
29939
29940        var _super = _createSuper(SharedStringsXform);
29941
29942        function SharedStringsXform(model) {
29943          var _this;
29944
29945          _classCallCheck(this, SharedStringsXform);
29946
29947          _this = _super.call(this);
29948          _this.model = model || {
29949            values: [],
29950            count: 0
29951          };
29952          _this.hash = Object.create(null);
29953          _this.rich = Object.create(null);
29954          return _this;
29955        }
29956
29957        _createClass(SharedStringsXform, [{
29958          key: "getString",
29959          value: function getString(index) {
29960            return this.model.values[index];
29961          }
29962        }, {
29963          key: "add",
29964          value: function add(value) {
29965            return value.richText ? this.addRichText(value) : this.addText(value);
29966          }
29967        }, {
29968          key: "addText",
29969          value: function addText(value) {
29970            var index = this.hash[value];
29971
29972            if (index === undefined) {
29973              index = this.hash[value] = this.model.values.length;
29974              this.model.values.push(value);
29975            }
29976
29977            this.model.count++;
29978            return index;
29979          }
29980        }, {
29981          key: "addRichText",
29982          value: function addRichText(value) {
29983            // TODO: add WeakMap here
29984            var xml = this.sharedStringXform.toXml(value);
29985            var index = this.rich[xml];
29986
29987            if (index === undefined) {
29988              index = this.rich[xml] = this.model.values.length;
29989              this.model.values.push(value);
29990            }
29991
29992            this.model.count++;
29993            return index;
29994          } // <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
29995          // <sst xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" count="<%=totalRefs%>" uniqueCount="<%=count%>">
29996          //   <si><t><%=text%></t></si>
29997          //   <si><r><rPr></rPr><t></t></r></si>
29998          // </sst>
29999
30000        }, {
30001          key: "render",
30002          value: function render(xmlStream, model) {
30003            model = model || this._values;
30004            xmlStream.openXml(XmlStream.StdDocAttributes);
30005            xmlStream.openNode('sst', {
30006              xmlns: 'http://schemas.openxmlformats.org/spreadsheetml/2006/main',
30007              count: model.count,
30008              uniqueCount: model.values.length
30009            });
30010            var sx = this.sharedStringXform;
30011            model.values.forEach(function (sharedString) {
30012              sx.render(xmlStream, sharedString);
30013            });
30014            xmlStream.closeNode();
30015          }
30016        }, {
30017          key: "parseOpen",
30018          value: function parseOpen(node) {
30019            if (this.parser) {
30020              this.parser.parseOpen(node);
30021              return true;
30022            }
30023
30024            switch (node.name) {
30025              case 'sst':
30026                return true;
30027
30028              case 'si':
30029                this.parser = this.sharedStringXform;
30030                this.parser.parseOpen(node);
30031                return true;
30032
30033              default:
30034                throw new Error("Unexpected xml node in parseOpen: ".concat(JSON.stringify(node)));
30035            }
30036          }
30037        }, {
30038          key: "parseText",
30039          value: function parseText(text) {
30040            if (this.parser) {
30041              this.parser.parseText(text);
30042            }
30043          }
30044        }, {
30045          key: "parseClose",
30046          value: function parseClose(name) {
30047            if (this.parser) {
30048              if (!this.parser.parseClose(name)) {
30049                this.model.values.push(this.parser.model);
30050                this.model.count++;
30051                this.parser = undefined;
30052              }
30053
30054              return true;
30055            }
30056
30057            switch (name) {
30058              case 'sst':
30059                return false;
30060
30061              default:
30062                throw new Error("Unexpected xml node in parseClose: ".concat(name));
30063            }
30064          }
30065        }, {
30066          key: "sharedStringXform",
30067          get: function get() {
30068            return this._sharedStringXform || (this._sharedStringXform = new SharedStringXform());
30069          }
30070        }, {
30071          key: "values",
30072          get: function get() {
30073            return this.model.values;
30074          }
30075        }, {
30076          key: "uniqueCount",
30077          get: function get() {
30078            return this.model.values.length;
30079          }
30080        }, {
30081          key: "count",
30082          get: function get() {
30083            return this.model.count;
30084          }
30085        }]);
30086
30087        return SharedStringsXform;
30088      }(BaseXform);
30089
30090      module.exports = SharedStringsXform;
30091    }, {
30092      "../../../utils/xml-stream": 25,
30093      "../base-xform": 29,
30094      "./shared-string-xform": 120
30095    }],
30096    122: [function (require, module, exports) {
30097      "use strict";
30098
30099      function _typeof(obj) {
30100        "@babel/helpers - typeof";
30101
30102        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
30103          _typeof = function _typeof(obj) {
30104            return typeof obj;
30105          };
30106        } else {
30107          _typeof = function _typeof(obj) {
30108            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
30109          };
30110        }
30111
30112        return _typeof(obj);
30113      }
30114
30115      function _classCallCheck(instance, Constructor) {
30116        if (!(instance instanceof Constructor)) {
30117          throw new TypeError("Cannot call a class as a function");
30118        }
30119      }
30120
30121      function _defineProperties(target, props) {
30122        for (var i = 0; i < props.length; i++) {
30123          var descriptor = props[i];
30124          descriptor.enumerable = descriptor.enumerable || false;
30125          descriptor.configurable = true;
30126          if ("value" in descriptor) descriptor.writable = true;
30127          Object.defineProperty(target, descriptor.key, descriptor);
30128        }
30129      }
30130
30131      function _createClass(Constructor, protoProps, staticProps) {
30132        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
30133        if (staticProps) _defineProperties(Constructor, staticProps);
30134        return Constructor;
30135      }
30136
30137      function _inherits(subClass, superClass) {
30138        if (typeof superClass !== "function" && superClass !== null) {
30139          throw new TypeError("Super expression must either be null or a function");
30140        }
30141
30142        subClass.prototype = Object.create(superClass && superClass.prototype, {
30143          constructor: {
30144            value: subClass,
30145            writable: true,
30146            configurable: true
30147          }
30148        });
30149        if (superClass) _setPrototypeOf(subClass, superClass);
30150      }
30151
30152      function _setPrototypeOf(o, p) {
30153        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
30154          o.__proto__ = p;
30155          return o;
30156        };
30157
30158        return _setPrototypeOf(o, p);
30159      }
30160
30161      function _createSuper(Derived) {
30162        return function () {
30163          var Super = _getPrototypeOf(Derived),
30164              result;
30165
30166          if (_isNativeReflectConstruct()) {
30167            var NewTarget = _getPrototypeOf(this).constructor;
30168
30169            result = Reflect.construct(Super, arguments, NewTarget);
30170          } else {
30171            result = Super.apply(this, arguments);
30172          }
30173
30174          return _possibleConstructorReturn(this, result);
30175        };
30176      }
30177
30178      function _possibleConstructorReturn(self, call) {
30179        if (call && (_typeof(call) === "object" || typeof call === "function")) {
30180          return call;
30181        }
30182
30183        return _assertThisInitialized(self);
30184      }
30185
30186      function _assertThisInitialized(self) {
30187        if (self === void 0) {
30188          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
30189        }
30190
30191        return self;
30192      }
30193
30194      function _isNativeReflectConstruct() {
30195        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
30196        if (Reflect.construct.sham) return false;
30197        if (typeof Proxy === "function") return true;
30198
30199        try {
30200          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
30201          return true;
30202        } catch (e) {
30203          return false;
30204        }
30205      }
30206
30207      function _getPrototypeOf(o) {
30208        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
30209          return o.__proto__ || Object.getPrototypeOf(o);
30210        };
30211        return _getPrototypeOf(o);
30212      }
30213
30214      var BaseXform = require('../base-xform'); //   <t xml:space="preserve"> is </t>
30215
30216
30217      var TextXform = /*#__PURE__*/function (_BaseXform) {
30218        _inherits(TextXform, _BaseXform);
30219
30220        var _super = _createSuper(TextXform);
30221
30222        function TextXform() {
30223          _classCallCheck(this, TextXform);
30224
30225          return _super.apply(this, arguments);
30226        }
30227
30228        _createClass(TextXform, [{
30229          key: "render",
30230          value: function render(xmlStream, model) {
30231            xmlStream.openNode('t');
30232
30233            if (/^\s|\n|\s$/.test(model)) {
30234              xmlStream.addAttribute('xml:space', 'preserve');
30235            }
30236
30237            xmlStream.writeText(model);
30238            xmlStream.closeNode();
30239          }
30240        }, {
30241          key: "parseOpen",
30242          value: function parseOpen(node) {
30243            switch (node.name) {
30244              case 't':
30245                this._text = [];
30246                return true;
30247
30248              default:
30249                return false;
30250            }
30251          }
30252        }, {
30253          key: "parseText",
30254          value: function parseText(text) {
30255            this._text.push(text);
30256          }
30257        }, {
30258          key: "parseClose",
30259          value: function parseClose() {
30260            return false;
30261          }
30262        }, {
30263          key: "tag",
30264          get: function get() {
30265            return 't';
30266          }
30267        }, {
30268          key: "model",
30269          get: function get() {
30270            return this._text.join('').replace(/_x([0-9A-F]{4})_/g, function ($0, $1) {
30271              return String.fromCharCode(parseInt($1, 16));
30272            });
30273          }
30274        }]);
30275
30276        return TextXform;
30277      }(BaseXform);
30278
30279      module.exports = TextXform;
30280    }, {
30281      "../base-xform": 29
30282    }],
30283    123: [function (require, module, exports) {
30284      "use strict";
30285
30286      function _typeof(obj) {
30287        "@babel/helpers - typeof";
30288
30289        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
30290          _typeof = function _typeof(obj) {
30291            return typeof obj;
30292          };
30293        } else {
30294          _typeof = function _typeof(obj) {
30295            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
30296          };
30297        }
30298
30299        return _typeof(obj);
30300      }
30301
30302      function _classCallCheck(instance, Constructor) {
30303        if (!(instance instanceof Constructor)) {
30304          throw new TypeError("Cannot call a class as a function");
30305        }
30306      }
30307
30308      function _defineProperties(target, props) {
30309        for (var i = 0; i < props.length; i++) {
30310          var descriptor = props[i];
30311          descriptor.enumerable = descriptor.enumerable || false;
30312          descriptor.configurable = true;
30313          if ("value" in descriptor) descriptor.writable = true;
30314          Object.defineProperty(target, descriptor.key, descriptor);
30315        }
30316      }
30317
30318      function _createClass(Constructor, protoProps, staticProps) {
30319        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
30320        if (staticProps) _defineProperties(Constructor, staticProps);
30321        return Constructor;
30322      }
30323
30324      function _inherits(subClass, superClass) {
30325        if (typeof superClass !== "function" && superClass !== null) {
30326          throw new TypeError("Super expression must either be null or a function");
30327        }
30328
30329        subClass.prototype = Object.create(superClass && superClass.prototype, {
30330          constructor: {
30331            value: subClass,
30332            writable: true,
30333            configurable: true
30334          }
30335        });
30336        if (superClass) _setPrototypeOf(subClass, superClass);
30337      }
30338
30339      function _setPrototypeOf(o, p) {
30340        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
30341          o.__proto__ = p;
30342          return o;
30343        };
30344
30345        return _setPrototypeOf(o, p);
30346      }
30347
30348      function _createSuper(Derived) {
30349        return function () {
30350          var Super = _getPrototypeOf(Derived),
30351              result;
30352
30353          if (_isNativeReflectConstruct()) {
30354            var NewTarget = _getPrototypeOf(this).constructor;
30355
30356            result = Reflect.construct(Super, arguments, NewTarget);
30357          } else {
30358            result = Super.apply(this, arguments);
30359          }
30360
30361          return _possibleConstructorReturn(this, result);
30362        };
30363      }
30364
30365      function _possibleConstructorReturn(self, call) {
30366        if (call && (_typeof(call) === "object" || typeof call === "function")) {
30367          return call;
30368        }
30369
30370        return _assertThisInitialized(self);
30371      }
30372
30373      function _assertThisInitialized(self) {
30374        if (self === void 0) {
30375          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
30376        }
30377
30378        return self;
30379      }
30380
30381      function _isNativeReflectConstruct() {
30382        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
30383        if (Reflect.construct.sham) return false;
30384        if (typeof Proxy === "function") return true;
30385
30386        try {
30387          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
30388          return true;
30389        } catch (e) {
30390          return false;
30391        }
30392      }
30393
30394      function _getPrototypeOf(o) {
30395        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
30396          return o.__proto__ || Object.getPrototypeOf(o);
30397        };
30398        return _getPrototypeOf(o);
30399      }
30400
30401      var Enums = require('../../../doc/enums');
30402
30403      var utils = require('../../../utils/utils');
30404
30405      var BaseXform = require('../base-xform');
30406
30407      var validation = {
30408        horizontalValues: ['left', 'center', 'right', 'fill', 'centerContinuous', 'distributed', 'justify'].reduce(function (p, v) {
30409          p[v] = true;
30410          return p;
30411        }, {}),
30412        horizontal: function horizontal(value) {
30413          return this.horizontalValues[value] ? value : undefined;
30414        },
30415        verticalValues: ['top', 'middle', 'bottom', 'distributed', 'justify'].reduce(function (p, v) {
30416          p[v] = true;
30417          return p;
30418        }, {}),
30419        vertical: function vertical(value) {
30420          if (value === 'middle') return 'center';
30421          return this.verticalValues[value] ? value : undefined;
30422        },
30423        wrapText: function wrapText(value) {
30424          return value ? true : undefined;
30425        },
30426        shrinkToFit: function shrinkToFit(value) {
30427          return value ? true : undefined;
30428        },
30429        textRotation: function textRotation(value) {
30430          switch (value) {
30431            case 'vertical':
30432              return value;
30433
30434            default:
30435              value = utils.validInt(value);
30436              return value >= -90 && value <= 90 ? value : undefined;
30437          }
30438        },
30439        indent: function indent(value) {
30440          value = utils.validInt(value);
30441          return Math.max(0, value);
30442        },
30443        readingOrder: function readingOrder(value) {
30444          switch (value) {
30445            case 'ltr':
30446              return Enums.ReadingOrder.LeftToRight;
30447
30448            case 'rtl':
30449              return Enums.ReadingOrder.RightToLeft;
30450
30451            default:
30452              return undefined;
30453          }
30454        }
30455      };
30456      var textRotationXform = {
30457        toXml: function toXml(textRotation) {
30458          textRotation = validation.textRotation(textRotation);
30459
30460          if (textRotation) {
30461            if (textRotation === 'vertical') {
30462              return 255;
30463            }
30464
30465            var tr = Math.round(textRotation);
30466
30467            if (tr >= 0 && tr <= 90) {
30468              return tr;
30469            }
30470
30471            if (tr < 0 && tr >= -90) {
30472              return 90 - tr;
30473            }
30474          }
30475
30476          return undefined;
30477        },
30478        toModel: function toModel(textRotation) {
30479          var tr = utils.validInt(textRotation);
30480
30481          if (tr !== undefined) {
30482            if (tr === 255) {
30483              return 'vertical';
30484            }
30485
30486            if (tr >= 0 && tr <= 90) {
30487              return tr;
30488            }
30489
30490            if (tr > 90 && tr <= 180) {
30491              return 90 - tr;
30492            }
30493          }
30494
30495          return undefined;
30496        }
30497      }; // Alignment encapsulates translation from style.alignment model to/from xlsx
30498
30499      var AlignmentXform = /*#__PURE__*/function (_BaseXform) {
30500        _inherits(AlignmentXform, _BaseXform);
30501
30502        var _super = _createSuper(AlignmentXform);
30503
30504        function AlignmentXform() {
30505          _classCallCheck(this, AlignmentXform);
30506
30507          return _super.apply(this, arguments);
30508        }
30509
30510        _createClass(AlignmentXform, [{
30511          key: "render",
30512          value: function render(xmlStream, model) {
30513            xmlStream.addRollback();
30514            xmlStream.openNode('alignment');
30515            var isValid = false;
30516
30517            function add(name, value) {
30518              if (value) {
30519                xmlStream.addAttribute(name, value);
30520                isValid = true;
30521              }
30522            }
30523
30524            add('horizontal', validation.horizontal(model.horizontal));
30525            add('vertical', validation.vertical(model.vertical));
30526            add('wrapText', validation.wrapText(model.wrapText) ? '1' : false);
30527            add('shrinkToFit', validation.shrinkToFit(model.shrinkToFit) ? '1' : false);
30528            add('indent', validation.indent(model.indent));
30529            add('textRotation', textRotationXform.toXml(model.textRotation));
30530            add('readingOrder', validation.readingOrder(model.readingOrder));
30531            xmlStream.closeNode();
30532
30533            if (isValid) {
30534              xmlStream.commit();
30535            } else {
30536              xmlStream.rollback();
30537            }
30538          }
30539        }, {
30540          key: "parseOpen",
30541          value: function parseOpen(node) {
30542            var model = {};
30543            var valid = false;
30544
30545            function add(truthy, name, value) {
30546              if (truthy) {
30547                model[name] = value;
30548                valid = true;
30549              }
30550            }
30551
30552            add(node.attributes.horizontal, 'horizontal', node.attributes.horizontal);
30553            add(node.attributes.vertical, 'vertical', node.attributes.vertical === 'center' ? 'middle' : node.attributes.vertical);
30554            add(node.attributes.wrapText, 'wrapText', !!node.attributes.wrapText);
30555            add(node.attributes.shrinkToFit, 'shrinkToFit', !!node.attributes.shrinkToFit);
30556            add(node.attributes.indent, 'indent', parseInt(node.attributes.indent, 10));
30557            add(node.attributes.textRotation, 'textRotation', textRotationXform.toModel(node.attributes.textRotation));
30558            add(node.attributes.readingOrder, 'readingOrder', node.attributes.readingOrder === '2' ? 'rtl' : 'ltr');
30559            this.model = valid ? model : null;
30560          }
30561        }, {
30562          key: "parseText",
30563          value: function parseText() {}
30564        }, {
30565          key: "parseClose",
30566          value: function parseClose() {
30567            return false;
30568          }
30569        }, {
30570          key: "tag",
30571          get: function get() {
30572            return 'alignment';
30573          }
30574        }]);
30575
30576        return AlignmentXform;
30577      }(BaseXform);
30578
30579      module.exports = AlignmentXform;
30580    }, {
30581      "../../../doc/enums": 7,
30582      "../../../utils/utils": 24,
30583      "../base-xform": 29
30584    }],
30585    124: [function (require, module, exports) {
30586      "use strict";
30587
30588      function ownKeys(object, enumerableOnly) {
30589        var keys = Object.keys(object);
30590
30591        if (Object.getOwnPropertySymbols) {
30592          var symbols = Object.getOwnPropertySymbols(object);
30593          if (enumerableOnly) symbols = symbols.filter(function (sym) {
30594            return Object.getOwnPropertyDescriptor(object, sym).enumerable;
30595          });
30596          keys.push.apply(keys, symbols);
30597        }
30598
30599        return keys;
30600      }
30601
30602      function _objectSpread(target) {
30603        for (var i = 1; i < arguments.length; i++) {
30604          var source = arguments[i] != null ? arguments[i] : {};
30605
30606          if (i % 2) {
30607            ownKeys(Object(source), true).forEach(function (key) {
30608              _defineProperty(target, key, source[key]);
30609            });
30610          } else if (Object.getOwnPropertyDescriptors) {
30611            Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
30612          } else {
30613            ownKeys(Object(source)).forEach(function (key) {
30614              Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
30615            });
30616          }
30617        }
30618
30619        return target;
30620      }
30621
30622      function _defineProperty(obj, key, value) {
30623        if (key in obj) {
30624          Object.defineProperty(obj, key, {
30625            value: value,
30626            enumerable: true,
30627            configurable: true,
30628            writable: true
30629          });
30630        } else {
30631          obj[key] = value;
30632        }
30633
30634        return obj;
30635      }
30636
30637      function _typeof(obj) {
30638        "@babel/helpers - typeof";
30639
30640        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
30641          _typeof = function _typeof(obj) {
30642            return typeof obj;
30643          };
30644        } else {
30645          _typeof = function _typeof(obj) {
30646            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
30647          };
30648        }
30649
30650        return _typeof(obj);
30651      }
30652
30653      function _classCallCheck(instance, Constructor) {
30654        if (!(instance instanceof Constructor)) {
30655          throw new TypeError("Cannot call a class as a function");
30656        }
30657      }
30658
30659      function _defineProperties(target, props) {
30660        for (var i = 0; i < props.length; i++) {
30661          var descriptor = props[i];
30662          descriptor.enumerable = descriptor.enumerable || false;
30663          descriptor.configurable = true;
30664          if ("value" in descriptor) descriptor.writable = true;
30665          Object.defineProperty(target, descriptor.key, descriptor);
30666        }
30667      }
30668
30669      function _createClass(Constructor, protoProps, staticProps) {
30670        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
30671        if (staticProps) _defineProperties(Constructor, staticProps);
30672        return Constructor;
30673      }
30674
30675      function _inherits(subClass, superClass) {
30676        if (typeof superClass !== "function" && superClass !== null) {
30677          throw new TypeError("Super expression must either be null or a function");
30678        }
30679
30680        subClass.prototype = Object.create(superClass && superClass.prototype, {
30681          constructor: {
30682            value: subClass,
30683            writable: true,
30684            configurable: true
30685          }
30686        });
30687        if (superClass) _setPrototypeOf(subClass, superClass);
30688      }
30689
30690      function _setPrototypeOf(o, p) {
30691        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
30692          o.__proto__ = p;
30693          return o;
30694        };
30695
30696        return _setPrototypeOf(o, p);
30697      }
30698
30699      function _createSuper(Derived) {
30700        return function () {
30701          var Super = _getPrototypeOf(Derived),
30702              result;
30703
30704          if (_isNativeReflectConstruct()) {
30705            var NewTarget = _getPrototypeOf(this).constructor;
30706
30707            result = Reflect.construct(Super, arguments, NewTarget);
30708          } else {
30709            result = Super.apply(this, arguments);
30710          }
30711
30712          return _possibleConstructorReturn(this, result);
30713        };
30714      }
30715
30716      function _possibleConstructorReturn(self, call) {
30717        if (call && (_typeof(call) === "object" || typeof call === "function")) {
30718          return call;
30719        }
30720
30721        return _assertThisInitialized(self);
30722      }
30723
30724      function _assertThisInitialized(self) {
30725        if (self === void 0) {
30726          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
30727        }
30728
30729        return self;
30730      }
30731
30732      function _isNativeReflectConstruct() {
30733        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
30734        if (Reflect.construct.sham) return false;
30735        if (typeof Proxy === "function") return true;
30736
30737        try {
30738          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
30739          return true;
30740        } catch (e) {
30741          return false;
30742        }
30743      }
30744
30745      function _getPrototypeOf(o) {
30746        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
30747          return o.__proto__ || Object.getPrototypeOf(o);
30748        };
30749        return _getPrototypeOf(o);
30750      }
30751      /* eslint-disable max-classes-per-file */
30752
30753
30754      var BaseXform = require('../base-xform');
30755
30756      var ColorXform = require('./color-xform');
30757
30758      var EdgeXform = /*#__PURE__*/function (_BaseXform) {
30759        _inherits(EdgeXform, _BaseXform);
30760
30761        var _super = _createSuper(EdgeXform);
30762
30763        function EdgeXform(name) {
30764          var _this;
30765
30766          _classCallCheck(this, EdgeXform);
30767
30768          _this = _super.call(this);
30769          _this.name = name;
30770          _this.map = {
30771            color: new ColorXform()
30772          };
30773          return _this;
30774        }
30775
30776        _createClass(EdgeXform, [{
30777          key: "render",
30778          value: function render(xmlStream, model, defaultColor) {
30779            var color = model && model.color || defaultColor || this.defaultColor;
30780            xmlStream.openNode(this.name);
30781
30782            if (model && model.style) {
30783              xmlStream.addAttribute('style', model.style);
30784
30785              if (color) {
30786                this.map.color.render(xmlStream, color);
30787              }
30788            }
30789
30790            xmlStream.closeNode();
30791          }
30792        }, {
30793          key: "parseOpen",
30794          value: function parseOpen(node) {
30795            if (this.parser) {
30796              this.parser.parseOpen(node);
30797              return true;
30798            }
30799
30800            switch (node.name) {
30801              case this.name:
30802                {
30803                  var style = node.attributes.style;
30804
30805                  if (style) {
30806                    this.model = {
30807                      style: style
30808                    };
30809                  } else {
30810                    this.model = undefined;
30811                  }
30812
30813                  return true;
30814                }
30815
30816              case 'color':
30817                this.parser = this.map.color;
30818                this.parser.parseOpen(node);
30819                return true;
30820
30821              default:
30822                return false;
30823            }
30824          }
30825        }, {
30826          key: "parseText",
30827          value: function parseText(text) {
30828            if (this.parser) {
30829              this.parser.parseText(text);
30830            }
30831          }
30832        }, {
30833          key: "parseClose",
30834          value: function parseClose(name) {
30835            if (this.parser) {
30836              if (!this.parser.parseClose(name)) {
30837                this.parser = undefined;
30838              }
30839
30840              return true;
30841            }
30842
30843            if (name === this.name) {
30844              if (this.map.color.model) {
30845                if (!this.model) {
30846                  this.model = {};
30847                }
30848
30849                this.model.color = this.map.color.model;
30850              }
30851            }
30852
30853            return false;
30854          }
30855        }, {
30856          key: "validStyle",
30857          value: function validStyle(value) {
30858            return EdgeXform.validStyleValues[value];
30859          }
30860        }, {
30861          key: "tag",
30862          get: function get() {
30863            return this.name;
30864          }
30865        }]);
30866
30867        return EdgeXform;
30868      }(BaseXform);
30869
30870      EdgeXform.validStyleValues = ['thin', 'dotted', 'dashDot', 'hair', 'dashDotDot', 'slantDashDot', 'mediumDashed', 'mediumDashDotDot', 'mediumDashDot', 'medium', 'double', 'thick'].reduce(function (p, v) {
30871        p[v] = true;
30872        return p;
30873      }, {}); // Border encapsulates translation from border model to/from xlsx
30874
30875      var BorderXform = /*#__PURE__*/function (_BaseXform2) {
30876        _inherits(BorderXform, _BaseXform2);
30877
30878        var _super2 = _createSuper(BorderXform);
30879
30880        function BorderXform() {
30881          var _this2;
30882
30883          _classCallCheck(this, BorderXform);
30884
30885          _this2 = _super2.call(this);
30886          _this2.map = {
30887            top: new EdgeXform('top'),
30888            left: new EdgeXform('left'),
30889            bottom: new EdgeXform('bottom'),
30890            right: new EdgeXform('right'),
30891            diagonal: new EdgeXform('diagonal')
30892          };
30893          return _this2;
30894        }
30895
30896        _createClass(BorderXform, [{
30897          key: "render",
30898          value: function render(xmlStream, model) {
30899            var color = model.color;
30900            xmlStream.openNode('border');
30901
30902            if (model.diagonal && model.diagonal.style) {
30903              if (model.diagonal.up) {
30904                xmlStream.addAttribute('diagonalUp', '1');
30905              }
30906
30907              if (model.diagonal.down) {
30908                xmlStream.addAttribute('diagonalDown', '1');
30909              }
30910            }
30911
30912            function add(edgeModel, edgeXform) {
30913              if (edgeModel && !edgeModel.color && model.color) {
30914                // don't mess with incoming models
30915                edgeModel = _objectSpread(_objectSpread({}, edgeModel), {}, {
30916                  color: model.color
30917                });
30918              }
30919
30920              edgeXform.render(xmlStream, edgeModel, color);
30921            }
30922
30923            add(model.left, this.map.left);
30924            add(model.right, this.map.right);
30925            add(model.top, this.map.top);
30926            add(model.bottom, this.map.bottom);
30927            add(model.diagonal, this.map.diagonal);
30928            xmlStream.closeNode();
30929          }
30930        }, {
30931          key: "parseOpen",
30932          value: function parseOpen(node) {
30933            if (this.parser) {
30934              this.parser.parseOpen(node);
30935              return true;
30936            }
30937
30938            switch (node.name) {
30939              case 'border':
30940                this.reset();
30941                this.diagonalUp = !!node.attributes.diagonalUp;
30942                this.diagonalDown = !!node.attributes.diagonalDown;
30943                return true;
30944
30945              default:
30946                this.parser = this.map[node.name];
30947
30948                if (this.parser) {
30949                  this.parser.parseOpen(node);
30950                  return true;
30951                }
30952
30953                return false;
30954            }
30955          }
30956        }, {
30957          key: "parseText",
30958          value: function parseText(text) {
30959            if (this.parser) {
30960              this.parser.parseText(text);
30961            }
30962          }
30963        }, {
30964          key: "parseClose",
30965          value: function parseClose(name) {
30966            if (this.parser) {
30967              if (!this.parser.parseClose(name)) {
30968                this.parser = undefined;
30969              }
30970
30971              return true;
30972            }
30973
30974            if (name === 'border') {
30975              var model = this.model = {};
30976
30977              var add = function add(key, edgeModel, extensions) {
30978                if (edgeModel) {
30979                  if (extensions) {
30980                    Object.assign(edgeModel, extensions);
30981                  }
30982
30983                  model[key] = edgeModel;
30984                }
30985              };
30986
30987              add('left', this.map.left.model);
30988              add('right', this.map.right.model);
30989              add('top', this.map.top.model);
30990              add('bottom', this.map.bottom.model);
30991              add('diagonal', this.map.diagonal.model, {
30992                up: this.diagonalUp,
30993                down: this.diagonalDown
30994              });
30995            }
30996
30997            return false;
30998          }
30999        }]);
31000
31001        return BorderXform;
31002      }(BaseXform);
31003
31004      module.exports = BorderXform;
31005    }, {
31006      "../base-xform": 29,
31007      "./color-xform": 125
31008    }],
31009    125: [function (require, module, exports) {
31010      "use strict";
31011
31012      function _typeof(obj) {
31013        "@babel/helpers - typeof";
31014
31015        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
31016          _typeof = function _typeof(obj) {
31017            return typeof obj;
31018          };
31019        } else {
31020          _typeof = function _typeof(obj) {
31021            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
31022          };
31023        }
31024
31025        return _typeof(obj);
31026      }
31027
31028      function _classCallCheck(instance, Constructor) {
31029        if (!(instance instanceof Constructor)) {
31030          throw new TypeError("Cannot call a class as a function");
31031        }
31032      }
31033
31034      function _defineProperties(target, props) {
31035        for (var i = 0; i < props.length; i++) {
31036          var descriptor = props[i];
31037          descriptor.enumerable = descriptor.enumerable || false;
31038          descriptor.configurable = true;
31039          if ("value" in descriptor) descriptor.writable = true;
31040          Object.defineProperty(target, descriptor.key, descriptor);
31041        }
31042      }
31043
31044      function _createClass(Constructor, protoProps, staticProps) {
31045        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
31046        if (staticProps) _defineProperties(Constructor, staticProps);
31047        return Constructor;
31048      }
31049
31050      function _inherits(subClass, superClass) {
31051        if (typeof superClass !== "function" && superClass !== null) {
31052          throw new TypeError("Super expression must either be null or a function");
31053        }
31054
31055        subClass.prototype = Object.create(superClass && superClass.prototype, {
31056          constructor: {
31057            value: subClass,
31058            writable: true,
31059            configurable: true
31060          }
31061        });
31062        if (superClass) _setPrototypeOf(subClass, superClass);
31063      }
31064
31065      function _setPrototypeOf(o, p) {
31066        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
31067          o.__proto__ = p;
31068          return o;
31069        };
31070
31071        return _setPrototypeOf(o, p);
31072      }
31073
31074      function _createSuper(Derived) {
31075        return function () {
31076          var Super = _getPrototypeOf(Derived),
31077              result;
31078
31079          if (_isNativeReflectConstruct()) {
31080            var NewTarget = _getPrototypeOf(this).constructor;
31081
31082            result = Reflect.construct(Super, arguments, NewTarget);
31083          } else {
31084            result = Super.apply(this, arguments);
31085          }
31086
31087          return _possibleConstructorReturn(this, result);
31088        };
31089      }
31090
31091      function _possibleConstructorReturn(self, call) {
31092        if (call && (_typeof(call) === "object" || typeof call === "function")) {
31093          return call;
31094        }
31095
31096        return _assertThisInitialized(self);
31097      }
31098
31099      function _assertThisInitialized(self) {
31100        if (self === void 0) {
31101          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
31102        }
31103
31104        return self;
31105      }
31106
31107      function _isNativeReflectConstruct() {
31108        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
31109        if (Reflect.construct.sham) return false;
31110        if (typeof Proxy === "function") return true;
31111
31112        try {
31113          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
31114          return true;
31115        } catch (e) {
31116          return false;
31117        }
31118      }
31119
31120      function _getPrototypeOf(o) {
31121        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
31122          return o.__proto__ || Object.getPrototypeOf(o);
31123        };
31124        return _getPrototypeOf(o);
31125      }
31126
31127      var BaseXform = require('../base-xform'); // Color encapsulates translation from color model to/from xlsx
31128
31129
31130      var ColorXform = /*#__PURE__*/function (_BaseXform) {
31131        _inherits(ColorXform, _BaseXform);
31132
31133        var _super = _createSuper(ColorXform);
31134
31135        function ColorXform(name) {
31136          var _this;
31137
31138          _classCallCheck(this, ColorXform);
31139
31140          _this = _super.call(this); // this.name controls the xm node name
31141
31142          _this.name = name || 'color';
31143          return _this;
31144        }
31145
31146        _createClass(ColorXform, [{
31147          key: "render",
31148          value: function render(xmlStream, model) {
31149            if (model) {
31150              xmlStream.openNode(this.name);
31151
31152              if (model.argb) {
31153                xmlStream.addAttribute('rgb', model.argb);
31154              } else if (model.theme !== undefined) {
31155                xmlStream.addAttribute('theme', model.theme);
31156
31157                if (model.tint !== undefined) {
31158                  xmlStream.addAttribute('tint', model.tint);
31159                }
31160              } else if (model.indexed !== undefined) {
31161                xmlStream.addAttribute('indexed', model.indexed);
31162              } else {
31163                xmlStream.addAttribute('auto', '1');
31164              }
31165
31166              xmlStream.closeNode();
31167              return true;
31168            }
31169
31170            return false;
31171          }
31172        }, {
31173          key: "parseOpen",
31174          value: function parseOpen(node) {
31175            if (node.name === this.name) {
31176              if (node.attributes.rgb) {
31177                this.model = {
31178                  argb: node.attributes.rgb
31179                };
31180              } else if (node.attributes.theme) {
31181                this.model = {
31182                  theme: parseInt(node.attributes.theme, 10)
31183                };
31184
31185                if (node.attributes.tint) {
31186                  this.model.tint = parseFloat(node.attributes.tint);
31187                }
31188              } else if (node.attributes.indexed) {
31189                this.model = {
31190                  indexed: parseInt(node.attributes.indexed, 10)
31191                };
31192              } else {
31193                this.model = undefined;
31194              }
31195
31196              return true;
31197            }
31198
31199            return false;
31200          }
31201        }, {
31202          key: "parseText",
31203          value: function parseText() {}
31204        }, {
31205          key: "parseClose",
31206          value: function parseClose() {
31207            return false;
31208          }
31209        }, {
31210          key: "tag",
31211          get: function get() {
31212            return this.name;
31213          }
31214        }]);
31215
31216        return ColorXform;
31217      }(BaseXform);
31218
31219      module.exports = ColorXform;
31220    }, {
31221      "../base-xform": 29
31222    }],
31223    126: [function (require, module, exports) {
31224      "use strict";
31225
31226      function _typeof(obj) {
31227        "@babel/helpers - typeof";
31228
31229        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
31230          _typeof = function _typeof(obj) {
31231            return typeof obj;
31232          };
31233        } else {
31234          _typeof = function _typeof(obj) {
31235            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
31236          };
31237        }
31238
31239        return _typeof(obj);
31240      }
31241
31242      function _classCallCheck(instance, Constructor) {
31243        if (!(instance instanceof Constructor)) {
31244          throw new TypeError("Cannot call a class as a function");
31245        }
31246      }
31247
31248      function _defineProperties(target, props) {
31249        for (var i = 0; i < props.length; i++) {
31250          var descriptor = props[i];
31251          descriptor.enumerable = descriptor.enumerable || false;
31252          descriptor.configurable = true;
31253          if ("value" in descriptor) descriptor.writable = true;
31254          Object.defineProperty(target, descriptor.key, descriptor);
31255        }
31256      }
31257
31258      function _createClass(Constructor, protoProps, staticProps) {
31259        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
31260        if (staticProps) _defineProperties(Constructor, staticProps);
31261        return Constructor;
31262      }
31263
31264      function _inherits(subClass, superClass) {
31265        if (typeof superClass !== "function" && superClass !== null) {
31266          throw new TypeError("Super expression must either be null or a function");
31267        }
31268
31269        subClass.prototype = Object.create(superClass && superClass.prototype, {
31270          constructor: {
31271            value: subClass,
31272            writable: true,
31273            configurable: true
31274          }
31275        });
31276        if (superClass) _setPrototypeOf(subClass, superClass);
31277      }
31278
31279      function _setPrototypeOf(o, p) {
31280        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
31281          o.__proto__ = p;
31282          return o;
31283        };
31284
31285        return _setPrototypeOf(o, p);
31286      }
31287
31288      function _createSuper(Derived) {
31289        return function () {
31290          var Super = _getPrototypeOf(Derived),
31291              result;
31292
31293          if (_isNativeReflectConstruct()) {
31294            var NewTarget = _getPrototypeOf(this).constructor;
31295
31296            result = Reflect.construct(Super, arguments, NewTarget);
31297          } else {
31298            result = Super.apply(this, arguments);
31299          }
31300
31301          return _possibleConstructorReturn(this, result);
31302        };
31303      }
31304
31305      function _possibleConstructorReturn(self, call) {
31306        if (call && (_typeof(call) === "object" || typeof call === "function")) {
31307          return call;
31308        }
31309
31310        return _assertThisInitialized(self);
31311      }
31312
31313      function _assertThisInitialized(self) {
31314        if (self === void 0) {
31315          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
31316        }
31317
31318        return self;
31319      }
31320
31321      function _isNativeReflectConstruct() {
31322        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
31323        if (Reflect.construct.sham) return false;
31324        if (typeof Proxy === "function") return true;
31325
31326        try {
31327          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
31328          return true;
31329        } catch (e) {
31330          return false;
31331        }
31332      }
31333
31334      function _getPrototypeOf(o) {
31335        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
31336          return o.__proto__ || Object.getPrototypeOf(o);
31337        };
31338        return _getPrototypeOf(o);
31339      }
31340
31341      var BaseXform = require('../base-xform');
31342
31343      var AlignmentXform = require('./alignment-xform');
31344
31345      var BorderXform = require('./border-xform');
31346
31347      var FillXform = require('./fill-xform');
31348
31349      var FontXform = require('./font-xform');
31350
31351      var NumFmtXform = require('./numfmt-xform');
31352
31353      var ProtectionXform = require('./protection-xform'); // <xf numFmtId="[numFmtId]" fontId="[fontId]" fillId="[fillId]" borderId="[xf.borderId]" xfId="[xfId]">
31354      //   Optional <alignment>
31355      //   Optional <protection>
31356      // </xf>
31357      // Style assists translation from style model to/from xlsx
31358
31359
31360      var DxfXform = /*#__PURE__*/function (_BaseXform) {
31361        _inherits(DxfXform, _BaseXform);
31362
31363        var _super = _createSuper(DxfXform);
31364
31365        function DxfXform() {
31366          var _this;
31367
31368          _classCallCheck(this, DxfXform);
31369
31370          _this = _super.call(this);
31371          _this.map = {
31372            alignment: new AlignmentXform(),
31373            border: new BorderXform(),
31374            fill: new FillXform(),
31375            font: new FontXform(),
31376            numFmt: new NumFmtXform(),
31377            protection: new ProtectionXform()
31378          };
31379          return _this;
31380        }
31381
31382        _createClass(DxfXform, [{
31383          key: "render",
31384          // how do we generate dxfid?
31385          value: function render(xmlStream, model) {
31386            xmlStream.openNode(this.tag);
31387
31388            if (model.alignment) {
31389              this.map.alignment.render(xmlStream, model.alignment);
31390            }
31391
31392            if (model.border) {
31393              this.map.border.render(xmlStream, model.border);
31394            }
31395
31396            if (model.fill) {
31397              this.map.fill.render(xmlStream, model.fill);
31398            }
31399
31400            if (model.font) {
31401              this.map.font.render(xmlStream, model.font);
31402            }
31403
31404            if (model.numFmt) {
31405              this.map.numFmt.render(xmlStream, model.numFmt);
31406            }
31407
31408            if (model.protection) {
31409              this.map.protection.render(xmlStream, model.protection);
31410            }
31411
31412            xmlStream.closeNode();
31413          }
31414        }, {
31415          key: "parseOpen",
31416          value: function parseOpen(node) {
31417            if (this.parser) {
31418              this.parser.parseOpen(node);
31419              return true;
31420            }
31421
31422            switch (node.name) {
31423              case this.tag:
31424                // this node is often repeated. Need to reset children
31425                this.reset();
31426                return true;
31427
31428              default:
31429                this.parser = this.map[node.name];
31430
31431                if (this.parser) {
31432                  this.parser.parseOpen(node);
31433                }
31434
31435                return true;
31436            }
31437          }
31438        }, {
31439          key: "parseText",
31440          value: function parseText(text) {
31441            if (this.parser) {
31442              this.parser.parseText(text);
31443            }
31444          }
31445        }, {
31446          key: "parseClose",
31447          value: function parseClose(name) {
31448            if (this.parser) {
31449              if (!this.parser.parseClose(name)) {
31450                this.parser = undefined;
31451              }
31452
31453              return true;
31454            }
31455
31456            if (name === this.tag) {
31457              this.model = {
31458                alignment: this.map.alignment.model,
31459                border: this.map.border.model,
31460                fill: this.map.fill.model,
31461                font: this.map.font.model,
31462                numFmt: this.map.numFmt.model,
31463                protection: this.map.protection.model
31464              };
31465              return false;
31466            }
31467
31468            return true;
31469          }
31470        }, {
31471          key: "tag",
31472          get: function get() {
31473            return 'dxf';
31474          }
31475        }]);
31476
31477        return DxfXform;
31478      }(BaseXform);
31479
31480      module.exports = DxfXform;
31481    }, {
31482      "../base-xform": 29,
31483      "./alignment-xform": 123,
31484      "./border-xform": 124,
31485      "./fill-xform": 127,
31486      "./font-xform": 128,
31487      "./numfmt-xform": 129,
31488      "./protection-xform": 130
31489    }],
31490    127: [function (require, module, exports) {
31491      "use strict";
31492
31493      function _typeof(obj) {
31494        "@babel/helpers - typeof";
31495
31496        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
31497          _typeof = function _typeof(obj) {
31498            return typeof obj;
31499          };
31500        } else {
31501          _typeof = function _typeof(obj) {
31502            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
31503          };
31504        }
31505
31506        return _typeof(obj);
31507      }
31508
31509      function _classCallCheck(instance, Constructor) {
31510        if (!(instance instanceof Constructor)) {
31511          throw new TypeError("Cannot call a class as a function");
31512        }
31513      }
31514
31515      function _defineProperties(target, props) {
31516        for (var i = 0; i < props.length; i++) {
31517          var descriptor = props[i];
31518          descriptor.enumerable = descriptor.enumerable || false;
31519          descriptor.configurable = true;
31520          if ("value" in descriptor) descriptor.writable = true;
31521          Object.defineProperty(target, descriptor.key, descriptor);
31522        }
31523      }
31524
31525      function _createClass(Constructor, protoProps, staticProps) {
31526        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
31527        if (staticProps) _defineProperties(Constructor, staticProps);
31528        return Constructor;
31529      }
31530
31531      function _inherits(subClass, superClass) {
31532        if (typeof superClass !== "function" && superClass !== null) {
31533          throw new TypeError("Super expression must either be null or a function");
31534        }
31535
31536        subClass.prototype = Object.create(superClass && superClass.prototype, {
31537          constructor: {
31538            value: subClass,
31539            writable: true,
31540            configurable: true
31541          }
31542        });
31543        if (superClass) _setPrototypeOf(subClass, superClass);
31544      }
31545
31546      function _setPrototypeOf(o, p) {
31547        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
31548          o.__proto__ = p;
31549          return o;
31550        };
31551
31552        return _setPrototypeOf(o, p);
31553      }
31554
31555      function _createSuper(Derived) {
31556        return function () {
31557          var Super = _getPrototypeOf(Derived),
31558              result;
31559
31560          if (_isNativeReflectConstruct()) {
31561            var NewTarget = _getPrototypeOf(this).constructor;
31562
31563            result = Reflect.construct(Super, arguments, NewTarget);
31564          } else {
31565            result = Super.apply(this, arguments);
31566          }
31567
31568          return _possibleConstructorReturn(this, result);
31569        };
31570      }
31571
31572      function _possibleConstructorReturn(self, call) {
31573        if (call && (_typeof(call) === "object" || typeof call === "function")) {
31574          return call;
31575        }
31576
31577        return _assertThisInitialized(self);
31578      }
31579
31580      function _assertThisInitialized(self) {
31581        if (self === void 0) {
31582          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
31583        }
31584
31585        return self;
31586      }
31587
31588      function _isNativeReflectConstruct() {
31589        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
31590        if (Reflect.construct.sham) return false;
31591        if (typeof Proxy === "function") return true;
31592
31593        try {
31594          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
31595          return true;
31596        } catch (e) {
31597          return false;
31598        }
31599      }
31600
31601      function _getPrototypeOf(o) {
31602        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
31603          return o.__proto__ || Object.getPrototypeOf(o);
31604        };
31605        return _getPrototypeOf(o);
31606      }
31607      /* eslint-disable max-classes-per-file */
31608
31609
31610      var BaseXform = require('../base-xform');
31611
31612      var ColorXform = require('./color-xform');
31613
31614      var StopXform = /*#__PURE__*/function (_BaseXform) {
31615        _inherits(StopXform, _BaseXform);
31616
31617        var _super = _createSuper(StopXform);
31618
31619        function StopXform() {
31620          var _this;
31621
31622          _classCallCheck(this, StopXform);
31623
31624          _this = _super.call(this);
31625          _this.map = {
31626            color: new ColorXform()
31627          };
31628          return _this;
31629        }
31630
31631        _createClass(StopXform, [{
31632          key: "render",
31633          value: function render(xmlStream, model) {
31634            xmlStream.openNode('stop');
31635            xmlStream.addAttribute('position', model.position);
31636            this.map.color.render(xmlStream, model.color);
31637            xmlStream.closeNode();
31638          }
31639        }, {
31640          key: "parseOpen",
31641          value: function parseOpen(node) {
31642            if (this.parser) {
31643              this.parser.parseOpen(node);
31644              return true;
31645            }
31646
31647            switch (node.name) {
31648              case 'stop':
31649                this.model = {
31650                  position: parseFloat(node.attributes.position)
31651                };
31652                return true;
31653
31654              case 'color':
31655                this.parser = this.map.color;
31656                this.parser.parseOpen(node);
31657                return true;
31658
31659              default:
31660                return false;
31661            }
31662          }
31663        }, {
31664          key: "parseText",
31665          value: function parseText() {}
31666        }, {
31667          key: "parseClose",
31668          value: function parseClose(name) {
31669            if (this.parser) {
31670              if (!this.parser.parseClose(name)) {
31671                this.model.color = this.parser.model;
31672                this.parser = undefined;
31673              }
31674
31675              return true;
31676            }
31677
31678            return false;
31679          }
31680        }, {
31681          key: "tag",
31682          get: function get() {
31683            return 'stop';
31684          }
31685        }]);
31686
31687        return StopXform;
31688      }(BaseXform);
31689
31690      var PatternFillXform = /*#__PURE__*/function (_BaseXform2) {
31691        _inherits(PatternFillXform, _BaseXform2);
31692
31693        var _super2 = _createSuper(PatternFillXform);
31694
31695        function PatternFillXform() {
31696          var _this2;
31697
31698          _classCallCheck(this, PatternFillXform);
31699
31700          _this2 = _super2.call(this);
31701          _this2.map = {
31702            fgColor: new ColorXform('fgColor'),
31703            bgColor: new ColorXform('bgColor')
31704          };
31705          return _this2;
31706        }
31707
31708        _createClass(PatternFillXform, [{
31709          key: "render",
31710          value: function render(xmlStream, model) {
31711            xmlStream.openNode('patternFill');
31712            xmlStream.addAttribute('patternType', model.pattern);
31713
31714            if (model.fgColor) {
31715              this.map.fgColor.render(xmlStream, model.fgColor);
31716            }
31717
31718            if (model.bgColor) {
31719              this.map.bgColor.render(xmlStream, model.bgColor);
31720            }
31721
31722            xmlStream.closeNode();
31723          }
31724        }, {
31725          key: "parseOpen",
31726          value: function parseOpen(node) {
31727            if (this.parser) {
31728              this.parser.parseOpen(node);
31729              return true;
31730            }
31731
31732            switch (node.name) {
31733              case 'patternFill':
31734                this.model = {
31735                  type: 'pattern',
31736                  pattern: node.attributes.patternType
31737                };
31738                return true;
31739
31740              default:
31741                this.parser = this.map[node.name];
31742
31743                if (this.parser) {
31744                  this.parser.parseOpen(node);
31745                  return true;
31746                }
31747
31748                return false;
31749            }
31750          }
31751        }, {
31752          key: "parseText",
31753          value: function parseText(text) {
31754            if (this.parser) {
31755              this.parser.parseText(text);
31756            }
31757          }
31758        }, {
31759          key: "parseClose",
31760          value: function parseClose(name) {
31761            if (this.parser) {
31762              if (!this.parser.parseClose(name)) {
31763                if (this.parser.model) {
31764                  this.model[name] = this.parser.model;
31765                }
31766
31767                this.parser = undefined;
31768              }
31769
31770              return true;
31771            }
31772
31773            return false;
31774          }
31775        }, {
31776          key: "name",
31777          get: function get() {
31778            return 'pattern';
31779          }
31780        }, {
31781          key: "tag",
31782          get: function get() {
31783            return 'patternFill';
31784          }
31785        }]);
31786
31787        return PatternFillXform;
31788      }(BaseXform);
31789
31790      var GradientFillXform = /*#__PURE__*/function (_BaseXform3) {
31791        _inherits(GradientFillXform, _BaseXform3);
31792
31793        var _super3 = _createSuper(GradientFillXform);
31794
31795        function GradientFillXform() {
31796          var _this3;
31797
31798          _classCallCheck(this, GradientFillXform);
31799
31800          _this3 = _super3.call(this);
31801          _this3.map = {
31802            stop: new StopXform()
31803          }; // if (model) {
31804          //   this.gradient = model.gradient;
31805          //   if (model.center) {
31806          //     this.center = model.center;
31807          //   }
31808          //   if (model.degree !== undefined) {
31809          //     this.degree = model.degree;
31810          //   }
31811          //   this.stops = model.stops.map(function(stop) { return new StopXform(stop); });
31812          // } else {
31813          //   this.stops = [];
31814          // }
31815
31816          return _this3;
31817        }
31818
31819        _createClass(GradientFillXform, [{
31820          key: "render",
31821          value: function render(xmlStream, model) {
31822            xmlStream.openNode('gradientFill');
31823
31824            switch (model.gradient) {
31825              case 'angle':
31826                xmlStream.addAttribute('degree', model.degree);
31827                break;
31828
31829              case 'path':
31830                xmlStream.addAttribute('type', 'path');
31831
31832                if (model.center.left) {
31833                  xmlStream.addAttribute('left', model.center.left);
31834
31835                  if (model.center.right === undefined) {
31836                    xmlStream.addAttribute('right', model.center.left);
31837                  }
31838                }
31839
31840                if (model.center.right) {
31841                  xmlStream.addAttribute('right', model.center.right);
31842                }
31843
31844                if (model.center.top) {
31845                  xmlStream.addAttribute('top', model.center.top);
31846
31847                  if (model.center.bottom === undefined) {
31848                    xmlStream.addAttribute('bottom', model.center.top);
31849                  }
31850                }
31851
31852                if (model.center.bottom) {
31853                  xmlStream.addAttribute('bottom', model.center.bottom);
31854                }
31855
31856                break;
31857
31858              default:
31859                break;
31860            }
31861
31862            var stopXform = this.map.stop;
31863            model.stops.forEach(function (stopModel) {
31864              stopXform.render(xmlStream, stopModel);
31865            });
31866            xmlStream.closeNode();
31867          }
31868        }, {
31869          key: "parseOpen",
31870          value: function parseOpen(node) {
31871            if (this.parser) {
31872              this.parser.parseOpen(node);
31873              return true;
31874            }
31875
31876            switch (node.name) {
31877              case 'gradientFill':
31878                {
31879                  var model = this.model = {
31880                    stops: []
31881                  };
31882
31883                  if (node.attributes.degree) {
31884                    model.gradient = 'angle';
31885                    model.degree = parseInt(node.attributes.degree, 10);
31886                  } else if (node.attributes.type === 'path') {
31887                    model.gradient = 'path';
31888                    model.center = {
31889                      left: node.attributes.left ? parseFloat(node.attributes.left) : 0,
31890                      top: node.attributes.top ? parseFloat(node.attributes.top) : 0
31891                    };
31892
31893                    if (node.attributes.right !== node.attributes.left) {
31894                      model.center.right = node.attributes.right ? parseFloat(node.attributes.right) : 0;
31895                    }
31896
31897                    if (node.attributes.bottom !== node.attributes.top) {
31898                      model.center.bottom = node.attributes.bottom ? parseFloat(node.attributes.bottom) : 0;
31899                    }
31900                  }
31901
31902                  return true;
31903                }
31904
31905              case 'stop':
31906                this.parser = this.map.stop;
31907                this.parser.parseOpen(node);
31908                return true;
31909
31910              default:
31911                return false;
31912            }
31913          }
31914        }, {
31915          key: "parseText",
31916          value: function parseText(text) {
31917            if (this.parser) {
31918              this.parser.parseText(text);
31919            }
31920          }
31921        }, {
31922          key: "parseClose",
31923          value: function parseClose(name) {
31924            if (this.parser) {
31925              if (!this.parser.parseClose(name)) {
31926                this.model.stops.push(this.parser.model);
31927                this.parser = undefined;
31928              }
31929
31930              return true;
31931            }
31932
31933            return false;
31934          }
31935        }, {
31936          key: "name",
31937          get: function get() {
31938            return 'gradient';
31939          }
31940        }, {
31941          key: "tag",
31942          get: function get() {
31943            return 'gradientFill';
31944          }
31945        }]);
31946
31947        return GradientFillXform;
31948      }(BaseXform); // Fill encapsulates translation from fill model to/from xlsx
31949
31950
31951      var FillXform = /*#__PURE__*/function (_BaseXform4) {
31952        _inherits(FillXform, _BaseXform4);
31953
31954        var _super4 = _createSuper(FillXform);
31955
31956        function FillXform() {
31957          var _this4;
31958
31959          _classCallCheck(this, FillXform);
31960
31961          _this4 = _super4.call(this);
31962          _this4.map = {
31963            patternFill: new PatternFillXform(),
31964            gradientFill: new GradientFillXform()
31965          };
31966          return _this4;
31967        }
31968
31969        _createClass(FillXform, [{
31970          key: "render",
31971          value: function render(xmlStream, model) {
31972            xmlStream.addRollback();
31973            xmlStream.openNode('fill');
31974
31975            switch (model.type) {
31976              case 'pattern':
31977                this.map.patternFill.render(xmlStream, model);
31978                break;
31979
31980              case 'gradient':
31981                this.map.gradientFill.render(xmlStream, model);
31982                break;
31983
31984              default:
31985                xmlStream.rollback();
31986                return;
31987            }
31988
31989            xmlStream.closeNode();
31990            xmlStream.commit();
31991          }
31992        }, {
31993          key: "parseOpen",
31994          value: function parseOpen(node) {
31995            if (this.parser) {
31996              this.parser.parseOpen(node);
31997              return true;
31998            }
31999
32000            switch (node.name) {
32001              case 'fill':
32002                this.model = {};
32003                return true;
32004
32005              default:
32006                this.parser = this.map[node.name];
32007
32008                if (this.parser) {
32009                  this.parser.parseOpen(node);
32010                  return true;
32011                }
32012
32013                return false;
32014            }
32015          }
32016        }, {
32017          key: "parseText",
32018          value: function parseText(text) {
32019            if (this.parser) {
32020              this.parser.parseText(text);
32021            }
32022          }
32023        }, {
32024          key: "parseClose",
32025          value: function parseClose(name) {
32026            if (this.parser) {
32027              if (!this.parser.parseClose(name)) {
32028                this.model = this.parser.model;
32029                this.model.type = this.parser.name;
32030                this.parser = undefined;
32031              }
32032
32033              return true;
32034            }
32035
32036            return false;
32037          }
32038        }, {
32039          key: "validStyle",
32040          value: function validStyle(value) {
32041            return FillXform.validPatternValues[value];
32042          }
32043        }, {
32044          key: "tag",
32045          get: function get() {
32046            return 'fill';
32047          }
32048        }]);
32049
32050        return FillXform;
32051      }(BaseXform);
32052
32053      FillXform.validPatternValues = ['none', 'solid', 'darkVertical', 'darkGray', 'mediumGray', 'lightGray', 'gray125', 'gray0625', 'darkHorizontal', 'darkVertical', 'darkDown', 'darkUp', 'darkGrid', 'darkTrellis', 'lightHorizontal', 'lightVertical', 'lightDown', 'lightUp', 'lightGrid', 'lightTrellis', 'lightGrid'].reduce(function (p, v) {
32054        p[v] = true;
32055        return p;
32056      }, {});
32057      FillXform.StopXform = StopXform;
32058      FillXform.PatternFillXform = PatternFillXform;
32059      FillXform.GradientFillXform = GradientFillXform;
32060      module.exports = FillXform;
32061    }, {
32062      "../base-xform": 29,
32063      "./color-xform": 125
32064    }],
32065    128: [function (require, module, exports) {
32066      'use strict';
32067
32068      function _typeof(obj) {
32069        "@babel/helpers - typeof";
32070
32071        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
32072          _typeof = function _typeof(obj) {
32073            return typeof obj;
32074          };
32075        } else {
32076          _typeof = function _typeof(obj) {
32077            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
32078          };
32079        }
32080
32081        return _typeof(obj);
32082      }
32083
32084      function _classCallCheck(instance, Constructor) {
32085        if (!(instance instanceof Constructor)) {
32086          throw new TypeError("Cannot call a class as a function");
32087        }
32088      }
32089
32090      function _defineProperties(target, props) {
32091        for (var i = 0; i < props.length; i++) {
32092          var descriptor = props[i];
32093          descriptor.enumerable = descriptor.enumerable || false;
32094          descriptor.configurable = true;
32095          if ("value" in descriptor) descriptor.writable = true;
32096          Object.defineProperty(target, descriptor.key, descriptor);
32097        }
32098      }
32099
32100      function _createClass(Constructor, protoProps, staticProps) {
32101        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
32102        if (staticProps) _defineProperties(Constructor, staticProps);
32103        return Constructor;
32104      }
32105
32106      function _inherits(subClass, superClass) {
32107        if (typeof superClass !== "function" && superClass !== null) {
32108          throw new TypeError("Super expression must either be null or a function");
32109        }
32110
32111        subClass.prototype = Object.create(superClass && superClass.prototype, {
32112          constructor: {
32113            value: subClass,
32114            writable: true,
32115            configurable: true
32116          }
32117        });
32118        if (superClass) _setPrototypeOf(subClass, superClass);
32119      }
32120
32121      function _setPrototypeOf(o, p) {
32122        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
32123          o.__proto__ = p;
32124          return o;
32125        };
32126
32127        return _setPrototypeOf(o, p);
32128      }
32129
32130      function _createSuper(Derived) {
32131        return function () {
32132          var Super = _getPrototypeOf(Derived),
32133              result;
32134
32135          if (_isNativeReflectConstruct()) {
32136            var NewTarget = _getPrototypeOf(this).constructor;
32137
32138            result = Reflect.construct(Super, arguments, NewTarget);
32139          } else {
32140            result = Super.apply(this, arguments);
32141          }
32142
32143          return _possibleConstructorReturn(this, result);
32144        };
32145      }
32146
32147      function _possibleConstructorReturn(self, call) {
32148        if (call && (_typeof(call) === "object" || typeof call === "function")) {
32149          return call;
32150        }
32151
32152        return _assertThisInitialized(self);
32153      }
32154
32155      function _assertThisInitialized(self) {
32156        if (self === void 0) {
32157          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
32158        }
32159
32160        return self;
32161      }
32162
32163      function _isNativeReflectConstruct() {
32164        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
32165        if (Reflect.construct.sham) return false;
32166        if (typeof Proxy === "function") return true;
32167
32168        try {
32169          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
32170          return true;
32171        } catch (e) {
32172          return false;
32173        }
32174      }
32175
32176      function _getPrototypeOf(o) {
32177        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
32178          return o.__proto__ || Object.getPrototypeOf(o);
32179        };
32180        return _getPrototypeOf(o);
32181      }
32182
32183      var ColorXform = require('./color-xform');
32184
32185      var BooleanXform = require('../simple/boolean-xform');
32186
32187      var IntegerXform = require('../simple/integer-xform');
32188
32189      var StringXform = require('../simple/string-xform');
32190
32191      var UnderlineXform = require('./underline-xform');
32192
32193      var _ = require('../../../utils/under-dash');
32194
32195      var BaseXform = require('../base-xform'); // Font encapsulates translation from font model to xlsx
32196
32197
32198      var FontXform = /*#__PURE__*/function (_BaseXform) {
32199        _inherits(FontXform, _BaseXform);
32200
32201        var _super = _createSuper(FontXform);
32202
32203        function FontXform(options) {
32204          var _this;
32205
32206          _classCallCheck(this, FontXform);
32207
32208          _this = _super.call(this);
32209          _this.options = options || FontXform.OPTIONS;
32210          _this.map = {
32211            b: {
32212              prop: 'bold',
32213              xform: new BooleanXform({
32214                tag: 'b',
32215                attr: 'val'
32216              })
32217            },
32218            i: {
32219              prop: 'italic',
32220              xform: new BooleanXform({
32221                tag: 'i',
32222                attr: 'val'
32223              })
32224            },
32225            u: {
32226              prop: 'underline',
32227              xform: new UnderlineXform()
32228            },
32229            charset: {
32230              prop: 'charset',
32231              xform: new IntegerXform({
32232                tag: 'charset',
32233                attr: 'val'
32234              })
32235            },
32236            color: {
32237              prop: 'color',
32238              xform: new ColorXform()
32239            },
32240            condense: {
32241              prop: 'condense',
32242              xform: new BooleanXform({
32243                tag: 'condense',
32244                attr: 'val'
32245              })
32246            },
32247            extend: {
32248              prop: 'extend',
32249              xform: new BooleanXform({
32250                tag: 'extend',
32251                attr: 'val'
32252              })
32253            },
32254            family: {
32255              prop: 'family',
32256              xform: new IntegerXform({
32257                tag: 'family',
32258                attr: 'val'
32259              })
32260            },
32261            outline: {
32262              prop: 'outline',
32263              xform: new BooleanXform({
32264                tag: 'outline',
32265                attr: 'val'
32266              })
32267            },
32268            vertAlign: {
32269              prop: 'vertAlign',
32270              xform: new StringXform({
32271                tag: 'vertAlign',
32272                attr: 'val'
32273              })
32274            },
32275            scheme: {
32276              prop: 'scheme',
32277              xform: new StringXform({
32278                tag: 'scheme',
32279                attr: 'val'
32280              })
32281            },
32282            shadow: {
32283              prop: 'shadow',
32284              xform: new BooleanXform({
32285                tag: 'shadow',
32286                attr: 'val'
32287              })
32288            },
32289            strike: {
32290              prop: 'strike',
32291              xform: new BooleanXform({
32292                tag: 'strike',
32293                attr: 'val'
32294              })
32295            },
32296            sz: {
32297              prop: 'size',
32298              xform: new IntegerXform({
32299                tag: 'sz',
32300                attr: 'val'
32301              })
32302            }
32303          };
32304          _this.map[_this.options.fontNameTag] = {
32305            prop: 'name',
32306            xform: new StringXform({
32307              tag: _this.options.fontNameTag,
32308              attr: 'val'
32309            })
32310          };
32311          return _this;
32312        }
32313
32314        _createClass(FontXform, [{
32315          key: "render",
32316          value: function render(xmlStream, model) {
32317            var map = this.map;
32318            xmlStream.openNode(this.options.tagName);
32319
32320            _.each(this.map, function (defn, tag) {
32321              map[tag].xform.render(xmlStream, model[defn.prop]);
32322            });
32323
32324            xmlStream.closeNode();
32325          }
32326        }, {
32327          key: "parseOpen",
32328          value: function parseOpen(node) {
32329            if (this.parser) {
32330              this.parser.parseOpen(node);
32331              return true;
32332            }
32333
32334            if (this.map[node.name]) {
32335              this.parser = this.map[node.name].xform;
32336              return this.parser.parseOpen(node);
32337            }
32338
32339            switch (node.name) {
32340              case this.options.tagName:
32341                this.model = {};
32342                return true;
32343
32344              default:
32345                return false;
32346            }
32347          }
32348        }, {
32349          key: "parseText",
32350          value: function parseText(text) {
32351            if (this.parser) {
32352              this.parser.parseText(text);
32353            }
32354          }
32355        }, {
32356          key: "parseClose",
32357          value: function parseClose(name) {
32358            if (this.parser && !this.parser.parseClose(name)) {
32359              var item = this.map[name];
32360
32361              if (this.parser.model) {
32362                this.model[item.prop] = this.parser.model;
32363              }
32364
32365              this.parser = undefined;
32366              return true;
32367            }
32368
32369            switch (name) {
32370              case this.options.tagName:
32371                return false;
32372
32373              default:
32374                return true;
32375            }
32376          }
32377        }, {
32378          key: "tag",
32379          get: function get() {
32380            return this.options.tagName;
32381          }
32382        }]);
32383
32384        return FontXform;
32385      }(BaseXform);
32386
32387      FontXform.OPTIONS = {
32388        tagName: 'font',
32389        fontNameTag: 'name'
32390      };
32391      module.exports = FontXform;
32392    }, {
32393      "../../../utils/under-dash": 23,
32394      "../base-xform": 29,
32395      "../simple/boolean-xform": 113,
32396      "../simple/integer-xform": 115,
32397      "../simple/string-xform": 116,
32398      "./color-xform": 125,
32399      "./underline-xform": 133
32400    }],
32401    129: [function (require, module, exports) {
32402      "use strict";
32403
32404      function _typeof(obj) {
32405        "@babel/helpers - typeof";
32406
32407        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
32408          _typeof = function _typeof(obj) {
32409            return typeof obj;
32410          };
32411        } else {
32412          _typeof = function _typeof(obj) {
32413            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
32414          };
32415        }
32416
32417        return _typeof(obj);
32418      }
32419
32420      function _classCallCheck(instance, Constructor) {
32421        if (!(instance instanceof Constructor)) {
32422          throw new TypeError("Cannot call a class as a function");
32423        }
32424      }
32425
32426      function _defineProperties(target, props) {
32427        for (var i = 0; i < props.length; i++) {
32428          var descriptor = props[i];
32429          descriptor.enumerable = descriptor.enumerable || false;
32430          descriptor.configurable = true;
32431          if ("value" in descriptor) descriptor.writable = true;
32432          Object.defineProperty(target, descriptor.key, descriptor);
32433        }
32434      }
32435
32436      function _createClass(Constructor, protoProps, staticProps) {
32437        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
32438        if (staticProps) _defineProperties(Constructor, staticProps);
32439        return Constructor;
32440      }
32441
32442      function _inherits(subClass, superClass) {
32443        if (typeof superClass !== "function" && superClass !== null) {
32444          throw new TypeError("Super expression must either be null or a function");
32445        }
32446
32447        subClass.prototype = Object.create(superClass && superClass.prototype, {
32448          constructor: {
32449            value: subClass,
32450            writable: true,
32451            configurable: true
32452          }
32453        });
32454        if (superClass) _setPrototypeOf(subClass, superClass);
32455      }
32456
32457      function _setPrototypeOf(o, p) {
32458        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
32459          o.__proto__ = p;
32460          return o;
32461        };
32462
32463        return _setPrototypeOf(o, p);
32464      }
32465
32466      function _createSuper(Derived) {
32467        return function () {
32468          var Super = _getPrototypeOf(Derived),
32469              result;
32470
32471          if (_isNativeReflectConstruct()) {
32472            var NewTarget = _getPrototypeOf(this).constructor;
32473
32474            result = Reflect.construct(Super, arguments, NewTarget);
32475          } else {
32476            result = Super.apply(this, arguments);
32477          }
32478
32479          return _possibleConstructorReturn(this, result);
32480        };
32481      }
32482
32483      function _possibleConstructorReturn(self, call) {
32484        if (call && (_typeof(call) === "object" || typeof call === "function")) {
32485          return call;
32486        }
32487
32488        return _assertThisInitialized(self);
32489      }
32490
32491      function _assertThisInitialized(self) {
32492        if (self === void 0) {
32493          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
32494        }
32495
32496        return self;
32497      }
32498
32499      function _isNativeReflectConstruct() {
32500        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
32501        if (Reflect.construct.sham) return false;
32502        if (typeof Proxy === "function") return true;
32503
32504        try {
32505          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
32506          return true;
32507        } catch (e) {
32508          return false;
32509        }
32510      }
32511
32512      function _getPrototypeOf(o) {
32513        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
32514          return o.__proto__ || Object.getPrototypeOf(o);
32515        };
32516        return _getPrototypeOf(o);
32517      }
32518
32519      var _ = require('../../../utils/under-dash');
32520
32521      var defaultNumFormats = require('../../defaultnumformats');
32522
32523      var BaseXform = require('../base-xform');
32524
32525      function hashDefaultFormats() {
32526        var hash = {};
32527
32528        _.each(defaultNumFormats, function (dnf, id) {
32529          if (dnf.f) {
32530            hash[dnf.f] = parseInt(id, 10);
32531          } // at some point, add the other cultures here...
32532
32533        });
32534
32535        return hash;
32536      }
32537
32538      var defaultFmtHash = hashDefaultFormats(); // NumFmt encapsulates translation between number format and xlsx
32539
32540      var NumFmtXform = /*#__PURE__*/function (_BaseXform) {
32541        _inherits(NumFmtXform, _BaseXform);
32542
32543        var _super = _createSuper(NumFmtXform);
32544
32545        function NumFmtXform(id, formatCode) {
32546          var _this;
32547
32548          _classCallCheck(this, NumFmtXform);
32549
32550          _this = _super.call(this);
32551          _this.id = id;
32552          _this.formatCode = formatCode;
32553          return _this;
32554        }
32555
32556        _createClass(NumFmtXform, [{
32557          key: "render",
32558          value: function render(xmlStream, model) {
32559            xmlStream.leafNode('numFmt', {
32560              numFmtId: model.id,
32561              formatCode: model.formatCode
32562            });
32563          }
32564        }, {
32565          key: "parseOpen",
32566          value: function parseOpen(node) {
32567            switch (node.name) {
32568              case 'numFmt':
32569                this.model = {
32570                  id: parseInt(node.attributes.numFmtId, 10),
32571                  formatCode: node.attributes.formatCode.replace(/[\\](.)/g, '$1')
32572                };
32573                return true;
32574
32575              default:
32576                return false;
32577            }
32578          }
32579        }, {
32580          key: "parseText",
32581          value: function parseText() {}
32582        }, {
32583          key: "parseClose",
32584          value: function parseClose() {
32585            return false;
32586          }
32587        }, {
32588          key: "tag",
32589          get: function get() {
32590            return 'numFmt';
32591          }
32592        }]);
32593
32594        return NumFmtXform;
32595      }(BaseXform);
32596
32597      NumFmtXform.getDefaultFmtId = function getDefaultFmtId(formatCode) {
32598        return defaultFmtHash[formatCode];
32599      };
32600
32601      NumFmtXform.getDefaultFmtCode = function getDefaultFmtCode(numFmtId) {
32602        return defaultNumFormats[numFmtId] && defaultNumFormats[numFmtId].f;
32603      };
32604
32605      module.exports = NumFmtXform;
32606    }, {
32607      "../../../utils/under-dash": 23,
32608      "../../defaultnumformats": 27,
32609      "../base-xform": 29
32610    }],
32611    130: [function (require, module, exports) {
32612      "use strict";
32613
32614      function _typeof(obj) {
32615        "@babel/helpers - typeof";
32616
32617        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
32618          _typeof = function _typeof(obj) {
32619            return typeof obj;
32620          };
32621        } else {
32622          _typeof = function _typeof(obj) {
32623            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
32624          };
32625        }
32626
32627        return _typeof(obj);
32628      }
32629
32630      function _classCallCheck(instance, Constructor) {
32631        if (!(instance instanceof Constructor)) {
32632          throw new TypeError("Cannot call a class as a function");
32633        }
32634      }
32635
32636      function _defineProperties(target, props) {
32637        for (var i = 0; i < props.length; i++) {
32638          var descriptor = props[i];
32639          descriptor.enumerable = descriptor.enumerable || false;
32640          descriptor.configurable = true;
32641          if ("value" in descriptor) descriptor.writable = true;
32642          Object.defineProperty(target, descriptor.key, descriptor);
32643        }
32644      }
32645
32646      function _createClass(Constructor, protoProps, staticProps) {
32647        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
32648        if (staticProps) _defineProperties(Constructor, staticProps);
32649        return Constructor;
32650      }
32651
32652      function _inherits(subClass, superClass) {
32653        if (typeof superClass !== "function" && superClass !== null) {
32654          throw new TypeError("Super expression must either be null or a function");
32655        }
32656
32657        subClass.prototype = Object.create(superClass && superClass.prototype, {
32658          constructor: {
32659            value: subClass,
32660            writable: true,
32661            configurable: true
32662          }
32663        });
32664        if (superClass) _setPrototypeOf(subClass, superClass);
32665      }
32666
32667      function _setPrototypeOf(o, p) {
32668        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
32669          o.__proto__ = p;
32670          return o;
32671        };
32672
32673        return _setPrototypeOf(o, p);
32674      }
32675
32676      function _createSuper(Derived) {
32677        return function () {
32678          var Super = _getPrototypeOf(Derived),
32679              result;
32680
32681          if (_isNativeReflectConstruct()) {
32682            var NewTarget = _getPrototypeOf(this).constructor;
32683
32684            result = Reflect.construct(Super, arguments, NewTarget);
32685          } else {
32686            result = Super.apply(this, arguments);
32687          }
32688
32689          return _possibleConstructorReturn(this, result);
32690        };
32691      }
32692
32693      function _possibleConstructorReturn(self, call) {
32694        if (call && (_typeof(call) === "object" || typeof call === "function")) {
32695          return call;
32696        }
32697
32698        return _assertThisInitialized(self);
32699      }
32700
32701      function _assertThisInitialized(self) {
32702        if (self === void 0) {
32703          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
32704        }
32705
32706        return self;
32707      }
32708
32709      function _isNativeReflectConstruct() {
32710        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
32711        if (Reflect.construct.sham) return false;
32712        if (typeof Proxy === "function") return true;
32713
32714        try {
32715          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
32716          return true;
32717        } catch (e) {
32718          return false;
32719        }
32720      }
32721
32722      function _getPrototypeOf(o) {
32723        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
32724          return o.__proto__ || Object.getPrototypeOf(o);
32725        };
32726        return _getPrototypeOf(o);
32727      }
32728
32729      var BaseXform = require('../base-xform');
32730
32731      var validation = {
32732        boolean: function boolean(value, dflt) {
32733          if (value === undefined) {
32734            return dflt;
32735          }
32736
32737          return value;
32738        }
32739      }; // Protection encapsulates translation from style.protection model to/from xlsx
32740
32741      var ProtectionXform = /*#__PURE__*/function (_BaseXform) {
32742        _inherits(ProtectionXform, _BaseXform);
32743
32744        var _super = _createSuper(ProtectionXform);
32745
32746        function ProtectionXform() {
32747          _classCallCheck(this, ProtectionXform);
32748
32749          return _super.apply(this, arguments);
32750        }
32751
32752        _createClass(ProtectionXform, [{
32753          key: "render",
32754          value: function render(xmlStream, model) {
32755            xmlStream.addRollback();
32756            xmlStream.openNode('protection');
32757            var isValid = false;
32758
32759            function add(name, value) {
32760              if (value !== undefined) {
32761                xmlStream.addAttribute(name, value);
32762                isValid = true;
32763              }
32764            }
32765
32766            add('locked', validation.boolean(model.locked, true) ? undefined : '0');
32767            add('hidden', validation.boolean(model.hidden, false) ? '1' : undefined);
32768            xmlStream.closeNode();
32769
32770            if (isValid) {
32771              xmlStream.commit();
32772            } else {
32773              xmlStream.rollback();
32774            }
32775          }
32776        }, {
32777          key: "parseOpen",
32778          value: function parseOpen(node) {
32779            var model = {
32780              locked: !(node.attributes.locked === '0'),
32781              hidden: node.attributes.hidden === '1'
32782            }; // only want to record models that differ from defaults
32783
32784            var isSignificant = !model.locked || model.hidden;
32785            this.model = isSignificant ? model : null;
32786          }
32787        }, {
32788          key: "parseText",
32789          value: function parseText() {}
32790        }, {
32791          key: "parseClose",
32792          value: function parseClose() {
32793            return false;
32794          }
32795        }, {
32796          key: "tag",
32797          get: function get() {
32798            return 'protection';
32799          }
32800        }]);
32801
32802        return ProtectionXform;
32803      }(BaseXform);
32804
32805      module.exports = ProtectionXform;
32806    }, {
32807      "../base-xform": 29
32808    }],
32809    131: [function (require, module, exports) {
32810      "use strict";
32811
32812      function _typeof(obj) {
32813        "@babel/helpers - typeof";
32814
32815        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
32816          _typeof = function _typeof(obj) {
32817            return typeof obj;
32818          };
32819        } else {
32820          _typeof = function _typeof(obj) {
32821            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
32822          };
32823        }
32824
32825        return _typeof(obj);
32826      }
32827
32828      function _classCallCheck(instance, Constructor) {
32829        if (!(instance instanceof Constructor)) {
32830          throw new TypeError("Cannot call a class as a function");
32831        }
32832      }
32833
32834      function _defineProperties(target, props) {
32835        for (var i = 0; i < props.length; i++) {
32836          var descriptor = props[i];
32837          descriptor.enumerable = descriptor.enumerable || false;
32838          descriptor.configurable = true;
32839          if ("value" in descriptor) descriptor.writable = true;
32840          Object.defineProperty(target, descriptor.key, descriptor);
32841        }
32842      }
32843
32844      function _createClass(Constructor, protoProps, staticProps) {
32845        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
32846        if (staticProps) _defineProperties(Constructor, staticProps);
32847        return Constructor;
32848      }
32849
32850      function _inherits(subClass, superClass) {
32851        if (typeof superClass !== "function" && superClass !== null) {
32852          throw new TypeError("Super expression must either be null or a function");
32853        }
32854
32855        subClass.prototype = Object.create(superClass && superClass.prototype, {
32856          constructor: {
32857            value: subClass,
32858            writable: true,
32859            configurable: true
32860          }
32861        });
32862        if (superClass) _setPrototypeOf(subClass, superClass);
32863      }
32864
32865      function _setPrototypeOf(o, p) {
32866        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
32867          o.__proto__ = p;
32868          return o;
32869        };
32870
32871        return _setPrototypeOf(o, p);
32872      }
32873
32874      function _createSuper(Derived) {
32875        return function () {
32876          var Super = _getPrototypeOf(Derived),
32877              result;
32878
32879          if (_isNativeReflectConstruct()) {
32880            var NewTarget = _getPrototypeOf(this).constructor;
32881
32882            result = Reflect.construct(Super, arguments, NewTarget);
32883          } else {
32884            result = Super.apply(this, arguments);
32885          }
32886
32887          return _possibleConstructorReturn(this, result);
32888        };
32889      }
32890
32891      function _possibleConstructorReturn(self, call) {
32892        if (call && (_typeof(call) === "object" || typeof call === "function")) {
32893          return call;
32894        }
32895
32896        return _assertThisInitialized(self);
32897      }
32898
32899      function _assertThisInitialized(self) {
32900        if (self === void 0) {
32901          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
32902        }
32903
32904        return self;
32905      }
32906
32907      function _isNativeReflectConstruct() {
32908        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
32909        if (Reflect.construct.sham) return false;
32910        if (typeof Proxy === "function") return true;
32911
32912        try {
32913          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
32914          return true;
32915        } catch (e) {
32916          return false;
32917        }
32918      }
32919
32920      function _getPrototypeOf(o) {
32921        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
32922          return o.__proto__ || Object.getPrototypeOf(o);
32923        };
32924        return _getPrototypeOf(o);
32925      }
32926
32927      var BaseXform = require('../base-xform');
32928
32929      var AlignmentXform = require('./alignment-xform');
32930
32931      var ProtectionXform = require('./protection-xform'); // <xf numFmtId="[numFmtId]" fontId="[fontId]" fillId="[fillId]" borderId="[xf.borderId]" xfId="[xfId]">
32932      //   Optional <alignment>
32933      //   Optional <protection>
32934      // </xf>
32935      // Style assists translation from style model to/from xlsx
32936
32937
32938      var StyleXform = /*#__PURE__*/function (_BaseXform) {
32939        _inherits(StyleXform, _BaseXform);
32940
32941        var _super = _createSuper(StyleXform);
32942
32943        function StyleXform(options) {
32944          var _this;
32945
32946          _classCallCheck(this, StyleXform);
32947
32948          _this = _super.call(this);
32949          _this.xfId = !!(options && options.xfId);
32950          _this.map = {
32951            alignment: new AlignmentXform(),
32952            protection: new ProtectionXform()
32953          };
32954          return _this;
32955        }
32956
32957        _createClass(StyleXform, [{
32958          key: "render",
32959          value: function render(xmlStream, model) {
32960            xmlStream.openNode('xf', {
32961              numFmtId: model.numFmtId || 0,
32962              fontId: model.fontId || 0,
32963              fillId: model.fillId || 0,
32964              borderId: model.borderId || 0
32965            });
32966
32967            if (this.xfId) {
32968              xmlStream.addAttribute('xfId', model.xfId || 0);
32969            }
32970
32971            if (model.numFmtId) {
32972              xmlStream.addAttribute('applyNumberFormat', '1');
32973            }
32974
32975            if (model.fontId) {
32976              xmlStream.addAttribute('applyFont', '1');
32977            }
32978
32979            if (model.fillId) {
32980              xmlStream.addAttribute('applyFill', '1');
32981            }
32982
32983            if (model.borderId) {
32984              xmlStream.addAttribute('applyBorder', '1');
32985            }
32986
32987            if (model.alignment) {
32988              xmlStream.addAttribute('applyAlignment', '1');
32989            }
32990
32991            if (model.protection) {
32992              xmlStream.addAttribute('applyProtection', '1');
32993            }
32994            /**
32995             * Rendering tags causes close of XML stream.
32996             * Therefore adding attributes must be done before rendering tags.
32997             */
32998
32999
33000            if (model.alignment) {
33001              this.map.alignment.render(xmlStream, model.alignment);
33002            }
33003
33004            if (model.protection) {
33005              this.map.protection.render(xmlStream, model.protection);
33006            }
33007
33008            xmlStream.closeNode();
33009          }
33010        }, {
33011          key: "parseOpen",
33012          value: function parseOpen(node) {
33013            if (this.parser) {
33014              this.parser.parseOpen(node);
33015              return true;
33016            } // used during sax parsing of xml to build font object
33017
33018
33019            switch (node.name) {
33020              case 'xf':
33021                this.model = {
33022                  numFmtId: parseInt(node.attributes.numFmtId, 10),
33023                  fontId: parseInt(node.attributes.fontId, 10),
33024                  fillId: parseInt(node.attributes.fillId, 10),
33025                  borderId: parseInt(node.attributes.borderId, 10)
33026                };
33027
33028                if (this.xfId) {
33029                  this.model.xfId = parseInt(node.attributes.xfId, 10);
33030                }
33031
33032                return true;
33033
33034              case 'alignment':
33035                this.parser = this.map.alignment;
33036                this.parser.parseOpen(node);
33037                return true;
33038
33039              case 'protection':
33040                this.parser = this.map.protection;
33041                this.parser.parseOpen(node);
33042                return true;
33043
33044              default:
33045                return false;
33046            }
33047          }
33048        }, {
33049          key: "parseText",
33050          value: function parseText(text) {
33051            if (this.parser) {
33052              this.parser.parseText(text);
33053            }
33054          }
33055        }, {
33056          key: "parseClose",
33057          value: function parseClose(name) {
33058            if (this.parser) {
33059              if (!this.parser.parseClose(name)) {
33060                if (this.map.protection === this.parser) {
33061                  this.model.protection = this.parser.model;
33062                } else {
33063                  this.model.alignment = this.parser.model;
33064                }
33065
33066                this.parser = undefined;
33067              }
33068
33069              return true;
33070            }
33071
33072            return name !== 'xf';
33073          }
33074        }, {
33075          key: "tag",
33076          get: function get() {
33077            return 'xf';
33078          }
33079        }]);
33080
33081        return StyleXform;
33082      }(BaseXform);
33083
33084      module.exports = StyleXform;
33085    }, {
33086      "../base-xform": 29,
33087      "./alignment-xform": 123,
33088      "./protection-xform": 130
33089    }],
33090    132: [function (require, module, exports) {
33091      "use strict";
33092
33093      function _typeof(obj) {
33094        "@babel/helpers - typeof";
33095
33096        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
33097          _typeof = function _typeof(obj) {
33098            return typeof obj;
33099          };
33100        } else {
33101          _typeof = function _typeof(obj) {
33102            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
33103          };
33104        }
33105
33106        return _typeof(obj);
33107      }
33108
33109      function _classCallCheck(instance, Constructor) {
33110        if (!(instance instanceof Constructor)) {
33111          throw new TypeError("Cannot call a class as a function");
33112        }
33113      }
33114
33115      function _defineProperties(target, props) {
33116        for (var i = 0; i < props.length; i++) {
33117          var descriptor = props[i];
33118          descriptor.enumerable = descriptor.enumerable || false;
33119          descriptor.configurable = true;
33120          if ("value" in descriptor) descriptor.writable = true;
33121          Object.defineProperty(target, descriptor.key, descriptor);
33122        }
33123      }
33124
33125      function _createClass(Constructor, protoProps, staticProps) {
33126        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
33127        if (staticProps) _defineProperties(Constructor, staticProps);
33128        return Constructor;
33129      }
33130
33131      function _inherits(subClass, superClass) {
33132        if (typeof superClass !== "function" && superClass !== null) {
33133          throw new TypeError("Super expression must either be null or a function");
33134        }
33135
33136        subClass.prototype = Object.create(superClass && superClass.prototype, {
33137          constructor: {
33138            value: subClass,
33139            writable: true,
33140            configurable: true
33141          }
33142        });
33143        if (superClass) _setPrototypeOf(subClass, superClass);
33144      }
33145
33146      function _setPrototypeOf(o, p) {
33147        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
33148          o.__proto__ = p;
33149          return o;
33150        };
33151
33152        return _setPrototypeOf(o, p);
33153      }
33154
33155      function _createSuper(Derived) {
33156        return function () {
33157          var Super = _getPrototypeOf(Derived),
33158              result;
33159
33160          if (_isNativeReflectConstruct()) {
33161            var NewTarget = _getPrototypeOf(this).constructor;
33162
33163            result = Reflect.construct(Super, arguments, NewTarget);
33164          } else {
33165            result = Super.apply(this, arguments);
33166          }
33167
33168          return _possibleConstructorReturn(this, result);
33169        };
33170      }
33171
33172      function _possibleConstructorReturn(self, call) {
33173        if (call && (_typeof(call) === "object" || typeof call === "function")) {
33174          return call;
33175        }
33176
33177        return _assertThisInitialized(self);
33178      }
33179
33180      function _assertThisInitialized(self) {
33181        if (self === void 0) {
33182          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
33183        }
33184
33185        return self;
33186      }
33187
33188      function _isNativeReflectConstruct() {
33189        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
33190        if (Reflect.construct.sham) return false;
33191        if (typeof Proxy === "function") return true;
33192
33193        try {
33194          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
33195          return true;
33196        } catch (e) {
33197          return false;
33198        }
33199      }
33200
33201      function _getPrototypeOf(o) {
33202        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
33203          return o.__proto__ || Object.getPrototypeOf(o);
33204        };
33205        return _getPrototypeOf(o);
33206      }
33207      /* eslint-disable max-classes-per-file */
33208
33209
33210      var Enums = require('../../../doc/enums');
33211
33212      var XmlStream = require('../../../utils/xml-stream');
33213
33214      var BaseXform = require('../base-xform');
33215
33216      var StaticXform = require('../static-xform');
33217
33218      var ListXform = require('../list-xform');
33219
33220      var FontXform = require('./font-xform');
33221
33222      var FillXform = require('./fill-xform');
33223
33224      var BorderXform = require('./border-xform');
33225
33226      var NumFmtXform = require('./numfmt-xform');
33227
33228      var StyleXform = require('./style-xform');
33229
33230      var DxfXform = require('./dxf-xform'); // custom numfmt ids start here
33231
33232
33233      var NUMFMT_BASE = 164; // =============================================================================
33234      // StylesXform is used to generate and parse the styles.xml file
33235      // it manages the collections of fonts, number formats, alignments, etc
33236
33237      var StylesXform = /*#__PURE__*/function (_BaseXform) {
33238        _inherits(StylesXform, _BaseXform);
33239
33240        var _super = _createSuper(StylesXform);
33241
33242        function StylesXform(initialise) {
33243          var _this;
33244
33245          _classCallCheck(this, StylesXform);
33246
33247          _this = _super.call(this);
33248          _this.map = {
33249            numFmts: new ListXform({
33250              tag: 'numFmts',
33251              count: true,
33252              childXform: new NumFmtXform()
33253            }),
33254            fonts: new ListXform({
33255              tag: 'fonts',
33256              count: true,
33257              childXform: new FontXform(),
33258              $: {
33259                'x14ac:knownFonts': 1
33260              }
33261            }),
33262            fills: new ListXform({
33263              tag: 'fills',
33264              count: true,
33265              childXform: new FillXform()
33266            }),
33267            borders: new ListXform({
33268              tag: 'borders',
33269              count: true,
33270              childXform: new BorderXform()
33271            }),
33272            cellStyleXfs: new ListXform({
33273              tag: 'cellStyleXfs',
33274              count: true,
33275              childXform: new StyleXform()
33276            }),
33277            cellXfs: new ListXform({
33278              tag: 'cellXfs',
33279              count: true,
33280              childXform: new StyleXform({
33281                xfId: true
33282              })
33283            }),
33284            dxfs: new ListXform({
33285              tag: 'dxfs',
33286              always: true,
33287              count: true,
33288              childXform: new DxfXform()
33289            }),
33290            // for style manager
33291            numFmt: new NumFmtXform(),
33292            font: new FontXform(),
33293            fill: new FillXform(),
33294            border: new BorderXform(),
33295            style: new StyleXform({
33296              xfId: true
33297            }),
33298            cellStyles: StylesXform.STATIC_XFORMS.cellStyles,
33299            tableStyles: StylesXform.STATIC_XFORMS.tableStyles,
33300            extLst: StylesXform.STATIC_XFORMS.extLst
33301          };
33302
33303          if (initialise) {
33304            // StylesXform also acts as style manager and is used to build up styles-model during worksheet processing
33305            _this.init();
33306          }
33307
33308          return _this;
33309        }
33310
33311        _createClass(StylesXform, [{
33312          key: "initIndex",
33313          value: function initIndex() {
33314            this.index = {
33315              style: {},
33316              numFmt: {},
33317              numFmtNextId: 164,
33318              // start custom format ids here
33319              font: {},
33320              border: {},
33321              fill: {}
33322            };
33323          }
33324        }, {
33325          key: "init",
33326          value: function init() {
33327            // Prepare for Style Manager role
33328            this.model = {
33329              styles: [],
33330              numFmts: [],
33331              fonts: [],
33332              borders: [],
33333              fills: [],
33334              dxfs: []
33335            };
33336            this.initIndex(); // default (zero) border
33337
33338            this._addBorder({}); // add default (all zero) style
33339
33340
33341            this._addStyle({
33342              numFmtId: 0,
33343              fontId: 0,
33344              fillId: 0,
33345              borderId: 0,
33346              xfId: 0
33347            }); // add default fills
33348
33349
33350            this._addFill({
33351              type: 'pattern',
33352              pattern: 'none'
33353            });
33354
33355            this._addFill({
33356              type: 'pattern',
33357              pattern: 'gray125'
33358            });
33359
33360            this.weakMap = new WeakMap();
33361          }
33362        }, {
33363          key: "render",
33364          value: function render(xmlStream, model) {
33365            model = model || this.model; //
33366            //   <fonts count="2" x14ac:knownFonts="1">
33367
33368            xmlStream.openXml(XmlStream.StdDocAttributes);
33369            xmlStream.openNode('styleSheet', StylesXform.STYLESHEET_ATTRIBUTES);
33370
33371            if (this.index) {
33372              // model has been built by style manager role (contains xml)
33373              if (model.numFmts && model.numFmts.length) {
33374                xmlStream.openNode('numFmts', {
33375                  count: model.numFmts.length
33376                });
vendor: 14,274 bytes, lines 33377-33822
33377                model.numFmts.forEach(function (numFmtXml) {
33378                  xmlStream.writeXml(numFmtXml);
33379                });
33380                xmlStream.closeNode();
33381              }
33382
33383              if (!model.fonts.length) {
33384                // default (zero) font
33385                this._addFont({
33386                  size: 11,
33387                  color: {
33388                    theme: 1
33389                  },
33390                  name: 'Calibri',
33391                  family: 2,
33392                  scheme: 'minor'
33393                });
33394              }
33395
33396              xmlStream.openNode('fonts', {
33397                count: model.fonts.length,
33398                'x14ac:knownFonts': 1
33399              });
33400              model.fonts.forEach(function (fontXml) {
33401                xmlStream.writeXml(fontXml);
33402              });
33403              xmlStream.closeNode();
33404              xmlStream.openNode('fills', {
33405                count: model.fills.length
33406              });
33407              model.fills.forEach(function (fillXml) {
33408                xmlStream.writeXml(fillXml);
33409              });
33410              xmlStream.closeNode();
33411              xmlStream.openNode('borders', {
33412                count: model.borders.length
33413              });
33414              model.borders.forEach(function (borderXml) {
33415                xmlStream.writeXml(borderXml);
33416              });
33417              xmlStream.closeNode();
33418              this.map.cellStyleXfs.render(xmlStream, [{
33419                numFmtId: 0,
33420                fontId: 0,
33421                fillId: 0,
33422                borderId: 0,
33423                xfId: 0
33424              }]);
33425              xmlStream.openNode('cellXfs', {
33426                count: model.styles.length
33427              });
33428              model.styles.forEach(function (styleXml) {
33429                xmlStream.writeXml(styleXml);
33430              });
33431              xmlStream.closeNode();
33432            } else {
33433              // model is plain JSON and needs to be xformed
33434              this.map.numFmts.render(xmlStream, model.numFmts);
33435              this.map.fonts.render(xmlStream, model.fonts);
33436              this.map.fills.render(xmlStream, model.fills);
33437              this.map.borders.render(xmlStream, model.borders);
33438              this.map.cellStyleXfs.render(xmlStream, [{
33439                numFmtId: 0,
33440                fontId: 0,
33441                fillId: 0,
33442                borderId: 0,
33443                xfId: 0
33444              }]);
33445              this.map.cellXfs.render(xmlStream, model.styles);
33446            }
33447
33448            StylesXform.STATIC_XFORMS.cellStyles.render(xmlStream);
33449            this.map.dxfs.render(xmlStream, model.dxfs);
33450            StylesXform.STATIC_XFORMS.tableStyles.render(xmlStream);
33451            StylesXform.STATIC_XFORMS.extLst.render(xmlStream);
33452            xmlStream.closeNode();
33453          }
33454        }, {
33455          key: "parseOpen",
33456          value: function parseOpen(node) {
33457            if (this.parser) {
33458              this.parser.parseOpen(node);
33459              return true;
33460            }
33461
33462            switch (node.name) {
33463              case 'styleSheet':
33464                this.initIndex();
33465                return true;
33466
33467              default:
33468                this.parser = this.map[node.name];
33469
33470                if (this.parser) {
33471                  this.parser.parseOpen(node);
33472                }
33473
33474                return true;
33475            }
33476          }
33477        }, {
33478          key: "parseText",
33479          value: function parseText(text) {
33480            if (this.parser) {
33481              this.parser.parseText(text);
33482            }
33483          }
33484        }, {
33485          key: "parseClose",
33486          value: function parseClose(name) {
33487            var _this2 = this;
33488
33489            if (this.parser) {
33490              if (!this.parser.parseClose(name)) {
33491                this.parser = undefined;
33492              }
33493
33494              return true;
33495            }
33496
33497            switch (name) {
33498              case 'styleSheet':
33499                {
33500                  this.model = {};
33501
33502                  var add = function add(propName, xform) {
33503                    if (xform.model && xform.model.length) {
33504                      _this2.model[propName] = xform.model;
33505                    }
33506                  };
33507
33508                  add('numFmts', this.map.numFmts);
33509                  add('fonts', this.map.fonts);
33510                  add('fills', this.map.fills);
33511                  add('borders', this.map.borders);
33512                  add('styles', this.map.cellXfs);
33513                  add('dxfs', this.map.dxfs); // index numFmts
33514
33515                  this.index = {
33516                    model: [],
33517                    numFmt: []
33518                  };
33519
33520                  if (this.model.numFmts) {
33521                    var numFmtIndex = this.index.numFmt;
33522                    this.model.numFmts.forEach(function (numFmt) {
33523                      numFmtIndex[numFmt.id] = numFmt.formatCode;
33524                    });
33525                  }
33526
33527                  return false;
33528                }
33529
33530              default:
33531                // not quite sure how we get here!
33532                return true;
33533            }
33534          } // add a cell's style model to the collection
33535          // each style property is processed and cross-referenced, etc.
33536          // the styleId is returned. Note: cellType is used when numFmt not defined
33537
33538        }, {
33539          key: "addStyleModel",
33540          value: function addStyleModel(model, cellType) {
33541            if (!model) {
33542              return 0;
33543            } // if we have no default font, add it here now
33544
33545
33546            if (!this.model.fonts.length) {
33547              // default (zero) font
33548              this._addFont({
33549                size: 11,
33550                color: {
33551                  theme: 1
33552                },
33553                name: 'Calibri',
33554                family: 2,
33555                scheme: 'minor'
33556              });
33557            } // if we have seen this style object before, assume it has the same styleId
33558
33559
33560            if (this.weakMap && this.weakMap.has(model)) {
33561              return this.weakMap.get(model);
33562            }
33563
33564            var style = {};
33565            cellType = cellType || Enums.ValueType.Number;
33566
33567            if (model.numFmt) {
33568              style.numFmtId = this._addNumFmtStr(model.numFmt);
33569            } else {
33570              switch (cellType) {
33571                case Enums.ValueType.Number:
33572                  style.numFmtId = this._addNumFmtStr('General');
33573                  break;
33574
33575                case Enums.ValueType.Date:
33576                  style.numFmtId = this._addNumFmtStr('mm-dd-yy');
33577                  break;
33578
33579                default:
33580                  break;
33581              }
33582            }
33583
33584            if (model.font) {
33585              style.fontId = this._addFont(model.font);
33586            }
33587
33588            if (model.border) {
33589              style.borderId = this._addBorder(model.border);
33590            }
33591
33592            if (model.fill) {
33593              style.fillId = this._addFill(model.fill);
33594            }
33595
33596            if (model.alignment) {
33597              style.alignment = model.alignment;
33598            }
33599
33600            if (model.protection) {
33601              style.protection = model.protection;
33602            }
33603
33604            var styleId = this._addStyle(style);
33605
33606            if (this.weakMap) {
33607              this.weakMap.set(model, styleId);
33608            }
33609
33610            return styleId;
33611          } // given a styleId (i.e. s="n"), get the cell's style model
33612          // objects are shared where possible.
33613
33614        }, {
33615          key: "getStyleModel",
33616          value: function getStyleModel(id) {
33617            // if the style doesn't exist return null
33618            var style = this.model.styles[id];
33619            if (!style) return null; // have we built this model before?
33620
33621            var model = this.index.model[id];
33622            if (model) return model; // build a new model
33623
33624            model = this.index.model[id] = {}; // -------------------------------------------------------
33625            // number format
33626
33627            if (style.numFmtId) {
33628              var numFmt = this.index.numFmt[style.numFmtId] || NumFmtXform.getDefaultFmtCode(style.numFmtId);
33629
33630              if (numFmt) {
33631                model.numFmt = numFmt;
33632              }
33633            }
33634
33635            function addStyle(name, group, styleId) {
33636              if (styleId || styleId === 0) {
33637                var part = group[styleId];
33638
33639                if (part) {
33640                  model[name] = part;
33641                }
33642              }
33643            }
33644
33645            addStyle('font', this.model.fonts, style.fontId);
33646            addStyle('border', this.model.borders, style.borderId);
33647            addStyle('fill', this.model.fills, style.fillId); // -------------------------------------------------------
33648            // alignment
33649
33650            if (style.alignment) {
33651              model.alignment = style.alignment;
33652            } // -------------------------------------------------------
33653            // protection
33654
33655
33656            if (style.protection) {
33657              model.protection = style.protection;
33658            }
33659
33660            return model;
33661          }
33662        }, {
33663          key: "addDxfStyle",
33664          value: function addDxfStyle(style) {
33665            this.model.dxfs.push(style);
33666            return this.model.dxfs.length - 1;
33667          }
33668        }, {
33669          key: "getDxfStyle",
33670          value: function getDxfStyle(id) {
33671            return this.model.dxfs[id];
33672          } // =========================================================================
33673          // Private Interface
33674
33675        }, {
33676          key: "_addStyle",
33677          value: function _addStyle(style) {
33678            var xml = this.map.style.toXml(style);
33679            var index = this.index.style[xml];
33680
33681            if (index === undefined) {
33682              index = this.index.style[xml] = this.model.styles.length;
33683              this.model.styles.push(xml);
33684            }
33685
33686            return index;
33687          } // =========================================================================
33688          // Number Formats
33689
33690        }, {
33691          key: "_addNumFmtStr",
33692          value: function _addNumFmtStr(formatCode) {
33693            // check if default format
33694            var index = NumFmtXform.getDefaultFmtId(formatCode);
33695            if (index !== undefined) return index; // check if already in
33696
33697            index = this.index.numFmt[formatCode];
33698            if (index !== undefined) return index;
33699            index = this.index.numFmt[formatCode] = NUMFMT_BASE + this.model.numFmts.length;
33700            var xml = this.map.numFmt.toXml({
33701              id: index,
33702              formatCode: formatCode
33703            });
33704            this.model.numFmts.push(xml);
33705            return index;
33706          } // =========================================================================
33707          // Fonts
33708
33709        }, {
33710          key: "_addFont",
33711          value: function _addFont(font) {
33712            var xml = this.map.font.toXml(font);
33713            var index = this.index.font[xml];
33714
33715            if (index === undefined) {
33716              index = this.index.font[xml] = this.model.fonts.length;
33717              this.model.fonts.push(xml);
33718            }
33719
33720            return index;
33721          } // =========================================================================
33722          // Borders
33723
33724        }, {
33725          key: "_addBorder",
33726          value: function _addBorder(border) {
33727            var xml = this.map.border.toXml(border);
33728            var index = this.index.border[xml];
33729
33730            if (index === undefined) {
33731              index = this.index.border[xml] = this.model.borders.length;
33732              this.model.borders.push(xml);
33733            }
33734
33735            return index;
33736          } // =========================================================================
33737          // Fills
33738
33739        }, {
33740          key: "_addFill",
33741          value: function _addFill(fill) {
33742            var xml = this.map.fill.toXml(fill);
33743            var index = this.index.fill[xml];
33744
33745            if (index === undefined) {
33746              index = this.index.fill[xml] = this.model.fills.length;
33747              this.model.fills.push(xml);
33748            }
33749
33750            return index;
33751          } // =========================================================================
33752
33753        }]);
33754
33755        return StylesXform;
33756      }(BaseXform);
33757
33758      StylesXform.STYLESHEET_ATTRIBUTES = {
33759        xmlns: 'http://schemas.openxmlformats.org/spreadsheetml/2006/main',
33760        'xmlns:mc': 'http://schemas.openxmlformats.org/markup-compatibility/2006',
33761        'mc:Ignorable': 'x14ac x16r2',
33762        'xmlns:x14ac': 'http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac',
33763        'xmlns:x16r2': 'http://schemas.microsoft.com/office/spreadsheetml/2015/02/main'
33764      };
33765      StylesXform.STATIC_XFORMS = {
33766        cellStyles: new StaticXform({
33767          tag: 'cellStyles',
33768          $: {
33769            count: 1
33770          },
33771          c: [{
33772            tag: 'cellStyle',
33773            $: {
33774              name: 'Normal',
33775              xfId: 0,
33776              builtinId: 0
33777            }
33778          }]
33779        }),
33780        dxfs: new StaticXform({
33781          tag: 'dxfs',
33782          $: {
33783            count: 0
33784          }
33785        }),
33786        tableStyles: new StaticXform({
33787          tag: 'tableStyles',
33788          $: {
33789            count: 0,
33790            defaultTableStyle: 'TableStyleMedium2',
33791            defaultPivotStyle: 'PivotStyleLight16'
33792          }
33793        }),
33794        extLst: new StaticXform({
33795          tag: 'extLst',
33796          c: [{
33797            tag: 'ext',
33798            $: {
33799              uri: '{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}',
33800              'xmlns:x14': 'http://schemas.microsoft.com/office/spreadsheetml/2009/9/main'
33801            },
33802            c: [{
33803              tag: 'x14:slicerStyles',
33804              $: {
33805                defaultSlicerStyle: 'SlicerStyleLight1'
33806              }
33807            }]
33808          }, {
33809            tag: 'ext',
33810            $: {
33811              uri: '{9260A510-F301-46a8-8635-F512D64BE5F5}',
33812              'xmlns:x15': 'http://schemas.microsoft.com/office/spreadsheetml/2010/11/main'
33813            },
33814            c: [{
33815              tag: 'x15:timelineStyles',
33816              $: {
33817                defaultTimelineStyle: 'TimeSlicerStyleLight1'
33818              }
33819            }]
33820          }]
33821        })
33822      }; // the stylemanager mock acts like StyleManager except that it al
33822ways returns 0 or {}
33823
33824      var StylesXformMock = /*#__PURE__*/function (_StylesXform) {
33825        _inherits(StylesXformMock, _StylesXform);
33826
33827        var _super2 = _createSuper(StylesXformMock);
33828
33829        function StylesXformMock() {
33830          var _this3;
33831
33832          _classCallCheck(this, StylesXformMock);
33833
33834          _this3 = _super2.call(this);
33835          _this3.model = {
33836            styles: [{
33837              numFmtId: 0,
33838              fontId: 0,
33839              fillId: 0,
33840              borderId: 0,
33841              xfId: 0
33842            }],
33843            numFmts: [],
33844            fonts: [{
33845              size: 11,
33846              color: {
33847                theme: 1
33848              },
33849              name: 'Calibri',
33850              family: 2,
33851              scheme: 'minor'
33852            }],
33853            borders: [{}],
33854            fills: [{
33855              type: 'pattern',
33856              pattern: 'none'
33857            }, {
33858              type: 'pattern',
33859              pattern: 'gray125'
33860            }]
33861          };
33862          return _this3;
33863        } // =========================================================================
33864        // Style Manager Interface
33865        // override normal behaviour - consume and dispose
33866
33867
33868        _createClass(StylesXformMock, [{
33869          key: "parseStream",
33870          value: function parseStream(stream) {
33871            stream.autodrain();
33872            return Promise.resolve();
33873          } // add a cell's style model to the collection
33874          // each style property is processed and cross-referenced, etc.
33875          // the styleId is returned. Note: cellType is used when numFmt not defined
33876
33877        }, {
33878          key: "addStyleModel",
33879          value: function addStyleModel(model, cellType) {
33880            switch (cellType) {
33881              case Enums.ValueType.Date:
33882                return this.dateStyleId;
33883
33884              default:
33885                return 0;
33886            }
33887          }
33888        }, {
33889          key: "getStyleModel",
33890          // given a styleId (i.e. s="n"), get the cell's style model
33891          // objects are shared where possible.
33892          value: function getStyleModel()
33893          /* id */
33894          {
33895            return {};
33896          }
33897        }, {
33898          key: "dateStyleId",
33899          get: function get() {
33900            if (!this._dateStyleId) {
33901              var dateStyle = {
33902                numFmtId: NumFmtXform.getDefaultFmtId('mm-dd-yy')
33903              };
33904              this._dateStyleId = this.model.styles.length;
33905              this.model.styles.push(dateStyle);
33906            }
33907
33908            return this._dateStyleId;
33909          }
33910        }]);
33911
33912        return StylesXformMock;
33913      }(StylesXform);
33914
33915      StylesXform.Mock = StylesXformMock;
33916      module.exports = StylesXform;
33917    }, {
33918      "../../../doc/enums": 7,
33919      "../../../utils/xml-stream": 25,
33920      "../base-xform": 29,
33921      "../list-xform": 68,
33922      "../static-xform": 117,
33923      "./border-xform": 124,
33924      "./dxf-xform": 126,
33925      "./fill-xform": 127,
33926      "./font-xform": 128,
33927      "./numfmt-xform": 129,
33928      "./style-xform": 131
33929    }],
33930    133: [function (require, module, exports) {
33931      "use strict";
33932
33933      function _typeof(obj) {
33934        "@babel/helpers - typeof";
33935
33936        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
33937          _typeof = function _typeof(obj) {
33938            return typeof obj;
33939          };
33940        } else {
33941          _typeof = function _typeof(obj) {
33942            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
33943          };
33944        }
33945
33946        return _typeof(obj);
33947      }
33948
33949      function _classCallCheck(instance, Constructor) {
33950        if (!(instance instanceof Constructor)) {
33951          throw new TypeError("Cannot call a class as a function");
33952        }
33953      }
33954
33955      function _defineProperties(target, props) {
33956        for (var i = 0; i < props.length; i++) {
33957          var descriptor = props[i];
33958          descriptor.enumerable = descriptor.enumerable || false;
33959          descriptor.configurable = true;
33960          if ("value" in descriptor) descriptor.writable = true;
33961          Object.defineProperty(target, descriptor.key, descriptor);
33962        }
33963      }
33964
33965      function _createClass(Constructor, protoProps, staticProps) {
33966        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
33967        if (staticProps) _defineProperties(Constructor, staticProps);
33968        return Constructor;
33969      }
33970
33971      function _inherits(subClass, superClass) {
33972        if (typeof superClass !== "function" && superClass !== null) {
33973          throw new TypeError("Super expression must either be null or a function");
33974        }
33975
33976        subClass.prototype = Object.create(superClass && superClass.prototype, {
33977          constructor: {
33978            value: subClass,
33979            writable: true,
33980            configurable: true
33981          }
33982        });
33983        if (superClass) _setPrototypeOf(subClass, superClass);
33984      }
33985
33986      function _setPrototypeOf(o, p) {
33987        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
33988          o.__proto__ = p;
33989          return o;
33990        };
33991
33992        return _setPrototypeOf(o, p);
33993      }
33994
33995      function _createSuper(Derived) {
33996        return function () {
33997          var Super = _getPrototypeOf(Derived),
33998              result;
33999
34000          if (_isNativeReflectConstruct()) {
34001            var NewTarget = _getPrototypeOf(this).constructor;
34002
34003            result = Reflect.construct(Super, arguments, NewTarget);
34004          } else {
34005            result = Super.apply(this, arguments);
34006          }
34007
34008          return _possibleConstructorReturn(this, result);
34009        };
34010      }
34011
34012      function _possibleConstructorReturn(self, call) {
34013        if (call && (_typeof(call) === "object" || typeof call === "function")) {
34014          return call;
34015        }
34016
34017        return _assertThisInitialized(self);
34018      }
34019
34020      function _assertThisInitialized(self) {
34021        if (self === void 0) {
34022          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
34023        }
34024
34025        return self;
34026      }
34027
34028      function _isNativeReflectConstruct() {
34029        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
34030        if (Reflect.construct.sham) return false;
34031        if (typeof Proxy === "function") return true;
34032
34033        try {
34034          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
34035          return true;
34036        } catch (e) {
34037          return false;
34038        }
34039      }
34040
34041      function _getPrototypeOf(o) {
34042        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
34043          return o.__proto__ || Object.getPrototypeOf(o);
34044        };
34045        return _getPrototypeOf(o);
34046      }
34047
34048      var BaseXform = require('../base-xform');
34049
34050      var UnderlineXform = /*#__PURE__*/function (_BaseXform) {
34051        _inherits(UnderlineXform, _BaseXform);
34052
34053        var _super = _createSuper(UnderlineXform);
34054
34055        function UnderlineXform(model) {
34056          var _this;
34057
34058          _classCallCheck(this, UnderlineXform);
34059
34060          _this = _super.call(this);
34061          _this.model = model;
34062          return _this;
34063        }
34064
34065        _createClass(UnderlineXform, [{
34066          key: "render",
34067          value: function render(xmlStream, model) {
34068            model = model || this.model;
34069
34070            if (model === true) {
34071              xmlStream.leafNode('u');
34072            } else {
34073              var attr = UnderlineXform.Attributes[model];
34074
34075              if (attr) {
34076                xmlStream.leafNode('u', attr);
34077              }
34078            }
34079          }
34080        }, {
34081          key: "parseOpen",
34082          value: function parseOpen(node) {
34083            if (node.name === 'u') {
34084              this.model = node.attributes.val || true;
34085            }
34086          }
34087        }, {
34088          key: "parseText",
34089          value: function parseText() {}
34090        }, {
34091          key: "parseClose",
34092          value: function parseClose() {
34093            return false;
34094          }
34095        }, {
34096          key: "tag",
34097          get: function get() {
34098            return 'u';
34099          }
34100        }]);
34101
34102        return UnderlineXform;
34103      }(BaseXform);
34104
34105      UnderlineXform.Attributes = {
34106        single: {},
34107        double: {
34108          val: 'double'
34109        },
34110        singleAccounting: {
34111          val: 'singleAccounting'
34112        },
34113        doubleAccounting: {
34114          val: 'doubleAccounting'
34115        }
34116      };
34117      module.exports = UnderlineXform;
34118    }, {
34119      "../base-xform": 29
34120    }],
34121    134: [function (require, module, exports) {
34122      "use strict";
34123
34124      function _typeof(obj) {
34125        "@babel/helpers - typeof";
34126
34127        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
34128          _typeof = function _typeof(obj) {
34129            return typeof obj;
34130          };
34131        } else {
34132          _typeof = function _typeof(obj) {
34133            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
34134          };
34135        }
34136
34137        return _typeof(obj);
34138      }
34139
34140      function _classCallCheck(instance, Constructor) {
34141        if (!(instance instanceof Constructor)) {
34142          throw new TypeError("Cannot call a class as a function");
34143        }
34144      }
34145
34146      function _defineProperties(target, props) {
34147        for (var i = 0; i < props.length; i++) {
34148          var descriptor = props[i];
34149          descriptor.enumerable = descriptor.enumerable || false;
34150          descriptor.configurable = true;
34151          if ("value" in descriptor) descriptor.writable = true;
34152          Object.defineProperty(target, descriptor.key, descriptor);
34153        }
34154      }
34155
34156      function _createClass(Constructor, protoProps, staticProps) {
34157        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
34158        if (staticProps) _defineProperties(Constructor, staticProps);
34159        return Constructor;
34160      }
34161
34162      function _inherits(subClass, superClass) {
34163        if (typeof superClass !== "function" && superClass !== null) {
34164          throw new TypeError("Super expression must either be null or a function");
34165        }
34166
34167        subClass.prototype = Object.create(superClass && superClass.prototype, {
34168          constructor: {
34169            value: subClass,
34170            writable: true,
34171            configurable: true
34172          }
34173        });
34174        if (superClass) _setPrototypeOf(subClass, superClass);
34175      }
34176
34177      function _setPrototypeOf(o, p) {
34178        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
34179          o.__proto__ = p;
34180          return o;
34181        };
34182
34183        return _setPrototypeOf(o, p);
34184      }
34185
34186      function _createSuper(Derived) {
34187        return function () {
34188          var Super = _getPrototypeOf(Derived),
34189              result;
34190
34191          if (_isNativeReflectConstruct()) {
34192            var NewTarget = _getPrototypeOf(this).constructor;
34193
34194            result = Reflect.construct(Super, arguments, NewTarget);
34195          } else {
34196            result = Super.apply(this, arguments);
34197          }
34198
34199          return _possibleConstructorReturn(this, result);
34200        };
34201      }
34202
34203      function _possibleConstructorReturn(self, call) {
34204        if (call && (_typeof(call) === "object" || typeof call === "function")) {
34205          return call;
34206        }
34207
34208        return _assertThisInitialized(self);
34209      }
34210
34211      function _assertThisInitialized(self) {
34212        if (self === void 0) {
34213          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
34214        }
34215
34216        return self;
34217      }
34218
34219      function _isNativeReflectConstruct() {
34220        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
34221        if (Reflect.construct.sham) return false;
34222        if (typeof Proxy === "function") return true;
34223
34224        try {
34225          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
34226          return true;
34227        } catch (e) {
34228          return false;
34229        }
34230      }
34231
34232      function _getPrototypeOf(o) {
34233        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
34234          return o.__proto__ || Object.getPrototypeOf(o);
34235        };
34236        return _getPrototypeOf(o);
34237      }
34238
34239      var BaseXform = require('../base-xform');
34240
34241      var FilterColumnXform = require('./filter-column-xform');
34242
34243      var AutoFilterXform = /*#__PURE__*/function (_BaseXform) {
34244        _inherits(AutoFilterXform, _BaseXform);
34245
34246        var _super = _createSuper(AutoFilterXform);
34247
34248        function AutoFilterXform() {
34249          var _this;
34250
34251          _classCallCheck(this, AutoFilterXform);
34252
34253          _this = _super.call(this);
34254          _this.map = {
34255            filterColumn: new FilterColumnXform()
34256          };
34257          return _this;
34258        }
34259
34260        _createClass(AutoFilterXform, [{
34261          key: "prepare",
34262          value: function prepare(model) {
34263            var _this2 = this;
34264
34265            model.columns.forEach(function (column, index) {
34266              _this2.map.filterColumn.prepare(column, {
34267                index: index
34268              });
34269            });
34270          }
34271        }, {
34272          key: "render",
34273          value: function render(xmlStream, model) {
34274            var _this3 = this;
34275
34276            xmlStream.openNode(this.tag, {
34277              ref: model.autoFilterRef
34278            });
34279            model.columns.forEach(function (column) {
34280              _this3.map.filterColumn.render(xmlStream, column);
34281            });
34282            xmlStream.closeNode();
34283            return true;
34284          }
34285        }, {
34286          key: "parseOpen",
34287          value: function parseOpen(node) {
34288            if (this.parser) {
34289              this.parser.parseOpen(node);
34290              return true;
34291            }
34292
34293            switch (node.name) {
34294              case this.tag:
34295                this.model = {
34296                  autoFilterRef: node.attributes.ref,
34297                  columns: []
34298                };
34299                return true;
34300
34301              default:
34302                this.parser = this.map[node.name];
34303
34304                if (this.parser) {
34305                  this.parseOpen(node);
34306                  return true;
34307                }
34308
34309                throw new Error("Unexpected xml node in parseOpen: ".concat(JSON.stringify(node)));
34310            }
34311          }
34312        }, {
34313          key: "parseText",
34314          value: function parseText(text) {
34315            if (this.parser) {
34316              this.parser.parseText(text);
34317            }
34318          }
34319        }, {
34320          key: "parseClose",
34321          value: function parseClose(name) {
34322            if (this.parser) {
34323              if (!this.parser.parseClose(name)) {
34324                this.model.columns.push(this.parser.model);
34325                this.parser = undefined;
34326              }
34327
34328              return true;
34329            }
34330
34331            switch (name) {
34332              case this.tag:
34333                return false;
34334
34335              default:
34336                throw new Error("Unexpected xml node in parseClose: ".concat(name));
34337            }
34338          }
34339        }, {
34340          key: "tag",
34341          get: function get() {
34342            return 'autoFilter';
34343          }
34344        }]);
34345
34346        return AutoFilterXform;
34347      }(BaseXform);
34348
34349      module.exports = AutoFilterXform;
34350    }, {
34351      "../base-xform": 29,
34352      "./filter-column-xform": 135
34353    }],
34354    135: [function (require, module, exports) {
34355      "use strict";
34356
34357      function _typeof(obj) {
34358        "@babel/helpers - typeof";
34359
34360        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
34361          _typeof = function _typeof(obj) {
34362            return typeof obj;
34363          };
34364        } else {
34365          _typeof = function _typeof(obj) {
34366            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
34367          };
34368        }
34369
34370        return _typeof(obj);
34371      }
34372
34373      function _classCallCheck(instance, Constructor) {
34374        if (!(instance instanceof Constructor)) {
34375          throw new TypeError("Cannot call a class as a function");
34376        }
34377      }
34378
34379      function _defineProperties(target, props) {
34380        for (var i = 0; i < props.length; i++) {
34381          var descriptor = props[i];
34382          descriptor.enumerable = descriptor.enumerable || false;
34383          descriptor.configurable = true;
34384          if ("value" in descriptor) descriptor.writable = true;
34385          Object.defineProperty(target, descriptor.key, descriptor);
34386        }
34387      }
34388
34389      function _createClass(Constructor, protoProps, staticProps) {
34390        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
34391        if (staticProps) _defineProperties(Constructor, staticProps);
34392        return Constructor;
34393      }
34394
34395      function _inherits(subClass, superClass) {
34396        if (typeof superClass !== "function" && superClass !== null) {
34397          throw new TypeError("Super expression must either be null or a function");
34398        }
34399
34400        subClass.prototype = Object.create(superClass && superClass.prototype, {
34401          constructor: {
34402            value: subClass,
34403            writable: true,
34404            configurable: true
34405          }
34406        });
34407        if (superClass) _setPrototypeOf(subClass, superClass);
34408      }
34409
34410      function _setPrototypeOf(o, p) {
34411        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
34412          o.__proto__ = p;
34413          return o;
34414        };
34415
34416        return _setPrototypeOf(o, p);
34417      }
34418
34419      function _createSuper(Derived) {
34420        return function () {
34421          var Super = _getPrototypeOf(Derived),
34422              result;
34423
34424          if (_isNativeReflectConstruct()) {
34425            var NewTarget = _getPrototypeOf(this).constructor;
34426
34427            result = Reflect.construct(Super, arguments, NewTarget);
34428          } else {
34429            result = Super.apply(this, arguments);
34430          }
34431
34432          return _possibleConstructorReturn(this, result);
34433        };
34434      }
34435
34436      function _possibleConstructorReturn(self, call) {
34437        if (call && (_typeof(call) === "object" || typeof call === "function")) {
34438          return call;
34439        }
34440
34441        return _assertThisInitialized(self);
34442      }
34443
34444      function _assertThisInitialized(self) {
34445        if (self === void 0) {
34446          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
34447        }
34448
34449        return self;
34450      }
34451
34452      function _isNativeReflectConstruct() {
34453        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
34454        if (Reflect.construct.sham) return false;
34455        if (typeof Proxy === "function") return true;
34456
34457        try {
34458          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
34459          return true;
34460        } catch (e) {
34461          return false;
34462        }
34463      }
34464
34465      function _getPrototypeOf(o) {
34466        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
34467          return o.__proto__ || Object.getPrototypeOf(o);
34468        };
34469        return _getPrototypeOf(o);
34470      }
34471
34472      var BaseXform = require('../base-xform');
34473
34474      var FilterColumnXform = /*#__PURE__*/function (_BaseXform) {
34475        _inherits(FilterColumnXform, _BaseXform);
34476
34477        var _super = _createSuper(FilterColumnXform);
34478
34479        function FilterColumnXform() {
34480          _classCallCheck(this, FilterColumnXform);
34481
34482          return _super.apply(this, arguments);
34483        }
34484
34485        _createClass(FilterColumnXform, [{
34486          key: "prepare",
34487          value: function prepare(model, options) {
34488            model.colId = options.index.toString();
34489          }
34490        }, {
34491          key: "render",
34492          value: function render(xmlStream, model) {
34493            xmlStream.leafNode(this.tag, {
34494              colId: model.colId,
34495              hiddenButton: model.filterButton ? '0' : '1'
34496            });
34497            return true;
34498          }
34499        }, {
34500          key: "parseOpen",
34501          value: function parseOpen(node) {
34502            if (node.name === this.tag) {
34503              var attributes = node.attributes;
34504              this.model = {
34505                filterButton: attributes.hiddenButton === '0'
34506              };
34507              return true;
34508            }
34509
34510            return false;
34511          }
34512        }, {
34513          key: "parseText",
34514          value: function parseText() {}
34515        }, {
34516          key: "parseClose",
34517          value: function parseClose() {
34518            return false;
34519          }
34520        }, {
34521          key: "tag",
34522          get: function get() {
34523            return 'filterColumn';
34524          }
34525        }]);
34526
34527        return FilterColumnXform;
34528      }(BaseXform);
34529
34530      module.exports = FilterColumnXform;
34531    }, {
34532      "../base-xform": 29
34533    }],
34534    136: [function (require, module, exports) {
34535      "use strict";
34536
34537      function _typeof(obj) {
34538        "@babel/helpers - typeof";
34539
34540        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
34541          _typeof = function _typeof(obj) {
34542            return typeof obj;
34543          };
34544        } else {
34545          _typeof = function _typeof(obj) {
34546            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
34547          };
34548        }
34549
34550        return _typeof(obj);
34551      }
34552
34553      function _classCallCheck(instance, Constructor) {
34554        if (!(instance instanceof Constructor)) {
34555          throw new TypeError("Cannot call a class as a function");
34556        }
34557      }
34558
34559      function _defineProperties(target, props) {
34560        for (var i = 0; i < props.length; i++) {
34561          var descriptor = props[i];
34562          descriptor.enumerable = descriptor.enumerable || false;
34563          descriptor.configurable = true;
34564          if ("value" in descriptor) descriptor.writable = true;
34565          Object.defineProperty(target, descriptor.key, descriptor);
34566        }
34567      }
34568
34569      function _createClass(Constructor, protoProps, staticProps) {
34570        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
34571        if (staticProps) _defineProperties(Constructor, staticProps);
34572        return Constructor;
34573      }
34574
34575      function _inherits(subClass, superClass) {
34576        if (typeof superClass !== "function" && superClass !== null) {
34577          throw new TypeError("Super expression must either be null or a function");
34578        }
34579
34580        subClass.prototype = Object.create(superClass && superClass.prototype, {
34581          constructor: {
34582            value: subClass,
34583            writable: true,
34584            configurable: true
34585          }
34586        });
34587        if (superClass) _setPrototypeOf(subClass, superClass);
34588      }
34589
34590      function _setPrototypeOf(o, p) {
34591        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
34592          o.__proto__ = p;
34593          return o;
34594        };
34595
34596        return _setPrototypeOf(o, p);
34597      }
34598
34599      function _createSuper(Derived) {
34600        return function () {
34601          var Super = _getPrototypeOf(Derived),
34602              result;
34603
34604          if (_isNativeReflectConstruct()) {
34605            var NewTarget = _getPrototypeOf(this).constructor;
34606
34607            result = Reflect.construct(Super, arguments, NewTarget);
34608          } else {
34609            result = Super.apply(this, arguments);
34610          }
34611
34612          return _possibleConstructorReturn(this, result);
34613        };
34614      }
34615
34616      function _possibleConstructorReturn(self, call) {
34617        if (call && (_typeof(call) === "object" || typeof call === "function")) {
34618          return call;
34619        }
34620
34621        return _assertThisInitialized(self);
34622      }
34623
34624      function _assertThisInitialized(self) {
34625        if (self === void 0) {
34626          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
34627        }
34628
34629        return self;
34630      }
34631
34632      function _isNativeReflectConstruct() {
34633        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
34634        if (Reflect.construct.sham) return false;
34635        if (typeof Proxy === "function") return true;
34636
34637        try {
34638          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
34639          return true;
34640        } catch (e) {
34641          return false;
34642        }
34643      }
34644
34645      function _getPrototypeOf(o) {
34646        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
34647          return o.__proto__ || Object.getPrototypeOf(o);
34648        };
34649        return _getPrototypeOf(o);
34650      }
34651
34652      var BaseXform = require('../base-xform');
34653
34654      var TableColumnXform = /*#__PURE__*/function (_BaseXform) {
34655        _inherits(TableColumnXform, _BaseXform);
34656
34657        var _super = _createSuper(TableColumnXform);
34658
34659        function TableColumnXform() {
34660          _classCallCheck(this, TableColumnXform);
34661
34662          return _super.apply(this, arguments);
34663        }
34664
34665        _createClass(TableColumnXform, [{
34666          key: "prepare",
34667          value: function prepare(model, options) {
34668            model.id = options.index + 1;
34669          }
34670        }, {
34671          key: "render",
34672          value: function render(xmlStream, model) {
34673            xmlStream.leafNode(this.tag, {
34674              id: model.id.toString(),
34675              name: model.name,
34676              totalsRowLabel: model.totalsRowLabel,
34677              totalsRowFunction: model.totalsRowFunction,
34678              dxfId: model.dxfId
34679            });
34680            return true;
34681          }
34682        }, {
34683          key: "parseOpen",
34684          value: function parseOpen(node) {
34685            if (node.name === this.tag) {
34686              var attributes = node.attributes;
34687              this.model = {
34688                name: attributes.name,
34689                totalsRowLabel: attributes.totalsRowLabel,
34690                totalsRowFunction: attributes.totalsRowFunction,
34691                dxfId: attributes.dxfId
34692              };
34693              return true;
34694            }
34695
34696            return false;
34697          }
34698        }, {
34699          key: "parseText",
34700          value: function parseText() {}
34701        }, {
34702          key: "parseClose",
34703          value: function parseClose() {
34704            return false;
34705          }
34706        }, {
34707          key: "tag",
34708          get: function get() {
34709            return 'tableColumn';
34710          }
34711        }]);
34712
34713        return TableColumnXform;
34714      }(BaseXform);
34715
34716      module.exports = TableColumnXform;
34717    }, {
34718      "../base-xform": 29
34719    }],
34720    137: [function (require, module, exports) {
34721      "use strict";
34722
34723      function _typeof(obj) {
34724        "@babel/helpers - typeof";
34725
34726        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
34727          _typeof = function _typeof(obj) {
34728            return typeof obj;
34729          };
34730        } else {
34731          _typeof = function _typeof(obj) {
34732            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
34733          };
34734        }
34735
34736        return _typeof(obj);
34737      }
34738
34739      function _classCallCheck(instance, Constructor) {
34740        if (!(instance instanceof Constructor)) {
34741          throw new TypeError("Cannot call a class as a function");
34742        }
34743      }
34744
34745      function _defineProperties(target, props) {
34746        for (var i = 0; i < props.length; i++) {
34747          var descriptor = props[i];
34748          descriptor.enumerable = descriptor.enumerable || false;
34749          descriptor.configurable = true;
34750          if ("value" in descriptor) descriptor.writable = true;
34751          Object.defineProperty(target, descriptor.key, descriptor);
34752        }
34753      }
34754
34755      function _createClass(Constructor, protoProps, staticProps) {
34756        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
34757        if (staticProps) _defineProperties(Constructor, staticProps);
34758        return Constructor;
34759      }
34760
34761      function _inherits(subClass, superClass) {
34762        if (typeof superClass !== "function" && superClass !== null) {
34763          throw new TypeError("Super expression must either be null or a function");
34764        }
34765
34766        subClass.prototype = Object.create(superClass && superClass.prototype, {
34767          constructor: {
34768            value: subClass,
34769            writable: true,
34770            configurable: true
34771          }
34772        });
34773        if (superClass) _setPrototypeOf(subClass, superClass);
34774      }
34775
34776      function _setPrototypeOf(o, p) {
34777        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
34778          o.__proto__ = p;
34779          return o;
34780        };
34781
34782        return _setPrototypeOf(o, p);
34783      }
34784
34785      function _createSuper(Derived) {
34786        return function () {
34787          var Super = _getPrototypeOf(Derived),
34788              result;
34789
34790          if (_isNativeReflectConstruct()) {
34791            var NewTarget = _getPrototypeOf(this).constructor;
34792
34793            result = Reflect.construct(Super, arguments, NewTarget);
34794          } else {
34795            result = Super.apply(this, arguments);
34796          }
34797
34798          return _possibleConstructorReturn(this, result);
34799        };
34800      }
34801
34802      function _possibleConstructorReturn(self, call) {
34803        if (call && (_typeof(call) === "object" || typeof call === "function")) {
34804          return call;
34805        }
34806
34807        return _assertThisInitialized(self);
34808      }
34809
34810      function _assertThisInitialized(self) {
34811        if (self === void 0) {
34812          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
34813        }
34814
34815        return self;
34816      }
34817
34818      function _isNativeReflectConstruct() {
34819        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
34820        if (Reflect.construct.sham) return false;
34821        if (typeof Proxy === "function") return true;
34822
34823        try {
34824          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
34825          return true;
34826        } catch (e) {
34827          return false;
34828        }
34829      }
34830
34831      function _getPrototypeOf(o) {
34832        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
34833          return o.__proto__ || Object.getPrototypeOf(o);
34834        };
34835        return _getPrototypeOf(o);
34836      }
34837
34838      var BaseXform = require('../base-xform');
34839
34840      var TableStyleInfoXform = /*#__PURE__*/function (_BaseXform) {
34841        _inherits(TableStyleInfoXform, _BaseXform);
34842
34843        var _super = _createSuper(TableStyleInfoXform);
34844
34845        function TableStyleInfoXform() {
34846          _classCallCheck(this, TableStyleInfoXform);
34847
34848          return _super.apply(this, arguments);
34849        }
34850
34851        _createClass(TableStyleInfoXform, [{
34852          key: "render",
34853          value: function render(xmlStream, model) {
34854            xmlStream.leafNode(this.tag, {
34855              name: model.theme ? model.theme : undefined,
34856              showFirstColumn: model.showFirstColumn ? '1' : '0',
34857              showLastColumn: model.showLastColumn ? '1' : '0',
34858              showRowStripes: model.showRowStripes ? '1' : '0',
34859              showColumnStripes: model.showColumnStripes ? '1' : '0'
34860            });
34861            return true;
34862          }
34863        }, {
34864          key: "parseOpen",
34865          value: function parseOpen(node) {
34866            if (node.name === this.tag) {
34867              var attributes = node.attributes;
34868              this.model = {
34869                theme: attributes.name ? attributes.name : null,
34870                showFirstColumn: attributes.showFirstColumn === '1',
34871                showLastColumn: attributes.showLastColumn === '1',
34872                showRowStripes: attributes.showRowStripes === '1',
34873                showColumnStripes: attributes.showColumnStripes === '1'
34874              };
34875              return true;
34876            }
34877
34878            return false;
34879          }
34880        }, {
34881          key: "parseText",
34882          value: function parseText() {}
34883        }, {
34884          key: "parseClose",
34885          value: function parseClose() {
34886            return false;
34887          }
34888        }, {
34889          key: "tag",
34890          get: function get() {
34891            return 'tableStyleInfo';
34892          }
34893        }]);
34894
34895        return TableStyleInfoXform;
34896      }(BaseXform);
34897
34898      module.exports = TableStyleInfoXform;
34899    }, {
34900      "../base-xform": 29
34901    }],
34902    138: [function (require, module, exports) {
34903      "use strict";
34904
34905      function _typeof(obj) {
34906        "@babel/helpers - typeof";
34907
34908        if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
34909          _typeof = function _typeof(obj) {
34910            return typeof obj;
34911          };
34912        } else {
34913          _typeof = function _typeof(obj) {
34914            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
34915          };
34916        }
34917
34918        return _typeof(obj);
34919      }
34920
34921      function ownKeys(object, enumerableOnly) {
34922        var keys = Object.keys(object);
34923
34924        if (Object.getOwnPropertySymbols) {
34925          var symbols = Object.getOwnPropertySymbols(object);
34926          if (enumerableOnly) symbols = symbols.filter(function (sym) {
34927            return Object.getOwnPropertyDescriptor(object, sym).enumerable;
34928          });
34929          keys.push.apply(keys, symbols);
34930        }
34931
34932        return keys;
34933      }
34934
34935      function _objectSpread(target) {
34936        for (var i = 1; i < arguments.length; i++) {
34937          var source = arguments[i] != null ? arguments[i] : {};
34938
34939          if (i % 2) {
34940            ownKeys(Object(source), true).forEach(function (key) {
34941              _defineProperty(target, key, source[key]);
34942            });
34943          } else if (Object.getOwnPropertyDescriptors) {
34944            Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
34945          } else {
34946            ownKeys(Object(source)).forEach(function (key) {
34947              Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
34948            });
34949          }
34950        }
34951
34952        return target;
34953      }
34954
34955      function _defineProperty(obj, key, value) {
34956        if (key in obj) {
34957          Object.defineProperty(obj, key, {
34958            value: value,
34959            enumerable: true,
34960            configurable: true,
34961            writable: true
34962          });
34963        } else {
34964          obj[key] = value;
34965        }
34966
34967        return obj;
34968      }
34969
34970      function _classCallCheck(instance, Constructor) {
34971        if (!(instance instanceof Constructor)) {
34972          throw new TypeError("Cannot call a class as a function");
34973        }
34974      }
34975
34976      function _defineProperties(target, props) {
34977        for (var i = 0; i < props.length; i++) {
34978          var descriptor = props[i];
34979          descriptor.enumerable = descriptor.enumerable || false;
34980          descriptor.configurable = true;
34981          if ("value" in descriptor) descriptor.writable = true;
34982          Object.defineProperty(target, descriptor.key, descriptor);
34983        }
34984      }
34985
34986      function _createClass(Constructor, protoProps, staticProps) {
34987        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
34988        if (staticProps) _defineProperties(Constructor, staticProps);
34989        return Constructor;
34990      }
34991
34992      function _inherits(subClass, superClass) {
34993        if (typeof superClass !== "function" && superClass !== null) {
34994          throw new TypeError("Super expression must either be null or a function");
34995        }
34996
34997        subClass.prototype = Object.create(superClass && superClass.prototype, {
34998          constructor: {
34999            value: subClass,
35000            writable: true,
35001            configurable: true
35002          }
35003        });
35004        if (superClass) _setPrototypeOf(subClass, superClass);
35005      }
35006
35007      function _setPrototypeOf(o, p) {
35008        _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
35009          o.__proto__ = p;
35010          return o;
35011        };
35012
35013        return _setPrototypeOf(o, p);
35014      }
35015
35016      function _createSuper(Derived) {
35017        return function () {
35018          var Super = _getPrototypeOf(Derived),
35019              result;
35020
35021          if (_isNativeReflectConstruct()) {
35022            var NewTarget = _getPrototypeOf(this).constructor;
35023
35024            result = Reflect.construct(Super, arguments, NewTarget);
35025          } else {
35026            result = Super.apply(this, arguments);
35027          }
35028
35029          return _possibleConstructorReturn(this, result);
35030        };
35031      }
35032
35033      function _possibleConstructorReturn(self, call) {
35034        if (call && (_typeof(call) === "object" || typeof call === "function")) {
35035          return call;
35036        }
35037
35038        return _assertThisInitialized(self);
35039      }
35040
35041      function _assertThisInitialized(self) {
35042        if (self === void 0) {
35043          throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
35044        }
35045
35046        return self;
35047      }
35048
35049      function _isNativeReflectConstruct() {
35050        if (typeof Reflect === "undefined" || !Reflect.construct) return false;
35051        if (Reflect.construct.sham) return false;
35052        if (typeof Proxy === "function") return true;
35053
35054        try {
35055          Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
35056          return true;
35057        } catch (e) {
35058          return false;
35059        }
35060      }
35061
35062      function _getPrototypeOf(o) {
35063        _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
35064          return o.__proto__ || Object.getPrototypeOf(o);
35065        };
35066        return _getPrototypeOf(o);
35067      }
35068
35069      var XmlStream = require('../../../utils/xml-stream');
35070
35071      var BaseXform = require('../base-xform');
35072
35073      var ListXform = require('../list-xform');
35074
35075      var AutoFilterXform = require('./auto-filter-xform');
35076
35077      var TableColumnXform = require('./table-column-xform');
35078
35079      var TableStyleInfoXform = require('./table-style-info-xform');
35080
35081      var TableXform = /*#__PURE__*/function (_BaseXform) {
35082        _inherits(TableXform, _BaseXform);
35083
35084        var _super = _createSuper(TableXform);
35085
35086        function TableXform() {
35087          var _this;
35088
35089          _classCallCheck(this, TableXform);
35090
35091          _this = _super.call(this);
35092          _this.map = {
35093            autoFilter: new AutoFilterXform(),
35094            tableColumns: new ListXform({
35095              tag: 'tableColumns',
35096              count: true,
35097              empty: true,
35098              childXform: new TableColumnXform()
35099            }),
35100            tableStyleInfo: new TableStyleInfoXform()
35101          };
35102          return _this;
35103        }
35104
35105        _createClass(TableXform, [{
35106          key: "prepare",
35107          value: function prepare(model, options) {
35108            this.map.autoFilter.prepare(model);
35109            this.map.tableColumns.prepare(model.columns, options);
35110          }
35111        }, {
35112          key: "render",
35113          value: function render(xmlStream, model) {
35114            xmlStream.openXml(XmlStream.StdDocAttributes);
35115            xmlStream.openNode(this.tag, _objectSpread(_objectSpread({}, TableXform.TABLE_ATTRIBUTES), {}, {
35116              id: model.id,
35117              name: model.name,
35118              displayName: model.displayName || model.name,
35119              ref: model.tableRef,
35120              totalsRowCount: model.totalsRow ? '1' : undefined,
35121              totalsRowShown: model.totalsRow ? undefined : '1',
35122              headerRowCount: model.headerRow ? '1' : '0'
35123            }));
35124            this.map.autoFilter.render(xmlStream, model);
35125            this.map.tableColumns.render(xmlStream, model.columns);
35126            this.map.tableStyleInfo.render(xmlStream, model.style);
35127            xmlStream.closeNode();
35128          }
35129        }, {
35130          key: "parseOpen",
35131          value: function parseOpen(node) {
35132            if (this.parser) {
35133              this.parser.parseOpen(node);
35134              return true;
35135            }
35136
35137            var name = node.name,
35138                attributes = node.attributes;
35139
35140            switch (name) {
35141              case this.tag:
35142                this.reset();
35143                this.model = {
35144                  name: attributes.name,
35145                  displayName: attributes.displayName || attributes.name,
35146                  tableRef: attributes.ref,
35147                  totalsRow: attributes.totalsRowCount === '1',
35148                  headerRow: attributes.headerRowCount === '1'
35149                };
35150                break;
35151
35152              default:
35153                this.parser = this.map[node.name];
35154
35155                if (this.parser) {
35156                  this.parser.parseOpen(node);
35157                }
35158
35159                break;
35160            }
35161
35162            return true;
35163          }
35164        }, {
35165          key: "parseText",
35166          value: function parseText(text) {
35167            if (this.parser) {
35168              this.parser.parseText(text);
35169            }
35170          }
35171        }, {
35172          key: "parseClose",
35173          value: function parseClose(name) {
35174            var _this2 = this;
35175
35176            if (this.parser) {
35177              if (!this.parser.parseClose(name)) {
35178                this.parser = undefined;
35179              }
35180
35181              return true;
35182            }
35183
35184            switch (name) {
35185              case this.tag:
35186                this.model.columns = this.map.tableColumns.model;
35187
35188                if (this.map.autoFilter.model) {
35189                  this.model.autoFilterRef = this.map.autoFilter.model.autoFilterRef;
35190                  this.map.autoFilter.model.columns.forEach(function (column, index) {
35191                    _this2.model.columns[index].filterButton = column.filterButton;
35192                  });
35193                }
35194
35195                this.model.style = this.map.tableStyleInfo.model;
35196                return false;
35197
35198              default:
35199                // could be some unrecognised tags
35200                return true;
35201            }
35202          }
35203        }, {
35204          key: "reconcile",
35205          value: function reconcile(model, options) {
35206            // fetch the dfxs from styles
35207            model.columns.forEach(function (column) {
35208              if (column.dxfId !== undefined) {
35209                column.style = options.styles.getDxfStyle(column.dxfId);
35210              }
35211            });
35212          }
35213        }, {
35214          key: "tag",
35215          get: function get() {
35216            return 'table';
35217          }
35218        }]);
35219
35220        return TableXform;
35221      }(BaseXform);
35222
35223      TableXform.TABLE_ATTRIBUTES = {
35224        xmlns: 'http://schemas.openxmlformats.org/spreadsheetml/2006/main',
35225        'xmlns:mc': 'http://schemas.openxmlformats.org/markup-compatibility/2006',
35226        'mc:Ignorable': 'xr xr3',
35227        'xmlns:xr': 'http://schemas.microsoft.com/office/spreadsheetml/2014/revision',
35228        'xmlns:xr3': 'http://schemas.microsoft.com/office/spreadsheetml/2016/revision3' // 'xr:uid': '{00000000-000C-0000-FFFF-FFFF00000000}',
35229
35230      };
35231      module.exports = TableXform;
35232    }, {
35233      "../../../utils/xml-stream": 25,
35234      "../base-xform": 29,
35235      "../list-xform": 68,
35236      "./auto-filter-xform": 134,
35237      "./table-column-xform": 136,
35238      "./table-style-info-xform": 137
35239    }],
35240    139: [function (require, module, exports) {
35241      (function (Buffer) {
35242        "use strict";
35243
35244        function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
35245          try {
35246            var info = gen[key](arg);
35247            var value = info.value;
35248          } catch (error) {
35249            reject(error);
35250            return;
35251          }
35252
35253          if (info.done) {
35254            resolve(value);
35255          } else {
35256            Promise.resolve(value).then(_next, _throw);
35257          }
35258        }
35259
35260        function _asyncToGenerator(fn) {
35261          return function () {
35262            var self = this,
35263                args = arguments;
35264            return new Promise(function (resolve, reject) {
35265              var gen = fn.apply(self, args);
35266
35267              function _next(value) {
35268                asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
35269              }
35270
35271              function _throw(err) {
35272                asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
35273              }
35274
35275              _next(undefined);
35276            });
35277          };
35278        }
35279
35280        function _classCallCheck(instance, Constructor) {
35281          if (!(instance instanceof Constructor)) {
35282            throw new TypeError("Cannot call a class as a function");
35283          }
35284        }
35285
35286        function _defineProperties(target, props) {
35287          for (var i = 0; i < props.length; i++) {
35288            var descriptor = props[i];
35289            descriptor.enumerable = descriptor.enumerable || false;
35290            descriptor.configurable = true;
35291            if ("value" in descriptor) descriptor.writable = true;
35292            Object.defineProperty(target, descriptor.key, descriptor);
35293          }
35294        }
35295
35296        function _createClass(Constructor, protoProps, staticProps) {
35297          if (protoProps) _defineProperties(Constructor.prototype, protoProps);
35298          if (staticProps) _defineProperties(Constructor, staticProps);
35299          return Constructor;
35300        }
35301
35302        function _asyncIterator(iterable) {
35303          var method;
35304
35305          if (typeof Symbol !== "undefined") {
35306            if (Symbol.asyncIterator) {
35307              method = iterable[Symbol.asyncIterator];
35308              if (method != null) return method.call(iterable);
35309            }
35310
35311            if (Symbol.iterator) {
35312              method = iterable[Symbol.iterator];
35313              if (method != null) return method.call(iterable);
35314            }
35315          }
35316
35317          throw new TypeError("Object is not async iterable");
35318        }
35319
35320        var fs = require('fs');
35321
35322        var JSZip = require('jszip');
35323
35324        var _require = require('readable-stream'),
35325            PassThrough = _require.PassThrough;
35326
35327        var ZipStream = require('../utils/zip-stream');
35328
35329        var StreamBuf = require('../utils/stream-buf');
35330
35331        var utils = require('../utils/utils');
35332
35333        var XmlStream = require('../utils/xml-stream');
35334
35335        var StylesXform = require('./xform/style/styles-xform');
35336
35337        var CoreXform = require('./xform/core/core-xform');
35338
35339        var SharedStringsXform = require('./xform/strings/shared-strings-xform');
35340
35341        var RelationshipsXform = require('./xform/core/relationships-xform');
35342
35343        var ContentTypesXform = require('./xform/core/content-types-xform');
35344
35345        var AppXform = require('./xform/core/app-xform');
35346
35347        var WorkbookXform = require('./xform/book/workbook-xform');
35348
35349        var WorksheetXform = require('./xform/sheet/worksheet-xform');
35350
35351        var DrawingXform = require('./xform/drawing/drawing-xform');
35352
35353        var TableXform = require('./xform/table/table-xform');
35354
35355        var CommentsXform = require('./xform/comment/comments-xform');
35356
35357        var VmlNotesXform = require('./xform/comment/vml-notes-xform');
35358
35359        var theme1Xml = require('./xml/theme1.js');
35360
35361        function fsReadFileAsync(filename, options) {
35362          return new Promise(function (resolve, reject) {
35363            fs.readFile(filename, options, function (error, data) {
35364              if (error) {
35365                reject(error);
35366              } else {
35367                resolve(data);
35368              }
35369            });
35370          });
35371        }
35372
35373        var XLSX = /*#__PURE__*/function () {
35374          function XLSX(workbook) {
35375            _classCallCheck(this, XLSX);
35376
35377            this.workbook = workbook;
35378          } // ===============================================================================
35379          // Workbook
35380          // =========================================================================
35381          // Read
35382
35383
35384          _createClass(XLSX, [{
35385            key: "readFile",
35386            value: function () {
35387              var _readFile = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(filename, options) {
35388                var stream, workbook;
35389                return regeneratorRuntime.wrap(function _callee$(_context) {
35390                  while (1) {
35391                    switch (_context.prev = _context.next) {
35392                      case 0:
35393                        _context.next = 2;
35394                        return utils.fs.exists(filename);
35395
35396                      case 2:
35397                        if (_context.sent) {
35398                          _context.next = 4;
35399                          break;
35400                        }
35401
35402                        throw new Error("File not found: ".concat(filename));
35403
35404                      case 4:
35405                        stream = fs.createReadStream(filename);
35406                        _context.prev = 5;
35407                        _context.next = 8;
35408                        return this.read(stream, options);
35409
35410                      case 8:
35411                        workbook = _context.sent;
35412                        stream.close();
35413                        return _context.abrupt("return", workbook);
35414
35415                      case 13:
35416                        _context.prev = 13;
35417                        _context.t0 = _context["catch"](5);
35418                        stream.close();
35419                        throw _context.t0;
35420
35421                      case 17:
35422                      case "end":
35423                        return _context.stop();
35424                    }
35425                  }
35426                }, _callee, this, [[5, 13]]);
35427              }));
35428
35429              function readFile(_x, _x2) {
35430                return _readFile.apply(this, arguments);
35431              }
35432
35433              return readFile;
35434            }()
35435          }, {
35436            key: "parseRels",
35437            value: function parseRels(stream) {
35438              var xform = new RelationshipsXform();
35439              return xform.parseStream(stream);
35440            }
35441          }, {
35442            key: "parseWorkbook",
35443            value: function parseWorkbook(stream) {
35444              var xform = new WorkbookXform();
35445              return xform.parseStream(stream);
35446            }
35447          }, {
35448            key: "parseSharedStrings",
35449            value: function parseSharedStrings(stream) {
35450              var xform = new SharedStringsXform();
35451              return xform.parseStream(stream);
35452            }
35453          }, {
35454            key: "reconcile",
35455            value: function reconcile(model, options) {
35456              var workbookXform = new WorkbookXform();
35457              var worksheetXform = new WorksheetXform(options);
35458              var drawingXform = new DrawingXform();
35459              var tableXform = new TableXform();
35460              workbookXform.reconcile(model); // reconcile drawings with their rels
35461
35462              var drawingOptions = {
35463                media: model.media,
35464                mediaIndex: model.mediaIndex
35465              };
35466              Object.keys(model.drawings).forEach(function (name) {
35467                var drawing = model.drawings[name];
35468                var drawingRel = model.drawingRels[name];
35469
35470                if (drawingRel) {
35471                  drawingOptions.rels = drawingRel.reduce(function (o, rel) {
35472                    o[rel.Id] = rel;
35473                    return o;
35474                  }, {});
35475                  (drawing.anchors || []).forEach(function (anchor) {
35476                    var hyperlinks = anchor.picture && anchor.picture.hyperlinks;
35477
35478                    if (hyperlinks && drawingOptions.rels[hyperlinks.rId]) {
35479                      hyperlinks.hyperlink = drawingOptions.rels[hyperlinks.rId].Target;
35480                      delete hyperlinks.rId;
35481                    }
35482                  });
35483                  drawingXform.reconcile(drawing, drawingOptions);
35484                }
35485              }); // reconcile tables with the default styles
35486
35487              var tableOptions = {
35488                styles: model.styles
35489              };
35490              Object.values(model.tables).forEach(function (table) {
35491                tableXform.reconcile(table, tableOptions);
35492              });
35493              var sheetOptions = {
35494                styles: model.styles,
35495                sharedStrings: model.sharedStrings,
35496                media: model.media,
35497                mediaIndex: model.mediaIndex,
35498                date1904: model.properties && model.properties.date1904,
35499                drawings: model.drawings,
35500                comments: model.comments,
35501                tables: model.tables,
35502                vmlDrawings: model.vmlDrawings
35503              };
35504              model.worksheets.forEach(function (worksheet) {
35505                worksheet.relationships = model.worksheetRels[worksheet.sheetNo];
35506                worksheetXform.reconcile(worksheet, sheetOptions);
35507              }); // delete unnecessary parts
35508
35509              delete model.worksheetHash;
35510              delete model.worksheetRels;
35511              delete model.globalRels;
35512              delete model.sharedStrings;
35513              delete model.workbookRels;
35514              delete model.sheetDefs;
35515              delete model.styles;
35516              delete model.mediaIndex;
35517              delete model.drawings;
35518              delete model.drawingRels;
35519              delete model.vmlDrawings;
35520            }
35521          }, {
35522            key: "_processWorksheetEntry",
35523            value: function () {
35524              var _processWorksheetEntry2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(stream, model, sheetNo, options, path) {
35525                var xform, worksheet;
35526                return regeneratorRuntime.wrap(function _callee2$(_context2) {
35527                  while (1) {
35528                    switch (_context2.prev = _context2.next) {
35529                      case 0:
35530                        xform = new WorksheetXform(options);
35531                        _context2.next = 3;
35532                        return xform.parseStream(stream);
35533
35534                      case 3:
35535                        worksheet = _context2.sent;
35536                        worksheet.sheetNo = sheetNo;
35537                        model.worksheetHash[path] = worksheet;
35538                        model.worksheets.push(worksheet);
35539
35540                      case 7:
35541                      case "end":
35542                        return _context2.stop();
35543                    }
35544                  }
35545                }, _callee2);
35546              }));
35547
35548              function _processWorksheetEntry(_x3, _x4, _x5, _x6, _x7) {
35549                return _processWorksheetEntry2.apply(this, arguments);
35550              }
35551
35552              return _processWorksheetEntry;
35553            }()
35554          }, {
35555            key: "_processCommentEntry",
35556            value: function () {
35557              var _processCommentEntry2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(stream, model, name) {
35558                var xform, comments;
35559                return regeneratorRuntime.wrap(function _callee3$(_context3) {
35560                  while (1) {
35561                    switch (_context3.prev = _context3.next) {
35562                      case 0:
35563                        xform = new CommentsXform();
35564                        _context3.next = 3;
35565                        return xform.parseStream(stream);
35566
35567                      case 3:
35568                        comments = _context3.sent;
35569                        model.comments["../".concat(name, ".xml")] = comments;
35570
35571                      case 5:
35572                      case "end":
35573                        return _context3.stop();
35574                    }
35575                  }
35576                }, _callee3);
35577              }));
35578
35579              function _processCommentEntry(_x8, _x9, _x10) {
35580                return _processCommentEntry2.apply(this, arguments);
35581              }
35582
35583              return _processCommentEntry;
35584            }()
35585          }, {
35586            key: "_processTableEntry",
35587            value: function () {
35588              var _processTableEntry2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(stream, model, name) {
35589                var xform, table;
35590                return regeneratorRuntime.wrap(function _callee4$(_context4) {
35591                  while (1) {
35592                    switch (_context4.prev = _context4.next) {
35593                      case 0:
35594                        xform = new TableXform();
35595                        _context4.next = 3;
35596                        return xform.parseStream(stream);
35597
35598                      case 3:
35599                        table = _context4.sent;
35600                        model.tables["../tables/".concat(name, ".xml")] = table;
35601
35602                      case 5:
35603                      case "end":
35604                        return _context4.stop();
35605                    }
35606                  }
35607                }, _callee4);
35608              }));
35609
35610              function _processTableEntry(_x11, _x12, _x13) {
35611                return _processTableEntry2.apply(this, arguments);
35612              }
35613
35614              return _processTableEntry;
35615            }()
35616          }, {
35617            key: "_processWorksheetRelsEntry",
35618            value: function () {
35619              var _processWorksheetRelsEntry2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(stream, model, sheetNo) {
35620                var xform, relationships;
35621                return regeneratorRuntime.wrap(function _callee5$(_context5) {
35622                  while (1) {
35623                    switch (_context5.prev = _context5.next) {
35624                      case 0:
35625                        xform = new RelationshipsXform();
35626                        _context5.next = 3;
35627                        return xform.parseStream(stream);
35628
35629                      case 3:
35630                        relationships = _context5.sent;
35631                        model.worksheetRels[sheetNo] = relationships;
35632
35633                      case 5:
35634                      case "end":
35635                        return _context5.stop();
35636                    }
35637                  }
35638                }, _callee5);
35639              }));
35640
35641              function _processWorksheetRelsEntry(_x14, _x15, _x16) {
35642                return _processWorksheetRelsEntry2.apply(this, arguments);
35643              }
35644
35645              return _processWorksheetRelsEntry;
35646            }()
35647          }, {
35648            key: "_processMediaEntry",
35649            value: function () {
35650              var _processMediaEntry2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(entry, model, filename) {
35651                var lastDot, extension, name;
35652                return regeneratorRuntime.wrap(function _callee6$(_context6) {
35653                  while (1) {
35654                    switch (_context6.prev = _context6.next) {
35655                      case 0:
35656                        lastDot = filename.lastIndexOf('.'); // if we can't determine extension, ignore it
35657
35658                        if (!(lastDot >= 1)) {
35659                          _context6.next = 6;
35660                          break;
35661                        }
35662
35663                        extension = filename.substr(lastDot + 1);
35664                        name = filename.substr(0, lastDot);
35665                        _context6.next = 6;
35666                        return new Promise(function (resolve, reject) {
35667                          var streamBuf = new StreamBuf();
35668                          streamBuf.on('finish', function () {
35669                            model.mediaIndex[filename] = model.media.length;
35670                            model.mediaIndex[name] = model.media.length;
35671                            var medium = {
35672                              type: 'image',
35673                              name: name,
35674                              extension: extension,
35675                              buffer: streamBuf.toBuffer()
35676                            };
35677                            model.media.push(medium);
35678                            resolve();
35679                          });
35680                          entry.on('error', function (error) {
35681                            reject(error);
35682                          });
35683                          entry.pipe(streamBuf);
35684                        });
35685
35686                      case 6:
35687                      case "end":
35688                        return _context6.stop();
35689                    }
35690                  }
35691                }, _callee6);
35692              }));
35693
35694              function _processMediaEntry(_x17, _x18, _x19) {
35695                return _processMediaEntry2.apply(this, arguments);
35696              }
35697
35698              return _processMediaEntry;
35699            }()
35700          }, {
35701            key: "_processDrawingEntry",
35702            value: function () {
35703              var _processDrawingEntry2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7(entry, model, name) {
35704                var xform, drawing;
35705                return regeneratorRuntime.wrap(function _callee7$(_context7) {
35706                  while (1) {
35707                    switch (_context7.prev = _context7.next) {
35708                      case 0:
35709                        xform = new DrawingXform();
35710                        _context7.next = 3;
35711                        return xform.parseStream(entry);
35712
35713                      case 3:
35714                        drawing = _context7.sent;
35715                        model.drawings[name] = drawing;
35716
35717                      case 5:
35718                      case "end":
35719                        return _context7.stop();
35720                    }
35721                  }
35722                }, _callee7);
35723              }));
35724
35725              function _processDrawingEntry(_x20, _x21, _x22) {
35726                return _processDrawingEntry2.apply(this, arguments);
35727              }
35728
35729              return _processDrawingEntry;
35730            }()
35731          }, {
35732            key: "_processDrawingRelsEntry",
35733            value: function () {
35734              var _processDrawingRelsEntry2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee8(entry, model, name) {
35735                var xform, relationships;
35736                return regeneratorRuntime.wrap(function _callee8$(_context8) {
35737                  while (1) {
35738                    switch (_context8.prev = _context8.next) {
35739                      case 0:
35740                        xform = new RelationshipsXform();
35741                        _context8.next = 3;
35742                        return xform.parseStream(entry);
35743
35744                      case 3:
35745                        relationships = _context8.sent;
35746                        model.drawingRels[name] = relationships;
35747
35748                      case 5:
35749                      case "end":
35750                        return _context8.stop();
35751                    }
35752                  }
35753                }, _callee8);
35754              }));
35755
35756              function _processDrawingRelsEntry(_x23, _x24, _x25) {
35757                return _processDrawingRelsEntry2.apply(this, arguments);
35758              }
35759
35760              return _processDrawingRelsEntry;
35761            }()
35762          }, {
35763            key: "_processVmlDrawingEntry",
35764            value: function () {
35765              var _processVmlDrawingEntry2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee9(entry, model, name) {
35766                var xform, vmlDrawing;
35767                return regeneratorRuntime.wrap(function _callee9$(_context9) {
35768                  while (1) {
35769                    switch (_context9.prev = _context9.next) {
35770                      case 0:
35771                        xform = new VmlNotesXform();
35772                        _context9.next = 3;
35773                        return xform.parseStream(entry);
35774
35775                      case 3:
35776                        vmlDrawing = _context9.sent;
35777                        model.vmlDrawings["../drawings/".concat(name, ".vml")] = vmlDrawing;
35778
35779                      case 5:
35780                      case "end":
35781                        return _context9.stop();
35782                    }
35783                  }
35784                }, _callee9);
35785              }));
35786
35787              function _processVmlDrawingEntry(_x26, _x27, _x28) {
35788                return _processVmlDrawingEntry2.apply(this, arguments);
35789              }
35790
35791              return _processVmlDrawingEntry;
35792            }()
35793          }, {
35794            key: "_processThemeEntry",
35795            value: function () {
35796              var _processThemeEntry2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee10(entry, model, name) {
35797                return regeneratorRuntime.wrap(function _callee10$(_context10) {
35798                  while (1) {
35799                    switch (_context10.prev = _context10.next) {
35800                      case 0:
35801                        _context10.next = 2;
35802                        return new Promise(function (resolve, reject) {
35803                          // TODO: stream entry into buffer and store the xml in the model.themes[]
35804                          var stream = new StreamBuf();
35805                          entry.on('error', reject);
35806                          stream.on('error', reject);
35807                          stream.on('finish', function () {
35808                            model.themes[name] = stream.read().toString();
35809                            resolve();
35810                          });
35811                          entry.pipe(stream);
35812                        });
35813
35814                      case 2:
35815                      case "end":
35816                        return _context10.stop();
35817                    }
35818                  }
35819                }, _callee10);
35820              }));
35821
35822              function _processThemeEntry(_x29, _x30, _x31) {
35823                return _processThemeEntry2.apply(this, arguments);
35824              }
35825
35826              return _processThemeEntry;
35827            }()
35828            /**
35829             * @deprecated since version 4.0. You should use `#read` instead. Please follow upgrade instruction: https://github.com/exceljs/exceljs/blob/master/UPGRADE-4.0.md
35830             */
35831
35832          }, {
35833            key: "createInputStream",
35834            value: function createInputStream() {
35835              throw new Error('`XLSX#createInputStream` is deprecated. You should use `XLSX#read` instead. This method will be removed in version 5.0. Please follow upgrade instruction: https://github.com/exceljs/exceljs/blob/master/UPGRADE-4.0.md');
35836            }
35837          }, {
35838            key: "read",
35839            value: function () {
35840              var _read = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee11(stream, options) {
35841                var chunks, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, chunk;
35842
35843                return regeneratorRuntime.wrap(function _callee11$(_context11) {
35844                  while (1) {
35845                    switch (_context11.prev = _context11.next) {
35846                      case 0:
35847                        // TODO: Remove once node v8 is deprecated
35848                        // Detect and upgrade old streams
35849                        if (!stream[Symbol.asyncIterator] && stream.pipe) {
35850                          stream = stream.pipe(new PassThrough());
35851                        }
35852
35853                        chunks = [];
35854                        _iteratorNormalCompletion = true;
35855                        _didIteratorError = false;
35856                        _context11.prev = 4;
35857                        _iterator = _asyncIterator(stream);
35858
35859                      case 6:
35860                        _context11.next = 8;
35861                        return _iterator.next();
35862
35863                      case 8:
35864                        _step = _context11.sent;
35865                        _iteratorNormalCompletion = _step.done;
35866                        _context11.next = 12;
35867                        return _step.value;
35868
35869                      case 12:
35870                        _value = _context11.sent;
35871
35872                        if (_iteratorNormalCompletion) {
35873                          _context11.next = 19;
35874                          break;
35875                        }
35876
35877                        chunk = _value;
35878                        chunks.push(chunk);
35879
35880                      case 16:
35881                        _iteratorNormalCompletion = true;
35882                        _context11.next = 6;
35883                        break;
35884
35885                      case 19:
35886                        _context11.next = 25;
35887                        break;
35888
35889                      case 21:
35890                        _context11.prev = 21;
35891                        _context11.t0 = _context11["catch"](4);
35892                        _didIteratorError = true;
35893                        _iteratorError = _context11.t0;
35894
35895                      case 25:
35896                        _context11.prev = 25;
35897                        _context11.prev = 26;
35898
35899                        if (!(!_iteratorNormalCompletion && _iterator.return != null)) {
35900                          _context11.next = 30;
35901                          break;
35902                        }
35903
35904                        _context11.next = 30;
35905                        return _iterator.return();
35906
35907                      case 30:
35908                        _context11.prev = 30;
35909
35910                        if (!_didIteratorError) {
35911                          _context11.next = 33;
35912                          break;
35913                        }
35914
35915                        throw _iteratorError;
35916
35917                      case 33:
35918                        return _context11.finish(30);
35919
35920                      case 34:
35921                        return _context11.finish(25);
35922
35923                      case 35:
35924                        return _context11.abrupt("return", this.load(Buffer.concat(chunks), options));
35925
35926                      case 36:
35927                      case "end":
35928                        return _context11.stop();
35929                    }
35930                  }
35931                }, _callee11, this, [[4, 21, 25, 35], [26,, 30, 34]]);
35932              }));
35933
35934              function read(_x32, _x33) {
35935                return _read.apply(this, arguments);
35936              }
35937
35938              return read;
35939            }()
35940          }, {
35941            key: "load",
35942            value: function () {
35943              var _load = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee12(data, options) {
35944                var buffer, model, zip, _i, _Object$values, entry, entryName, stream, content, chunkSize, i, workbook, appXform, appProperties, coreXform, coreProperties, match;
35945
35946                return regeneratorRuntime.wrap(function _callee12$(_context12) {
35947                  while (1) {
35948                    switch (_context12.prev = _context12.next) {
35949                      case 0:
35950                        if (options && options.base64) {
35951                          buffer = Buffer.from(data.toString(), 'base64');
35952                        } else {
35953                          buffer = data;
35954                        }
35955
35956                        model = {
35957                          worksheets: [],
35958                          worksheetHash: {},
35959                          worksheetRels: [],
35960                          themes: {},
35961                          media: [],
35962                          mediaIndex: {},
35963                          drawings: {},
35964                          drawingRels: {},
35965                          comments: {},
35966                          tables: {},
35967                          vmlDrawings: {}
35968                        };
35969                        _context12.next = 4;
35970                        return JSZip.loadAsync(buffer);
35971
35972                      case 4:
35973                        zip = _context12.sent;
35974                        _i = 0, _Object$values = Object.values(zip.files);
35975
35976                      case 6:
35977                        if (!(_i < _Object$values.length)) {
35978                          _context12.next = 115;
35979                          break;
35980                        }
35981
35982                        entry = _Object$values[_i];
35983
35984                        if (entry.dir) {
35985                          _context12.next = 112;
35986                          break;
35987                        }
35988
35989                        entryName = entry.name;
35990
35991                        if (entryName[0] === '/') {
35992                          entryName = entryName.substr(1);
35993                        }
35994
35995                        stream = new PassThrough();
35996
35997                        if (!entryName.match(/xl\/media\//)) {
35998                          _context12.next = 20;
35999                          break;
36000                        }
36001
36002                        _context12.t0 = stream;
36003                        _context12.next = 16;
36004                        return entry.async('nodebuffer');
36005
36006                      case 16:
36007                        _context12.t1 = _context12.sent;
36008
36009                        _context12.t0.write.call(_context12.t0, _context12.t1);
36010
36011                        _context12.next = 25;
36012                        break;
36013
36014                      case 20:
36015                        _context12.next = 22;
36016                        return entry.async('string');
36017
36018                      case 22:
36019                        content = _context12.sent;
36020                        chunkSize = 16 * 1024;
36021
36022                        for (i = 0; i < content.length; i += chunkSize) {
36023                          stream.write(content.substring(i, i + chunkSize));
36024                        }
36025
36026                      case 25:
36027                        stream.end();
36028                        _context12.t2 = entryName;
36029                        _context12.next = _context12.t2 === '_rels/.rels' ? 29 : _context12.t2 === 'xl/workbook.xml' ? 33 : _context12.t2 === 'xl/_rels/workbook.xml.rels' ? 42 : _context12.t2 === 'xl/sharedStrings.xml' ? 46 : _context12.t2 === 'xl/styles.xml' ? 50 : _context12.t2 === 'docProps/app.xml' ? 54 : _context12.t2 === 'docProps/core.xml' ? 61 : 67;
36030                        break;
36031
36032                      case 29:
36033                        _context12.next = 31;
36034                        return this.parseRels(stream);
36035
36036                      case 31:
36037                        model.globalRels = _context12.sent;
36038                        return _context12.abrupt("break", 112);
36039
36040                      case 33:
36041                        _context12.next = 35;
36042                        return this.parseWorkbook(stream);
36043
36044                      case 35:
36045                        workbook = _context12.sent;
36046                        model.sheets = workbook.sheets;
36047                        model.definedNames = workbook.definedNames;
36048                        model.views = workbook.views;
36049                        model.properties = workbook.properties;
36050                        model.calcProperties = workbook.calcProperties;
36051                        return _context12.abrupt("break", 112);
36052
36053                      case 42:
36054                        _context12.next = 44;
36055                        return this.parseRels(stream);
36056
36057                      case 44:
36058                        model.workbookRels = _context12.sent;
36059                        return _context12.abrupt("break", 112);
36060
36061                      case 46:
36062                        model.sharedStrings = new SharedStringsXform();
36063                        _context12.next = 49;
36064                        return model.sharedStrings.parseStream(stream);
36065
36066                      case 49:
36067                        return _context12.abrupt("break", 112);
36068
36069                      case 50:
36070                        model.styles = new StylesXform();
36071                        _context12.next = 53;
36072                        return model.styles.parseStream(stream);
36073
36074                      case 53:
36075                        return _context12.abrupt("break", 112);
36076
36077                      case 54:
36078                        appXform = new AppXform();
36079                        _context12.next = 57;
36080                        return appXform.parseStream(stream);
36081
36082                      case 57:
36083                        appProperties = _context12.sent;
36084                        model.company = appProperties.company;
36085                        model.manager = appProperties.manager;
36086                        return _context12.abrupt("break", 112);
36087
36088                      case 61:
36089                        coreXform = new CoreXform();
36090                        _context12.next = 64;
36091                        return coreXform.parseStream(stream);
36092
36093                      case 64:
36094                        coreProperties = _context12.sent;
36095                        Object.assign(model, coreProperties);
36096                        return _context12.abrupt("break", 112);
36097
36098                      case 67:
36099                        match = entryName.match(/xl\/worksheets\/sheet(\d+)[.]xml/);
36100
36101                        if (!match) {
36102                          _context12.next = 72;
36103                          break;
36104                        }
36105
36106                        _context12.next = 71;
36107                        return this._processWorksheetEntry(stream, model, match[1], options, entryName);
36108
36109                      case 71:
36110                        return _context12.abrupt("break", 112);
36111
36112                      case 72:
36113                        match = entryName.match(/xl\/worksheets\/_rels\/sheet(\d+)[.]xml.rels/);
36114
36115                        if (!match) {
36116                          _context12.next = 77;
36117                          break;
36118                        }
36119
36120                        _context12.next = 76;
36121                        return this._processWorksheetRelsEntry(stream, model, match[1]);
36122
36123                      case 76:
36124                        return _context12.abrupt("break", 112);
36125
36126                      case 77:
36127                        match = entryName.match(/xl\/theme\/([a-zA-Z0-9]+)[.]xml/);
36128
36129                        if (!match) {
36130                          _context12.next = 82;
36131                          break;
36132                        }
36133
36134                        _context12.next = 81;
36135                        return this._processThemeEntry(stream, model, match[1]);
36136
36137                      case 81:
36138                        return _context12.abrupt("break", 112);
36139
36140                      case 82:
36141                        match = entryName.match(/xl\/media\/([a-zA-Z0-9]+[.][a-zA-Z0-9]{3,4})$/);
36142
36143                        if (!match) {
36144                          _context12.next = 87;
36145                          break;
36146                        }
36147
36148                        _context12.next = 86;
36149                        return this._processMediaEntry(stream, model, match[1]);
36150
36151                      case 86:
36152                        return _context12.abrupt("break", 112);
36153
36154                      case 87:
36155                        match = entryName.match(/xl\/drawings\/([a-zA-Z0-9]+)[.]xml/);
36156
36157                        if (!match) {
36158                          _context12.next = 92;
36159                          break;
36160                        }
36161
36162                        _context12.next = 91;
36163                        return this._processDrawingEntry(stream, model, match[1]);
36164
36165                      case 91:
36166                        return _context12.abrupt("break", 112);
36167
36168                      case 92:
36169                        match = entryName.match(/xl\/(comments\d+)[.]xml/);
36170
36171                        if (!match) {
36172                          _context12.next = 97;
36173                          break;
36174                        }
36175
36176                        _context12.next = 96;
36177                        return this._processCommentEntry(stream, model, match[1]);
36178
36179                      case 96:
36180                        return _context12.abrupt("break", 112);
36181
36182                      case 97:
36183                        match = entryName.match(/xl\/tables\/(table\d+)[.]xml/);
36184
36185                        if (!match) {
36186                          _context12.next = 102;
36187                          break;
36188                        }
36189
36190                        _context12.next = 101;
36191                        return this._processTableEntry(stream, model, match[1]);
36192
36193                      case 101:
36194                        return _context12.abrupt("break", 112);
36195
36196                      case 102:
36197                        match = entryName.match(/xl\/drawings\/_rels\/([a-zA-Z0-9]+)[.]xml[.]rels/);
36198
36199                        if (!match) {
36200                          _context12.next = 107;
36201                          break;
36202                        }
36203
36204                        _context12.next = 106;
36205                        return this._processDrawingRelsEntry(stream, model, match[1]);
36206
36207                      case 106:
36208                        return _context12.abrupt("break", 112);
36209
36210                      case 107:
36211                        match = entryName.match(/xl\/drawings\/(vmlDrawing\d+)[.]vml/);
36212
36213                        if (!match) {
36214                          _context12.next = 112;
36215                          break;
36216                        }
36217
36218                        _context12.next = 111;
36219                        return this._processVmlDrawingEntry(stream, model, match[1]);
36220
36221                      case 111:
36222                        return _context12.abrupt("break", 112);
36223
36224                      case 112:
36225                        _i++;
36226                        _context12.next = 6;
36227                        break;
36228
36229                      case 115:
36230                        this.reconcile(model, options); // apply model
36231
36232                        this.workbook.model = model;
36233                        return _context12.abrupt("return", this.workbook);
36234
36235                      case 118:
36236                      case "end":
36237                        return _context12.stop();
36238                    }
36239                  }
36240                }, _callee12, this);
36241              }));
36242
36243              function load(_x34, _x35) {
36244                return _load.apply(this, arguments);
36245              }
36246
36247              return load;
36248            }() // =========================================================================
36249            // Write
36250
36251          }, {
36252            key: "addMedia",
36253            value: function () {
36254              var _addMedia = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee14(zip, model) {
36255                return regeneratorRuntime.wrap(function _callee14$(_context14) {
36256                  while (1) {
36257                    switch (_context14.prev = _context14.next) {
36258                      case 0:
36259                        _context14.next = 2;
36260                        return Promise.all(model.media.map( /*#__PURE__*/function () {
36261                          var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee13(medium) {
36262                            var filename, data, dataimg64, content;
36263                            return regeneratorRuntime.wrap(function _callee13$(_context13) {
36264                              while (1) {
36265                                switch (_context13.prev = _context13.next) {
36266                                  case 0:
36267                                    if (!(medium.type === 'image')) {
36268                                      _context13.next = 13;
36269                                      break;
36270                                    }
36271
36272                                    filename = "xl/media/".concat(medium.name, ".").concat(medium.extension);
36273
36274                                    if (!medium.filename) {
36275                                      _context13.next = 7;
36276                                      break;
36277                                    }
36278
36279                                    _context13.next = 5;
36280                                    return fsReadFileAsync(medium.filename);
36281
36282                                  case 5:
36283                                    data = _context13.sent;
36284                                    return _context13.abrupt("return", zip.append(data, {
36285                                      name: filename
36286                                    }));
36287
36288                                  case 7:
36289                                    if (!medium.buffer) {
36290                                      _context13.next = 9;
36291                                      break;
36292                                    }
36293
36294                                    return _context13.abrupt("return", zip.append(medium.buffer, {
36295                                      name: filename
36296                                    }));
36297
36298                                  case 9:
36299                                    if (!medium.base64) {
36300                                      _context13.next = 13;
36301                                      break;
36302                                    }
36303
36304                                    dataimg64 = medium.base64;
36305                                    content = dataimg64.substring(dataimg64.indexOf(',') + 1);
36306                                    return _context13.abrupt("return", zip.append(content, {
36307                                      name: filename,
36308                                      base64: true
36309                                    }));
36310
36311                                  case 13:
36312                                    throw new Error('Unsupported media');
36313
36314                                  case 14:
36315                                  case "end":
36316                                    return _context13.stop();
36317                                }
36318                              }
36319                            }, _callee13);
36320                          }));
36321
36322                          return function (_x38) {
36323                            return _ref.apply(this, arguments);
36324                          };
36325                        }()));
36326
36327                      case 2:
36328                      case "end":
36329                        return _context14.stop();
36330                    }
36331                  }
36332                }, _callee14);
36333              }));
36334
36335              function addMedia(_x36, _x37) {
36336                return _addMedia.apply(this, arguments);
36337              }
36338
36339              return addMedia;
36340            }()
36341          }, {
36342            key: "addDrawings",
36343            value: function addDrawings(zip, model) {
36344              var drawingXform = new DrawingXform();
36345              var relsXform = new RelationshipsXform();
36346              model.worksheets.forEach(function (worksheet) {
36347                var drawing = worksheet.drawing;
36348
36349                if (drawing) {
36350                  drawingXform.prepare(drawing, {});
36351                  var xml = drawingXform.toXml(drawing);
36352                  zip.append(xml, {
36353                    name: "xl/drawings/".concat(drawing.name, ".xml")
36354                  });
36355                  xml = relsXform.toXml(drawing.rels);
36356                  zip.append(xml, {
36357                    name: "xl/drawings/_rels/".concat(drawing.name, ".xml.rels")
36358                  });
36359                }
36360              });
36361            }
36362          }, {
36363            key: "addTables",
36364            value: function addTables(zip, model) {
36365              var tableXform = new TableXform();
36366              model.worksheets.forEach(function (worksheet) {
36367                var tables = worksheet.tables;
36368                tables.forEach(function (table) {
36369                  tableXform.prepare(table, {});
36370                  var tableXml = tableXform.toXml(table);
36371                  zip.append(tableXml, {
36372                    name: "xl/tables/".concat(table.target)
36373                  });
36374                });
36375              });
36376            }
36377          }, {
36378            key: "addContentTypes",
36379            value: function () {
36380              var _addContentTypes = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee15(zip, model) {
36381                var xform, xml;
36382                return regeneratorRuntime.wrap(function _callee15$(_context15) {
36383                  while (1) {
36384                    switch (_context15.prev = _context15.next) {
36385                      case 0:
36386                        xform = new ContentTypesXform();
36387                        xml = xform.toXml(model);
36388                        zip.append(xml, {
36389                          name: '[Content_Types].xml'
36390                        });
36391
36392                      case 3:
36393                      case "end":
36394                        return _context15.stop();
36395                    }
36396                  }
36397                }, _callee15);
36398              }));
36399
36400              function addContentTypes(_x39, _x40) {
36401                return _addContentTypes.apply(this, arguments);
36402              }
36403
36404              return addContentTypes;
36405            }()
36406          }, {
36407            key: "addApp",
36408            value: function () {
36409              var _addApp = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee16(zip, model) {
36410                var xform, xml;
36411                return regeneratorRuntime.wrap(function _callee16$(_context16) {
36412                  while (1) {
36413                    switch (_context16.prev = _context16.next) {
36414                      case 0:
36415                        xform = new AppXform();
36416                        xml = xform.toXml(model);
36417                        zip.append(xml, {
36418                          name: 'docProps/app.xml'
36419                        });
36420
36421                      case 3:
36422                      case "end":
36423                        return _context16.stop();
36424                    }
36425                  }
36426                }, _callee16);
36427              }));
36428
36429              function addApp(_x41, _x42) {
36430                return _addApp.apply(this, arguments);
36431              }
36432
36433              return addApp;
36434            }()
36435          }, {
36436            key: "addCore",
36437            value: function () {
36438              var _addCore = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee17(zip, model) {
36439                var coreXform;
36440                return regeneratorRuntime.wrap(function _callee17$(_context17) {
36441                  while (1) {
36442                    switch (_context17.prev = _context17.next) {
36443                      case 0:
36444                        coreXform = new CoreXform();
36445                        zip.append(coreXform.toXml(model), {
36446                          name: 'docProps/core.xml'
36447                        });
36448
36449                      case 2:
36450                      case "end":
36451                        return _context17.stop();
36452                    }
36453                  }
36454                }, _callee17);
36455              }));
36456
36457              function addCore(_x43, _x44) {
36458                return _addCore.apply(this, arguments);
36459              }
36460
36461              return addCore;
36462            }()
36463          }, {
36464            key: "addThemes",
36465            value: function () {
36466              var _addThemes = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee18(zip, model) {
36467                var themes;
36468                return regeneratorRuntime.wrap(function _callee18$(_context18) {
36469                  while (1) {
36470                    switch (_context18.prev = _context18.next) {
36471                      case 0:
36472                        themes = model.themes || {
36473                          theme1: theme1Xml
36474                        };
36475                        Object.keys(themes).forEach(function (name) {
36476                          var xml = themes[name];
36477                          var path = "xl/theme/".concat(name, ".xml");
36478                          zip.append(xml, {
36479                            name: path
36480                          });
36481                        });
36482
36483                      case 2:
36484                      case "end":
36485                        return _context18.stop();
36486                    }
36487                  }
36488                }, _callee18);
36489              }));
36490
36491              function addThemes(_x45, _x46) {
36492                return _addThemes.apply(this, arguments);
36493              }
36494
36495              return addThemes;
36496            }()
36497          }, {
36498            key: "addOfficeRels",
36499            value: function () {
36500              var _addOfficeRels = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee19(zip) {
36501                var xform, xml;
36502                return regeneratorRuntime.wrap(function _callee19$(_context19) {
36503                  while (1) {
36504                    switch (_context19.prev = _context19.next) {
36505                      case 0:
36506                        xform = new RelationshipsXform();
36507                        xml = xform.toXml([{
36508                          Id: 'rId1',
36509                          Type: XLSX.RelType.OfficeDocument,
36510                          Target: 'xl/workbook.xml'
36511                        }, {
36512                          Id: 'rId2',
36513                          Type: XLSX.RelType.CoreProperties,
36514                          Target: 'docProps/core.xml'
36515                        }, {
36516                          Id: 'rId3',
36517                          Type: XLSX.RelType.ExtenderProperties,
36518                          Target: 'docProps/app.xml'
36519                        }]);
36520                        zip.append(xml, {
36521                          name: '_rels/.rels'
36522                        });
36523
36524                      case 3:
36525                      case "end":
36526                        return _context19.stop();
36527                    }
36528                  }
36529                }, _callee19);
36530              }));
36531
36532              function addOfficeRels(_x47) {
36533                return _addOfficeRels.apply(this, arguments);
36534              }
36535
36536              return addOfficeRels;
36537            }()
36538          }, {
36539            key: "addWorkbookRels",
36540            value: function () {
36541              var _addWorkbookRels = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee20(zip, model) {
36542                var count, relationships, xform, xml;
36543                return regeneratorRuntime.wrap(function _callee20$(_context20) {
36544                  while (1) {
36545                    switch (_context20.prev = _context20.next) {
36546                      case 0:
36547                        count = 1;
36548                        relationships = [{
36549                          Id: "rId".concat(count++),
36550                          Type: XLSX.RelType.Styles,
36551                          Target: 'styles.xml'
36552                        }, {
36553                          Id: "rId".concat(count++),
36554                          Type: XLSX.RelType.Theme,
36555                          Target: 'theme/theme1.xml'
36556                        }];
36557
36558                        if (model.sharedStrings.count) {
36559                          relationships.push({
36560                            Id: "rId".concat(count++),
36561                            Type: XLSX.RelType.SharedStrings,
36562                            Target: 'sharedStrings.xml'
36563                          });
36564                        }
36565
36566                        model.worksheets.forEach(function (worksheet) {
36567                          worksheet.rId = "rId".concat(count++);
36568                          relationships.push({
36569                            Id: worksheet.rId,
36570                            Type: XLSX.RelType.Worksheet,
36571                            Target: "worksheets/sheet".concat(worksheet.id, ".xml")
36572                          });
36573                        });
36574                        xform = new RelationshipsXform();
36575                        xml = xform.toXml(relationships);
36576                        zip.append(xml, {
36577                          name: 'xl/_rels/workbook.xml.rels'
36578                        });
36579
36580                      case 7:
36581                      case "end":
36582                        return _context20.stop();
36583                    }
36584                  }
36585                }, _callee20);
36586              }));
36587
36588              function addWorkbookRels(_x48, _x49) {
36589                return _addWorkbookRels.apply(this, arguments);
36590              }
36591
36592              return addWorkbookRels;
36593            }()
36594          }, {
36595            key: "addSharedStrings",
36596            value: function () {
36597              var _addSharedStrings = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee21(zip, model) {
36598                return regeneratorRuntime.wrap(function _callee21$(_context21) {
36599                  while (1) {
36600                    switch (_context21.prev = _context21.next) {
36601                      case 0:
36602                        if (model.sharedStrings && model.sharedStrings.count) {
36603                          zip.append(model.sharedStrings.xml, {
36604                            name: 'xl/sharedStrings.xml'
36605                          });
36606                        }
36607
36608                      case 1:
36609                      case "end":
36610                        return _context21.stop();
36611                    }
36612                  }
36613                }, _callee21);
36614              }));
36615
36616              function addSharedStrings(_x50, _x51) {
36617                return _addSharedStrings.apply(this, arguments);
36618              }
36619
36620              return addSharedStrings;
36621            }()
36622          }, {
36623            key: "addStyles",
36624            value: function () {
36625              var _addStyles = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee22(zip, model) {
36626                var xml;
36627                return regeneratorRuntime.wrap(function _callee22$(_context22) {
36628                  while (1) {
36629                    switch (_context22.prev = _context22.next) {
36630                      case 0:
36631                        xml = model.styles.xml;
36632
36633                        if (xml) {
36634                          zip.append(xml, {
36635                            name: 'xl/styles.xml'
36636                          });
36637                        }
36638
36639                      case 2:
36640                      case "end":
36641                        return _context22.stop();
36642                    }
36643                  }
36644                }, _callee22);
36645              }));
36646
36647              function addStyles(_x52, _x53) {
36648                return _addStyles.apply(this, arguments);
36649              }
36650
36651              return addStyles;
36652            }()
36653          }, {
36654            key: "addWorkbook",
36655            value: function () {
36656              var _addWorkbook = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee23(zip, model) {
36657                var xform;
36658                return regeneratorRuntime.wrap(function _callee23$(_context23) {
36659                  while (1) {
36660                    switch (_context23.prev = _context23.next) {
36661                      case 0:
36662                        xform = new WorkbookXform();
36663                        zip.append(xform.toXml(model), {
36664                          name: 'xl/workbook.xml'
36665                        });
36666
36667                      case 2:
36668                      case "end":
36669                        return _context23.stop();
36670                    }
36671                  }
36672                }, _callee23);
36673              }));
36674
36675              function addWorkbook(_x54, _x55) {
36676                return _addWorkbook.apply(this, arguments);
36677              }
36678
36679              return addWorkbook;
36680            }()
36681          }, {
36682            key: "addWorksheets",
36683            value: function () {
36684              var _addWorksheets = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee24(zip, model) {
36685                var worksheetXform, relationshipsXform, commentsXform, vmlNotesXform;
36686                return regeneratorRuntime.wrap(function _callee24$(_context24) {
36687                  while (1) {
36688                    switch (_context24.prev = _context24.next) {
36689                      case 0:
36690                        // preparation phase
36691                        worksheetXform = new WorksheetXform();
36692                        relationshipsXform = new RelationshipsXform();
36693                        commentsXform = new CommentsXform();
36694                        vmlNotesXform = new VmlNotesXform(); // write sheets
36695
36696                        model.worksheets.forEach(function (worksheet) {
36697                          var xmlStream = new XmlStream();
36698                          worksheetXform.render(xmlStream, worksheet);
36699                          zip.append(xmlStream.xml, {
36700                            name: "xl/worksheets/sheet".concat(worksheet.id, ".xml")
36701                          });
36702
36703                          if (worksheet.rels && worksheet.rels.length) {
36704                            xmlStream = new XmlStream();
36705                            relationshipsXform.render(xmlStream, worksheet.rels);
36706                            zip.append(xmlStream.xml, {
36707                              name: "xl/worksheets/_rels/sheet".concat(worksheet.id, ".xml.rels")
36708                            });
36709                          }
36710
36711                          if (worksheet.comments.length > 0) {
36712                            xmlStream = new XmlStream();
36713                            commentsXform.render(xmlStream, worksheet);
36714                            zip.append(xmlStream.xml, {
36715                              name: "xl/comments".concat(worksheet.id, ".xml")
36716                            });
36717                            xmlStream = new XmlStream();
36718                            vmlNotesXform.render(xmlStream, worksheet);
36719                            zip.append(xmlStream.xml, {
36720                              name: "xl/drawings/vmlDrawing".concat(worksheet.id, ".vml")
36721                            });
36722                          }
36723                        });
36724
36725                      case 5:
36726                      case "end":
36727                        return _context24.stop();
36728                    }
36729                  }
36730                }, _callee24);
36731              }));
36732
36733              function addWorksheets(_x56, _x57) {
36734                return _addWorksheets.apply(this, arguments);
36735              }
36736
36737              return addWorksheets;
36738            }()
36739          }, {
36740            key: "_finalize",
36741            value: function _finalize(zip) {
36742              var _this = this;
36743
36744              return new Promise(function (resolve, reject) {
36745                zip.on('finish', function () {
36746                  resolve(_this);
36747                });
36748                zip.on('error', reject);
36749                zip.finalize();
36750              });
36751            }
36752          }, {
36753            key: "prepareModel",
36754            value: function prepareModel(model, options) {
36755              // ensure following properties have sane values
36756              model.creator = model.creator || 'ExcelJS';
36757              model.lastModifiedBy = model.lastModifiedBy || 'ExcelJS';
36758              model.created = model.created || new Date();
36759              model.modified = model.modified || new Date();
36760              model.useSharedStrings = options.useSharedStrings !== undefined ? options.useSharedStrings : true;
36761              model.useStyles = options.useStyles !== undefined ? options.useStyles : true; // Manage the shared strings
36762
36763              model.sharedStrings = new SharedStringsXform(); // add a style manager to handle cell formats, fonts, etc.
36764
36765              model.styles = model.useStyles ? new StylesXform(true) : new StylesXform.Mock(); // prepare all of the things before the render
36766
36767              var workbookXform = new WorkbookXform();
36768              var worksheetXform = new WorksheetXform();
36769              workbookXform.prepare(model);
36770              var worksheetOptions = {
36771                sharedStrings: model.sharedStrings,
36772                styles: model.styles,
36773                date1904: model.properties.date1904,
36774                drawingsCount: 0,
36775                media: model.media
36776              };
36777              worksheetOptions.drawings = model.drawings = [];
36778              worksheetOptions.commentRefs = model.commentRefs = [];
36779              var tableCount = 0;
36780              model.tables = [];
36781              model.worksheets.forEach(function (worksheet) {
36782                // assign unique filenames to tables
36783                worksheet.tables.forEach(function (table) {
36784                  tableCount++;
36785                  table.target = "table".concat(tableCount, ".xml");
36786                  table.id = tableCount;
36787                  model.tables.push(table);
36788                });
36789                worksheetXform.prepare(worksheet, worksheetOptions);
36790              }); // TODO: workbook drawing list
36791            }
36792          }, {
36793            key: "write",
36794            value: function () {
36795              var _write = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee25(stream, options) {
36796                var model, zip;
36797                return regeneratorRuntime.wrap(function _callee25$(_context25) {
36798                  while (1) {
36799                    switch (_context25.prev = _context25.next) {
36800                      case 0:
36801                        options = options || {};
36802                        model = this.workbook.model;
36803                        zip = new ZipStream.ZipWriter(options.zip);
36804                        zip.pipe(stream);
36805                        this.prepareModel(model, options); // render
36806
36807                        _context25.next = 7;
36808                        return this.addContentTypes(zip, model);
36809
36810                      case 7:
36811                        _context25.next = 9;
36812                        return this.addOfficeRels(zip, model);
36813
36814                      case 9:
36815                        _context25.next = 11;
36816                        return this.addWorkbookRels(zip, model);
36817
36818                      case 11:
36819                        _context25.next = 13;
36820                        return this.addWorksheets(zip, model);
36821
36822                      case 13:
36823                        _context25.next = 15;
36824                        return this.addSharedStrings(zip, model);
36825
36826                      case 15:
36827                        _context25.next = 17;
36828                        return this.addDrawings(zip, model);
36829
36830                      case 17:
36831                        _context25.next = 19;
36832                        return this.addTables(zip, model);
36833
36834                      case 19:
36835                        _context25.next = 21;
36836                        return Promise.all([this.addThemes(zip, model), this.addStyles(zip, model)]);
36837
36838                      case 21:
36839                        _context25.next = 23;
36840                        return this.addMedia(zip, model);
36841
36842                      case 23:
36843                        _context25.next = 25;
36844                        return Promise.all([this.addApp(zip, model), this.addCore(zip, model)]);
36845
36846                      case 25:
36847                        _context25.next = 27;
36848                        return this.addWorkbook(zip, model);
36849
36850                      case 27:
36851                        return _context25.abrupt("return", this._finalize(zip));
36852
36853                      case 28:
36854                      case "end":
36855                        return _context25.stop();
36856                    }
36857                  }
36858                }, _callee25, this);
36859              }));
36860
36861              function write(_x58, _x59) {
36862                return _write.apply(this, arguments);
36863              }
36864
36865              return write;
36866            }()
36867          }, {
36868            key: "writeFile",
36869            value: function writeFile(filename, options) {
36870              var _this2 = this;
36871
36872              var stream = fs.createWriteStream(filename);
36873              return new Promise(function (resolve, reject) {
36874                stream.on('finish', function () {
36875                  resolve();
36876                });
36877                stream.on('error', function (error) {
36878                  reject(error);
36879                });
36880
36881                _this2.write(stream, options).then(function () {
36882                  stream.end();
36883                });
36884              });
36885            }
36886          }, {
36887            key: "writeBuffer",
36888            value: function () {
36889              var _writeBuffer = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee26(options) {
36890                var stream;
36891                return regeneratorRuntime.wrap(function _callee26$(_context26) {
36892                  while (1) {
36893                    switch (_context26.prev = _context26.next) {
36894                      case 0:
36895                        stream = new StreamBuf();
36896                        _context26.next = 3;
36897                        return this.write(stream, options);
36898
36899                      case 3:
36900                        return _context26.abrupt("return", stream.read());
36901
36902                      case 4:
36903                      case "end":
36904                        return _context26.stop();
36905                    }
36906                  }
36907                }, _callee26, this);
36908              }));
36909
36910              function writeBuffer(_x60) {
36911                return _writeBuffer.apply(this, arguments);
36912              }
36913
36914              return writeBuffer;
36915            }()
36916          }]);
36917
36918          return XLSX;
36919        }();
36920
36921        XLSX.RelType = require('./rel-type');
36922        module.exports = XLSX;
36923      }).call(this, require("buffer").Buffer);
36924    }, {
36925      "../utils/stream-buf": 21,
36926      "../utils/utils": 24,
36927      "../utils/xml-stream": 25,
36928      "../utils/zip-stream": 26,
36929      "./rel-type": 28,
36930      "./xform/book/workbook-xform": 35,
36931      "./xform/comment/comments-xform": 37,
36932      "./xform/comment/vml-notes-xform": 42,
36933      "./xform/core/app-xform": 48,
36934      "./xform/core/content-types-xform": 49,
36935      "./xform/core/core-xform": 50,
36936      "./xform/core/relationships-xform": 52,
36937      "./xform/drawing/drawing-xform": 59,
36938      "./xform/sheet/worksheet-xform": 112,
36939      "./xform/strings/shared-strings-xform": 121,
36940      "./xform/style/styles-xform": 132,
36941      "./xform/table/table-xform": 138,
36942      "./xml/theme1.js": 140,
36943      "buffer": 214,
36944      "fs": 213,
36945      "jszip": 376,
36946      "readable-stream": 467
36947    }],
36948    140: [function (require, module, exports) {
36949      "use strict";
36950      /* eslint-disable */
36951
36952      
vendor: 7,983 bytes, line 36952
36952module.exports = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="Office Theme"> <a:themeElements> <a:clrScheme name="Office"> <a:dk1> <a:sysClr val="windowText" lastClr="000000"/> </a:dk1> <a:lt1> <a:sysClr val="window" lastClr="FFFFFF"/> </a:lt1> <a:dk2> <a:srgbClr val="1F497D"/> </a:dk2> <a:lt2> <a:srgbClr val="EEECE1"/> </a:lt2> <a:accent1> <a:srgbClr val="4F81BD"/> </a:accent1> <a:accent2> <a:srgbClr val="C0504D"/> </a:accent2> <a:accent3> <a:srgbClr val="9BBB59"/> </a:accent3> <a:accent4> <a:srgbClr val="8064A2"/> </a:accent4> <a:accent5> <a:srgbClr val="4BACC6"/> </a:accent5> <a:accent6> <a:srgbClr val="F79646"/> </a:accent6> <a:hlink> <a:srgbClr val="0000FF"/> </a:hlink> <a:folHlink> <a:srgbClr val="800080"/> </a:folHlink> </a:clrScheme> <a:fontScheme name="Office"> <a:majorFont> <a:latin typeface="Cambria"/> <a:ea typeface=""/> <a:cs typeface=""/> <a:font script="Jpan" typeface="MS Pゴシック"/> <a:font script="Hang" typeface="맑은 고딕"/> <a:font script="Hans" typeface="宋体"/> <a:font script="Hant" typeface="新細明體"/> <a:font script="Arab" typeface="Times New Roman"/> <a:font script="Hebr" typeface="Times New Roman"/> <a:font script="Thai" typeface="Tahoma"/> <a:font script="Ethi" typeface="Nyala"/> <a:font script="Beng" typeface="Vrinda"/> <a:font script="Gujr" typeface="Shruti"/> <a:font script="Khmr" typeface="MoolBoran"/> <a:font script="Knda" typeface="Tunga"/> <a:font script="Guru" typeface="Raavi"/> <a:font script="Cans" typeface="Euphemia"/> <a:font script="Cher" typeface="Plantagenet Cherokee"/> <a:font script="Yiii" typeface="Microsoft Yi Baiti"/> <a:font script="Tibt" typeface="Microsoft Himalaya"/> <a:font script="Thaa" typeface="MV Boli"/> <a:font script="Deva" typeface="Mangal"/> <a:font script="Telu" typeface="Gautami"/> <a:font script="Taml" typeface="Latha"/> <a:font script="Syrc" typeface="Estrangelo Edessa"/> <a:font script="Orya" typeface="Kalinga"/> <a:font script="Mlym" typeface="Kartika"/> <a:font script="Laoo" typeface="DokChampa"/> <a:font script="Sinh" typeface="Iskoola Pota"/> <a:font script="Mong" typeface="Mongolian Baiti"/> <a:font script="Viet" typeface="Times New Roman"/> <a:font script="Uigh" typeface="Microsoft Uighur"/> <a:font script="Geor" typeface="Sylfaen"/> </a:majorFont> <a:minorFont> <a:latin typeface="Calibri"/> <a:ea typeface=""/> <a:cs typeface=""/> <a:font script="Jpan" typeface="MS Pゴシック"/> <a:font script="Hang" typeface="맑은 고딕"/> <a:font script="Hans" typeface="宋体"/> <a:font script="Hant" typeface="新細明體"/> <a:font script="Arab" typeface="Arial"/> <a:font script="Hebr" typeface="Arial"/> <a:font script="Thai" typeface="Tahoma"/> <a:font script="Ethi" typeface="Nyala"/> <a:font script="Beng" typeface="Vrinda"/> <a:font script="Gujr" typeface="Shruti"/> <a:font script="Khmr" typeface="DaunPenh"/> <a:font script="Knda" typeface="Tunga"/> <a:font script="Guru" typeface="Raavi"/> <a:font script="Cans" typeface="Euphemia"/> <a:font script="Cher" typeface="Plantagenet Cherokee"/> <a:font script="Yiii" typeface="Microsoft Yi Baiti"/> <a:font script="Tibt" typeface="Microsoft Himalaya"/> <a:font script="Thaa" typeface="MV Boli"/> <a:font script="Deva" typeface="Mangal"/> <a:font script="Telu" typeface="Gautami"/> <a:font script="Taml" typeface="Latha"/> <a:font script="Syrc" typeface="Estrangelo Edessa"/> <a:font script="Orya" typeface="Kalinga"/> <a:font script="Mlym" typeface="Kartika"/> <a:font script="Laoo" typeface="DokChampa"/> <a:font script="Sinh" typeface="Iskoola Pota"/> <a:font script="Mong" typeface="Mongolian Baiti"/> <a:font script="Viet" typeface="Arial"/> <a:font script="Uigh" typeface="Microsoft Uighur"/> <a:font script="Geor" typeface="Sylfaen"/> </a:minorFont> </a:fontScheme> <a:fmtScheme name="Office"> <a:fillStyleLst> <a:solidFill> <a:schemeClr val="phClr"/> </a:solidFill> <a:gradFill rotWithShape="1"> <a:gsLst> <a:gs pos="0"> <a:schemeClr val="phClr"> <a:tint val="50000"/> <a:satMod val="300000"/> </a:schemeClr> </a:gs> <a:gs pos="35000"> <a:schemeClr val="phClr"> <a:tint val="37000"/> <a:satMod val="300000"/> </a:schemeClr> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:tint val="15000"/> <a:satMod val="350000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:lin ang="16200000" scaled="1"/> </a:gradFill> <a:gradFill rotWithShape="1"> <a:gsLst> <a:gs pos="0"> <a:schemeClr val="phClr"> <a:tint val="100000"/> <a:shade val="100000"/> <a:satMod val="130000"/> </a:schemeClr> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:tint val="50000"/> <a:shade val="100000"/> <a:satMod val="350000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:lin ang="16200000" scaled="0"/> </a:gradFill> </a:fillStyleLst> <a:lnStyleLst> <a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"> <a:solidFill> <a:schemeClr val="phClr"> <a:shade val="95000"/> <a:satMod val="105000"/> </a:schemeClr> </a:solidFill> <a:prstDash val="solid"/> </a:ln> <a:ln w="25400" cap="flat" cmpd="sng" algn="ctr"> <a:solidFill> <a:schemeClr val="phClr"/> </a:solidFill> <a:prstDash val="solid"/> </a:ln> <a:ln w="38100" cap="flat" cmpd="sng" algn="ctr"> <a:solidFill> <a:schemeClr val="phClr"/> </a:solidFill> <a:prstDash val="solid"/> </a:ln> </a:lnStyleLst> <a:effectStyleLst> <a:effectStyle> <a:effectLst> <a:outerShdw blurRad="40000" dist="20000" dir="5400000" rotWithShape="0"> <a:srgbClr val="000000"> <a:alpha val="38000"/> </a:srgbClr> </a:outerShdw> </a:effectLst> </a:effectStyle> <a:effectStyle> <a:effectLst> <a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"> <a:srgbClr val="000000"> <a:alpha val="35000"/> </a:srgbClr> </a:outerShdw> </a:effectLst> </a:effectStyle> <a:effectStyle> <a:effectLst> <a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"> <a:srgbClr val="000000"> <a:alpha val="35000"/> </a:srgbClr> </a:outerShdw> </a:effectLst> <a:scene3d> <a:camera prst="orthographicFront"> <a:rot lat="0" lon="0" rev="0"/> </a:camera> <a:lightRig rig="threePt" dir="t"> <a:rot lat="0" lon="0" rev="1200000"/> </a:lightRig> </a:scene3d> <a:sp3d> <a:bevelT w="63500" h="25400"/> </a:sp3d> </a:effectStyle> </a:effectStyleLst> <a:bgFillStyleLst> <a:solidFill> <a:schemeClr val="phClr"/> </a:solidFill> <a:gradFill rotWithShape="1"> <a:gsLst> <a:gs pos="0"> <a:schemeClr val="phClr"> <a:tint val="40000"/> <a:satMod val="350000"/> </a:schemeClr> </a:gs> <a:gs pos="40000"> <a:schemeClr val="phClr"> <a:tint val="45000"/> <a:shade val="99000"/> <a:satMod val="350000"/> </a:schemeClr> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:shade val="20000"/> <a:satMod val="255000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:path path="circle"> <a:fillToRect l="50000" t="-80000" r="50000" b="180000"/> </a:path> </a:gradFill> <a:gradFill rotWithShape="1"> <a:gsLst> <a:gs pos="0"> <a:schemeClr val="phClr"> <a:tint val="80000"/> <a:satMod val="300000"/> </a:schemeClr> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:shade val="30000"/> <a:satMod val="200000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:path path="circle"> <a:fillToRect l="50000" t="50000" r="50000" b="50000"/> </a:path> </a:gradFill> </a:bgFillStyleLst> </a:fmtScheme> </a:themeElements> <a:objectDefaults> <a:spDef> <a:spPr/> <a:bodyPr/> <a:lstStyle/> <a:style> <a:lnRef idx="1"> <a:schemeClr val="accent1"/> </a:lnRef> <a:fillRef idx="3"> <a:schemeClr val="accent1"/> </a:fillRef> <a:effectRef idx="2"> <a:schemeClr val="accent1"/> </a:effectRef> <a:fontRef idx="minor"> <a:schemeClr val="lt1"/> </a:fontRef> </a:style> </a:spDef> <a:lnDef> <a:spPr/> <a:bodyPr/> <a:lstStyle/> <a:style> <a:lnRef idx="2"> <a:schemeClr val="accent1"/> </a:lnRef> <a:fillRef idx="0"> <a:schemeClr val="accent1"/> </a:fillRef> <a:effectRef idx="1"> <a:schemeClr val="accent1"/> </a:effectRef> <a:fontRef idx="minor"> <a:schemeClr val="tx1"/> </a:fontRef> </a:style> </a:lnDef> </a:objectDefaults> <a:extraClrSchemeLst/> </a:theme>';
36953    }, {}],
36954    141: [function (require, module, exports) {
36955      (function (Buffer) {
36956        "use strict";
36957
36958        Object.defineProperty(exports, "__esModule", {
36959          value: true
36960        });
36961        exports.CsvFormatterStream = void 0;
36962
36963        var stream_1 = require("stream");
36964
36965        var formatter_1 = require("./formatter");
36966
36967        var CsvFormatterStream = /*#__PURE__*/function (_stream_1$Transform) {
36968          _inherits2(CsvFormatterStream, _stream_1$Transform);
36969
36970          var _super5 = _createSuper2(CsvFormatterStream);
36971
36972          function CsvFormatterStream(formatterOptions) {
36973            var _this10;
36974
36975            _classCallCheck2(this, CsvFormatterStream);
36976
36977            _this10 = _super5.call(this, {
36978              writableObjectMode: formatterOptions.objectMode
36979            });
36980            _this10.hasWrittenBOM = false;
36981            _this10.formatterOptions = formatterOptions;
36982            _this10.rowFormatter = new formatter_1.RowFormatter(formatterOptions); // if writeBOM is false then set to true
36983            // if writeBOM is true then set to false by default so it is written out
36984
36985            _this10.hasWrittenBOM = !formatterOptions.writeBOM;
36986            return _this10;
36987          }
36988
36989          _createClass2(CsvFormatterStream, [{
36990            key: "transform",
36991            value: function transform(transformFunction) {
36992              this.rowFormatter.rowTransform = transformFunction;
36993              return this;
36994            }
36995          }, {
36996            key: "_transform",
36997            value: function _transform(row, encoding, cb) {
36998              var _this11 = this;
36999
37000              var cbCalled = false;
37001
37002              try {
37003                if (!this.hasWrittenBOM) {
37004                  this.push(this.formatterOptions.BOM);
37005                  this.hasWrittenBOM = true;
37006                }
37007
37008                this.rowFormatter.format(row, function (err, rows) {
37009                  if (err) {
37010                    cbCalled = true;
37011                    return cb(err);
37012                  }
37013
37014                  if (rows) {
37015                    rows.forEach(function (r) {
37016                      _this11.push(Buffer.from(r, 'utf8'));
37017                    });
37018                  }
37019
37020                  cbCalled = true;
37021                  return cb();
37022                });
37023              } catch (e) {
37024                if (cbCalled) {
37025                  throw e;
37026                }
37027
37028                cb(e);
37029              }
37030            }
37031          }, {
37032            key: "_flush",
37033            value: function _flush(cb) {
37034              var _this12 = this;
37035
37036              this.rowFormatter.finish(function (err, rows) {
37037                if (err) {
37038                  return cb(err);
37039                }
37040
37041                if (rows) {
37042                  rows.forEach(function (r) {
37043                    _this12.push(Buffer.from(r, 'utf8'));
37044                  });
37045                }
37046
37047                return cb();
37048              });
37049            }
37050          }]);
37051
37052          return CsvFormatterStream;
37053        }(stream_1.Transform);
37054
37055        exports.CsvFormatterStream = CsvFormatterStream;
37056      }).call(this, require("buffer").Buffer);
37057    }, {
37058      "./formatter": 145,
37059      "buffer": 214,
37060      "stream": 481
37061    }],
37062    142: [function (require, module, exports) {
37063      "use strict";
37064
37065      Object.defineProperty(exports, "__esModule", {
37066        value: true
37067      });
37068      exports.FormatterOptions = void 0;
37069
37070      var FormatterOptions = function FormatterOptions() {
37071        var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
37072
37073        _classCallCheck2(this, FormatterOptions);
37074
37075        var _a;
37076
37077        this.objectMode = true;
37078        this.delimiter = ',';
37079        this.rowDelimiter = '\n';
37080        this.quote = '"';
37081        this.escape = this.quote;
37082        this.quoteColumns = false;
37083        this.quoteHeaders = this.quoteColumns;
37084        this.headers = null;
37085        this.includeEndRowDelimiter = false;
37086        this.writeBOM = false;
37087        this.BOM = "\uFEFF";
37088        this.alwaysWriteHeaders = false;
37089        Object.assign(this, opts || {});
37090
37091        if (typeof (opts === null || opts === void 0 ? void 0 : opts.quoteHeaders) === 'undefined') {
37092          this.quoteHeaders = this.quoteColumns;
37093        }
37094
37095        if ((opts === null || opts === void 0 ? void 0 : opts.quote) === true) {
37096          this.quote = '"';
37097        } else if ((opts === null || opts === void 0 ? void 0 : opts.quote) === false) {
37098          this.quote = '';
37099        }
37100
37101        if (typeof (opts === null || opts === void 0 ? void 0 : opts.escape) !== 'string') {
37102          this.escape = this.quote;
37103        }
37104
37105        this.shouldWriteHeaders = !!this.headers && ((_a = opts.writeHeaders) !== null && _a !== void 0 ? _a : true);
37106        this.headers = Array.isArray(this.headers) ? this.headers : null;
37107        this.escapedQuote = "".concat(this.escape).concat(this.quote);
37108      };
37109
37110      exports.FormatterOptions = FormatterOptions;
37111    }, {}],
37112    143: [function (require, module, exports) {
37113      "use strict";
37114
37115      var __importDefault = this && this.__importDefault || function (mod) {
37116        return mod && mod.__esModule ? mod : {
37117          "default": mod
37118        };
37119      };
37120
37121      Object.defineProperty(exports, "__esModule", {
37122        value: true
37123      });
37124      exports.FieldFormatter = void 0;
37125
37126      var lodash_isboolean_1 = __importDefault(require("lodash.isboolean"));
37127
37128      var lodash_isnil_1 = __importDefault(require("lodash.isnil"));
37129
37130      var lodash_escaperegexp_1 = __importDefault(require("lodash.escaperegexp"));
37131
37132      var FieldFormatter = /*#__PURE__*/function () {
37133        function FieldFormatter(formatterOptions) {
37134          _classCallCheck2(this, FieldFormatter);
37135
37136          this._headers = null;
37137          this.formatterOptions = formatterOptions;
37138
37139          if (formatterOptions.headers !== null) {
37140            this.headers = formatterOptions.headers;
37141          }
37142
37143          this.REPLACE_REGEXP = new RegExp(formatterOptions.quote, 'g');
37144          var escapePattern = "[".concat(formatterOptions.delimiter).concat(lodash_escaperegexp_1.default(formatterOptions.rowDelimiter), "|\r|\n']");
37145          this.ESCAPE_REGEXP = new RegExp(escapePattern);
37146        }
37147
37148        _createClass2(FieldFormatter, [{
37149          key: "shouldQuote",
37150          value: function shouldQuote(fieldIndex, isHeader) {
37151            var quoteConfig = isHeader ? this.formatterOptions.quoteHeaders : this.formatterOptions.quoteColumns;
37152
37153            if (lodash_isboolean_1.default(quoteConfig)) {
37154              return quoteConfig;
37155            }
37156
37157            if (Array.isArray(quoteConfig)) {
37158              return quoteConfig[fieldIndex];
37159            }
37160
37161            if (this._headers !== null) {
37162              return quoteConfig[this._headers[fieldIndex]];
37163            }
37164
37165            return false;
37166          }
37167        }, {
37168          key: "format",
37169          value: function format(field, fieldIndex, isHeader) {
37170            var preparedField = "".concat(lodash_isnil_1.default(field) ? '' : field).replace(/\0/g, '');
37171            var formatterOptions = this.formatterOptions;
37172
37173            if (formatterOptions.quote !== '') {
37174              var shouldEscape = preparedField.indexOf(formatterOptions.quote) !== -1;
37175
37176              if (shouldEscape) {
37177                return this.quoteField(preparedField.replace(this.REPLACE_REGEXP, formatterOptions.escapedQuote));
37178              }
37179            }
37180
37181            var hasEscapeCharacters = preparedField.search(this.ESCAPE_REGEXP) !== -1;
37182
37183            if (hasEscapeCharacters || this.shouldQuote(fieldIndex, isHeader)) {
37184              return this.quoteField(preparedField);
37185            }
37186
37187            return preparedField;
37188          }
37189        }, {
37190          key: "quoteField",
37191          value: function quoteField(field) {
37192            var quote = this.formatterOptions.quote;
37193            return "".concat(quote).concat(field).concat(quote);
37194          }
37195        }, {
37196          key: "headers",
37197          set: function set(headers) {
37198            this._headers = headers;
37199          }
37200        }]);
37201
37202        return FieldFormatter;
37203      }();
37204
37205      exports.FieldFormatter = FieldFormatter;
37206    }, {
37207      "lodash.escaperegexp": 403,
37208      "lodash.isboolean": 405,
37209      "lodash.isnil": 408
37210    }],
37211    144: [function (require, module, exports) {
37212      "use strict";
37213
37214      var __importDefault = this && this.__importDefault || function (mod) {
37215        return mod && mod.__esModule ? mod : {
37216          "default": mod
37217        };
37218      };
37219
37220      Object.defineProperty(exports, "__esModule", {
37221        value: true
37222      });
37223      exports.RowFormatter = void 0;
37224
37225      var lodash_isfunction_1 = __importDefault(require("lodash.isfunction"));
37226
37227      var lodash_isequal_1 = __importDefault(require("lodash.isequal"));
37228
vendor: 6,059 bytes, lines 37229-37412
37229      var FieldFormatter_1 = require("./FieldFormatter");
37230
37231      var types_1 = require("../types");
37232
37233      var RowFormatter = /*#__PURE__*/function () {
37234        function RowFormatter(formatterOptions) {
37235          _classCallCheck2(this, RowFormatter);
37236
37237          this.rowCount = 0;
37238          this.formatterOptions = formatterOptions;
37239          this.fieldFormatter = new FieldFormatter_1.FieldFormatter(formatterOptions);
37240          this.headers = formatterOptions.headers;
37241          this.shouldWriteHeaders = formatterOptions.shouldWriteHeaders;
37242          this.hasWrittenHeaders = false;
37243
37244          if (this.headers !== null) {
37245            this.fieldFormatter.headers = this.headers;
37246          }
37247
37248          if (formatterOptions.transform) {
37249            this.rowTransform = formatterOptions.transform;
37250          }
37251        }
37252
37253        _createClass2(RowFormatter, [{
37254          key: "format",
37255          value: function format(row, cb) {
37256            var _this13 = this;
37257
37258            this.callTransformer(row, function (err, transformedRow) {
37259              if (err) {
37260                return cb(err);
37261              }
37262
37263              if (!row) {
37264                return cb(null);
37265              }
37266
37267              var rows = [];
37268
37269              if (transformedRow) {
37270                var _this13$checkHeaders = _this13.checkHeaders(transformedRow),
37271                    shouldFormatColumns = _this13$checkHeaders.shouldFormatColumns,
37272                    headers = _this13$checkHeaders.headers;
37273
37274                if (_this13.shouldWriteHeaders && headers && !_this13.hasWrittenHeaders) {
37275                  rows.push(_this13.formatColumns(headers, true));
37276                  _this13.hasWrittenHeaders = true;
37277                }
37278
37279                if (shouldFormatColumns) {
37280                  var columns = _this13.gatherColumns(transformedRow);
37281
37282                  rows.push(_this13.formatColumns(columns, false));
37283                }
37284              }
37285
37286              return cb(null, rows);
37287            });
37288          }
37289        }, {
37290          key: "finish",
37291          value: function finish(cb) {
37292            var rows = []; // check if we should write headers and we didnt get any rows
37293
37294            if (this.formatterOptions.alwaysWriteHeaders && this.rowCount === 0) {
37295              if (!this.headers) {
37296                return cb(new Error('`alwaysWriteHeaders` option is set to true but `headers` option not provided.'));
37297              }
37298
37299              rows.push(this.formatColumns(this.headers, true));
37300            }
37301
37302            if (this.formatterOptions.includeEndRowDelimiter) {
37303              rows.push(this.formatterOptions.rowDelimiter);
37304            }
37305
37306            return cb(null, rows);
37307          } // check if we need to write header return true if we should also write a row
37308          // could be false if headers is true and the header row(first item) is passed in
37309
37310        }, {
37311          key: "checkHeaders",
37312          value: function checkHeaders(row) {
37313            if (this.headers) {
37314              // either the headers were provided by the user or we have already gathered them.
37315              return {
37316                shouldFormatColumns: true,
37317                headers: this.headers
37318              };
37319            }
37320
37321            var headers = RowFormatter.gatherHeaders(row);
37322            this.headers = headers;
37323            this.fieldFormatter.headers = headers;
37324
37325            if (!this.shouldWriteHeaders) {
37326              // if we are not supposed to write the headers then
37327              // always format the columns
37328              return {
37329                shouldFormatColumns: true,
37330                headers: null
37331              };
37332            } // if the row is equal to headers dont format
37333
37334
37335            return {
37336              shouldFormatColumns: !lodash_isequal_1.default(headers, row),
37337              headers: headers
37338            };
37339          } // todo change this method to unknown[]
37340
37341        }, {
37342          key: "gatherColumns",
37343          value: function gatherColumns(row) {
37344            if (this.headers === null) {
37345              throw new Error('Headers is currently null');
37346            }
37347
37348            if (!Array.isArray(row)) {
37349              return this.headers.map(function (header) {
37350                return row[header];
37351              });
37352            }
37353
37354            if (RowFormatter.isHashArray(row)) {
37355              return this.headers.map(function (header, i) {
37356                var col = row[i];
37357
37358                if (col) {
37359                  return col[1];
37360                }
37361
37362                return '';
37363              });
37364            }
37365
37366            return this.headers.map(function (header, i) {
37367              return row[i];
37368            });
37369          }
37370        }, {
37371          key: "callTransformer",
37372          value: function callTransformer(row, cb) {
37373            if (!this._rowTransform) {
37374              return cb(null, row);
37375            }
37376
37377            return this._rowTransform(row, cb);
37378          }
37379        }, {
37380          key: "formatColumns",
37381          value: function formatColumns(columns, isHeadersRow) {
37382            var _this14 = this;
37383
37384            var formattedCols = columns.map(function (field, i) {
37385              return _this14.fieldFormatter.format(field, i, isHeadersRow);
37386            }).join(this.formatterOptions.delimiter);
37387            var rowCount = this.rowCount;
37388            this.rowCount += 1;
37389
37390            if (rowCount) {
37391              return [this.formatterOptions.rowDelimiter, formattedCols].join('');
37392            }
37393
37394            return formattedCols;
37395          }
37396        }, {
37397          key: "rowTransform",
37398          set: function set(transformFunction) {
37399            if (!lodash_isfunction_1.default(transformFunction)) {
37400              throw new TypeError('The transform should be a function');
37401            }
37402
37403            this._rowTransform = RowFormatter.createTransform(transformFunction);
37404          }
37405        }], [{
37406          key: "isHashArray",
37407          value: function isHashArray(row) {
37408            if (Array.isArray(row)) {
37409              return Array.isArray(row[0]) && row[0].length === 2;
37410            }
37411
37412            return false;
37413          } // get headers from a row item
37414
37415        }, {
37416          key: "gatherHeaders",
37417          value: function gatherHeaders(row) {
37418            if (RowFormatter.isHashArray(row)) {
37419              // lets assume a multi-dimesional array with item 0 being the header
37420              return row.map(function (it) {
37421                return it[0];
37422              });
37423            }
37424
37425            if (Array.isArray(row)) {
37426              return row;
37427            }
37428
37429            return Object.keys(row);
37430          }
37431        }, {
37432          key: "createTransform",
37433          value: function createTransform(transformFunction) {
37434            if (types_1.isSyncTransform(transformFunction)) {
37435              return function (row, cb) {
37436                var transformedRow = null;
37437
37438                try {
37439                  transformedRow = transformFunction(row);
37440                } catch (e) {
37441                  return cb(e);
37442                }
37443
37444                return cb(null, transformedRow);
37445              };
37446            }
37447
37448            return function (row, cb) {
37449              transformFunction(row, cb);
37450            };
37451          }
37452        }]);
37453
37454        return RowFormatter;
37455      }();
37456
37457      exports.RowFormatter = RowFormatter;
37458    }, {
37459      "../types": 147,
37460      "./FieldFormatter": 143,
37461      "lodash.isequal": 406,
37462      "lodash.isfunction": 407
37463    }],
37464    145: [function (require, module, exports) {
37465      "use strict";
37466
37467      Object.defineProperty(exports, "__esModule", {
37468        value: true
37469      });
37470
37471      var RowFormatter_1 = require("./RowFormatter");
37472
37473      Object.defineProperty(exports, "RowFormatter", {
37474        enumerable: true,
37475        get: function get() {
37476          return RowFormatter_1.RowFormatter;
37477        }
37478      });
37479
37480      var FieldFormatter_1 = require("./FieldFormatter");
37481
37482      Object.defineProperty(exports, "FieldFormatter", {
37483        enumerable: true,
37484        get: function get() {
37485          return FieldFormatter_1.FieldFormatter;
37486        }
37487      });
37488    }, {
37489      "./FieldFormatter": 143,
37490      "./RowFormatter": 144
37491    }],
37492    146: [function (require, module, exports) {
37493      (function (Buffer) {
37494        "use strict";
37495
37496        var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
37497          if (k2 === undefined) k2 = k;
37498          Object.defineProperty(o, k2, {
37499            enumerable: true,
37500            get: function get() {
37501              return m[k];
37502            }
37503          });
37504        } : function (o, m, k, k2) {
37505          if (k2 === undefined) k2 = k;
37506          o[k2] = m[k];
37507        });
37508
37509        var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
37510          Object.defineProperty(o, "default", {
37511            enumerable: true,
37512            value: v
37513          });
37514        } : function (o, v) {
37515          o["default"] = v;
37516        });
37517
37518        var __importStar = this && this.__importStar || function (mod) {
37519          if (mod && mod.__esModule) return mod;
37520          var result = {};
37521          if (mod != null) for (var k in mod) {
37522            if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
37523          }
37524
37525          __setModuleDefault(result, mod);
37526
37527          return result;
37528        };
37529
37530        var __exportStar = this && this.__exportStar || function (m, exports) {
37531          for (var p in m) {
37532            if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
37533          }
37534        };
37535
37536        Object.defineProperty(exports, "__esModule", {
37537          value: true
37538        });
37539        exports.writeToPath = exports.writeToString = exports.writeToBuffer = exports.writeToStream = exports.write = exports.format = void 0;
37540
37541        var util_1 = require("util");
37542
37543        var stream_1 = require("stream");
37544
37545        var fs = __importStar(require("fs"));
37546
37547        var FormatterOptions_1 = require("./FormatterOptions");
37548
37549        var CsvFormatterStream_1 = require("./CsvFormatterStream");
37550
37551        __exportStar(require("./types"), exports);
37552
37553        var CsvFormatterStream_2 = require("./CsvFormatterStream");
37554
37555        Object.defineProperty(exports, "CsvFormatterStream", {
37556          enumerable: true,
37557          get: function get() {
37558            return CsvFormatterStream_2.CsvFormatterStream;
37559          }
37560        });
37561
37562        var FormatterOptions_2 = require("./FormatterOptions");
37563
37564        Object.defineProperty(exports, "FormatterOptions", {
37565          enumerable: true,
37566          get: function get() {
37567            return FormatterOptions_2.FormatterOptions;
37568          }
37569        });
37570
37571        exports.format = function (options) {
37572          return new CsvFormatterStream_1.CsvFormatterStream(new FormatterOptions_1.FormatterOptions(options));
37573        };
37574
37575        exports.write = function (rows, options) {
37576          var csvStream = exports.format(options);
37577          var promiseWrite = util_1.promisify(function (row, cb) {
37578            csvStream.write(row, undefined, cb);
37579          });
37580          rows.reduce(function (prev, row) {
37581            return prev.then(function () {
37582              return promiseWrite(row);
37583            });
37584          }, Promise.resolve()).then(function () {
37585            return csvStream.end();
37586          }).catch(function (err) {
37587            csvStream.emit('error', err);
37588          });
37589          return csvStream;
37590        };
37591
37592        exports.writeToStream = function (ws, rows, options) {
37593          return exports.write(rows, options).pipe(ws);
37594        };
37595
37596        exports.writeToBuffer = function (rows) {
37597          var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
37598          var buffers = [];
37599          var ws = new stream_1.Writable({
37600            write: function write(data, enc, writeCb) {
37601              buffers.push(data);
37602              writeCb();
37603            }
37604          });
37605          return new Promise(function (res, rej) {
37606            ws.on('error', rej).on('finish', function () {
37607              return res(Buffer.concat(buffers));
37608            });
37609            exports.write(rows, opts).pipe(ws);
37610          });
37611        };
37612
37613        exports.writeToString = function (rows, options) {
37614          return exports.writeToBuffer(rows, options).then(function (buffer) {
37615            return buffer.toString();
37616          });
37617        };
37618
37619        exports.writeToPath = function (path, rows, options) {
37620          var stream = fs.createWriteStream(path, {
37621            encoding: 'utf8'
37622          });
37623          return exports.write(rows, options).pipe(stream);
37624        };
37625      }).call(this, require("buffer").Buffer);
37626    }, {
37627      "./CsvFormatterStream": 141,
37628      "./FormatterOptions": 142,
37629      "./types": 147,
37630      "buffer": 214,
37631      "fs": 213,
37632      "stream": 481,
37633      "util": 500
37634    }],
37635    147: [function (require, module, exports) {
37636      "use strict";
37637      /* eslint-disable @typescript-eslint/no-explicit-any */
37638
37639      Object.defineProperty(exports, "__esModule", {
37640        value: true
37641      });
37642      exports.isSyncTransform = void 0;
37643
37644      exports.isSyncTransform = function (transform) {
37645        return transform.length === 1;
37646      };
37647    }, {}],
37648    148: [function (require, module, exports) {
37649      (function (setImmediate) {
37650        "use strict";
37651
37652        Object.defineProperty(exports, "__esModule", {
37653          value: true
37654        });
37655        exports.CsvParserStream = void 0;
37656
37657        var string_decoder_1 = require("string_decoder");
37658
37659        var stream_1 = require("stream");
37660
37661        var transforms_1 = require("./transforms");
37662
37663        var parser_1 = require("./parser");
37664
37665        var CsvParserStream = /*#__PURE__*/function (_stream_1$Transform2) {
37666          _inherits2(CsvParserStream, _stream_1$Transform2);
37667
37668          var _super6 = _createSuper2(CsvParserStream);
37669
37670          function CsvParserStream(parserOptions) {
37671            var _this15;
37672
37673            _classCallCheck2(this, CsvParserStream);
37674
37675            _this15 = _super6.call(this, {
37676              objectMode: parserOptions.objectMode
37677            });
37678            _this15.lines = '';
37679            _this15.rowCount = 0;
37680            _this15.parsedRowCount = 0;
37681            _this15.parsedLineCount = 0;
37682            _this15.endEmitted = false;
37683            _this15.headersEmitted = false;
37684            _this15.parserOptions = parserOptions;
37685            _this15.parser = new parser_1.Parser(parserOptions);
37686            _this15.headerTransformer = new transforms_1.HeaderTransformer(parserOptions);
37687            _this15.decoder = new string_decoder_1.StringDecoder(parserOptions.encoding);
37688            _this15.rowTransformerValidator = new transforms_1.RowTransformerValidator();
37689            return _this15;
37690          }
37691
37692          _createClass2(CsvParserStream, [{
37693            key: "transform",
37694            value: function transform(transformFunction) {
37695              this.rowTransformerValidator.rowTransform = transformFunction;
37696              return this;
37697            }
37698          }, {
37699            key: "validate",
37700            value: function validate(validateFunction) {
37701              this.rowTransformerValidator.rowValidator = validateFunction;
37702              return this;
37703            } // eslint-disable-next-line @typescript-eslint/no-explicit-any
37704
37705          }, {
37706            key: "emit",
37707            value: function emit(event) {
37708              var _get2;
37709
37710              if (event === 'end') {
37711                if (!this.endEmitted) {
37712                  this.endEmitted = true;
37713
37714                  _get(_getPrototypeOf2(CsvParserStream.prototype), "emit", this).call(this, 'end', this.rowCount);
37715                }
37716
37717                return false;
37718              }
37719
37720              for (var _len6 = arguments.length, rest = new Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) {
37721                rest[_key6 - 1] = arguments[_key6];
37722              }
37723
37724              return (_get2 = _get(_getPrototypeOf2(CsvParserStream.prototype), "emit", this)).call.apply(_get2, [this, event].concat(rest));
37725            }
37726          }, {
37727            key: "_transform",
37728            value: function _transform(data, encoding, done) {
37729              // if we have hit our maxRows parsing limit then skip parsing
37730              if (this.hasHitRowLimit) {
37731                return done();
37732              }
37733
37734              try {
37735                var lines = this.lines;
37736                var newLine = lines + this.decoder.write(data);
37737                var rows = this.parse(newLine, true);
37738                return this.processRows(rows, done);
37739              } catch (e) {
37740                return this.destroy(e);
37741              }
37742            }
37743          }, {
37744            key: "_flush",
37745            value: function _flush(done) {
37746              // if we have hit our maxRows parsing limit then skip parsing
37747              if (this.hasHitRowLimit) {
37748                return done();
37749              }
37750
37751              try {
37752                var newLine = this.lines + this.decoder.end();
37753                var rows = this.parse(newLine, false);
37754                return this.processRows(rows, done);
37755              } catch (e) {
37756                return done(e);
37757              }
37758            }
37759          }, {
37760            key: "parse",
37761            value: function parse(data, hasMoreData) {
37762              if (!data) {
37763                return [];
37764              }
37765
37766              var _this$parser$parse = this.parser.parse(data, hasMoreData),
37767                  line = _this$parser$parse.line,
37768                  rows = _this$parser$parse.rows;
37769
37770              this.lines = line;
37771              return rows;
37772            }
37773          }, {
37774            key: "processRows",
37775            value: function processRows(rows, cb) {
37776              var _this16 = this;
37777
37778              var rowsLength = rows.length;
37779
37780              var iterate = function iterate(i) {
37781                var callNext = function callNext(err) {
37782                  if (err) {
37783                    return _this16.destroy(err);
37784                  }
37785
37786                  if (i % 100 === 0) {
37787                    // incase the transform are sync insert a next tick to prevent stack overflow
37788                    setImmediate(function () {
37789                      return iterate(i + 1);
37790                    });
37791                    return undefined;
37792                  }
37793
37794                  return iterate(i + 1);
37795                };
37796
37797                _this16.checkAndEmitHeaders(); // if we have emitted all rows or we have hit the maxRows limit option
37798                // then end
37799
37800
37801                if (i >= rowsLength || _this16.hasHitRowLimit) {
37802                  return cb();
37803                }
37804
37805                _this16.parsedLineCount += 1;
37806
37807                if (_this16.shouldSkipLine) {
37808                  return callNext();
37809                }
37810
37811                var row = rows[i];
37812                _this16.rowCount += 1;
37813                _this16.parsedRowCount += 1;
37814                var nextRowCount = _this16.rowCount;
37815                return _this16.transformRow(row, function (err, transformResult) {
37816                  if (err) {
37817                    _this16.rowCount -= 1;
37818                    return callNext(err);
37819                  }
37820
37821                  if (!transformResult) {
37822                    return callNext(new Error('expected transform result'));
37823                  }
37824
37825                  if (!transformResult.isValid) {
37826                    _this16.emit('data-invalid', transformResult.row, nextRowCount, transformResult.reason);
37827                  } else if (transformResult.row) {
37828                    return _this16.pushRow(transformResult.row, callNext);
37829                  }
37830
37831                  return callNext();
37832                });
37833              };
37834
37835              iterate(0);
37836            }
37837          }, {
37838            key: "transformRow",
37839            value: function transformRow(parsedRow, cb) {
37840              var _this17 = this;
37841
37842              try {
37843                this.headerTransformer.transform(parsedRow, function (err, withHeaders) {
37844                  if (err) {
37845                    return cb(err);
37846                  }
37847
37848                  if (!withHeaders) {
37849                    return cb(new Error('Expected result from header transform'));
37850                  }
37851
37852                  if (!withHeaders.isValid) {
37853                    if (_this17.shouldEmitRows) {
37854                      return cb(null, {
37855                        isValid: false,
37856                        row: parsedRow
37857                      });
37858                    } // skipped because of skipRows option remove from total row count
37859
37860
37861                    return _this17.skipRow(cb);
37862                  }
37863
37864                  if (withHeaders.row) {
37865                    if (_this17.shouldEmitRows) {
37866                      return _this17.rowTransformerValidator.transformAndValidate(withHeaders.row, cb);
37867                    } // skipped because of skipRows option remove from total row count
37868
37869
37870                    return _this17.skipRow(cb);
37871                  } // this is a header row dont include in the rowCount or parsedRowCount
37872
37873
37874                  _this17.rowCount -= 1;
37875                  _this17.parsedRowCount -= 1;
37876                  return cb(null, {
37877                    row: null,
37878                    isValid: true
37879                  });
37880                });
37881              } catch (e) {
37882                cb(e);
37883              }
37884            }
37885          }, {
37886            key: "checkAndEmitHeaders",
37887            value: function checkAndEmitHeaders() {
37888              if (!this.headersEmitted && this.headerTransformer.headers) {
37889                this.headersEmitted = true;
37890                this.emit('headers', this.headerTransformer.headers);
37891              }
37892            }
37893          }, {
37894            key: "skipRow",
37895            value: function skipRow(cb) {
37896              // skipped because of skipRows option remove from total row count
37897              this.rowCount -= 1;
37898              return cb(null, {
37899                row: null,
37900                isValid: true
37901              });
37902            }
37903          }, {
37904            key: "pushRow",
37905            value: function pushRow(row, cb) {
37906              try {
37907                if (!this.parserOptions.objectMode) {
37908                  this.push(JSON.stringify(row));
37909                } else {
37910                  this.push(row);
37911                }
37912
37913                cb();
37914              } catch (e) {
37915                cb(e);
37916              }
37917            }
37918          }, {
37919            key: "hasHitRowLimit",
37920            get: function get() {
37921              return this.parserOptions.limitRows && this.rowCount >= this.parserOptions.maxRows;
37922            }
37923          }, {
37924            key: "shouldEmitRows",
37925            get: function get() {
37926              return this.parsedRowCount > this.parserOptions.skipRows;
37927            }
37928          }, {
37929            key: "shouldSkipLine",
37930            get: function get() {
37931              return this.parsedLineCount <= this.parserOptions.skipLines;
37932            }
37933          }]);
37934
37935          return CsvParserStream;
37936        }(stream_1.Transform);
37937
37938        exports.CsvParserStream = CsvParserStream;
37939      }).call(this, require("timers").setImmediate);
37940    }, {
37941      "./parser": 160,
37942      "./transforms": 163,
37943      "stream": 481,
37944      "string_decoder": 495,
37945      "timers": 496
37946    }],
37947    149: [function (require, module, exports) {
37948      "use strict";
37949
37950      var __importDefault = this && this.__importDefault || function (mod) {
37951        return mod && mod.__esModule ? mod : {
37952          "default": mod
37953        };
37954      };
37955
37956      Object.defineProperty(exports, "__esModule", {
37957        value: true
37958      });
37959      exports.ParserOptions = void 0;
37960
37961      var lodash_escaperegexp_1 = __importDefault(require("lodash.escaperegexp"));
37962
37963      var lodash_isnil_1 = __importDefault(require("lodash.isnil"));
37964
37965      var ParserOptions = function ParserOptions(opts) {
37966        _classCallCheck2(this, ParserOptions);
37967
37968        var _a;
37969
37970        this.objectMode = true;
37971        this.delimiter = ',';
37972        this.ignoreEmpty = false;
37973        this.quote = '"';
37974        this.escape = null;
37975        this.escapeChar = this.quote;
37976        this.comment = null;
37977        this.supportsComments = false;
37978        this.ltrim = false;
37979        this.rtrim = false;
37980        this.trim = false;
37981        this.headers = null;
37982        this.renameHeaders = false;
37983        this.strictColumnHandling = false;
37984        this.discardUnmappedColumns = false;
37985        this.carriageReturn = '\r';
37986        this.encoding = 'utf8';
37987        this.limitRows = false;
37988        this.maxRows = 0;
37989        this.skipLines = 0;
37990        this.skipRows = 0;
37991        Object.assign(this, opts || {});
37992
37993        if (this.delimiter.length > 1) {
37994          throw new Error('delimiter option must be one character long');
37995        }
37996
37997        this.escapedDelimiter = lodash_escaperegexp_1.default(this.delimiter);
37998        this.escapeChar = (_a = this.escape) !== null && _a !== void 0 ? _a : this.quote;
37999        this.supportsComments = !lodash_isnil_1.default(this.comment);
38000        this.NEXT_TOKEN_REGEXP = new RegExp("([^\\s]|\\r\\n|\\n|\\r|".concat(this.escapedDelimiter, ")"));
38001
38002        if (this.maxRows > 0) {
38003          this.limitRows = true;
38004        }
38005      };
38006
38007      exports.ParserOptions = ParserOptions;
38008    }, {
38009      "lodash.escaperegexp": 403,
38010      "lodash.isnil": 408
38011    }],
38012    150: [function (require, module, exports) {
38013      "use strict";
38014
38015      var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
38016        if (k2 === undefined) k2 = k;
38017        Object.defineProperty(o, k2, {
38018          enumerable: true,
38019          get: function get() {
38020            return m[k];
38021          }
38022        });
38023      } : function (o, m, k, k2) {
38024        if (k2 === undefined) k2 = k;
38025        o[k2] = m[k];
38026      });
38027
38028      var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
38029        Object.defineProperty(o, "default", {
38030          enumerable: true,
38031          value: v
38032        });
38033      } : function (o, v) {
38034        o["default"] = v;
38035      });
38036
38037      var __importStar = this && this.__importStar || function (mod) {
38038        if (mod && mod.__esModule) return mod;
38039        var result = {};
38040        if (mod != null) for (var k in mod) {
38041          if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
38042        }
38043
38044        __setModuleDefault(result, mod);
38045
38046        return result;
38047      };
38048
38049      var __exportStar = this && this.__exportStar || function (m, exports) {
38050        for (var p in m) {
38051          if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
38052        }
38053      };
38054
38055      Object.defineProperty(exports, "__esModule", {
38056        value: true
38057      });
38058      exports.parseString = exports.parseFile = exports.parseStream = exports.parse = void 0;
38059
38060      var fs = __importStar(require("fs"));
38061
38062      var stream_1 = require("stream");
38063
38064      var ParserOptions_1 = require("./ParserOptions");
38065
38066      var CsvParserStream_1 = require("./CsvParserStream");
38067
38068      __exportStar(require("./types"), exports);
38069
38070      var CsvParserStream_2 = require("./CsvParserStream");
38071
38072      Object.defineProperty(exports, "CsvParserStream", {
38073        enumerable: true,
38074        get: function get() {
38075          return CsvParserStream_2.CsvParserStream;
38076        }
38077      });
38078
38079      var ParserOptions_2 = require("./ParserOptions");
38080
38081      Object.defineProperty(exports, "ParserOptions", {
38082        enumerable: true,
38083        get: function get() {
38084          return ParserOptions_2.ParserOptions;
38085        }
38086      });
38087
38088      exports.parse = function (args) {
38089        return new CsvParserStream_1.CsvParserStream(new ParserOptions_1.ParserOptions(args));
38090      };
38091
38092      exports.parseStream = function (stream, options) {
38093        return stream.pipe(new CsvParserStream_1.CsvParserStream(new ParserOptions_1.ParserOptions(options)));
38094      };
38095
38096      exports.parseFile = function (location) {
38097        var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
38098        return fs.createReadStream(location).pipe(new CsvParserStream_1.CsvParserStream(new ParserOptions_1.ParserOptions(options)));
38099      };
38100
38101      exports.parseString = function (string, options) {
38102        var rs = new stream_1.Readable();
38103        rs.push(string);
38104        rs.push(null);
38105        return rs.pipe(new CsvParserStream_1.CsvParserStream(new ParserOptions_1.ParserOptions(options)));
38106      };
38107    }, {
vendor: 4,908 bytes, lines 38108-38278
38108      "./CsvParserStream": 148,
38109      "./ParserOptions": 149,
38110      "./types": 164,
38111      "fs": 213,
38112      "stream": 481
38113    }],
38114    151: [function (require, module, exports) {
38115      "use strict";
38116
38117      Object.defineProperty(exports, "__esModule", {
38118        value: true
38119      });
38120      exports.Parser = void 0;
38121
38122      var Scanner_1 = require("./Scanner");
38123
38124      var RowParser_1 = require("./RowParser");
38125
38126      var Token_1 = require("./Token");
38127
38128      var EMPTY_ROW_REGEXP = /^\s*(?:''|"")?\s*(?:,\s*(?:''|"")?\s*)*$/;
38129
38130      var Parser = /*#__PURE__*/function () {
38131        function Parser(parserOptions) {
38132          _classCallCheck2(this, Parser);
38133
38134          this.parserOptions = parserOptions;
38135          this.rowParser = new RowParser_1.RowParser(this.parserOptions);
38136        }
38137
38138        _createClass2(Parser, [{
38139          key: "parse",
38140          value: function parse(line, hasMoreData) {
38141            var scanner = new Scanner_1.Scanner({
38142              line: Parser.removeBOM(line),
38143              parserOptions: this.parserOptions,
38144              hasMoreData: hasMoreData
38145            });
38146
38147            if (this.parserOptions.supportsComments) {
38148              return this.parseWithComments(scanner);
38149            }
38150
38151            return this.parseWithoutComments(scanner);
38152          }
38153        }, {
38154          key: "parseWithoutComments",
38155          value: function parseWithoutComments(scanner) {
38156            var rows = [];
38157            var shouldContinue = true;
38158
38159            while (shouldContinue) {
38160              shouldContinue = this.parseRow(scanner, rows);
38161            }
38162
38163            return {
38164              line: scanner.line,
38165              rows: rows
38166            };
38167          }
38168        }, {
38169          key: "parseWithComments",
38170          value: function parseWithComments(scanner) {
38171            var parserOptions = this.parserOptions;
38172            var rows = [];
38173
38174            for (var nextToken = scanner.nextCharacterToken; nextToken !== null; nextToken = scanner.nextCharacterToken) {
38175              if (Token_1.Token.isTokenComment(nextToken, parserOptions)) {
38176                var cursor = scanner.advancePastLine();
38177
38178                if (cursor === null) {
38179                  return {
38180                    line: scanner.lineFromCursor,
38181                    rows: rows
38182                  };
38183                }
38184
38185                if (!scanner.hasMoreCharacters) {
38186                  return {
38187                    line: scanner.lineFromCursor,
38188                    rows: rows
38189                  };
38190                }
38191
38192                scanner.truncateToCursor();
38193              } else if (!this.parseRow(scanner, rows)) {
38194                break;
38195              }
38196            }
38197
38198            return {
38199              line: scanner.line,
38200              rows: rows
38201            };
38202          }
38203        }, {
38204          key: "parseRow",
38205          value: function parseRow(scanner, rows) {
38206            var nextToken = scanner.nextNonSpaceToken;
38207
38208            if (!nextToken) {
38209              return false;
38210            }
38211
38212            var row = this.rowParser.parse(scanner);
38213
38214            if (row === null) {
38215              return false;
38216            }
38217
38218            if (this.parserOptions.ignoreEmpty && EMPTY_ROW_REGEXP.test(row.join(''))) {
38219              return true;
38220            }
38221
38222            rows.push(row);
38223            return true;
38224          }
38225        }], [{
38226          key: "removeBOM",
38227          value: function removeBOM(line) {
38228            // Catches EFBBBF (UTF-8 BOM) because the buffer-to-string
38229            // conversion translates it to FEFF (UTF-16 BOM)
38230            if (line && line.charCodeAt(0) === 0xfeff) {
38231              return line.slice(1);
38232            }
38233
38234            return line;
38235          }
38236        }]);
38237
38238        return Parser;
38239      }();
38240
38241      exports.Parser = Parser;
38242    }, {
38243      "./RowParser": 152,
38244      "./Scanner": 153,
38245      "./Token": 154
38246    }],
38247    152: [function (require, module, exports) {
38248      "use strict";
38249
38250      Object.defineProperty(exports, "__esModule", {
38251        value: true
38252      });
38253      exports.RowParser = void 0;
38254
38255      var column_1 = require("./column");
38256
38257      var Token_1 = require("./Token");
38258
38259      var _Token_1$Token = Token_1.Token,
38260          isTokenRowDelimiter = _Token_1$Token.isTokenRowDelimiter,
38261          isTokenCarriageReturn = _Token_1$Token.isTokenCarriageReturn,
38262          isTokenDelimiter = _Token_1$Token.isTokenDelimiter;
38263
38264      var RowParser = /*#__PURE__*/function () {
38265        function RowParser(parserOptions) {
38266          _classCallCheck2(this, RowParser);
38267
38268          this.parserOptions = parserOptions;
38269          this.columnParser = new column_1.ColumnParser(parserOptions);
38270        }
38271
38272        _createClass2(RowParser, [{
38273          key: "parse",
38274          value: function parse(scanner) {
38275            var parserOptions = this.parserOptions;
38276            var hasMoreData = scanner.hasMoreData;
38277            var currentScanner = scanner;
38278            var columns = [];
38279            var currentToken = this.getStartToken(currentScanner, columns);
38280
38281            while (currentToken) {
38282              if (isTokenRowDelimiter(currentToken)) {
38283                currentScanner.advancePastToken(currentToken); // if ends with CR and there is more data, keep unparsed due to possible
38284                // coming LF in CRLF
38285
38286                if (!currentScanner.hasMoreCharacters && isTokenCarriageReturn(currentToken, parserOptions) && hasMoreData) {
38287                  return null;
38288                }
38289
38290                currentScanner.truncateToCursor();
38291                return columns;
38292              }
38293
38294              if (!this.shouldSkipColumnParse(currentScanner, currentToken, columns)) {
38295                var item = this.columnParser.parse(currentScanner);
38296
38297                if (item === null) {
38298                  return null;
38299                }
38300
38301                columns.push(item);
38302              }
38303
38304              currentToken = currentScanner.nextNonSpaceToken;
38305            }
38306
38307            if (!hasMoreData) {
38308              currentScanner.truncateToCursor();
38309              return columns;
38310            }
38311
38312            return null;
38313          }
38314        }, {
38315          key: "getStartToken",
38316          value: function getStartToken(scanner, columns) {
38317            var currentToken = scanner.nextNonSpaceToken;
38318
38319            if (currentToken !== null && isTokenDelimiter(currentToken, this.parserOptions)) {
38320              columns.push('');
38321              return scanner.nextNonSpaceToken;
38322            }
38323
38324            return currentToken;
38325          }
38326        }, {
38327          key: "shouldSkipColumnParse",
38328          value: function shouldSkipColumnParse(scanner, currentToken, columns) {
38329            var parserOptions = this.parserOptions;
38330
38331            if (isTokenDelimiter(currentToken, parserOptions)) {
38332              scanner.advancePastToken(currentToken); // if the delimiter is at the end of a line
38333
38334              var nextToken = scanner.nextCharacterToken;
38335
38336              if (!scanner.hasMoreCharacters || nextToken !== null && isTokenRowDelimiter(nextToken)) {
38337                columns.push('');
38338                return true;
38339              }
38340
38341              if (nextToken !== null && isTokenDelimiter(nextToken, parserOptions)) {
38342                columns.push('');
38343                return true;
38344              }
38345            }
38346
38347            return false;
38348          }
38349        }]);
38350
38351        return RowParser;
38352      }();
38353
38354      exports.RowParser = RowParser;
38355    }, {
38356      "./Token": 154,
38357      "./column": 159
38358    }],
38359    153: [function (require, module, exports) {
38360      "use strict";
38361
38362      Object.defineProperty(exports, "__esModule", {
38363        value: true
38364      });
38365      exports.Scanner = void 0;
38366
38367      var Token_1 = require("./Token");
38368
38369      var ROW_DELIMITER = /((?:\r\n)|\n|\r)/;
38370
38371      var Scanner = /*#__PURE__*/function () {
38372        function Scanner(args) {
38373          _classCallCheck2(this, Scanner);
38374
38375          this.cursor = 0;
38376          this.line = args.line;
38377          this.lineLength = this.line.length;
38378          this.parserOptions = args.parserOptions;
38379          this.hasMoreData = args.hasMoreData;
38380          this.cursor = args.cursor || 0;
38381        }
38382
38383        _createClass2(Scanner, [{
38384          key: "advancePastLine",
38385          value: function advancePastLine() {
38386            var match = ROW_DELIMITER.exec(this.lineFromCursor);
38387
38388            if (!match) {
38389              if (this.hasMoreData) {
38390                return null;
38391              }
38392
38393              this.cursor = this.lineLength;
38394              return this;
38395            }
38396
38397            this.cursor += (match.index || 0) + match[0].length;
38398            return this;
38399          }
38400        }, {
38401          key: "advanceTo",
38402          value: function advanceTo(cursor) {
38403            this.cursor = cursor;
38404            return this;
38405          }
38406        }, {
38407          key: "advanceToToken",
38408          value: function advanceToToken(token) {
38409            this.cursor = token.startCursor;
38410            return this;
38411          }
38412        }, {
38413          key: "advancePastToken",
38414          value: function advancePastToken(token) {
38415            this.cursor = token.endCursor + 1;
38416            return this;
38417          }
38418        }, {
38419          key: "truncateToCursor",
38420          value: function truncateToCursor() {
38421            this.line = this.lineFromCursor;
38422            this.lineLength = this.line.length;
38423            this.cursor = 0;
38424            return this;
38425          }
38426        }, {
38427          key: "hasMoreCharacters",
38428          get: function get() {
38429            return this.lineLength > this.cursor;
38430          }
38431        }, {
38432          key: "nextNonSpaceToken",
38433          get: function get() {
38434            var lineFromCursor = this.lineFromCursor;
38435            var regex = this.parserOptions.NEXT_TOKEN_REGEXP;
38436
38437            if (lineFromCursor.search(regex) === -1) {
38438              return null;
38439            }
38440
38441            var match = regex.exec(lineFromCursor);
38442
38443            if (match == null) {
38444              return null;
38445            }
38446
38447            var token = match[1];
38448            var startCursor = this.cursor + (match.index || 0);
38449            return new Token_1.Token({
38450              token: token,
38451              startCursor: startCursor,
38452              endCursor: startCursor + token.length - 1
38453            });
38454          }
38455        }, {
38456          key: "nextCharacterToken",
38457          get: function get() {
38458            var cursor = this.cursor,
38459                lineLength = this.lineLength;
38460
38461            if (lineLength <= cursor) {
38462              return null;
38463            }
38464
38465            return new Token_1.Token({
38466              token: this.line[cursor],
38467              startCursor: cursor,
38468              endCursor: cursor
38469            });
38470          }
38471        }, {
38472          key: "lineFromCursor",
38473          get: function get() {
38474            return this.line.substr(this.cursor);
38475          }
38476        }]);
38477
38478        return Scanner;
38479      }();
38480
38481      exports.Scanner = Scanner;
38482    }, {
38483      "./Token": 154
38484    }],
38485    154: [function (require, module, exports) {
38486      "use strict";
38487
38488      Object.defineProperty(exports, "__esModule", {
38489        value: true
38490      });
38491      exports.Token = void 0;
38492
38493      var Token = /*#__PURE__*/function () {
38494        function Token(tokenArgs) {
38495          _classCallCheck2(this, Token);
38496
38497          this.token = tokenArgs.token;
38498          this.startCursor = tokenArgs.startCursor;
38499          this.endCursor = tokenArgs.endCursor;
38500        }
38501
38502        _createClass2(Token, null, [{
38503          key: "isTokenRowDelimiter",
38504          value: function isTokenRowDelimiter(token) {
38505            var content = token.token;
38506            return content === '\r' || content === '\n' || content === '\r\n';
38507          }
38508        }, {
38509          key: "isTokenCarriageReturn",
38510          value: function isTokenCarriageReturn(token, parserOptions) {
38511            return token.token === parserOptions.carriageReturn;
38512          }
38513        }, {
38514          key: "isTokenComment",
38515          value: function isTokenComment(token, parserOptions) {
38516            return parserOptions.supportsComments && !!token && token.token === parserOptions.comment;
38517          }
38518        }, {
38519          key: "isTokenEscapeCharacter",
38520          value: function isTokenEscapeCharacter(token, parserOptions) {
38521            return token.token === parserOptions.escapeChar;
38522          }
38523        }, {
38524          key: "isTokenQuote",
38525          value: function isTokenQuote(token, parserOptions) {
38526            return token.token === parserOptions.quote;
38527          }
38528        }, {
38529          key: "isTokenDelimiter",
38530          value: function isTokenDelimiter(token, parserOptions) {
38531            return token.token === parserOptions.delimiter;
38532          }
38533        }]);
38534
38535        return Token;
38536      }();
38537
38538      exports.Token = Token;
38539    }, {}],
38540    155: [function (require, module, exports) {
38541      "use strict";
38542
38543      Object.defineProperty(exports, "__esModule", {
38544        value: true
38545      });
38546      exports.ColumnFormatter = void 0;
38547
38548      var ColumnFormatter = function ColumnFormatter(parserOptions) {
38549        _classCallCheck2(this, ColumnFormatter);
38550
38551        if (parserOptions.trim) {
38552          this.format = function (col) {
38553            return col.trim();
38554          };
38555        } else if (parserOptions.ltrim) {
38556          this.format = function (col) {
38557            return col.trimLeft();
38558          };
38559        } else if (parserOptions.rtrim) {
38560          this.format = function (col) {
38561            return col.trimRight();
38562          };
38563        } else {
38564          this.format = function (col) {
38565            return col;
38566          };
38567        }
38568      };
38569
38570      exports.ColumnFormatter = ColumnFormatter;
38571    }, {}],
38572    156: [function (require, module, exports) {
38573      "use strict";
38574
38575      Object.defineProperty(exports, "__esModule", {
38576        value: true
38577      });
38578      exports.ColumnParser = void 0;
38579
38580      var NonQuotedColumnParser_1 = require("./NonQuotedColumnParser");
38581
38582      var QuotedColumnParser_1 = require("./QuotedColumnParser");
38583
38584      var Token_1 = require("../Token");
38585
38586      var ColumnParser = /*#__PURE__*/function () {
38587        function ColumnParser(parserOptions) {
38588          _classCallCheck2(this, ColumnParser);
38589
38590          this.parserOptions = parserOptions;
38591          this.quotedColumnParser = new QuotedColumnParser_1.QuotedColumnParser(parserOptions);
38592          this.nonQuotedColumnParser = new NonQuotedColumnParser_1.NonQuotedColumnParser(parserOptions);
38593        }
38594
38595        _createClass2(ColumnParser, [{
38596          key: "parse",
38597          value: function parse(scanner) {
38598            var nextNonSpaceToken = scanner.nextNonSpaceToken;
38599
38600            if (nextNonSpaceToken !== null && Token_1.Token.isTokenQuote(nextNonSpaceToken, this.parserOptions)) {
38601              scanner.advanceToToken(nextNonSpaceToken);
38602              return this.quotedColumnParser.parse(scanner);
38603            }
38604
38605            return this.nonQuotedColumnParser.parse(scanner);
38606          }
38607        }]);
38608
38609        return ColumnParser;
38610      }();
38611
38612      exports.ColumnParser = ColumnParser;
38613    }, {
38614      "../Token": 154,
38615      "./NonQuotedColumnParser": 157,
38616      "./QuotedColumnParser": 158
38617    }],
38618    157: [function (require, module, exports) {
38619      "use strict";
38620
38621      Object.defineProperty(exports, "__esModule", {
38622        value: true
38623      });
38624      exports.NonQuotedColumnParser = void 0;
38625
38626      var ColumnFormatter_1 = require("./ColumnFormatter");
38627
38628      var Token_1 = require("../Token");
38629
38630      var _Token_1$Token2 = Token_1.Token,
38631          isTokenDelimiter = _Token_1$Token2.isTokenDelimiter,
38632          isTokenRowDelimiter = _Token_1$Token2.isTokenRowDelimiter;
38633
38634      var NonQuotedColumnParser = /*#__PURE__*/function () {
38635        function NonQuotedColumnParser(parserOptions) {
38636          _classCallCheck2(this, NonQuotedColumnParser);
38637
38638          this.parserOptions = parserOptions;
38639          this.columnFormatter = new ColumnFormatter_1.ColumnFormatter(parserOptions);
38640        }
38641
38642        _createClass2(NonQuotedColumnParser, [{
38643          key: "parse",
38644          value: function parse(scanner) {
38645            if (!scanner.hasMoreCharacters) {
38646              return null;
38647            }
38648
38649            var parserOptions = this.parserOptions;
38650            var characters = [];
38651            var nextToken = scanner.nextCharacterToken;
38652
38653            for (; nextToken; nextToken = scanner.nextCharacterToken) {
38654              if (isTokenDelimiter(nextToken, parserOptions) || isTokenRowDelimiter(nextToken)) {
38655                break;
38656              }
38657
38658              characters.push(nextToken.token);
38659              scanner.advancePastToken(nextToken);
38660            }
38661
38662            return this.columnFormatter.format(characters.join(''));
38663          }
38664        }]);
38665
38666        return NonQuotedColumnParser;
38667      }();
38668
38669      exports.NonQuotedColumnParser = NonQuotedColumnParser;
38670    }, {
38671      "../Token": 154,
38672      "./ColumnFormatter": 155
38673    }],
38674    158: [function (require, module, exports) {
38675      "use strict";
38676
38677      Object.defineProperty(exports, "__esModule", {
38678        value: true
38679      });
38680      exports.QuotedColumnParser = void 0;
38681
38682      var ColumnFormatter_1 = require("./ColumnFormatter");
38683
38684      var Token_1 = require("../Token");
38685
38686      var _Token_1$Token3 = Token_1.Token,
38687          isTokenDelimiter = _Token_1$Token3.isTokenDelimiter,
38688          isTokenRowDelimiter = _Token_1$Token3.isTokenRowDelimiter,
38689          isTokenEscapeCharacter = _Token_1$Token3.isTokenEscapeCharacter,
38690          isTokenQuote = _Token_1$Token3.isTokenQuote;
38691
38692      var QuotedColumnParser = /*#__PURE__*/function () {
38693        function QuotedColumnParser(parserOptions) {
38694          _classCallCheck2(this, QuotedColumnParser);
38695
38696          this.parserOptions = parserOptions;
38697          this.columnFormatter = new ColumnFormatter_1.ColumnFormatter(parserOptions);
38698        }
38699
38700        _createClass2(QuotedColumnParser, [{
38701          key: "parse",
38702          value: function parse(scanner) {
38703            if (!scanner.hasMoreCharacters) {
38704              return null;
38705            }
38706
38707            var originalCursor = scanner.cursor;
38708
38709            var _this$gatherDataBetwe = this.gatherDataBetweenQuotes(scanner),
38710                foundClosingQuote = _this$gatherDataBetwe.foundClosingQuote,
38711                col = _this$gatherDataBetwe.col;
38712
38713            if (!foundClosingQuote) {
38714              // reset the cursor to the original
38715              scanner.advanceTo(originalCursor); // if we didnt find a closing quote but we potentially have more data then skip the parsing
38716              // and return the original scanner.
38717
38718              if (!scanner.hasMoreData) {
38719                throw new Error("Parse Error: missing closing: '".concat(this.parserOptions.quote || '', "' in line: at '").concat(scanner.lineFromCursor.replace(/[\r\n]/g, "\\n'"), "'"));
38720              }
38721
38722              return null;
38723            }
38724
38725            this.checkForMalformedColumn(scanner);
38726            return col;
38727          }
38728        }, {
38729          key: "gatherDataBetweenQuotes",
38730          value: function gatherDataBetweenQuotes(scanner) {
38731            var parserOptions = this.parserOptions;
38732            var foundStartingQuote = false;
38733            var foundClosingQuote = false;
38734            var characters = [];
38735            var nextToken = scanner.nextCharacterToken;
38736
38737            for (; !foundClosingQuote && nextToken !== null; nextToken = scanner.nextCharacterToken) {
38738              var isQuote = isTokenQuote(nextToken, parserOptions); // ignore first quote
38739
38740              if (!foundStartingQuote && isQuote) {
38741                foundStartingQuote = true;
38742              } else if (foundStartingQuote) {
38743                if (isTokenEscapeCharacter(nextToken, parserOptions)) {
38744                  // advance past the escape character so we can get the next one in line
38745                  scanner.advancePastToken(nextToken);
38746                  var tokenFollowingEscape = scanner.nextCharacterToken; // if the character following the escape is a quote character then just add
38747                  // the quote and advance to that character
38748
38749                  if (tokenFollowingEscape !== null && (isTokenQuote(tokenFollowingEscape, parserOptions) || isTokenEscapeCharacter(tokenFollowingEscape, parserOptions))) {
38750                    characters.push(tokenFollowingEscape.token);
38751                    nextToken = tokenFollowingEscape;
38752                  } else if (isQuote) {
38753                    // if the escape is also a quote then we found our closing quote and finish early
38754                    foundClosingQuote = true;
38755                  } else {
38756                    // other wise add the escape token to the characters since it wast escaping anything
38757                    characters.push(nextToken.token);
38758                  }
38759                } else if (isQuote) {
38760                  // we found our closing quote!
38761                  foundClosingQuote = true;
38762                } else {
38763                  // add the token to the characters
38764                  characters.push(nextToken.token);
38765                }
38766              }
38767
38768              scanner.advancePastToken(nextToken);
38769            }
38770
38771            return {
38772              col: this.columnFormatter.format(characters.join('')),
38773              foundClosingQuote: foundClosingQuote
38774            };
38775          }
38776        }, {
38777          key: "checkForMalformedColumn",
38778          value: function checkForMalformedColumn(scanner) {
38779            var parserOptions = this.parserOptions;
38780            var nextNonSpaceToken = scanner.nextNonSpaceToken;
38781
38782            if (nextNonSpaceToken) {
38783              var isNextTokenADelimiter = isTokenDelimiter(nextNonSpaceToken, parserOptions);
38784              var isNextTokenARowDelimiter = isTokenRowDelimiter(nextNonSpaceToken);
38785
38786              if (!(isNextTokenADelimiter || isNextTokenARowDelimiter)) {
38787                // if the final quote was NOT followed by a column (,) or row(\n) delimiter then its a bad column
38788                // tldr: only part of the column was quoted
38789                var linePreview = scanner.lineFromCursor.substr(0, 10).replace(/[\r\n]/g, "\\n'");
38790                throw new Error("Parse Error: expected: '".concat(parserOptions.escapedDelimiter, "' OR new line got: '").concat(nextNonSpaceToken.token, "'. at '").concat(linePreview));
38791              }
38792
38793              scanner.advanceToToken(nextNonSpaceToken);
38794            } else if (!scanner.hasMoreData) {
38795              scanner.advancePastLine();
38796            }
38797          }
38798        }]);
38799
38800        return QuotedColumnParser;
38801      }();
38802
38803      exports.QuotedColumnParser = QuotedColumnParser;
38804    }, {
38805      "../Token": 154,
38806      "./ColumnFormatter": 155
38807    }],
38808    159: [function (require, module, exports) {
38809      "use strict";
38810
38811      Object.defineProperty(exports, "__esModule", {
38812        value: true
38813      });
38814
38815      var ColumnParser_1 = require("./ColumnParser");
38816
38817      Object.defineProperty(exports, "ColumnParser", {
38818        enumerable: true,
38819        get: function get() {
38820          return ColumnParser_1.ColumnParser;
38821        }
38822      });
38823
38824      var NonQuotedColumnParser_1 = require("./NonQuotedColumnParser");
38825
38826      Object.defineProperty(exports, "NonQuotedColumnParser", {
38827        enumerable: true,
38828        get: function get() {
38829          return NonQuotedColumnParser_1.NonQuotedColumnParser;
38830        }
38831      });
38832
38833      var QuotedColumnParser_1 = require("./QuotedColumnParser");
38834
38835      Object.defineProperty(exports, "QuotedColumnParser", {
38836        enumerable: true,
38837        get: function get() {
38838          return QuotedColumnParser_1.QuotedColumnParser;
38839        }
38840      });
38841
38842      var ColumnFormatter_1 = require("./ColumnFormatter");
38843
38844      Object.defineProperty(exports, "ColumnFormatter", {
38845        enumerable: true,
38846        get: function get() {
38847          return ColumnFormatter_1.ColumnFormatter;
38848        }
38849      });
38850    }, {
38851      "./ColumnFormatter": 155,
38852      "./ColumnParser": 156,
38853      "./NonQuotedColumnParser": 157,
38854      "./QuotedColumnParser": 158
38855    }],
38856    160: [function (require, module, exports) {
38857      "use strict";
38858
38859      Object.defineProperty(exports, "__esModule", {
38860        value: true
38861      });
38862
38863      var Parser_1 = require("./Parser");
38864
38865      Object.defineProperty(exports, "Parser", {
38866        enumerable: true,
38867        get: function get() {
38868          return Parser_1.Parser;
38869        }
38870      });
38871
38872      var RowParser_1 = require("./RowParser");
38873
38874      Object.defineProperty(exports, "RowParser", {
38875        enumerable: true,
38876        get: function get() {
38877          return RowParser_1.RowParser;
38878        }
38879      });
38880
38881      var Scanner_1 = require("./Scanner");
38882
38883      Object.defineProperty(exports, "Scanner", {
38884        enumerable: true,
38885        get: function get() {
38886          return Scanner_1.Scanner;
38887        }
38888      });
38889
38890      var Token_1 = require("./Token");
38891
38892      Object.defineProperty(exports, "Token", {
38893        enumerable: true,
38894        get: function get() {
38895          return Token_1.Token;
38896        }
38897      });
38898
38899      var column_1 = require("./column");
38900
38901      Object.defineProperty(exports, "ColumnParser", {
38902        enumerable: true,
38903        get: function get() {
38904          return column_1.ColumnParser;
38905        }
38906      });
38907      Object.defineProperty(exports, "NonQuotedColumnParser", {
38908        enumerable: true,
38909        get: function get() {
38910          return column_1.NonQuotedColumnParser;
38911        }
38912      });
38913      Object.defineProperty(exports, "QuotedColumnParser", {
38914        enumerable: true,
38915        get: function get() {
38916          return column_1.QuotedColumnParser;
38917        }
38918      });
38919    }, {
38920      "./Parser": 151,
38921      "./RowParser": 152,
38922      "./Scanner": 153,
38923      "./Token": 154,
38924      "./column": 159
38925    }],
38926    161: [function (require, module, exports) {
38927      "use strict";
38928
38929      var __importDefault = this && this.__importDefault || function (mod) {
38930        return mod && mod.__esModule ? mod : {
38931          "default": mod
38932        };
38933      };
38934
38935      Object.defineProperty(exports, "__esModule", {
38936        value: true
38937      });
38938      exports.HeaderTransformer = void 0;
38939
38940      var lodash_isundefined_1 = __importDefault(require("lodash.isundefined"));
38941
38942      var lodash_isfunction_1 = __importDefault(require("lodash.isfunction"));
38943
38944      var lodash_uniq_1 = __importDefault(require("lodash.uniq"));
38945
38946      var lodash_groupby_1 = __importDefault(require("lodash.groupby"));
38947
38948      var HeaderTransformer = /*#__PURE__*/function () {
38949        function HeaderTransformer(parserOptions) {
38950          _classCallCheck2(this, HeaderTransformer);
38951
38952          this.headers = null;
38953          this.receivedHeaders = false;
38954          this.shouldUseFirstRow = false;
38955          this.processedFirstRow = false;
38956          this.headersLength = 0;
38957          this.parserOptions = parserOptions;
38958
38959          if (parserOptions.headers === true) {
38960            this.shouldUseFirstRow = true;
38961          } else if (Array.isArray(parserOptions.headers)) {
38962            this.setHeaders(parserOptions.headers);
38963          } else if (lodash_isfunction_1.default(parserOptions.headers)) {
38964            this.headersTransform = parserOptions.headers;
38965          }
38966        }
38967
38968        _createClass2(HeaderTransformer, [{
38969          key: "transform",
38970          value: function transform(row, cb) {
38971            if (!this.shouldMapRow(row)) {
38972              return cb(null, {
38973                row: null,
38974                isValid: true
38975              });
38976            }
38977
38978            return cb(null, this.processRow(row));
38979          }
38980        }, {
38981          key: "shouldMapRow",
38982          value: function shouldMapRow(row) {
38983            var parserOptions = this.parserOptions;
38984
38985            if (!this.headersTransform && parserOptions.renameHeaders && !this.processedFirstRow) {
38986              if (!this.receivedHeaders) {
38987                throw new Error('Error renaming headers: new headers must be provided in an array');
38988              }
38989
38990              this.processedFirstRow = true;
38991              return false;
38992            }
38993
38994            if (!this.receivedHeaders && Array.isArray(row)) {
38995              if (this.headersTransform) {
38996                this.setHeaders(this.headersTransform(row));
38997              } else if (this.shouldUseFirstRow) {
38998                this.setHeaders(row);
38999              } else {
39000                // dont do anything with the headers if we didnt receive a transform or shouldnt use the first row.
39001                return true;
39002              }
39003
39004              return false;
39005            }
39006
39007            return true;
39008          }
39009        }, {
39010          key: "processRow",
39011          value: function processRow(row) {
39012            if (!this.headers) {
39013              return {
39014                row: row,
39015                isValid: true
39016              };
39017            }
39018
39019            var parserOptions = this.parserOptions;
39020
39021            if (!parserOptions.discardUnmappedColumns && row.length > this.headersLength) {
39022              if (!parserOptions.strictColumnHandling) {
39023                throw new Error("Unexpected Error: column header mismatch expected: ".concat(this.headersLength, " columns got: ").concat(row.length));
39024              }
39025
39026              return {
39027                row: row,
39028                isValid: false,
39029                reason: "Column header mismatch expected: ".concat(this.headersLength, " columns got: ").concat(row.length)
39030              };
39031            }
39032
39033            if (parserOptions.strictColumnHandling && row.length < this.headersLength) {
39034              return {
39035                row: row,
39036                isValid: false,
39037                reason: "Column header mismatch expected: ".concat(this.headersLength, " columns got: ").concat(row.length)
39038              };
39039            }
39040
39041            return {
39042              row: this.mapHeaders(row),
39043              isValid: true
39044            };
39045          }
39046        }, {
39047          key: "mapHeaders",
39048          value: function mapHeaders(row) {
39049            var rowMap = {};
39050            var headers = this.headers,
39051                headersLength = this.headersLength;
39052
39053            for (var i = 0; i < headersLength; i += 1) {
39054              var header = headers[i];
39055
39056              if (!lodash_isundefined_1.default(header)) {
39057                var val = row[i]; // eslint-disable-next-line no-param-reassign
39058
39059                if (lodash_isundefined_1.default(val)) {
39060                  rowMap[header] = '';
39061                } else {
39062                  rowMap[header] = val;
39063                }
39064              }
39065            }
39066
39067            return rowMap;
39068          }
39069        }, {
39070          key: "setHeaders",
39071          value: function setHeaders(headers) {
39072            var _a;
39073
39074            var filteredHeaders = headers.filter(function (h) {
39075              return !!h;
39076            });
39077
39078            if (lodash_uniq_1.default(filteredHeaders).length !== filteredHeaders.length) {
39079              var grouped = lodash_groupby_1.default(filteredHeaders);
39080              var duplicates = Object.keys(grouped).filter(function (dup) {
39081                return grouped[dup].length > 1;
39082              });
39083              throw new Error("Duplicate headers found ".concat(JSON.stringify(duplicates)));
39084            }
39085
39086            this.headers = headers;
39087            this.receivedHeaders = true;
39088            this.headersLength = ((_a = this.headers) === null || _a === void 0 ? void 0 : _a.length) || 0;
39089          }
39090        }]);
39091
39092        return HeaderTransformer;
39093      }();
39094
39095      exports.HeaderTransformer = HeaderTransformer;
39096    }, {
39097      "lodash.groupby": 404,
39098      "lodash.isfunction": 407,
39099      "lodash.isundefined": 409,
39100      "lodash.uniq": 410
39101    }],
39102    162: [function (require, module, exports) {
39103      "use strict";
39104
39105      var __importDefault = this && this.__importDefault || function (mod) {
39106        return mod && mod.__esModule ? mod : {
39107          "default": mod
39108        };
39109      };
39110
39111      Object.defineProperty(exports, "__esModule", {
39112        value: true
39113      });
39114      exports.RowTransformerValidator = void 0;
39115
39116      var lodash_isfunction_1 = __importDefault(require("lodash.isfunction"));
39117
39118      var types_1 = require("../types");
39119
39120      var RowTransformerValidator = /*#__PURE__*/function () {
39121        function RowTransformerValidator() {
39122          _classCallCheck2(this, RowTransformerValidator);
39123
39124          this._rowTransform = null;
39125          this._rowValidator = null;
39126        }
39127
39128        _createClass2(RowTransformerValidator, [{
39129          key: "transformAndValidate",
39130          value: function transformAndValidate(row, cb) {
39131            var _this18 = this;
39132
39133            return this.callTransformer(row, function (transformErr, transformedRow) {
39134              if (transformErr) {
39135                return cb(transformErr);
39136              }
39137
39138              if (!transformedRow) {
39139                return cb(null, {
39140                  row: null,
39141                  isValid: true
39142                });
39143              }
39144
39145              return _this18.callValidator(transformedRow, function (validateErr, validationResult) {
39146                if (validateErr) {
39147                  return cb(validateErr);
39148                }
39149
39150                if (validationResult && !validationResult.isValid) {
39151                  return cb(null, {
39152                    row: transformedRow,
39153                    isValid: false,
39154                    reason: validationResult.reason
39155                  });
39156                }
39157
39158                return cb(null, {
39159                  row: transformedRow,
39160                  isValid: true
39161                });
39162              });
39163            });
39164          }
39165        }, {
39166          key: "callTransformer",
39167          value: function callTransformer(row, cb) {
39168            if (!this._rowTransform) {
39169              return cb(null, row);
39170            }
39171
39172            return this._rowTransform(row, cb);
39173          }
39174        }, {
39175          key: "callValidator",
39176          value: function callValidator(row, cb) {
39177            if (!this._rowValidator) {
39178              return cb(null, {
39179                row: row,
39180                isValid: true
39181              });
39182            }
39183
39184            return this._rowValidator(row, cb);
39185          }
39186        }, {
39187          key: "rowTransform",
39188          set: function set(transformFunction) {
39189            if (!lodash_isfunction_1.default(transformFunction)) {
39190              throw new TypeError('The transform should be a function');
39191            }
39192
39193            this._rowTransform = RowTransformerValidator.createTransform(transformFunction);
39194          }
39195        }, {
39196          key: "rowValidator",
39197          set: function set(validateFunction) {
39198            if (!lodash_isfunction_1.default(validateFunction)) {
39199              throw new TypeError('The validate should be a function');
39200            }
39201
39202            this._rowValidator = RowTransformerValidator.createValidator(validateFunction);
39203          }
39204        }], [{
39205          key: "createTransform",
39206          value: function createTransform(transformFunction) {
39207            if (types_1.isSyncTransform(transformFunction)) {
39208              return function (row, cb) {
39209                var transformed = null;
39210
39211                try {
39212                  transformed = transformFunction(row);
39213                } catch (e) {
39214                  return cb(e);
39215                }
39216
39217                return cb(null, transformed);
39218              };
39219            }
39220
39221            return transformFunction;
39222          }
39223        }, {
39224          key: "createValidator",
39225          value: function createValidator(validateFunction) {
39226            if (types_1.isSyncValidate(validateFunction)) {
39227              return function (row, cb) {
39228                cb(null, {
39229                  row: row,
39230                  isValid: validateFunction(row)
39231                });
39232              };
39233            }
39234
39235            return function (row, cb) {
39236              validateFunction(row, function (err, isValid, reason) {
39237                if (err) {
39238                  return cb(err);
39239                }
39240
39241                if (isValid) {
39242                  return cb(null, {
39243                    row: row,
39244                    isValid: isValid,
39245                    reason: reason
39246                  });
39247                }
39248
39249                return cb(null, {
39250                  row: row,
39251                  isValid: false,
39252                  reason: reason
39253                });
39254              });
39255            };
39256          }
39257        }]);
39258
39259        return RowTransformerValidator;
39260      }();
39261
39262      exports.RowTransformerValidator = RowTransformerValidator;
39263    }, {
vendor: 7,324 bytes, lines 39264-39500
39264      "../types": 164,
39265      "lodash.isfunction": 407
39266    }],
39267    163: [function (require, module, exports) {
39268      "use strict";
39269
39270      Object.defineProperty(exports, "__esModule", {
39271        value: true
39272      });
39273
39274      var RowTransformerValidator_1 = require("./RowTransformerValidator");
39275
39276      Object.defineProperty(exports, "RowTransformerValidator", {
39277        enumerable: true,
39278        get: function get() {
39279          return RowTransformerValidator_1.RowTransformerValidator;
39280        }
39281      });
39282
39283      var HeaderTransformer_1 = require("./HeaderTransformer");
39284
39285      Object.defineProperty(exports, "HeaderTransformer", {
39286        enumerable: true,
39287        get: function get() {
39288          return HeaderTransformer_1.HeaderTransformer;
39289        }
39290      });
39291    }, {
39292      "./HeaderTransformer": 161,
39293      "./RowTransformerValidator": 162
39294    }],
39295    164: [function (require, module, exports) {
39296      "use strict";
39297
39298      Object.defineProperty(exports, "__esModule", {
39299        value: true
39300      });
39301      exports.isSyncValidate = exports.isSyncTransform = void 0;
39302
39303      exports.isSyncTransform = function (transform) {
39304        return transform.length === 1;
39305      };
39306
39307      exports.isSyncValidate = function (validate) {
39308        return validate.length === 1;
39309      };
39310    }, {}],
39311    165: [function (require, module, exports) {
39312      var asn1 = exports;
39313      asn1.bignum = require('bn.js');
39314      asn1.define = require('./asn1/api').define;
39315      asn1.base = require('./asn1/base');
39316      asn1.constants = require('./asn1/constants');
39317      asn1.decoders = require('./asn1/decoders');
39318      asn1.encoders = require('./asn1/encoders');
39319    }, {
39320      "./asn1/api": 166,
39321      "./asn1/base": 168,
39322      "./asn1/constants": 172,
39323      "./asn1/decoders": 174,
39324      "./asn1/encoders": 177,
39325      "bn.js": 179
39326    }],
39327    166: [function (require, module, exports) {
39328      var asn1 = require('../asn1');
39329
39330      var inherits = require('inherits');
39331
39332      var api = exports;
39333
39334      api.define = function define(name, body) {
39335        return new Entity(name, body);
39336      };
39337
39338      function Entity(name, body) {
39339        this.name = name;
39340        this.body = body;
39341        this.decoders = {};
39342        this.encoders = {};
39343      }
39344
39345      ;
39346
39347      Entity.prototype._createNamed = function createNamed(base) {
39348        var named;
39349
39350        try {
39351          named = require('vm').runInThisContext('(function ' + this.name + '(entity) {\n' + '  this._initNamed(entity);\n' + '})');
39352        } catch (e) {
39353          named = function named(entity) {
39354            this._initNamed(entity);
39355          };
39356        }
39357
39358        inherits(named, base);
39359
39360        named.prototype._initNamed = function initnamed(entity) {
39361          base.call(this, entity);
39362        };
39363
39364        return new named(this);
39365      };
39366
39367      Entity.prototype._getDecoder = function _getDecoder(enc) {
39368        enc = enc || 'der'; // Lazily create decoder
39369
39370        if (!this.decoders.hasOwnProperty(enc)) this.decoders[enc] = this._createNamed(asn1.decoders[enc]);
39371        return this.decoders[enc];
39372      };
39373
39374      Entity.prototype.decode = function decode(data, enc, options) {
39375        return this._getDecoder(enc).decode(data, options);
39376      };
39377
39378      Entity.prototype._getEncoder = function _getEncoder(enc) {
39379        enc = enc || 'der'; // Lazily create encoder
39380
39381        if (!this.encoders.hasOwnProperty(enc)) this.encoders[enc] = this._createNamed(asn1.encoders[enc]);
39382        return this.encoders[enc];
39383      };
39384
39385      Entity.prototype.encode = function encode(data, enc,
39386      /* internal */
39387      reporter) {
39388        return this._getEncoder(enc).encode(data, reporter);
39389      };
39390    }, {
39391      "../asn1": 165,
39392      "inherits": 364,
39393      "vm": 511
39394    }],
39395    167: [function (require, module, exports) {
39396      var inherits = require('inherits');
39397
39398      var Reporter = require('../base').Reporter;
39399
39400      var Buffer = require('buffer').Buffer;
39401
39402      function DecoderBuffer(base, options) {
39403        Reporter.call(this, options);
39404
39405        if (!Buffer.isBuffer(base)) {
39406          this.error('Input not Buffer');
39407          return;
39408        }
39409
39410        this.base = base;
39411        this.offset = 0;
39412        this.length = base.length;
39413      }
39414
39415      inherits(DecoderBuffer, Reporter);
39416      exports.DecoderBuffer = DecoderBuffer;
39417
39418      DecoderBuffer.prototype.save = function save() {
39419        return {
39420          offset: this.offset,
39421          reporter: Reporter.prototype.save.call(this)
39422        };
39423      };
39424
39425      DecoderBuffer.prototype.restore = function restore(save) {
39426        // Return skipped data
39427        var res = new DecoderBuffer(this.base);
39428        res.offset = save.offset;
39429        res.length = this.offset;
39430        this.offset = save.offset;
39431        Reporter.prototype.restore.call(this, save.reporter);
39432        return res;
39433      };
39434
39435      DecoderBuffer.prototype.isEmpty = function isEmpty() {
39436        return this.offset === this.length;
39437      };
39438
39439      DecoderBuffer.prototype.readUInt8 = function readUInt8(fail) {
39440        if (this.offset + 1 <= this.length) return this.base.readUInt8(this.offset++, true);else return this.error(fail || 'DecoderBuffer overrun');
39441      };
39442
39443      DecoderBuffer.prototype.skip = function skip(bytes, fail) {
39444        if (!(this.offset + bytes <= this.length)) return this.error(fail || 'DecoderBuffer overrun');
39445        var res = new DecoderBuffer(this.base); // Share reporter state
39446
39447        res._reporterState = this._reporterState;
39448        res.offset = this.offset;
39449        res.length = this.offset + bytes;
39450        this.offset += bytes;
39451        return res;
39452      };
39453
39454      DecoderBuffer.prototype.raw = function raw(save) {
39455        return this.base.slice(save ? save.offset : this.offset, this.length);
39456      };
39457
39458      function EncoderBuffer(value, reporter) {
39459        if (Array.isArray(value)) {
39460          this.length = 0;
39461          this.value = value.map(function (item) {
39462            if (!(item instanceof EncoderBuffer)) item = new EncoderBuffer(item, reporter);
39463            this.length += item.length;
39464            return item;
39465          }, this);
39466        } else if (typeof value === 'number') {
39467          if (!(0 <= value && value <= 0xff)) return reporter.error('non-byte EncoderBuffer value');
39468          this.value = value;
39469          this.length = 1;
39470        } else if (typeof value === 'string') {
39471          this.value = value;
39472          this.length = Buffer.byteLength(value);
39473        } else if (Buffer.isBuffer(value)) {
39474          this.value = value;
39475          this.length = value.length;
39476        } else {
39477          return reporter.error('Unsupported type: ' + _typeof2(value));
39478        }
39479      }
39480
39481      exports.EncoderBuffer = EncoderBuffer;
39482
39483      EncoderBuffer.prototype.join = function join(out, offset) {
39484        if (!out) out = new Buffer(this.length);
39485        if (!offset) offset = 0;
39486        if (this.length === 0) return out;
39487
39488        if (Array.isArray(this.value)) {
39489          this.value.forEach(function (item) {
39490            item.join(out, offset);
39491            offset += item.length;
39492          });
39493        } else {
39494          if (typeof this.value === 'number') out[offset] = this.value;else if (typeof this.value === 'string') out.write(this.value, offset);else if (Buffer.isBuffer(this.value)) this.value.copy(out, offset);
39495          offset += this.length;
39496        }
39497
39498        return out;
39499      };
39500    }, {
39501      "../base": 168,
39502      "buffer": 214,
39503      "inherits": 364
39504    }],
39505    168: [function (require, module, exports) {
39506      var base = exports;
39507      base.Reporter = require('./reporter').Reporter;
39508      base.DecoderBuffer = require('./buffer').DecoderBuffer;
39509      base.EncoderBuffer = require('./buffer').EncoderBuffer;
39510      base.Node = require('./node');
39511    }, {
39512      "./buffer": 167,
39513      "./node": 169,
39514      "./reporter": 170
39515    }],
39516    169: [function (require, module, exports) {
39517      var Reporter = require('../base').Reporter;
39518
39519      var EncoderBuffer = require('../base').EncoderBuffer;
39520
39521      var DecoderBuffer = require('../base').DecoderBuffer;
39522
39523      var assert = require('minimalistic-assert'); // Supported tags
39524
39525
39526      var tags = ['seq', 'seqof', 'set', 'setof', 'objid', 'bool', 'gentime', 'utctime', 'null_', 'enum', 'int', 'objDesc', 'bitstr', 'bmpstr', 'charstr', 'genstr', 'graphstr', 'ia5str', 'iso646str', 'numstr', 'octstr', 'printstr', 't61str', 'unistr', 'utf8str', 'videostr']; // Public methods list
39527
39528      var methods = ['key', 'obj', 'use', 'optional', 'explicit', 'implicit', 'def', 'choice', 'any', 'contains'].concat(tags); // Overrided methods list
39529
39530      var overrided = ['_peekTag', '_decodeTag', '_use', '_decodeStr', '_decodeObjid', '_decodeTime', '_decodeNull', '_decodeInt', '_decodeBool', '_decodeList', '_encodeComposite', '_encodeStr', '_encodeObjid', '_encodeTime', '_encodeNull', '_encodeInt', '_encodeBool'];
39531
39532      function Node(enc, parent) {
39533        var state = {};
39534        this._baseState = state;
39535        state.enc = enc;
39536        state.parent = parent || null;
39537        state.children = null; // State
39538
39539        state.tag = null;
39540        state.args = null;
39541        state.reverseArgs = null;
39542        state.choice = null;
39543        state.optional = false;
vendor: 3,211 bytes, lines 39544-39643
39544        state.any = false;
39545        state.obj = false;
39546        state.use = null;
39547        state.useDecoder = null;
39548        state.key = null;
39549        state['default'] = null;
39550        state.explicit = null;
39551        state.implicit = null;
39552        state.contains = null; // Should create new instance on each method
39553
39554        if (!state.parent) {
39555          state.children = [];
39556
39557          this._wrap();
39558        }
39559      }
39560
39561      module.exports = Node;
39562      var stateProps = ['enc', 'parent', 'children', 'tag', 'args', 'reverseArgs', 'choice', 'optional', 'any', 'obj', 'use', 'alteredUse', 'key', 'default', 'explicit', 'implicit', 'contains'];
39563
39564      Node.prototype.clone = function clone() {
39565        var state = this._baseState;
39566        var cstate = {};
39567        stateProps.forEach(function (prop) {
39568          cstate[prop] = state[prop];
39569        });
39570        var res = new this.constructor(cstate.parent);
39571        res._baseState = cstate;
39572        return res;
39573      };
39574
39575      Node.prototype._wrap = function wrap() {
39576        var state = this._baseState;
39577        methods.forEach(function (method) {
39578          this[method] = function _wrappedMethod() {
39579            var clone = new this.constructor(this);
39580            state.children.push(clone);
39581            return clone[method].apply(clone, arguments);
39582          };
39583        }, this);
39584      };
39585
39586      Node.prototype._init = function init(body) {
39587        var state = this._baseState;
39588        assert(state.parent === null);
39589        body.call(this); // Filter children
39590
39591        state.children = state.children.filter(function (child) {
39592          return child._baseState.parent === this;
39593        }, this);
39594        assert.equal(state.children.length, 1, 'Root node can have only one child');
39595      };
39596
39597      Node.prototype._useArgs = function useArgs(args) {
39598        var state = this._baseState; // Filter children and args
39599
39600        var children = args.filter(function (arg) {
39601          return arg instanceof this.constructor;
39602        }, this);
39603        args = args.filter(function (arg) {
39604          return !(arg instanceof this.constructor);
39605        }, this);
39606
39607        if (children.length !== 0) {
39608          assert(state.children === null);
39609          state.children = children; // Replace parent to maintain backward link
39610
39611          children.forEach(function (child) {
39612            child._baseState.parent = this;
39613          }, this);
39614        }
39615
39616        if (args.length !== 0) {
39617          assert(state.args === null);
39618          state.args = args;
39619          state.reverseArgs = args.map(function (arg) {
39620            if (_typeof2(arg) !== 'object' || arg.constructor !== Object) return arg;
39621            var res = {};
39622            Object.keys(arg).forEach(function (key) {
39623              if (key == (key | 0)) key |= 0;
39624              var value = arg[key];
39625              res[value] = key;
39626            });
39627            return res;
39628          });
39629        }
39630      }; //
39631      // Overrided methods
39632      //
39633
39634
39635      overrided.forEach(function (method) {
39636        Node.prototype[method] = function _overrided() {
39637          var state = this._baseState;
39638          throw new Error(method + ' not implemented for encoding: ' + state.enc);
39639        };
39640      }); //
39641      // Public methods
39642      //
39643
vendor: 9,239 bytes, lines 39644-39895
39644      tags.forEach(function (tag) {
39645        Node.prototype[tag] = function _tagMethod() {
39646          var state = this._baseState;
39647          var args = Array.prototype.slice.call(arguments);
39648          assert(state.tag === null);
39649          state.tag = tag;
39650
39651          this._useArgs(args);
39652
39653          return this;
39654        };
39655      });
39656
39657      Node.prototype.use = function use(item) {
39658        assert(item);
39659        var state = this._baseState;
39660        assert(state.use === null);
39661        state.use = item;
39662        return this;
39663      };
39664
39665      Node.prototype.optional = function optional() {
39666        var state = this._baseState;
39667        state.optional = true;
39668        return this;
39669      };
39670
39671      Node.prototype.def = function def(val) {
39672        var state = this._baseState;
39673        assert(state['default'] === null);
39674        state['default'] = val;
39675        state.optional = true;
39676        return this;
39677      };
39678
39679      Node.prototype.explicit = function explicit(num) {
39680        var state = this._baseState;
39681        assert(state.explicit === null && state.implicit === null);
39682        state.explicit = num;
39683        return this;
39684      };
39685
39686      Node.prototype.implicit = function implicit(num) {
39687        var state = this._baseState;
39688        assert(state.explicit === null && state.implicit === null);
39689        state.implicit = num;
39690        return this;
39691      };
39692
39693      Node.prototype.obj = function obj() {
39694        var state = this._baseState;
39695        var args = Array.prototype.slice.call(arguments);
39696        state.obj = true;
39697        if (args.length !== 0) this._useArgs(args);
39698        return this;
39699      };
39700
39701      Node.prototype.key = function key(newKey) {
39702        var state = this._baseState;
39703        assert(state.key === null);
39704        state.key = newKey;
39705        return this;
39706      };
39707
39708      Node.prototype.any = function any() {
39709        var state = this._baseState;
39710        state.any = true;
39711        return this;
39712      };
39713
39714      Node.prototype.choice = function choice(obj) {
39715        var state = this._baseState;
39716        assert(state.choice === null);
39717        state.choice = obj;
39718
39719        this._useArgs(Object.keys(obj).map(function (key) {
39720          return obj[key];
39721        }));
39722
39723        return this;
39724      };
39725
39726      Node.prototype.contains = function contains(item) {
39727        var state = this._baseState;
39728        assert(state.use === null);
39729        state.contains = item;
39730        return this;
39731      }; //
39732      // Decoding
39733      //
39734
39735
39736      Node.prototype._decode = function decode(input, options) {
39737        var state = this._baseState; // Decode root node
39738
39739        if (state.parent === null) return input.wrapResult(state.children[0]._decode(input, options));
39740        var result = state['default'];
39741        var present = true;
39742        var prevKey = null;
39743        if (state.key !== null) prevKey = input.enterKey(state.key); // Check if tag is there
39744
39745        if (state.optional) {
39746          var tag = null;
39747          if (state.explicit !== null) tag = state.explicit;else if (state.implicit !== null) tag = state.implicit;else if (state.tag !== null) tag = state.tag;
39748
39749          if (tag === null && !state.any) {
39750            // Trial and Error
39751            var save = input.save();
39752
39753            try {
39754              if (state.choice === null) this._decodeGeneric(state.tag, input, options);else this._decodeChoice(input, options);
39755              present = true;
39756            } catch (e) {
39757              present = false;
39758            }
39759
39760            input.restore(save);
39761          } else {
39762            present = this._peekTag(input, tag, state.any);
39763            if (input.isError(present)) return present;
39764          }
39765        } // Push object on stack
39766
39767
39768        var prevObj;
39769        if (state.obj && present) prevObj = input.enterObject();
39770
39771        if (present) {
39772          // Unwrap explicit values
39773          if (state.explicit !== null) {
39774            var explicit = this._decodeTag(input, state.explicit);
39775
39776            if (input.isError(explicit)) return explicit;
39777            input = explicit;
39778          }
39779
39780          var start = input.offset; // Unwrap implicit and normal values
39781
39782          if (state.use === null && state.choice === null) {
39783            if (state.any) var save = input.save();
39784
39785            var body = this._decodeTag(input, state.implicit !== null ? state.implicit : state.tag, state.any);
39786
39787            if (input.isError(body)) return body;
39788            if (state.any) result = input.raw(save);else input = body;
39789          }
39790
39791          if (options && options.track && state.tag !== null) options.track(input.path(), start, input.length, 'tagged');
39792          if (options && options.track && state.tag !== null) options.track(input.path(), input.offset, input.length, 'content'); // Select proper method for tag
39793
39794          if (state.any) result = result;else if (state.choice === null) result = this._decodeGeneric(state.tag, input, options);else result = this._decodeChoice(input, options);
39795          if (input.isError(result)) return result; // Decode children
39796
39797          if (!state.any && state.choice === null && state.children !== null) {
39798            state.children.forEach(function decodeChildren(child) {
39799              // NOTE: We are ignoring errors here, to let parser continue with other
39800              // parts of encoded data
39801              child._decode(input, options);
39802            });
39803          } // Decode contained/encoded by schema, only in bit or octet strings
39804
39805
39806          if (state.contains && (state.tag === 'octstr' || state.tag === 'bitstr')) {
39807            var data = new DecoderBuffer(result);
39808            result = this._getUse(state.contains, input._reporterState.obj)._decode(data, options);
39809          }
39810        } // Pop object
39811
39812
39813        if (state.obj && present) result = input.leaveObject(prevObj); // Set key
39814
39815        if (state.key !== null && (result !== null || present === true)) input.leaveKey(prevKey, state.key, result);else if (prevKey !== null) input.exitKey(prevKey);
39816        return result;
39817      };
39818
39819      Node.prototype._decodeGeneric = function decodeGeneric(tag, input, options) {
39820        var state = this._baseState;
39821        if (tag === 'seq' || tag === 'set') return null;
39822        if (tag === 'seqof' || tag === 'setof') return this._decodeList(input, tag, state.args[0], options);else if (/str$/.test(tag)) return this._decodeStr(input, tag, options);else if (tag === 'objid' && state.args) return this._decodeObjid(input, state.args[0], state.args[1], options);else if (tag === 'objid') return this._decodeObjid(input, null, null, options);else if (tag === 'gentime' || tag === 'utctime') return this._decodeTime(input, tag, options);else if (tag === 'null_') return this._decodeNull(input, options);else if (tag === 'bool') return this._decodeBool(input, options);else if (tag === 'objDesc') return this._decodeStr(input, tag, options);else if (tag === 'int' || tag === 'enum') return this._decodeInt(input, state.args && state.args[0], options);
39823
39824        if (state.use !== null) {
39825          return this._getUse(state.use, input._reporterState.obj)._decode(input, options);
39826        } else {
39827          return input.error('unknown tag: ' + tag);
39828        }
39829      };
39830
39831      Node.prototype._getUse = function _getUse(entity, obj) {
39832        var state = this._baseState; // Create altered use decoder if implicit is set
39833
39834        state.useDecoder = this._use(entity, obj);
39835        assert(state.useDecoder._baseState.parent === null);
39836        state.useDecoder = state.useDecoder._baseState.children[0];
39837
39838        if (state.implicit !== state.useDecoder._baseState.implicit) {
39839          state.useDecoder = state.useDecoder.clone();
39840          state.useDecoder._baseState.implicit = state.implicit;
39841        }
39842
39843        return state.useDecoder;
39844      };
39845
39846      Node.prototype._decodeChoice = function decodeChoice(input, options) {
39847        var state = this._baseState;
39848        var result = null;
39849        var match = false;
39850        Object.keys(state.choice).some(function (key) {
39851          var save = input.save();
39852          var node = state.choice[key];
39853
39854          try {
39855            var value = node._decode(input, options);
39856
39857            if (input.isError(value)) return false;
39858            result = {
39859              type: key,
39860              value: value
39861            };
39862            match = true;
39863          } catch (e) {
39864            input.restore(save);
39865            return false;
39866          }
39867
39868          return true;
39869        }, this);
39870        if (!match) return input.error('Choice not matched');
39871        return result;
39872      }; //
39873      // Encoding
39874      //
39875
39876
39877      Node.prototype._createEncoderBuffer = function createEncoderBuffer(data) {
39878        return new EncoderBuffer(data, this.reporter);
39879      };
39880
39881      Node.prototype._encode = function encode(data, reporter, parent) {
39882        var state = this._baseState;
39883        if (state['default'] !== null && state['default'] === data) return;
39884
39885        var result = this._encodeValue(data, reporter, parent);
39886
39887        if (result === undefined) return;
39888        if (this._skipDefault(result, reporter, parent)) return;
39889        return result;
39890      };
39891
39892      Node.prototype._encodeValue = function encode(data, reporter, parent) {
39893        var state = this._baseState; // Decode root node
39894
39895        if (state.parent === null) return state.children[0]._encode(d
vendor: 4,489 bytes, lines 39895-39992
39895ata, reporter || new Reporter());
39896        var result = null; // Set reporter to share it with a child class
39897
39898        this.reporter = reporter; // Check if data is there
39899
39900        if (state.optional && data === undefined) {
39901          if (state['default'] !== null) data = state['default'];else return;
39902        } // Encode children first
39903
39904
39905        var content = null;
39906        var primitive = false;
39907
39908        if (state.any) {
39909          // Anything that was given is translated to buffer
39910          result = this._createEncoderBuffer(data);
39911        } else if (state.choice) {
39912          result = this._encodeChoice(data, reporter);
39913        } else if (state.contains) {
39914          content = this._getUse(state.contains, parent)._encode(data, reporter);
39915          primitive = true;
39916        } else if (state.children) {
39917          content = state.children.map(function (child) {
39918            if (child._baseState.tag === 'null_') return child._encode(null, reporter, data);
39919            if (child._baseState.key === null) return reporter.error('Child should have a key');
39920            var prevKey = reporter.enterKey(child._baseState.key);
39921            if (_typeof2(data) !== 'object') return reporter.error('Child expected, but input is not object');
39922
39923            var res = child._encode(data[child._baseState.key], reporter, data);
39924
39925            reporter.leaveKey(prevKey);
39926            return res;
39927          }, this).filter(function (child) {
39928            return child;
39929          });
39930          content = this._createEncoderBuffer(content);
39931        } else {
39932          if (state.tag === 'seqof' || state.tag === 'setof') {
39933            // TODO(indutny): this should be thrown on DSL level
39934            if (!(state.args && state.args.length === 1)) return reporter.error('Too many args for : ' + state.tag);
39935            if (!Array.isArray(data)) return reporter.error('seqof/setof, but data is not Array');
39936            var child = this.clone();
39937            child._baseState.implicit = null;
39938            content = this._createEncoderBuffer(data.map(function (item) {
39939              var state = this._baseState;
39940              return this._getUse(state.args[0], data)._encode(item, reporter);
39941            }, child));
39942          } else if (state.use !== null) {
39943            result = this._getUse(state.use, parent)._encode(data, reporter);
39944          } else {
39945            content = this._encodePrimitive(state.tag, data);
39946            primitive = true;
39947          }
39948        } // Encode data itself
39949
39950
39951        var result;
39952
39953        if (!state.any && state.choice === null) {
39954          var tag = state.implicit !== null ? state.implicit : state.tag;
39955          var cls = state.implicit === null ? 'universal' : 'context';
39956
39957          if (tag === null) {
39958            if (state.use === null) reporter.error('Tag could be omitted only for .use()');
39959          } else {
39960            if (state.use === null) result = this._encodeComposite(tag, primitive, cls, content);
39961          }
39962        } // Wrap in explicit
39963
39964
39965        if (state.explicit !== null) result = this._encodeComposite(state.explicit, false, 'context', result);
39966        return result;
39967      };
39968
39969      Node.prototype._encodeChoice = function encodeChoice(data, reporter) {
39970        var state = this._baseState;
39971        var node = state.choice[data.type];
39972
39973        if (!node) {
39974          assert(false, data.type + ' not found in ' + JSON.stringify(Object.keys(state.choice)));
39975        }
39976
39977        return node._encode(data.value, reporter);
39978      };
39979
39980      Node.prototype._encodePrimitive = function encodePrimitive(tag, data) {
39981        var state = this._baseState;
39982        if (/str$/.test(tag)) return this._encodeStr(data, tag);else if (tag === 'objid' && state.args) return this._encodeObjid(data, state.reverseArgs[0], state.args[1]);else if (tag === 'objid') return this._encodeObjid(data, null, null);else if (tag === 'gentime' || tag === 'utctime') return this._encodeTime(data, tag);else if (tag === 'null_') return this._encodeNull();else if (tag === 'int' || tag === 'enum') return this._encodeInt(data, state.args && state.reverseArgs[0]);else if (tag === 'bool') return this._encodeBool(data);else if (tag === 'objDesc') return this._encodeStr(data, tag);else throw new Error('Unsupported tag: ' + tag);
39983      };
39984
39985      Node.prototype._isNumstr = function isNumstr(str) {
39986        return /^[0-9 ]*$/.test(str);
39987      };
39988
39989      Node.prototype._isPrintstr = function isPrintstr(str) {
39990        return /^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(str);
39991      };
39992    }, {
vendor: 23,314 bytes, lines 39993-40748
39993      "../base": 168,
39994      "minimalistic-assert": 414
39995    }],
39996    170: [function (require, module, exports) {
39997      var inherits = require('inherits');
39998
39999      function Reporter(options) {
40000        this._reporterState = {
40001          obj: null,
40002          path: [],
40003          options: options || {},
40004          errors: []
40005        };
40006      }
40007
40008      exports.Reporter = Reporter;
40009
40010      Reporter.prototype.isError = function isError(obj) {
40011        return obj instanceof ReporterError;
40012      };
40013
40014      Reporter.prototype.save = function save() {
40015        var state = this._reporterState;
40016        return {
40017          obj: state.obj,
40018          pathLen: state.path.length
40019        };
40020      };
40021
40022      Reporter.prototype.restore = function restore(data) {
40023        var state = this._reporterState;
40024        state.obj = data.obj;
40025        state.path = state.path.slice(0, data.pathLen);
40026      };
40027
40028      Reporter.prototype.enterKey = function enterKey(key) {
40029        return this._reporterState.path.push(key);
40030      };
40031
40032      Reporter.prototype.exitKey = function exitKey(index) {
40033        var state = this._reporterState;
40034        state.path = state.path.slice(0, index - 1);
40035      };
40036
40037      Reporter.prototype.leaveKey = function leaveKey(index, key, value) {
40038        var state = this._reporterState;
40039        this.exitKey(index);
40040        if (state.obj !== null) state.obj[key] = value;
40041      };
40042
40043      Reporter.prototype.path = function path() {
40044        return this._reporterState.path.join('/');
40045      };
40046
40047      Reporter.prototype.enterObject = function enterObject() {
40048        var state = this._reporterState;
40049        var prev = state.obj;
40050        state.obj = {};
40051        return prev;
40052      };
40053
40054      Reporter.prototype.leaveObject = function leaveObject(prev) {
40055        var state = this._reporterState;
40056        var now = state.obj;
40057        state.obj = prev;
40058        return now;
40059      };
40060
40061      Reporter.prototype.error = function error(msg) {
40062        var err;
40063        var state = this._reporterState;
40064        var inherited = msg instanceof ReporterError;
40065
40066        if (inherited) {
40067          err = msg;
40068        } else {
40069          err = new ReporterError(state.path.map(function (elem) {
40070            return '[' + JSON.stringify(elem) + ']';
40071          }).join(''), msg.message || msg, msg.stack);
40072        }
40073
40074        if (!state.options.partial) throw err;
40075        if (!inherited) state.errors.push(err);
40076        return err;
40077      };
40078
40079      Reporter.prototype.wrapResult = function wrapResult(result) {
40080        var state = this._reporterState;
40081        if (!state.options.partial) return result;
40082        return {
40083          result: this.isError(result) ? null : result,
40084          errors: state.errors
40085        };
40086      };
40087
40088      function ReporterError(path, msg) {
40089        this.path = path;
40090        this.rethrow(msg);
40091      }
40092
40093      ;
40094      inherits(ReporterError, Error);
40095
40096      ReporterError.prototype.rethrow = function rethrow(msg) {
40097        this.message = msg + ' at: ' + (this.path || '(shallow)');
40098        if (Error.captureStackTrace) Error.captureStackTrace(this, ReporterError);
40099
40100        if (!this.stack) {
40101          try {
40102            // IE only adds stack when thrown
40103            throw new Error(this.message);
40104          } catch (e) {
40105            this.stack = e.stack;
40106          }
40107        }
40108
40109        return this;
40110      };
40111    }, {
40112      "inherits": 364
40113    }],
40114    171: [function (require, module, exports) {
40115      var constants = require('../constants');
40116
40117      exports.tagClass = {
40118        0: 'universal',
40119        1: 'application',
40120        2: 'context',
40121        3: 'private'
40122      };
40123      exports.tagClassByName = constants._reverse(exports.tagClass);
40124      exports.tag = {
40125        0x00: 'end',
40126        0x01: 'bool',
40127        0x02: 'int',
40128        0x03: 'bitstr',
40129        0x04: 'octstr',
40130        0x05: 'null_',
40131        0x06: 'objid',
40132        0x07: 'objDesc',
40133        0x08: 'external',
40134        0x09: 'real',
40135        0x0a: 'enum',
40136        0x0b: 'embed',
40137        0x0c: 'utf8str',
40138        0x0d: 'relativeOid',
40139        0x10: 'seq',
40140        0x11: 'set',
40141        0x12: 'numstr',
40142        0x13: 'printstr',
40143        0x14: 't61str',
40144        0x15: 'videostr',
40145        0x16: 'ia5str',
40146        0x17: 'utctime',
40147        0x18: 'gentime',
40148        0x19: 'graphstr',
40149        0x1a: 'iso646str',
40150        0x1b: 'genstr',
40151        0x1c: 'unistr',
40152        0x1d: 'charstr',
40153        0x1e: 'bmpstr'
40154      };
40155      exports.tagByName = constants._reverse(exports.tag);
40156    }, {
40157      "../constants": 172
40158    }],
40159    172: [function (require, module, exports) {
40160      var constants = exports; // Helper
40161
40162      constants._reverse = function reverse(map) {
40163        var res = {};
40164        Object.keys(map).forEach(function (key) {
40165          // Convert key to integer if it is stringified
40166          if ((key | 0) == key) key = key | 0;
40167          var value = map[key];
40168          res[value] = key;
40169        });
40170        return res;
40171      };
40172
40173      constants.der = require('./der');
40174    }, {
40175      "./der": 171
40176    }],
40177    173: [function (require, module, exports) {
40178      var inherits = require('inherits');
40179
40180      var asn1 = require('../../asn1');
40181
40182      var base = asn1.base;
40183      var bignum = asn1.bignum; // Import DER constants
40184
40185      var der = asn1.constants.der;
40186
40187      function DERDecoder(entity) {
40188        this.enc = 'der';
40189        this.name = entity.name;
40190        this.entity = entity; // Construct base tree
40191
40192        this.tree = new DERNode();
40193
40194        this.tree._init(entity.body);
40195      }
40196
40197      ;
40198      module.exports = DERDecoder;
40199
40200      DERDecoder.prototype.decode = function decode(data, options) {
40201        if (!(data instanceof base.DecoderBuffer)) data = new base.DecoderBuffer(data, options);
40202        return this.tree._decode(data, options);
40203      }; // Tree methods
40204
40205
40206      function DERNode(parent) {
40207        base.Node.call(this, 'der', parent);
40208      }
40209
40210      inherits(DERNode, base.Node);
40211
40212      DERNode.prototype._peekTag = function peekTag(buffer, tag, any) {
40213        if (buffer.isEmpty()) return false;
40214        var state = buffer.save();
40215        var decodedTag = derDecodeTag(buffer, 'Failed to peek tag: "' + tag + '"');
40216        if (buffer.isError(decodedTag)) return decodedTag;
40217        buffer.restore(state);
40218        return decodedTag.tag === tag || decodedTag.tagStr === tag || decodedTag.tagStr + 'of' === tag || any;
40219      };
40220
40221      DERNode.prototype._decodeTag = function decodeTag(buffer, tag, any) {
40222        var decodedTag = derDecodeTag(buffer, 'Failed to decode tag of "' + tag + '"');
40223        if (buffer.isError(decodedTag)) return decodedTag;
40224        var len = derDecodeLen(buffer, decodedTag.primitive, 'Failed to get length of "' + tag + '"'); // Failure
40225
40226        if (buffer.isError(len)) return len;
40227
40228        if (!any && decodedTag.tag !== tag && decodedTag.tagStr !== tag && decodedTag.tagStr + 'of' !== tag) {
40229          return buffer.error('Failed to match tag: "' + tag + '"');
40230        }
40231
40232        if (decodedTag.primitive || len !== null) return buffer.skip(len, 'Failed to match body of: "' + tag + '"'); // Indefinite length... find END tag
40233
40234        var state = buffer.save();
40235
40236        var res = this._skipUntilEnd(buffer, 'Failed to skip indefinite length body: "' + this.tag + '"');
40237
40238        if (buffer.isError(res)) return res;
40239        len = buffer.offset - state.offset;
40240        buffer.restore(state);
40241        return buffer.skip(len, 'Failed to match body of: "' + tag + '"');
40242      };
40243
40244      DERNode.prototype._skipUntilEnd = function skipUntilEnd(buffer, fail) {
40245        while (true) {
40246          var tag = derDecodeTag(buffer, fail);
40247          if (buffer.isError(tag)) return tag;
40248          var len = derDecodeLen(buffer, tag.primitive, fail);
40249          if (buffer.isError(len)) return len;
40250          var res;
40251          if (tag.primitive || len !== null) res = buffer.skip(len);else res = this._skipUntilEnd(buffer, fail); // Failure
40252
40253          if (buffer.isError(res)) return res;
40254          if (tag.tagStr === 'end') break;
40255        }
40256      };
40257
40258      DERNode.prototype._decodeList = function decodeList(buffer, tag, decoder, options) {
40259        var result = [];
40260
40261        while (!buffer.isEmpty()) {
40262          var possibleEnd = this._peekTag(buffer, 'end');
40263
40264          if (buffer.isError(possibleEnd)) return possibleEnd;
40265          var res = decoder.decode(buffer, 'der', options);
40266          if (buffer.isError(res) && possibleEnd) break;
40267          result.push(res);
40268        }
40269
40270        return result;
40271      };
40272
40273      DERNode.prototype._decodeStr = function decodeStr(buffer, tag) {
40274        if (tag === 'bitstr') {
40275          var unused = buffer.readUInt8();
40276          if (buffer.isError(unused)) return unused;
40277          return {
40278            unused: unused,
40279            data: buffer.raw()
40280          };
40281        } else if (tag === 'bmpstr') {
40282          var raw = buffer.raw();
40283          if (raw.length % 2 === 1) return buffer.error('Decoding of string type: bmpstr length mismatch');
40284          var str = '';
40285
40286          for (var i = 0; i < raw.length / 2; i++) {
40287            str += String.fromCharCode(raw.readUInt16BE(i * 2));
40288          }
40289
40290          return str;
40291        } else if (tag === 'numstr') {
40292          var numstr = buffer.raw().toString('ascii');
40293
40294          if (!this._isNumstr(numstr)) {
40295            return buffer.error('Decoding of string type: ' + 'numstr unsupported characters');
40296          }
40297
40298          return numstr;
40299        } else if (tag === 'octstr') {
40300          return buffer.raw();
40301        } else if (tag === 'objDesc') {
40302          return buffer.raw();
40303        } else if (tag === 'printstr') {
40304          var printstr = buffer.raw().toString('ascii');
40305
40306          if (!this._isPrintstr(printstr)) {
40307            return buffer.error('Decoding of string type: ' + 'printstr unsupported characters');
40308          }
40309
40310          return printstr;
40311        } else if (/str$/.test(tag)) {
40312          return buffer.raw().toString();
40313        } else {
40314          return buffer.error('Decoding of string type: ' + tag + ' unsupported');
40315        }
40316      };
40317
40318      DERNode.prototype._decodeObjid = function decodeObjid(buffer, values, relative) {
40319        var result;
40320        var identifiers = [];
40321        var ident = 0;
40322
40323        while (!buffer.isEmpty()) {
40324          var subident = buffer.readUInt8();
40325          ident <<= 7;
40326          ident |= subident & 0x7f;
40327
40328          if ((subident & 0x80) === 0) {
40329            identifiers.push(ident);
40330            ident = 0;
40331          }
40332        }
40333
40334        if (subident & 0x80) identifiers.push(ident);
40335        var first = identifiers[0] / 40 | 0;
40336        var second = identifiers[0] % 40;
40337        if (relative) result = identifiers;else result = [first, second].concat(identifiers.slice(1));
40338
40339        if (values) {
40340          var tmp = values[result.join(' ')];
40341          if (tmp === undefined) tmp = values[result.join('.')];
40342          if (tmp !== undefined) result = tmp;
40343        }
40344
40345        return result;
40346      };
40347
40348      DERNode.prototype._decodeTime = function decodeTime(buffer, tag) {
40349        var str = buffer.raw().toString();
40350
40351        if (tag === 'gentime') {
40352          var year = str.slice(0, 4) | 0;
40353          var mon = str.slice(4, 6) | 0;
40354          var day = str.slice(6, 8) | 0;
40355          var hour = str.slice(8, 10) | 0;
40356          var min = str.slice(10, 12) | 0;
40357          var sec = str.slice(12, 14) | 0;
40358        } else if (tag === 'utctime') {
40359          var year = str.slice(0, 2) | 0;
40360          var mon = str.slice(2, 4) | 0;
40361          var day = str.slice(4, 6) | 0;
40362          var hour = str.slice(6, 8) | 0;
40363          var min = str.slice(8, 10) | 0;
40364          var sec = str.slice(10, 12) | 0;
40365          if (year < 70) year = 2000 + year;else year = 1900 + year;
40366        } else {
40367          return buffer.error('Decoding ' + tag + ' time is not supported yet');
40368        }
40369
40370        return Date.UTC(year, mon - 1, day, hour, min, sec, 0);
40371      };
40372
40373      DERNode.prototype._decodeNull = function decodeNull(buffer) {
40374        return null;
40375      };
40376
40377      DERNode.prototype._decodeBool = function decodeBool(buffer) {
40378        var res = buffer.readUInt8();
40379        if (buffer.isError(res)) return res;else return res !== 0;
40380      };
40381
40382      DERNode.prototype._decodeInt = function decodeInt(buffer, values) {
40383        // Bigint, return as it is (assume big endian)
40384        var raw = buffer.raw();
40385        var res = new bignum(raw);
40386        if (values) res = values[res.toString(10)] || res;
40387        return res;
40388      };
40389
40390      DERNode.prototype._use = function use(entity, obj) {
40391        if (typeof entity === 'function') entity = entity(obj);
40392        return entity._getDecoder('der').tree;
40393      }; // Utility methods
40394
40395
40396      function derDecodeTag(buf, fail) {
40397        var tag = buf.readUInt8(fail);
40398        if (buf.isError(tag)) return tag;
40399        var cls = der.tagClass[tag >> 6];
40400        var primitive = (tag & 0x20) === 0; // Multi-octet tag - load
40401
40402        if ((tag & 0x1f) === 0x1f) {
40403          var oct = tag;
40404          tag = 0;
40405
40406          while ((oct & 0x80) === 0x80) {
40407            oct = buf.readUInt8(fail);
40408            if (buf.isError(oct)) return oct;
40409            tag <<= 7;
40410            tag |= oct & 0x7f;
40411          }
40412        } else {
40413          tag &= 0x1f;
40414        }
40415
40416        var tagStr = der.tag[tag];
40417        return {
40418          cls: cls,
40419          primitive: primitive,
40420          tag: tag,
40421          tagStr: tagStr
40422        };
40423      }
40424
40425      function derDecodeLen(buf, primitive, fail) {
40426        var len = buf.readUInt8(fail);
40427        if (buf.isError(len)) return len; // Indefinite form
40428
40429        if (!primitive && len === 0x80) return null; // Definite form
40430
40431        if ((len & 0x80) === 0) {
40432          // Short form
40433          return len;
40434        } // Long form
40435
40436
40437        var num = len & 0x7f;
40438        if (num > 4) return buf.error('length octect is too long');
40439        len = 0;
40440
40441        for (var i = 0; i < num; i++) {
40442          len <<= 8;
40443          var j = buf.readUInt8(fail);
40444          if (buf.isError(j)) return j;
40445          len |= j;
40446        }
40447
40448        return len;
40449      }
40450    }, {
40451      "../../asn1": 165,
40452      "inherits": 364
40453    }],
40454    174: [function (require, module, exports) {
40455      var decoders = exports;
40456      decoders.der = require('./der');
40457      decoders.pem = require('./pem');
40458    }, {
40459      "./der": 173,
40460      "./pem": 175
40461    }],
40462    175: [function (require, module, exports) {
40463      var inherits = require('inherits');
40464
40465      var Buffer = require('buffer').Buffer;
40466
40467      var DERDecoder = require('./der');
40468
40469      function PEMDecoder(entity) {
40470        DERDecoder.call(this, entity);
40471        this.enc = 'pem';
40472      }
40473
40474      ;
40475      inherits(PEMDecoder, DERDecoder);
40476      module.exports = PEMDecoder;
40477
40478      PEMDecoder.prototype.decode = function decode(data, options) {
40479        var lines = data.toString().split(/[\r\n]+/g);
40480        var label = options.label.toUpperCase();
40481        var re = /^-----(BEGIN|END) ([^-]+)-----$/;
40482        var start = -1;
40483        var end = -1;
40484
40485        for (var i = 0; i < lines.length; i++) {
40486          var match = lines[i].match(re);
40487          if (match === null) continue;
40488          if (match[2] !== label) continue;
40489
40490          if (start === -1) {
40491            if (match[1] !== 'BEGIN') break;
40492            start = i;
40493          } else {
40494            if (match[1] !== 'END') break;
40495            end = i;
40496            break;
40497          }
40498        }
40499
40500        if (start === -1 || end === -1) throw new Error('PEM section not found for: ' + label);
40501        var base64 = lines.slice(start + 1, end).join(''); // Remove excessive symbols
40502
40503        base64.replace(/[^a-z0-9\+\/=]+/gi, '');
40504        var input = new Buffer(base64, 'base64');
40505        return DERDecoder.prototype.decode.call(this, input, options);
40506      };
40507    }, {
40508      "./der": 173,
40509      "buffer": 214,
40510      "inherits": 364
40511    }],
40512    176: [function (require, module, exports) {
40513      var inherits = require('inherits');
40514
40515      var Buffer = require('buffer').Buffer;
40516
40517      var asn1 = require('../../asn1');
40518
40519      var base = asn1.base; // Import DER constants
40520
40521      var der = asn1.constants.der;
40522
40523      function DEREncoder(entity) {
40524        this.enc = 'der';
40525        this.name = entity.name;
40526        this.entity = entity; // Construct base tree
40527
40528        this.tree = new DERNode();
40529
40530        this.tree._init(entity.body);
40531      }
40532
40533      ;
40534      module.exports = DEREncoder;
40535
40536      DEREncoder.prototype.encode = function encode(data, reporter) {
40537        return this.tree._encode(data, reporter).join();
40538      }; // Tree methods
40539
40540
40541      function DERNode(parent) {
40542        base.Node.call(this, 'der', parent);
40543      }
40544
40545      inherits(DERNode, base.Node);
40546
40547      DERNode.prototype._encodeComposite = function encodeComposite(tag, primitive, cls, content) {
40548        var encodedTag = encodeTag(tag, primitive, cls, this.reporter); // Short form
40549
40550        if (content.length < 0x80) {
40551          var header = new Buffer(2);
40552          header[0] = encodedTag;
40553          header[1] = content.length;
40554          return this._createEncoderBuffer([header, content]);
40555        } // Long form
40556        // Count octets required to store length
40557
40558
40559        var lenOctets = 1;
40560
40561        for (var i = content.length; i >= 0x100; i >>= 8) {
40562          lenOctets++;
40563        }
40564
40565        var header = new Buffer(1 + 1 + lenOctets);
40566        header[0] = encodedTag;
40567        header[1] = 0x80 | lenOctets;
40568
40569        for (var i = 1 + lenOctets, j = content.length; j > 0; i--, j >>= 8) {
40570          header[i] = j & 0xff;
40571        }
40572
40573        return this._createEncoderBuffer([header, content]);
40574      };
40575
40576      DERNode.prototype._encodeStr = function encodeStr(str, tag) {
40577        if (tag === 'bitstr') {
40578          return this._createEncoderBuffer([str.unused | 0, str.data]);
40579        } else if (tag === 'bmpstr') {
40580          var buf = new Buffer(str.length * 2);
40581
40582          for (var i = 0; i < str.length; i++) {
40583            buf.writeUInt16BE(str.charCodeAt(i), i * 2);
40584          }
40585
40586          return this._createEncoderBuffer(buf);
40587        } else if (tag === 'numstr') {
40588          if (!this._isNumstr(str)) {
40589            return this.reporter.error('Encoding of string type: numstr supports ' + 'only digits and space');
40590          }
40591
40592          return this._createEncoderBuffer(str);
40593        } else if (tag === 'printstr') {
40594          if (!this._isPrintstr(str)) {
40595            return this.reporter.error('Encoding of string type: printstr supports ' + 'only latin upper and lower case letters, ' + 'digits, space, apostrophe, left and rigth ' + 'parenthesis, plus sign, comma, hyphen, ' + 'dot, slash, colon, equal sign, ' + 'question mark');
40596          }
40597
40598          return this._createEncoderBuffer(str);
40599        } else if (/str$/.test(tag)) {
40600          return this._createEncoderBuffer(str);
40601        } else if (tag === 'objDesc') {
40602          return this._createEncoderBuffer(str);
40603        } else {
40604          return this.reporter.error('Encoding of string type: ' + tag + ' unsupported');
40605        }
40606      };
40607
40608      DERNode.prototype._encodeObjid = function encodeObjid(id, values, relative) {
40609        if (typeof id === 'string') {
40610          if (!values) return this.reporter.error('string objid given, but no values map found');
40611          if (!values.hasOwnProperty(id)) return this.reporter.error('objid not found in values map');
40612          id = values[id].split(/[\s\.]+/g);
40613
40614          for (var i = 0; i < id.length; i++) {
40615            id[i] |= 0;
40616          }
40617        } else if (Array.isArray(id)) {
40618          id = id.slice();
40619
40620          for (var i = 0; i < id.length; i++) {
40621            id[i] |= 0;
40622          }
40623        }
40624
40625        if (!Array.isArray(id)) {
40626          return this.reporter.error('objid() should be either array or string, ' + 'got: ' + JSON.stringify(id));
40627        }
40628
40629        if (!relative) {
40630          if (id[1] >= 40) return this.reporter.error('Second objid identifier OOB');
40631          id.splice(0, 2, id[0] * 40 + id[1]);
40632        } // Count number of octets
40633
40634
40635        var size = 0;
40636
40637        for (var i = 0; i < id.length; i++) {
40638          var ident = id[i];
40639
40640          for (size++; ident >= 0x80; ident >>= 7) {
40641            size++;
40642          }
40643        }
40644
40645        var objid = new Buffer(size);
40646        var offset = objid.length - 1;
40647
40648        for (var i = id.length - 1; i >= 0; i--) {
40649          var ident = id[i];
40650          objid[offset--] = ident & 0x7f;
40651
40652          while ((ident >>= 7) > 0) {
40653            objid[offset--] = 0x80 | ident & 0x7f;
40654          }
40655        }
40656
40657        return this._createEncoderBuffer(objid);
40658      };
40659
40660      function two(num) {
40661        if (num < 10) return '0' + num;else return num;
40662      }
40663
40664      DERNode.prototype._encodeTime = function encodeTime(time, tag) {
40665        var str;
40666        var date = new Date(time);
40667
40668        if (tag === 'gentime') {
40669          str = [two(date.getFullYear()), two(date.getUTCMonth() + 1), two(date.getUTCDate()), two(date.getUTCHours()), two(date.getUTCMinutes()), two(date.getUTCSeconds()), 'Z'].join('');
40670        } else if (tag === 'utctime') {
40671          str = [two(date.getFullYear() % 100), two(date.getUTCMonth() + 1), two(date.getUTCDate()), two(date.getUTCHours()), two(date.getUTCMinutes()), two(date.getUTCSeconds()), 'Z'].join('');
40672        } else {
40673          this.reporter.error('Encoding ' + tag + ' time is not supported yet');
40674        }
40675
40676        return this._encodeStr(str, 'octstr');
40677      };
40678
40679      DERNode.prototype._encodeNull = function encodeNull() {
40680        return this._createEncoderBuffer('');
40681      };
40682
40683      DERNode.prototype._encodeInt = function encodeInt(num, values) {
40684        if (typeof num === 'string') {
40685          if (!values) return this.reporter.error('String int or enum given, but no values map');
40686
40687          if (!values.hasOwnProperty(num)) {
40688            return this.reporter.error('Values map doesn\'t contain: ' + JSON.stringify(num));
40689          }
40690
40691          num = values[num];
40692        } // Bignum, assume big endian
40693
40694
40695        if (typeof num !== 'number' && !Buffer.isBuffer(num)) {
40696          var numArray = num.toArray();
40697
40698          if (!num.sign && numArray[0] & 0x80) {
40699            numArray.unshift(0);
40700          }
40701
40702          num = new Buffer(numArray);
40703        }
40704
40705        if (Buffer.isBuffer(num)) {
40706          var size = num.length;
40707          if (num.length === 0) size++;
40708          var out = new Buffer(size);
40709          num.copy(out);
40710          if (num.length === 0) out[0] = 0;
40711          return this._createEncoderBuffer(out);
40712        }
40713
40714        if (num < 0x80) return this._createEncoderBuffer(num);
40715        if (num < 0x100) return this._createEncoderBuffer([0, num]);
40716        var size = 1;
40717
40718        for (var i = num; i >= 0x100; i >>= 8) {
40719          size++;
40720        }
40721
40722        var out = new Array(size);
40723
40724        for (var i = out.length - 1; i >= 0; i--) {
40725          out[i] = num & 0xff;
40726          num >>= 8;
40727        }
40728
40729        if (out[0] & 0x80) {
40730          out.unshift(0);
40731        }
40732
40733        return this._createEncoderBuffer(new Buffer(out));
40734      };
40735
40736      DERNode.prototype._encodeBool = function encodeBool(value) {
40737        return this._createEncoderBuffer(value ? 0xff : 0);
40738      };
40739
40740      DERNode.prototype._use = function use(entity, obj) {
40741        if (typeof entity === 'function') entity = entity(obj);
40742        return entity._getEncoder('der').tree;
40743      };
40744
40745      DERNode.prototype._skipDefault = function skipDefault(dataBuffer, reporter, parent) {
40746        var state = this._baseState;
40747        var i;
40748        if (state['default'] === null) return false;
vendor: 11,504 bytes, lines 40749-41152
40749        var data = dataBuffer.join();
40750        if (state.defaultBuffer === undefined) state.defaultBuffer = this._encodeValue(state['default'], reporter, parent).join();
40751        if (data.length !== state.defaultBuffer.length) return false;
40752
40753        for (i = 0; i < data.length; i++) {
40754          if (data[i] !== state.defaultBuffer[i]) return false;
40755        }
40756
40757        return true;
40758      }; // Utility methods
40759
40760
40761      function encodeTag(tag, primitive, cls, reporter) {
40762        var res;
40763        if (tag === 'seqof') tag = 'seq';else if (tag === 'setof') tag = 'set';
40764        if (der.tagByName.hasOwnProperty(tag)) res = der.tagByName[tag];else if (typeof tag === 'number' && (tag | 0) === tag) res = tag;else return reporter.error('Unknown tag: ' + tag);
40765        if (res >= 0x1f) return reporter.error('Multi-octet tag encoding unsupported');
40766        if (!primitive) res |= 0x20;
40767        res |= der.tagClassByName[cls || 'universal'] << 6;
40768        return res;
40769      }
40770    }, {
40771      "../../asn1": 165,
40772      "buffer": 214,
40773      "inherits": 364
40774    }],
40775    177: [function (require, module, exports) {
40776      var encoders = exports;
40777      encoders.der = require('./der');
40778      encoders.pem = require('./pem');
40779    }, {
40780      "./der": 176,
40781      "./pem": 178
40782    }],
40783    178: [function (require, module, exports) {
40784      var inherits = require('inherits');
40785
40786      var DEREncoder = require('./der');
40787
40788      function PEMEncoder(entity) {
40789        DEREncoder.call(this, entity);
40790        this.enc = 'pem';
40791      }
40792
40793      ;
40794      inherits(PEMEncoder, DEREncoder);
40795      module.exports = PEMEncoder;
40796
40797      PEMEncoder.prototype.encode = function encode(data, options) {
40798        var buf = DEREncoder.prototype.encode.call(this, data);
40799        var p = buf.toString('base64');
40800        var out = ['-----BEGIN ' + options.label + '-----'];
40801
40802        for (var i = 0; i < p.length; i += 64) {
40803          out.push(p.slice(i, i + 64));
40804        }
40805
40806        out.push('-----END ' + options.label + '-----');
40807        return out.join('\n');
40808      };
40809    }, {
40810      "./der": 176,
40811      "inherits": 364
40812    }],
40813    179: [function (require, module, exports) {
40814      (function (module, exports) {
40815        'use strict'; // Utils
40816
40817        function assert(val, msg) {
40818          if (!val) throw new Error(msg || 'Assertion failed');
40819        } // Could use `inherits` module, but don't want to move from single file
40820        // architecture yet.
40821
40822
40823        function inherits(ctor, superCtor) {
40824          ctor.super_ = superCtor;
40825
40826          var TempCtor = function TempCtor() {};
40827
40828          TempCtor.prototype = superCtor.prototype;
40829          ctor.prototype = new TempCtor();
40830          ctor.prototype.constructor = ctor;
40831        } // BN
40832
40833
40834        function BN(number, base, endian) {
40835          if (BN.isBN(number)) {
40836            return number;
40837          }
40838
40839          this.negative = 0;
40840          this.words = null;
40841          this.length = 0; // Reduction context
40842
40843          this.red = null;
40844
40845          if (number !== null) {
40846            if (base === 'le' || base === 'be') {
40847              endian = base;
40848              base = 10;
40849            }
40850
40851            this._init(number || 0, base || 10, endian || 'be');
40852          }
40853        }
40854
40855        if (_typeof2(module) === 'object') {
40856          module.exports = BN;
40857        } else {
40858          exports.BN = BN;
40859        }
40860
40861        BN.BN = BN;
40862        BN.wordSize = 26;
40863        var Buffer;
40864
40865        try {
40866          Buffer = require('buffer').Buffer;
40867        } catch (e) {}
40868
40869        BN.isBN = function isBN(num) {
40870          if (num instanceof BN) {
40871            return true;
40872          }
40873
40874          return num !== null && _typeof2(num) === 'object' && num.constructor.wordSize === BN.wordSize && Array.isArray(num.words);
40875        };
40876
40877        BN.max = function max(left, right) {
40878          if (left.cmp(right) > 0) return left;
40879          return right;
40880        };
40881
40882        BN.min = function min(left, right) {
40883          if (left.cmp(right) < 0) return left;
40884          return right;
40885        };
40886
40887        BN.prototype._init = function init(number, base, endian) {
40888          if (typeof number === 'number') {
40889            return this._initNumber(number, base, endian);
40890          }
40891
40892          if (_typeof2(number) === 'object') {
40893            return this._initArray(number, base, endian);
40894          }
40895
40896          if (base === 'hex') {
40897            base = 16;
40898          }
40899
40900          assert(base === (base | 0) && base >= 2 && base <= 36);
40901          number = number.toString().replace(/\s+/g, '');
40902          var start = 0;
40903
40904          if (number[0] === '-') {
40905            start++;
40906          }
40907
40908          if (base === 16) {
40909            this._parseHex(number, start);
40910          } else {
40911            this._parseBase(number, base, start);
40912          }
40913
40914          if (number[0] === '-') {
40915            this.negative = 1;
40916          }
40917
40918          this.strip();
40919          if (endian !== 'le') return;
40920
40921          this._initArray(this.toArray(), base, endian);
40922        };
40923
40924        BN.prototype._initNumber = function _initNumber(number, base, endian) {
40925          if (number < 0) {
40926            this.negative = 1;
40927            number = -number;
40928          }
40929
40930          if (number < 0x4000000) {
40931            this.words = [number & 0x3ffffff];
40932            this.length = 1;
40933          } else if (number < 0x10000000000000) {
40934            this.words = [number & 0x3ffffff, number / 0x4000000 & 0x3ffffff];
40935            this.length = 2;
40936          } else {
40937            assert(number < 0x20000000000000); // 2 ^ 53 (unsafe)
40938
40939            this.words = [number & 0x3ffffff, number / 0x4000000 & 0x3ffffff, 1];
40940            this.length = 3;
40941          }
40942
40943          if (endian !== 'le') return; // Reverse the bytes
40944
40945          this._initArray(this.toArray(), base, endian);
40946        };
40947
40948        BN.prototype._initArray = function _initArray(number, base, endian) {
40949          // Perhaps a Uint8Array
40950          assert(typeof number.length === 'number');
40951
40952          if (number.length <= 0) {
40953            this.words = [0];
40954            this.length = 1;
40955            return this;
40956          }
40957
40958          this.length = Math.ceil(number.length / 3);
40959          this.words = new Array(this.length);
40960
40961          for (var i = 0; i < this.length; i++) {
40962            this.words[i] = 0;
40963          }
40964
40965          var j, w;
40966          var off = 0;
40967
40968          if (endian === 'be') {
40969            for (i = number.length - 1, j = 0; i >= 0; i -= 3) {
40970              w = number[i] | number[i - 1] << 8 | number[i - 2] << 16;
40971              this.words[j] |= w << off & 0x3ffffff;
40972              this.words[j + 1] = w >>> 26 - off & 0x3ffffff;
40973              off += 24;
40974
40975              if (off >= 26) {
40976                off -= 26;
40977                j++;
40978              }
40979            }
40980          } else if (endian === 'le') {
40981            for (i = 0, j = 0; i < number.length; i += 3) {
40982              w = number[i] | number[i + 1] << 8 | number[i + 2] << 16;
40983              this.words[j] |= w << off & 0x3ffffff;
40984              this.words[j + 1] = w >>> 26 - off & 0x3ffffff;
40985              off += 24;
40986
40987              if (off >= 26) {
40988                off -= 26;
40989                j++;
40990              }
40991            }
40992          }
40993
40994          return this.strip();
40995        };
40996
40997        function parseHex(str, start, end) {
40998          var r = 0;
40999          var len = Math.min(str.length, end);
41000
41001          for (var i = start; i < len; i++) {
41002            var c = str.charCodeAt(i) - 48;
41003            r <<= 4; // 'a' - 'f'
41004
41005            if (c >= 49 && c <= 54) {
41006              r |= c - 49 + 0xa; // 'A' - 'F'
41007            } else if (c >= 17 && c <= 22) {
41008              r |= c - 17 + 0xa; // '0' - '9'
41009            } else {
41010              r |= c & 0xf;
41011            }
41012          }
41013
41014          return r;
41015        }
41016
41017        BN.prototype._parseHex = function _parseHex(number, start) {
41018          // Create possibly bigger array to ensure that it fits the number
41019          this.length = Math.ceil((number.length - start) / 6);
41020          this.words = new Array(this.length);
41021
41022          for (var i = 0; i < this.length; i++) {
41023            this.words[i] = 0;
41024          }
41025
41026          var j, w; // Scan 24-bit chunks and add them to the number
41027
41028          var off = 0;
41029
41030          for (i = number.length - 6, j = 0; i >= start; i -= 6) {
41031            w = parseHex(number, i, i + 6);
41032            this.words[j] |= w << off & 0x3ffffff; // NOTE: `0x3fffff` is intentional here, 26bits max shift + 24bit hex limb
41033
41034            this.words[j + 1] |= w >>> 26 - off & 0x3fffff;
41035            off += 24;
41036
41037            if (off >= 26) {
41038              off -= 26;
41039              j++;
41040            }
41041          }
41042
41043          if (i + 6 !== start) {
41044            w = parseHex(number, start, i + 6);
41045            this.words[j] |= w << off & 0x3ffffff;
41046            this.words[j + 1] |= w >>> 26 - off & 0x3fffff;
41047          }
41048
41049          this.strip();
41050        };
41051
41052        function parseBase(str, start, end, mul) {
41053          var r = 0;
41054          var len = Math.min(str.length, end);
41055
41056          for (var i = start; i < len; i++) {
41057            var c = str.charCodeAt(i) - 48;
41058            r *= mul; // 'a'
41059
41060            if (c >= 49) {
41061              r += c - 49 + 0xa; // 'A'
41062            } else if (c >= 17) {
41063              r += c - 17 + 0xa; // '0' - '9'
41064            } else {
41065              r += c;
41066            }
41067          }
41068
41069          return r;
41070        }
41071
41072        BN.prototype._parseBase = function _parseBase(number, base, start) {
41073          // Initialize as zero
41074          this.words = [0];
41075          this.length = 1; // Find length of limb in base
41076
41077          for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) {
41078            limbLen++;
41079          }
41080
41081          limbLen--;
41082          limbPow = limbPow / base | 0;
41083          var total = number.length - start;
41084          var mod = total % limbLen;
41085          var end = Math.min(total, total - mod) + start;
41086          var word = 0;
41087
41088          for (var i = start; i < end; i += limbLen) {
41089            word = parseBase(number, i, i + limbLen, base);
41090            this.imuln(limbPow);
41091
41092            if (this.words[0] + word < 0x4000000) {
41093              this.words[0] += word;
41094            } else {
41095              this._iaddn(word);
41096            }
41097          }
41098
41099          if (mod !== 0) {
41100            var pow = 1;
41101            word = parseBase(number, i, number.length, base);
41102
41103            for (i = 0; i < mod; i++) {
41104              pow *= base;
41105            }
41106
41107            this.imuln(pow);
41108
41109            if (this.words[0] + word < 0x4000000) {
41110              this.words[0] += word;
41111            } else {
41112              this._iaddn(word);
41113            }
41114          }
41115        };
41116
41117        BN.prototype.copy = function copy(dest) {
41118          dest.words = new Array(this.length);
41119
41120          for (var i = 0; i < this.length; i++) {
41121            dest.words[i] = this.words[i];
41122          }
41123
41124          dest.length = this.length;
41125          dest.negative = this.negative;
41126          dest.red = this.red;
41127        };
41128
41129        BN.prototype.clone = function clone() {
41130          var r = new BN(null);
41131          this.copy(r);
41132          return r;
41133        };
41134
41135        BN.prototype._expand = function _expand(size) {
41136          while (this.length < size) {
41137            this.words[this.length++] = 0;
41138          }
41139
41140          return this;
41141        }; // Remove leading `0` from `this`
41142
41143
41144        BN.prototype.strip = function strip() {
41145          while (this.length > 1 && this.words[this.length - 1] === 0) {
41146            this.length--;
41147          }
41148
41149          return this._normSign();
41150        };
41151
41152        BN.prototype._normSign = function _normSign() {
vendor: 87,867 bytes, lines 41153-44091
41153          // -0 = 0
41154          if (this.length === 1 && this.words[0] === 0) {
41155            this.negative = 0;
41156          }
41157
41158          return this;
41159        };
41160
41161        BN.prototype.inspect = function inspect() {
41162          return (this.red ? '<BN-R: ' : '<BN: ') + this.toString(16) + '>';
41163        };
41164        /*
41165         var zeros = [];
41166        var groupSizes = [];
41167        var groupBases = [];
41168         var s = '';
41169        var i = -1;
41170        while (++i < BN.wordSize) {
41171          zeros[i] = s;
41172          s += '0';
41173        }
41174        groupSizes[0] = 0;
41175        groupSizes[1] = 0;
41176        groupBases[0] = 0;
41177        groupBases[1] = 0;
41178        var base = 2 - 1;
41179        while (++base < 36 + 1) {
41180          var groupSize = 0;
41181          var groupBase = 1;
41182          while (groupBase < (1 << BN.wordSize) / base) {
41183            groupBase *= base;
41184            groupSize += 1;
41185          }
41186          groupSizes[base] = groupSize;
41187          groupBases[base] = groupBase;
41188        }
41189         */
41190
41191
41192        var zeros = ['', '0', '00', '000', '0000', '00000', '000000', '0000000', '00000000', '000000000', '0000000000', '00000000000', '000000000000', '0000000000000', '00000000000000', '000000000000000', '0000000000000000', '00000000000000000', '000000000000000000', '0000000000000000000', '00000000000000000000', '000000000000000000000', '0000000000000000000000', '00000000000000000000000', '000000000000000000000000', '0000000000000000000000000'];
41193        var groupSizes = [0, 0, 25, 16, 12, 11, 10, 9, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5];
41194        var groupBases = [0, 0, 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625, 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632, 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176];
41195
41196        BN.prototype.toString = function toString(base, padding) {
41197          base = base || 10;
41198          padding = padding | 0 || 1;
41199          var out;
41200
41201          if (base === 16 || base === 'hex') {
41202            out = '';
41203            var off = 0;
41204            var carry = 0;
41205
41206            for (var i = 0; i < this.length; i++) {
41207              var w = this.words[i];
41208              var word = ((w << off | carry) & 0xffffff).toString(16);
41209              carry = w >>> 24 - off & 0xffffff;
41210
41211              if (carry !== 0 || i !== this.length - 1) {
41212                out = zeros[6 - word.length] + word + out;
41213              } else {
41214                out = word + out;
41215              }
41216
41217              off += 2;
41218
41219              if (off >= 26) {
41220                off -= 26;
41221                i--;
41222              }
41223            }
41224
41225            if (carry !== 0) {
41226              out = carry.toString(16) + out;
41227            }
41228
41229            while (out.length % padding !== 0) {
41230              out = '0' + out;
41231            }
41232
41233            if (this.negative !== 0) {
41234              out = '-' + out;
41235            }
41236
41237            return out;
41238          }
41239
41240          if (base === (base | 0) && base >= 2 && base <= 36) {
41241            // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base));
41242            var groupSize = groupSizes[base]; // var groupBase = Math.pow(base, groupSize);
41243
41244            var groupBase = groupBases[base];
41245            out = '';
41246            var c = this.clone();
41247            c.negative = 0;
41248
41249            while (!c.isZero()) {
41250              var r = c.modn(groupBase).toString(base);
41251              c = c.idivn(groupBase);
41252
41253              if (!c.isZero()) {
41254                out = zeros[groupSize - r.length] + r + out;
41255              } else {
41256                out = r + out;
41257              }
41258            }
41259
41260            if (this.isZero()) {
41261              out = '0' + out;
41262            }
41263
41264            while (out.length % padding !== 0) {
41265              out = '0' + out;
41266            }
41267
41268            if (this.negative !== 0) {
41269              out = '-' + out;
41270            }
41271
41272            return out;
41273          }
41274
41275          assert(false, 'Base should be between 2 and 36');
41276        };
41277
41278        BN.prototype.toNumber = function toNumber() {
41279          var ret = this.words[0];
41280
41281          if (this.length === 2) {
41282            ret += this.words[1] * 0x4000000;
41283          } else if (this.length === 3 && this.words[2] === 0x01) {
41284            // NOTE: at this stage it is known that the top bit is set
41285            ret += 0x10000000000000 + this.words[1] * 0x4000000;
41286          } else if (this.length > 2) {
41287            assert(false, 'Number can only safely store up to 53 bits');
41288          }
41289
41290          return this.negative !== 0 ? -ret : ret;
41291        };
41292
41293        BN.prototype.toJSON = function toJSON() {
41294          return this.toString(16);
41295        };
41296
41297        BN.prototype.toBuffer = function toBuffer(endian, length) {
41298          assert(typeof Buffer !== 'undefined');
41299          return this.toArrayLike(Buffer, endian, length);
41300        };
41301
41302        BN.prototype.toArray = function toArray(endian, length) {
41303          return this.toArrayLike(Array, endian, length);
41304        };
41305
41306        BN.prototype.toArrayLike = function toArrayLike(ArrayType, endian, length) {
41307          var byteLength = this.byteLength();
41308          var reqLength = length || Math.max(1, byteLength);
41309          assert(byteLength <= reqLength, 'byte array longer than desired length');
41310          assert(reqLength > 0, 'Requested array length <= 0');
41311          this.strip();
41312          var littleEndian = endian === 'le';
41313          var res = new ArrayType(reqLength);
41314          var b, i;
41315          var q = this.clone();
41316
41317          if (!littleEndian) {
41318            // Assume big-endian
41319            for (i = 0; i < reqLength - byteLength; i++) {
41320              res[i] = 0;
41321            }
41322
41323            for (i = 0; !q.isZero(); i++) {
41324              b = q.andln(0xff);
41325              q.iushrn(8);
41326              res[reqLength - i - 1] = b;
41327            }
41328          } else {
41329            for (i = 0; !q.isZero(); i++) {
41330              b = q.andln(0xff);
41331              q.iushrn(8);
41332              res[i] = b;
41333            }
41334
41335            for (; i < reqLength; i++) {
41336              res[i] = 0;
41337            }
41338          }
41339
41340          return res;
41341        };
41342
41343        if (Math.clz32) {
41344          BN.prototype._countBits = function _countBits(w) {
41345            return 32 - Math.clz32(w);
41346          };
41347        } else {
41348          BN.prototype._countBits = function _countBits(w) {
41349            var t = w;
41350            var r = 0;
41351
41352            if (t >= 0x1000) {
41353              r += 13;
41354              t >>>= 13;
41355            }
41356
41357            if (t >= 0x40) {
41358              r += 7;
41359              t >>>= 7;
41360            }
41361
41362            if (t >= 0x8) {
41363              r += 4;
41364              t >>>= 4;
41365            }
41366
41367            if (t >= 0x02) {
41368              r += 2;
41369              t >>>= 2;
41370            }
41371
41372            return r + t;
41373          };
41374        }
41375
41376        BN.prototype._zeroBits = function _zeroBits(w) {
41377          // Short-cut
41378          if (w === 0) return 26;
41379          var t = w;
41380          var r = 0;
41381
41382          if ((t & 0x1fff) === 0) {
41383            r += 13;
41384            t >>>= 13;
41385          }
41386
41387          if ((t & 0x7f) === 0) {
41388            r += 7;
41389            t >>>= 7;
41390          }
41391
41392          if ((t & 0xf) === 0) {
41393            r += 4;
41394            t >>>= 4;
41395          }
41396
41397          if ((t & 0x3) === 0) {
41398            r += 2;
41399            t >>>= 2;
41400          }
41401
41402          if ((t & 0x1) === 0) {
41403            r++;
41404          }
41405
41406          return r;
41407        }; // Return number of used bits in a BN
41408
41409
41410        BN.prototype.bitLength = function bitLength() {
41411          var w = this.words[this.length - 1];
41412
41413          var hi = this._countBits(w);
41414
41415          return (this.length - 1) * 26 + hi;
41416        };
41417
41418        function toBitArray(num) {
41419          var w = new Array(num.bitLength());
41420
41421          for (var bit = 0; bit < w.length; bit++) {
41422            var off = bit / 26 | 0;
41423            var wbit = bit % 26;
41424            w[bit] = (num.words[off] & 1 << wbit) >>> wbit;
41425          }
41426
41427          return w;
41428        } // Number of trailing zero bits
41429
41430
41431        BN.prototype.zeroBits = function zeroBits() {
41432          if (this.isZero()) return 0;
41433          var r = 0;
41434
41435          for (var i = 0; i < this.length; i++) {
41436            var b = this._zeroBits(this.words[i]);
41437
41438            r += b;
41439            if (b !== 26) break;
41440          }
41441
41442          return r;
41443        };
41444
41445        BN.prototype.byteLength = function byteLength() {
41446          return Math.ceil(this.bitLength() / 8);
41447        };
41448
41449        BN.prototype.toTwos = function toTwos(width) {
41450          if (this.negative !== 0) {
41451            return this.abs().inotn(width).iaddn(1);
41452          }
41453
41454          return this.clone();
41455        };
41456
41457        BN.prototype.fromTwos = function fromTwos(width) {
41458          if (this.testn(width - 1)) {
41459            return this.notn(width).iaddn(1).ineg();
41460          }
41461
41462          return this.clone();
41463        };
41464
41465        BN.prototype.isNeg = function isNeg() {
41466          return this.negative !== 0;
41467        }; // Return negative clone of `this`
41468
41469
41470        BN.prototype.neg = function neg() {
41471          return this.clone().ineg();
41472        };
41473
41474        BN.prototype.ineg = function ineg() {
41475          if (!this.isZero()) {
41476            this.negative ^= 1;
41477          }
41478
41479          return this;
41480        }; // Or `num` with `this` in-place
41481
41482
41483        BN.prototype.iuor = function iuor(num) {
41484          while (this.length < num.length) {
41485            this.words[this.length++] = 0;
41486          }
41487
41488          for (var i = 0; i < num.length; i++) {
41489            this.words[i] = this.words[i] | num.words[i];
41490          }
41491
41492          return this.strip();
41493        };
41494
41495        BN.prototype.ior = function ior(num) {
41496          assert((this.negative | num.negative) === 0);
41497          return this.iuor(num);
41498        }; // Or `num` with `this`
41499
41500
41501        BN.prototype.or = function or(num) {
41502          if (this.length > num.length) return this.clone().ior(num);
41503          return num.clone().ior(this);
41504        };
41505
41506        BN.prototype.uor = function uor(num) {
41507          if (this.length > num.length) return this.clone().iuor(num);
41508          return num.clone().iuor(this);
41509        }; // And `num` with `this` in-place
41510
41511
41512        BN.prototype.iuand = function iuand(num) {
41513          // b = min-length(num, this)
41514          var b;
41515
41516          if (this.length > num.length) {
41517            b = num;
41518          } else {
41519            b = this;
41520          }
41521
41522          for (var i = 0; i < b.length; i++) {
41523            this.words[i] = this.words[i] & num.words[i];
41524          }
41525
41526          this.length = b.length;
41527          return this.strip();
41528        };
41529
41530        BN.prototype.iand = function iand(num) {
41531          assert((this.negative | num.negative) === 0);
41532          return this.iuand(num);
41533        }; // And `num` with `this`
41534
41535
41536        BN.prototype.and = function and(num) {
41537          if (this.length > num.length) return this.clone().iand(num);
41538          return num.clone().iand(this);
41539        };
41540
41541        BN.prototype.uand = function uand(num) {
41542          if (this.length > num.length) return this.clone().iuand(num);
41543          return num.clone().iuand(this);
41544        }; // Xor `num` with `this` in-place
41545
41546
41547        BN.prototype.iuxor = function iuxor(num) {
41548          // a.length > b.length
41549          var a;
41550          var b;
41551
41552          if (this.length > num.length) {
41553            a = this;
41554            b = num;
41555          } else {
41556            a = num;
41557            b = this;
41558          }
41559
41560          for (var i = 0; i < b.length; i++) {
41561            this.words[i] = a.words[i] ^ b.words[i];
41562          }
41563
41564          if (this !== a) {
41565            for (; i < a.length; i++) {
41566              this.words[i] = a.words[i];
41567            }
41568          }
41569
41570          this.length = a.length;
41571          return this.strip();
41572        };
41573
41574        BN.prototype.ixor = function ixor(num) {
41575          assert((this.negative | num.negative) === 0);
41576          return this.iuxor(num);
41577        }; // Xor `num` with `this`
41578
41579
41580        BN.prototype.xor = function xor(num) {
41581          if (this.length > num.length) return this.clone().ixor(num);
41582          return num.clone().ixor(this);
41583        };
41584
41585        BN.prototype.uxor = function uxor(num) {
41586          if (this.length > num.length) return this.clone().iuxor(num);
41587          return num.clone().iuxor(this);
41588        }; // Not ``this`` with ``width`` bitwidth
41589
41590
41591        BN.prototype.inotn = function inotn(width) {
41592          assert(typeof width === 'number' && width >= 0);
41593          var bytesNeeded = Math.ceil(width / 26) | 0;
41594          var bitsLeft = width % 26; // Extend the buffer with leading zeroes
41595
41596          this._expand(bytesNeeded);
41597
41598          if (bitsLeft > 0) {
41599            bytesNeeded--;
41600          } // Handle complete words
41601
41602
41603          for (var i = 0; i < bytesNeeded; i++) {
41604            this.words[i] = ~this.words[i] & 0x3ffffff;
41605          } // Handle the residue
41606
41607
41608          if (bitsLeft > 0) {
41609            this.words[i] = ~this.words[i] & 0x3ffffff >> 26 - bitsLeft;
41610          } // And remove leading zeroes
41611
41612
41613          return this.strip();
41614        };
41615
41616        BN.prototype.notn = function notn(width) {
41617          return this.clone().inotn(width);
41618        }; // Set `bit` of `this`
41619
41620
41621        BN.prototype.setn = function setn(bit, val) {
41622          assert(typeof bit === 'number' && bit >= 0);
41623          var off = bit / 26 | 0;
41624          var wbit = bit % 26;
41625
41626          this._expand(off + 1);
41627
41628          if (val) {
41629            this.words[off] = this.words[off] | 1 << wbit;
41630          } else {
41631            this.words[off] = this.words[off] & ~(1 << wbit);
41632          }
41633
41634          return this.strip();
41635        }; // Add `num` to `this` in-place
41636
41637
41638        BN.prototype.iadd = function iadd(num) {
41639          var r; // negative + positive
41640
41641          if (this.negative !== 0 && num.negative === 0) {
41642            this.negative = 0;
41643            r = this.isub(num);
41644            this.negative ^= 1;
41645            return this._normSign(); // positive + negative
41646          } else if (this.negative === 0 && num.negative !== 0) {
41647            num.negative = 0;
41648            r = this.isub(num);
41649            num.negative = 1;
41650            return r._normSign();
41651          } // a.length > b.length
41652
41653
41654          var a, b;
41655
41656          if (this.length > num.length) {
41657            a = this;
41658            b = num;
41659          } else {
41660            a = num;
41661            b = this;
41662          }
41663
41664          var carry = 0;
41665
41666          for (var i = 0; i < b.length; i++) {
41667            r = (a.words[i] | 0) + (b.words[i] | 0) + carry;
41668            this.words[i] = r & 0x3ffffff;
41669            carry = r >>> 26;
41670          }
41671
41672          for (; carry !== 0 && i < a.length; i++) {
41673            r = (a.words[i] | 0) + carry;
41674            this.words[i] = r & 0x3ffffff;
41675            carry = r >>> 26;
41676          }
41677
41678          this.length = a.length;
41679
41680          if (carry !== 0) {
41681            this.words[this.length] = carry;
41682            this.length++; // Copy the rest of the words
41683          } else if (a !== this) {
41684            for (; i < a.length; i++) {
41685              this.words[i] = a.words[i];
41686            }
41687          }
41688
41689          return this;
41690        }; // Add `num` to `this`
41691
41692
41693        BN.prototype.add = function add(num) {
41694          var res;
41695
41696          if (num.negative !== 0 && this.negative === 0) {
41697            num.negative = 0;
41698            res = this.sub(num);
41699            num.negative ^= 1;
41700            return res;
41701          } else if (num.negative === 0 && this.negative !== 0) {
41702            this.negative = 0;
41703            res = num.sub(this);
41704            this.negative = 1;
41705            return res;
41706          }
41707
41708          if (this.length > num.length) return this.clone().iadd(num);
41709          return num.clone().iadd(this);
41710        }; // Subtract `num` from `this` in-place
41711
41712
41713        BN.prototype.isub = function isub(num) {
41714          // this - (-num) = this + num
41715          if (num.negative !== 0) {
41716            num.negative = 0;
41717            var r = this.iadd(num);
41718            num.negative = 1;
41719            return r._normSign(); // -this - num = -(this + num)
41720          } else if (this.negative !== 0) {
41721            this.negative = 0;
41722            this.iadd(num);
41723            this.negative = 1;
41724            return this._normSign();
41725          } // At this point both numbers are positive
41726
41727
41728          var cmp = this.cmp(num); // Optimization - zeroify
41729
41730          if (cmp === 0) {
41731            this.negative = 0;
41732            this.length = 1;
41733            this.words[0] = 0;
41734            return this;
41735          } // a > b
41736
41737
41738          var a, b;
41739
41740          if (cmp > 0) {
41741            a = this;
41742            b = num;
41743          } else {
41744            a = num;
41745            b = this;
41746          }
41747
41748          var carry = 0;
41749
41750          for (var i = 0; i < b.length; i++) {
41751            r = (a.words[i] | 0) - (b.words[i] | 0) + carry;
41752            carry = r >> 26;
41753            this.words[i] = r & 0x3ffffff;
41754          }
41755
41756          for (; carry !== 0 && i < a.length; i++) {
41757            r = (a.words[i] | 0) + carry;
41758            carry = r >> 26;
41759            this.words[i] = r & 0x3ffffff;
41760          } // Copy rest of the words
41761
41762
41763          if (carry === 0 && i < a.length && a !== this) {
41764            for (; i < a.length; i++) {
41765              this.words[i] = a.words[i];
41766            }
41767          }
41768
41769          this.length = Math.max(this.length, i);
41770
41771          if (a !== this) {
41772            this.negative = 1;
41773          }
41774
41775          return this.strip();
41776        }; // Subtract `num` from `this`
41777
41778
41779        BN.prototype.sub = function sub(num) {
41780          return this.clone().isub(num);
41781        };
41782
41783        function smallMulTo(self, num, out) {
41784          out.negative = num.negative ^ self.negative;
41785          var len = self.length + num.length | 0;
41786          out.length = len;
41787          len = len - 1 | 0; // Peel one iteration (compiler can't do it, because of code complexity)
41788
41789          var a = self.words[0] | 0;
41790          var b = num.words[0] | 0;
41791          var r = a * b;
41792          var lo = r & 0x3ffffff;
41793          var carry = r / 0x4000000 | 0;
41794          out.words[0] = lo;
41795
41796          for (var k = 1; k < len; k++) {
41797            // Sum all words with the same `i + j = k` and accumulate `ncarry`,
41798            // note that ncarry could be >= 0x3ffffff
41799            var ncarry = carry >>> 26;
41800            var rword = carry & 0x3ffffff;
41801            var maxJ = Math.min(k, num.length - 1);
41802
41803            for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {
41804              var i = k - j | 0;
41805              a = self.words[i] | 0;
41806              b = num.words[j] | 0;
41807              r = a * b + rword;
41808              ncarry += r / 0x4000000 | 0;
41809              rword = r & 0x3ffffff;
41810            }
41811
41812            out.words[k] = rword | 0;
41813            carry = ncarry | 0;
41814          }
41815
41816          if (carry !== 0) {
41817            out.words[k] = carry | 0;
41818          } else {
41819            out.length--;
41820          }
41821
41822          return out.strip();
41823        } // TODO(indutny): it may be reasonable to omit it for users who don't need
41824        // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit
41825        // multiplication (like elliptic secp256k1).
41826
41827
41828        var comb10MulTo = function comb10MulTo(self, num, out) {
41829          var a = self.words;
41830          var b = num.words;
41831          var o = out.words;
41832          var c = 0;
41833          var lo;
41834          var mid;
41835          var hi;
41836          var a0 = a[0] | 0;
41837          var al0 = a0 & 0x1fff;
41838          var ah0 = a0 >>> 13;
41839          var a1 = a[1] | 0;
41840          var al1 = a1 & 0x1fff;
41841          var ah1 = a1 >>> 13;
41842          var a2 = a[2] | 0;
41843          var al2 = a2 & 0x1fff;
41844          var ah2 = a2 >>> 13;
41845          var a3 = a[3] | 0;
41846          var al3 = a3 & 0x1fff;
41847          var ah3 = a3 >>> 13;
41848          var a4 = a[4] | 0;
41849          var al4 = a4 & 0x1fff;
41850          var ah4 = a4 >>> 13;
41851          var a5 = a[5] | 0;
41852          var al5 = a5 & 0x1fff;
41853          var ah5 = a5 >>> 13;
41854          var a6 = a[6] | 0;
41855          var al6 = a6 & 0x1fff;
41856          var ah6 = a6 >>> 13;
41857          var a7 = a[7] | 0;
41858          var al7 = a7 & 0x1fff;
41859          var ah7 = a7 >>> 13;
41860          var a8 = a[8] | 0;
41861          var al8 = a8 & 0x1fff;
41862          var ah8 = a8 >>> 13;
41863          var a9 = a[9] | 0;
41864          var al9 = a9 & 0x1fff;
41865          var ah9 = a9 >>> 13;
41866          var b0 = b[0] | 0;
41867          var bl0 = b0 & 0x1fff;
41868          var bh0 = b0 >>> 13;
41869          var b1 = b[1] | 0;
41870          var bl1 = b1 & 0x1fff;
41871          var bh1 = b1 >>> 13;
41872          var b2 = b[2] | 0;
41873          var bl2 = b2 & 0x1fff;
41874          var bh2 = b2 >>> 13;
41875          var b3 = b[3] | 0;
41876          var bl3 = b3 & 0x1fff;
41877          var bh3 = b3 >>> 13;
41878          var b4 = b[4] | 0;
41879          var bl4 = b4 & 0x1fff;
41880          var bh4 = b4 >>> 13;
41881          var b5 = b[5] | 0;
41882          var bl5 = b5 & 0x1fff;
41883          var bh5 = b5 >>> 13;
41884          var b6 = b[6] | 0;
41885          var bl6 = b6 & 0x1fff;
41886          var bh6 = b6 >>> 13;
41887          var b7 = b[7] | 0;
41888          var bl7 = b7 & 0x1fff;
41889          var bh7 = b7 >>> 13;
41890          var b8 = b[8] | 0;
41891          var bl8 = b8 & 0x1fff;
41892          var bh8 = b8 >>> 13;
41893          var b9 = b[9] | 0;
41894          var bl9 = b9 & 0x1fff;
41895          var bh9 = b9 >>> 13;
41896          out.negative = self.negative ^ num.negative;
41897          out.length = 19;
41898          /* k = 0 */
41899
41900          lo = Math.imul(al0, bl0);
41901          mid = Math.imul(al0, bh0);
41902          mid = mid + Math.imul(ah0, bl0) | 0;
41903          hi = Math.imul(ah0, bh0);
41904          var w0 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;
41905          c = (hi + (mid >>> 13) | 0) + (w0 >>> 26) | 0;
41906          w0 &= 0x3ffffff;
41907          /* k = 1 */
41908
41909          lo = Math.imul(al1, bl0);
41910          mid = Math.imul(al1, bh0);
41911          mid = mid + Math.imul(ah1, bl0) | 0;
41912          hi = Math.imul(ah1, bh0);
41913          lo = lo + Math.imul(al0, bl1) | 0;
41914          mid = mid + Math.imul(al0, bh1) | 0;
41915          mid = mid + Math.imul(ah0, bl1) | 0;
41916          hi = hi + Math.imul(ah0, bh1) | 0;
41917          var w1 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;
41918          c = (hi + (mid >>> 13) | 0) + (w1 >>> 26) | 0;
41919          w1 &= 0x3ffffff;
41920          /* k = 2 */
41921
41922          lo = Math.imul(al2, bl0);
41923          mid = Math.imul(al2, bh0);
41924          mid = mid + Math.imul(ah2, bl0) | 0;
41925          hi = Math.imul(ah2, bh0);
41926          lo = lo + Math.imul(al1, bl1) | 0;
41927          mid = mid + Math.imul(al1, bh1) | 0;
41928          mid = mid + Math.imul(ah1, bl1) | 0;
41929          hi = hi + Math.imul(ah1, bh1) | 0;
41930          lo = lo + Math.imul(al0, bl2) | 0;
41931          mid = mid + Math.imul(al0, bh2) | 0;
41932          mid = mid + Math.imul(ah0, bl2) | 0;
41933          hi = hi + Math.imul(ah0, bh2) | 0;
41934          var w2 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;
41935          c = (hi + (mid >>> 13) | 0) + (w2 >>> 26) | 0;
41936          w2 &= 0x3ffffff;
41937          /* k = 3 */
41938
41939          lo = Math.imul(al3, bl0);
41940          mid = Math.imul(al3, bh0);
41941          mid = mid + Math.imul(ah3, bl0) | 0;
41942          hi = Math.imul(ah3, bh0);
41943          lo = lo + Math.imul(al2, bl1) | 0;
41944          mid = mid + Math.imul(al2, bh1) | 0;
41945          mid = mid + Math.imul(ah2, bl1) | 0;
41946          hi = hi + Math.imul(ah2, bh1) | 0;
41947          lo = lo + Math.imul(al1, bl2) | 0;
41948          mid = mid + Math.imul(al1, bh2) | 0;
41949          mid = mid + Math.imul(ah1, bl2) | 0;
41950          hi = hi + Math.imul(ah1, bh2) | 0;
41951          lo = lo + Math.imul(al0, bl3) | 0;
41952          mid = mid + Math.imul(al0, bh3) | 0;
41953          mid = mid + Math.imul(ah0, bl3) | 0;
41954          hi = hi + Math.imul(ah0, bh3) | 0;
41955          var w3 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;
41956          c = (hi + (mid >>> 13) | 0) + (w3 >>> 26) | 0;
41957          w3 &= 0x3ffffff;
41958          /* k = 4 */
41959
41960          lo = Math.imul(al4, bl0);
41961          mid = Math.imul(al4, bh0);
41962          mid = mid + Math.imul(ah4, bl0) | 0;
41963          hi = Math.imul(ah4, bh0);
41964          lo = lo + Math.imul(al3, bl1) | 0;
41965          mid = mid + Math.imul(al3, bh1) | 0;
41966          mid = mid + Math.imul(ah3, bl1) | 0;
41967          hi = hi + Math.imul(ah3, bh1) | 0;
41968          lo = lo + Math.imul(al2, bl2) | 0;
41969          mid = mid + Math.imul(al2, bh2) | 0;
41970          mid = mid + Math.imul(ah2, bl2) | 0;
41971          hi = hi + Math.imul(ah2, bh2) | 0;
41972          lo = lo + Math.imul(al1, bl3) | 0;
41973          mid = mid + Math.imul(al1, bh3) | 0;
41974          mid = mid + Math.imul(ah1, bl3) | 0;
41975          hi = hi + Math.imul(ah1, bh3) | 0;
41976          lo = lo + Math.imul(al0, bl4) | 0;
41977          mid = mid + Math.imul(al0, bh4) | 0;
41978          mid = mid + Math.imul(ah0, bl4) | 0;
41979          hi = hi + Math.imul(ah0, bh4) | 0;
41980          var w4 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;
41981          c = (hi + (mid >>> 13) | 0) + (w4 >>> 26) | 0;
41982          w4 &= 0x3ffffff;
41983          /* k = 5 */
41984
41985          lo = Math.imul(al5, bl0);
41986          mid = Math.imul(al5, bh0);
41987          mid = mid + Math.imul(ah5, bl0) | 0;
41988          hi = Math.imul(ah5, bh0);
41989          lo = lo + Math.imul(al4, bl1) | 0;
41990          mid = mid + Math.imul(al4, bh1) | 0;
41991          mid = mid + Math.imul(ah4, bl1) | 0;
41992          hi = hi + Math.imul(ah4, bh1) | 0;
41993          lo = lo + Math.imul(al3, bl2) | 0;
41994          mid = mid + Math.imul(al3, bh2) | 0;
41995          mid = mid + Math.imul(ah3, bl2) | 0;
41996          hi = hi + Math.imul(ah3, bh2) | 0;
41997          lo = lo + Math.imul(al2, bl3) | 0;
41998          mid = mid + Math.imul(al2, bh3) | 0;
41999          mid = mid + Math.imul(ah2, bl3) | 0;
42000          hi = hi + Math.imul(ah2, bh3) | 0;
42001          lo = lo + Math.imul(al1, bl4) | 0;
42002          mid = mid + Math.imul(al1, bh4) | 0;
42003          mid = mid + Math.imul(ah1, bl4) | 0;
42004          hi = hi + Math.imul(ah1, bh4) | 0;
42005          lo = lo + Math.imul(al0, bl5) | 0;
42006          mid = mid + Math.imul(al0, bh5) | 0;
42007          mid = mid + Math.imul(ah0, bl5) | 0;
42008          hi = hi + Math.imul(ah0, bh5) | 0;
42009          var w5 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;
42010          c = (hi + (mid >>> 13) | 0) + (w5 >>> 26) | 0;
42011          w5 &= 0x3ffffff;
42012          /* k = 6 */
42013
42014          lo = Math.imul(al6, bl0);
42015          mid = Math.imul(al6, bh0);
42016          mid = mid + Math.imul(ah6, bl0) | 0;
42017          hi = Math.imul(ah6, bh0);
42018          lo = lo + Math.imul(al5, bl1) | 0;
42019          mid = mid + Math.imul(al5, bh1) | 0;
42020          mid = mid + Math.imul(ah5, bl1) | 0;
42021          hi = hi + Math.imul(ah5, bh1) | 0;
42022          lo = lo + Math.imul(al4, bl2) | 0;
42023          mid = mid + Math.imul(al4, bh2) | 0;
42024          mid = mid + Math.imul(ah4, bl2) | 0;
42025          hi = hi + Math.imul(ah4, bh2) | 0;
42026          lo = lo + Math.imul(al3, bl3) | 0;
42027          mid = mid + Math.imul(al3, bh3) | 0;
42028          mid = mid + Math.imul(ah3, bl3) | 0;
42029          hi = hi + Math.imul(ah3, bh3) | 0;
42030          lo = lo + Math.imul(al2, bl4) | 0;
42031          mid = mid + Math.imul(al2, bh4) | 0;
42032          mid = mid + Math.imul(ah2, bl4) | 0;
42033          hi = hi + Math.imul(ah2, bh4) | 0;
42034          lo = lo + Math.imul(al1, bl5) | 0;
42035          mid = mid + Math.imul(al1, bh5) | 0;
42036          mid = mid + Math.imul(ah1, bl5) | 0;
42037          hi = hi + Math.imul(ah1, bh5) | 0;
42038          lo = lo + Math.imul(al0, bl6) | 0;
42039          mid = mid + Math.imul(al0, bh6) | 0;
42040          mid = mid + Math.imul(ah0, bl6) | 0;
42041          hi = hi + Math.imul(ah0, bh6) | 0;
42042          var w6 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;
42043          c = (hi + (mid >>> 13) | 0) + (w6 >>> 26) | 0;
42044          w6 &= 0x3ffffff;
42045          /* k = 7 */
42046
42047          lo = Math.imul(al7, bl0);
42048          mid = Math.imul(al7, bh0);
42049          mid = mid + Math.imul(ah7, bl0) | 0;
42050          hi = Math.imul(ah7, bh0);
42051          lo = lo + Math.imul(al6, bl1) | 0;
42052          mid = mid + Math.imul(al6, bh1) | 0;
42053          mid = mid + Math.imul(ah6, bl1) | 0;
42054          hi = hi + Math.imul(ah6, bh1) | 0;
42055          lo = lo + Math.imul(al5, bl2) | 0;
42056          mid = mid + Math.imul(al5, bh2) | 0;
42057          mid = mid + Math.imul(ah5, bl2) | 0;
42058          hi = hi + Math.imul(ah5, bh2) | 0;
42059          lo = lo + Math.imul(al4, bl3) | 0;
42060          mid = mid + Math.imul(al4, bh3) | 0;
42061          mid = mid + Math.imul(ah4, bl3) | 0;
42062          hi = hi + Math.imul(ah4, bh3) | 0;
42063          lo = lo + Math.imul(al3, bl4) | 0;
42064          mid = mid + Math.imul(al3, bh4) | 0;
42065          mid = mid + Math.imul(ah3, bl4) | 0;
42066          hi = hi + Math.imul(ah3, bh4) | 0;
42067          lo = lo + Math.imul(al2, bl5) | 0;
42068          mid = mid + Math.imul(al2, bh5) | 0;
42069          mid = mid + Math.imul(ah2, bl5) | 0;
42070          hi = hi + Math.imul(ah2, bh5) | 0;
42071          lo = lo + Math.imul(al1, bl6) | 0;
42072          mid = mid + Math.imul(al1, bh6) | 0;
42073          mid = mid + Math.imul(ah1, bl6) | 0;
42074          hi = hi + Math.imul(ah1, bh6) | 0;
42075          lo = lo + Math.imul(al0, bl7) | 0;
42076          mid = mid + Math.imul(al0, bh7) | 0;
42077          mid = mid + Math.imul(ah0, bl7) | 0;
42078          hi = hi + Math.imul(ah0, bh7) | 0;
42079          var w7 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;
42080          c = (hi + (mid >>> 13) | 0) + (w7 >>> 26) | 0;
42081          w7 &= 0x3ffffff;
42082          /* k = 8 */
42083
42084          lo = Math.imul(al8, bl0);
42085          mid = Math.imul(al8, bh0);
42086          mid = mid + Math.imul(ah8, bl0) | 0;
42087          hi = Math.imul(ah8, bh0);
42088          lo = lo + Math.imul(al7, bl1) | 0;
42089          mid = mid + Math.imul(al7, bh1) | 0;
42090          mid = mid + Math.imul(ah7, bl1) | 0;
42091          hi = hi + Math.imul(ah7, bh1) | 0;
42092          lo = lo + Math.imul(al6, bl2) | 0;
42093          mid = mid + Math.imul(al6, bh2) | 0;
42094          mid = mid + Math.imul(ah6, bl2) | 0;
42095          hi = hi + Math.imul(ah6, bh2) | 0;
42096          lo = lo + Math.imul(al5, bl3) | 0;
42097          mid = mid + Math.imul(al5, bh3) | 0;
42098          mid = mid + Math.imul(ah5, bl3) | 0;
42099          hi = hi + Math.imul(ah5, bh3) | 0;
42100          lo = lo + Math.imul(al4, bl4) | 0;
42101          mid = mid + Math.imul(al4, bh4) | 0;
42102          mid = mid + Math.imul(ah4, bl4) | 0;
42103          hi = hi + Math.imul(ah4, bh4) | 0;
42104          lo = lo + Math.imul(al3, bl5) | 0;
42105          mid = mid + Math.imul(al3, bh5) | 0;
42106          mid = mid + Math.imul(ah3, bl5) | 0;
42107          hi = hi + Math.imul(ah3, bh5) | 0;
42108          lo = lo + Math.imul(al2, bl6) | 0;
42109          mid = mid + Math.imul(al2, bh6) | 0;
42110          mid = mid + Math.imul(ah2, bl6) | 0;
42111          hi = hi + Math.imul(ah2, bh6) | 0;
42112          lo = lo + Math.imul(al1, bl7) | 0;
42113          mid = mid + Math.imul(al1, bh7) | 0;
42114          mid = mid + Math.imul(ah1, bl7) | 0;
42115          hi = hi + Math.imul(ah1, bh7) | 0;
42116          lo = lo + Math.imul(al0, bl8) | 0;
42117          mid = mid + Math.imul(al0, bh8) | 0;
42118          mid = mid + Math.imul(ah0, bl8) | 0;
42119          hi = hi + Math.imul(ah0, bh8) | 0;
42120          var w8 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;
42121          c = (hi + (mid >>> 13) | 0) + (w8 >>> 26) | 0;
42122          w8 &= 0x3ffffff;
42123          /* k = 9 */
42124
42125          lo = Math.imul(al9, bl0);
42126          mid = Math.imul(al9, bh0);
42127          mid = mid + Math.imul(ah9, bl0) | 0;
42128          hi = Math.imul(ah9, bh0);
42129          lo = lo + Math.imul(al8, bl1) | 0;
42130          mid = mid + Math.imul(al8, bh1) | 0;
42131          mid = mid + Math.imul(ah8, bl1) | 0;
42132          hi = hi + Math.imul(ah8, bh1) | 0;
42133          lo = lo + Math.imul(al7, bl2) | 0;
42134          mid = mid + Math.imul(al7, bh2) | 0;
42135          mid = mid + Math.imul(ah7, bl2) | 0;
42136          hi = hi + Math.imul(ah7, bh2) | 0;
42137          lo = lo + Math.imul(al6, bl3) | 0;
42138          mid = mid + Math.imul(al6, bh3) | 0;
42139          mid = mid + Math.imul(ah6, bl3) | 0;
42140          hi = hi + Math.imul(ah6, bh3) | 0;
42141          lo = lo + Math.imul(al5, bl4) | 0;
42142          mid = mid + Math.imul(al5, bh4) | 0;
42143          mid = mid + Math.imul(ah5, bl4) | 0;
42144          hi = hi + Math.imul(ah5, bh4) | 0;
42145          lo = lo + Math.imul(al4, bl5) | 0;
42146          mid = mid + Math.imul(al4, bh5) | 0;
42147          mid = mid + Math.imul(ah4, bl5) | 0;
42148          hi = hi + Math.imul(ah4, bh5) | 0;
42149          lo = lo + Math.imul(al3, bl6) | 0;
42150          mid = mid + Math.imul(al3, bh6) | 0;
42151          mid = mid + Math.imul(ah3, bl6) | 0;
42152          hi = hi + Math.imul(ah3, bh6) | 0;
42153          lo = lo + Math.imul(al2, bl7) | 0;
42154          mid = mid + Math.imul(al2, bh7) | 0;
42155          mid = mid + Math.imul(ah2, bl7) | 0;
42156          hi = hi + Math.imul(ah2, bh7) | 0;
42157          lo = lo + Math.imul(al1, bl8) | 0;
42158          mid = mid + Math.imul(al1, bh8) | 0;
42159          mid = mid + Math.imul(ah1, bl8) | 0;
42160          hi = hi + Math.imul(ah1, bh8) | 0;
42161          lo = lo + Math.imul(al0, bl9) | 0;
42162          mid = mid + Math.imul(al0, bh9) | 0;
42163          mid = mid + Math.imul(ah0, bl9) | 0;
42164          hi = hi + Math.imul(ah0, bh9) | 0;
42165          var w9 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;
42166          c = (hi + (mid >>> 13) | 0) + (w9 >>> 26) | 0;
42167          w9 &= 0x3ffffff;
42168          /* k = 10 */
42169
42170          lo = Math.imul(al9, bl1);
42171          mid = Math.imul(al9, bh1);
42172          mid = mid + Math.imul(ah9, bl1) | 0;
42173          hi = Math.imul(ah9, bh1);
42174          lo = lo + Math.imul(al8, bl2) | 0;
42175          mid = mid + Math.imul(al8, bh2) | 0;
42176          mid = mid + Math.imul(ah8, bl2) | 0;
42177          hi = hi + Math.imul(ah8, bh2) | 0;
42178          lo = lo + Math.imul(al7, bl3) | 0;
42179          mid = mid + Math.imul(al7, bh3) | 0;
42180          mid = mid + Math.imul(ah7, bl3) | 0;
42181          hi = hi + Math.imul(ah7, bh3) | 0;
42182          lo = lo + Math.imul(al6, bl4) | 0;
42183          mid = mid + Math.imul(al6, bh4) | 0;
42184          mid = mid + Math.imul(ah6, bl4) | 0;
42185          hi = hi + Math.imul(ah6, bh4) | 0;
42186          lo = lo + Math.imul(al5, bl5) | 0;
42187          mid = mid + Math.imul(al5, bh5) | 0;
42188          mid = mid + Math.imul(ah5, bl5) | 0;
42189          hi = hi + Math.imul(ah5, bh5) | 0;
42190          lo = lo + Math.imul(al4, bl6) | 0;
42191          mid = mid + Math.imul(al4, bh6) | 0;
42192          mid = mid + Math.imul(ah4, bl6) | 0;
42193          hi = hi + Math.imul(ah4, bh6) | 0;
42194          lo = lo + Math.imul(al3, bl7) | 0;
42195          mid = mid + Math.imul(al3, bh7) | 0;
42196          mid = mid + Math.imul(ah3, bl7) | 0;
42197          hi = hi + Math.imul(ah3, bh7) | 0;
42198          lo = lo + Math.imul(al2, bl8) | 0;
42199          mid = mid + Math.imul(al2, bh8) | 0;
42200          mid = mid + Math.imul(ah2, bl8) | 0;
42201          hi = hi + Math.imul(ah2, bh8) | 0;
42202          lo = lo + Math.imul(al1, bl9) | 0;
42203          mid = mid + Math.imul(al1, bh9) | 0;
42204          mid = mid + Math.imul(ah1, bl9) | 0;
42205          hi = hi + Math.imul(ah1, bh9) | 0;
42206          var w10 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;
42207          c = (hi + (mid >>> 13) | 0) + (w10 >>> 26) | 0;
42208          w10 &= 0x3ffffff;
42209          /* k = 11 */
42210
42211          lo = Math.imul(al9, bl2);
42212          mid = Math.imul(al9, bh2);
42213          mid = mid + Math.imul(ah9, bl2) | 0;
42214          hi = Math.imul(ah9, bh2);
42215          lo = lo + Math.imul(al8, bl3) | 0;
42216          mid = mid + Math.imul(al8, bh3) | 0;
42217          mid = mid + Math.imul(ah8, bl3) | 0;
42218          hi = hi + Math.imul(ah8, bh3) | 0;
42219          lo = lo + Math.imul(al7, bl4) | 0;
42220          mid = mid + Math.imul(al7, bh4) | 0;
42221          mid = mid + Math.imul(ah7, bl4) | 0;
42222          hi = hi + Math.imul(ah7, bh4) | 0;
42223          lo = lo + Math.imul(al6, bl5) | 0;
42224          mid = mid + Math.imul(al6, bh5) | 0;
42225          mid = mid + Math.imul(ah6, bl5) | 0;
42226          hi = hi + Math.imul(ah6, bh5) | 0;
42227          lo = lo + Math.imul(al5, bl6) | 0;
42228          mid = mid + Math.imul(al5, bh6) | 0;
42229          mid = mid + Math.imul(ah5, bl6) | 0;
42230          hi = hi + Math.imul(ah5, bh6) | 0;
42231          lo = lo + Math.imul(al4, bl7) | 0;
42232          mid = mid + Math.imul(al4, bh7) | 0;
42233          mid = mid + Math.imul(ah4, bl7) | 0;
42234          hi = hi + Math.imul(ah4, bh7) | 0;
42235          lo = lo + Math.imul(al3, bl8) | 0;
42236          mid = mid + Math.imul(al3, bh8) | 0;
42237          mid = mid + Math.imul(ah3, bl8) | 0;
42238          hi = hi + Math.imul(ah3, bh8) | 0;
42239          lo = lo + Math.imul(al2, bl9) | 0;
42240          mid = mid + Math.imul(al2, bh9) | 0;
42241          mid = mid + Math.imul(ah2, bl9) | 0;
42242          hi = hi + Math.imul(ah2, bh9) | 0;
42243          var w11 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;
42244          c = (hi + (mid >>> 13) | 0) + (w11 >>> 26) | 0;
42245          w11 &= 0x3ffffff;
42246          /* k = 12 */
42247
42248          lo = Math.imul(al9, bl3);
42249          mid = Math.imul(al9, bh3);
42250          mid = mid + Math.imul(ah9, bl3) | 0;
42251          hi = Math.imul(ah9, bh3);
42252          lo = lo + Math.imul(al8, bl4) | 0;
42253          mid = mid + Math.imul(al8, bh4) | 0;
42254          mid = mid + Math.imul(ah8, bl4) | 0;
42255          hi = hi + Math.imul(ah8, bh4) | 0;
42256          lo = lo + Math.imul(al7, bl5) | 0;
42257          mid = mid + Math.imul(al7, bh5) | 0;
42258          mid = mid + Math.imul(ah7, bl5) | 0;
42259          hi = hi + Math.imul(ah7, bh5) | 0;
42260          lo = lo + Math.imul(al6, bl6) | 0;
42261          mid = mid + Math.imul(al6, bh6) | 0;
42262          mid = mid + Math.imul(ah6, bl6) | 0;
42263          hi = hi + Math.imul(ah6, bh6) | 0;
42264          lo = lo + Math.imul(al5, bl7) | 0;
42265          mid = mid + Math.imul(al5, bh7) | 0;
42266          mid = mid + Math.imul(ah5, bl7) | 0;
42267          hi = hi + Math.imul(ah5, bh7) | 0;
42268          lo = lo + Math.imul(al4, bl8) | 0;
42269          mid = mid + Math.imul(al4, bh8) | 0;
42270          mid = mid + Math.imul(ah4, bl8) | 0;
42271          hi = hi + Math.imul(ah4, bh8) | 0;
42272          lo = lo + Math.imul(al3, bl9) | 0;
42273          mid = mid + Math.imul(al3, bh9) | 0;
42274          mid = mid + Math.imul(ah3, bl9) | 0;
42275          hi = hi + Math.imul(ah3, bh9) | 0;
42276          var w12 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;
42277          c = (hi + (mid >>> 13) | 0) + (w12 >>> 26) | 0;
42278          w12 &= 0x3ffffff;
42279          /* k = 13 */
42280
42281          lo = Math.imul(al9, bl4);
42282          mid = Math.imul(al9, bh4);
42283          mid = mid + Math.imul(ah9, bl4) | 0;
42284          hi = Math.imul(ah9, bh4);
42285          lo = lo + Math.imul(al8, bl5) | 0;
42286          mid = mid + Math.imul(al8, bh5) | 0;
42287          mid = mid + Math.imul(ah8, bl5) | 0;
42288          hi = hi + Math.imul(ah8, bh5) | 0;
42289          lo = lo + Math.imul(al7, bl6) | 0;
42290          mid = mid + Math.imul(al7, bh6) | 0;
42291          mid = mid + Math.imul(ah7, bl6) | 0;
42292          hi = hi + Math.imul(ah7, bh6) | 0;
42293          lo = lo + Math.imul(al6, bl7) | 0;
42294          mid = mid + Math.imul(al6, bh7) | 0;
42295          mid = mid + Math.imul(ah6, bl7) | 0;
42296          hi = hi + Math.imul(ah6, bh7) | 0;
42297          lo = lo + Math.imul(al5, bl8) | 0;
42298          mid = mid + Math.imul(al5, bh8) | 0;
42299          mid = mid + Math.imul(ah5, bl8) | 0;
42300          hi = hi + Math.imul(ah5, bh8) | 0;
42301          lo = lo + Math.imul(al4, bl9) | 0;
42302          mid = mid + Math.imul(al4, bh9) | 0;
42303          mid = mid + Math.imul(ah4, bl9) | 0;
42304          hi = hi + Math.imul(ah4, bh9) | 0;
42305          var w13 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;
42306          c = (hi + (mid >>> 13) | 0) + (w13 >>> 26) | 0;
42307          w13 &= 0x3ffffff;
42308          /* k = 14 */
42309
42310          lo = Math.imul(al9, bl5);
42311          mid = Math.imul(al9, bh5);
42312          mid = mid + Math.imul(ah9, bl5) | 0;
42313          hi = Math.imul(ah9, bh5);
42314          lo = lo + Math.imul(al8, bl6) | 0;
42315          mid = mid + Math.imul(al8, bh6) | 0;
42316          mid = mid + Math.imul(ah8, bl6) | 0;
42317          hi = hi + Math.imul(ah8, bh6) | 0;
42318          lo = lo + Math.imul(al7, bl7) | 0;
42319          mid = mid + Math.imul(al7, bh7) | 0;
42320          mid = mid + Math.imul(ah7, bl7) | 0;
42321          hi = hi + Math.imul(ah7, bh7) | 0;
42322          lo = lo + Math.imul(al6, bl8) | 0;
42323          mid = mid + Math.imul(al6, bh8) | 0;
42324          mid = mid + Math.imul(ah6, bl8) | 0;
42325          hi = hi + Math.imul(ah6, bh8) | 0;
42326          lo = lo + Math.imul(al5, bl9) | 0;
42327          mid = mid + Math.imul(al5, bh9) | 0;
42328          mid = mid + Math.imul(ah5, bl9) | 0;
42329          hi = hi + Math.imul(ah5, bh9) | 0;
42330          var w14 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;
42331          c = (hi + (mid >>> 13) | 0) + (w14 >>> 26) | 0;
42332          w14 &= 0x3ffffff;
42333          /* k = 15 */
42334
42335          lo = Math.imul(al9, bl6);
42336          mid = Math.imul(al9, bh6);
42337          mid = mid + Math.imul(ah9, bl6) | 0;
42338          hi = Math.imul(ah9, bh6);
42339          lo = lo + Math.imul(al8, bl7) | 0;
42340          mid = mid + Math.imul(al8, bh7) | 0;
42341          mid = mid + Math.imul(ah8, bl7) | 0;
42342          hi = hi + Math.imul(ah8, bh7) | 0;
42343          lo = lo + Math.imul(al7, bl8) | 0;
42344          mid = mid + Math.imul(al7, bh8) | 0;
42345          mid = mid + Math.imul(ah7, bl8) | 0;
42346          hi = hi + Math.imul(ah7, bh8) | 0;
42347          lo = lo + Math.imul(al6, bl9) | 0;
42348          mid = mid + Math.imul(al6, bh9) | 0;
42349          mid = mid + Math.imul(ah6, bl9) | 0;
42350          hi = hi + Math.imul(ah6, bh9) | 0;
42351          var w15 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;
42352          c = (hi + (mid >>> 13) | 0) + (w15 >>> 26) | 0;
42353          w15 &= 0x3ffffff;
42354          /* k = 16 */
42355
42356          lo = Math.imul(al9, bl7);
42357          mid = Math.imul(al9, bh7);
42358          mid = mid + Math.imul(ah9, bl7) | 0;
42359          hi = Math.imul(ah9, bh7);
42360          lo = lo + Math.imul(al8, bl8) | 0;
42361          mid = mid + Math.imul(al8, bh8) | 0;
42362          mid = mid + Math.imul(ah8, bl8) | 0;
42363          hi = hi + Math.imul(ah8, bh8) | 0;
42364          lo = lo + Math.imul(al7, bl9) | 0;
42365          mid = mid + Math.imul(al7, bh9) | 0;
42366          mid = mid + Math.imul(ah7, bl9) | 0;
42367          hi = hi + Math.imul(ah7, bh9) | 0;
42368          var w16 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;
42369          c = (hi + (mid >>> 13) | 0) + (w16 >>> 26) | 0;
42370          w16 &= 0x3ffffff;
42371          /* k = 17 */
42372
42373          lo = Math.imul(al9, bl8);
42374          mid = Math.imul(al9, bh8);
42375          mid = mid + Math.imul(ah9, bl8) | 0;
42376          hi = Math.imul(ah9, bh8);
42377          lo = lo + Math.imul(al8, bl9) | 0;
42378          mid = mid + Math.imul(al8, bh9) | 0;
42379          mid = mid + Math.imul(ah8, bl9) | 0;
42380          hi = hi + Math.imul(ah8, bh9) | 0;
42381          var w17 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;
42382          c = (hi + (mid >>> 13) | 0) + (w17 >>> 26) | 0;
42383          w17 &= 0x3ffffff;
42384          /* k = 18 */
42385
42386          lo = Math.imul(al9, bl9);
42387          mid = Math.imul(al9, bh9);
42388          mid = mid + Math.imul(ah9, bl9) | 0;
42389          hi = Math.imul(ah9, bh9);
42390          var w18 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;
42391          c = (hi + (mid >>> 13) | 0) + (w18 >>> 26) | 0;
42392          w18 &= 0x3ffffff;
42393          o[0] = w0;
42394          o[1] = w1;
42395          o[2] = w2;
42396          o[3] = w3;
42397          o[4] = w4;
42398          o[5] = w5;
42399          o[6] = w6;
42400          o[7] = w7;
42401          o[8] = w8;
42402          o[9] = w9;
42403          o[10] = w10;
42404          o[11] = w11;
42405          o[12] = w12;
42406          o[13] = w13;
42407          o[14] = w14;
42408          o[15] = w15;
42409          o[16] = w16;
42410          o[17] = w17;
42411          o[18] = w18;
42412
42413          if (c !== 0) {
42414            o[19] = c;
42415            out.length++;
42416          }
42417
42418          return out;
42419        }; // Polyfill comb
42420
42421
42422        if (!Math.imul) {
42423          comb10MulTo = smallMulTo;
42424        }
42425
42426        function bigMulTo(self, num, out) {
42427          out.negative = num.negative ^ self.negative;
42428          out.length = self.length + num.length;
42429          var carry = 0;
42430          var hncarry = 0;
42431
42432          for (var k = 0; k < out.length - 1; k++) {
42433            // Sum all words with the same `i + j = k` and accumulate `ncarry`,
42434            // note that ncarry could be >= 0x3ffffff
42435            var ncarry = hncarry;
42436            hncarry = 0;
42437            var rword = carry & 0x3ffffff;
42438            var maxJ = Math.min(k, num.length - 1);
42439
42440            for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {
42441              var i = k - j;
42442              var a = self.words[i] | 0;
42443              var b = num.words[j] | 0;
42444              var r = a * b;
42445              var lo = r & 0x3ffffff;
42446              ncarry = ncarry + (r / 0x4000000 | 0) | 0;
42447              lo = lo + rword | 0;
42448              rword = lo & 0x3ffffff;
42449              ncarry = ncarry + (lo >>> 26) | 0;
42450              hncarry += ncarry >>> 26;
42451              ncarry &= 0x3ffffff;
42452            }
42453
42454            out.words[k] = rword;
42455            carry = ncarry;
42456            ncarry = hncarry;
42457          }
42458
42459          if (carry !== 0) {
42460            out.words[k] = carry;
42461          } else {
42462            out.length--;
42463          }
42464
42465          return out.strip();
42466        }
42467
42468        function jumboMulTo(self, num, out) {
42469          var fftm = new FFTM();
42470          return fftm.mulp(self, num, out);
42471        }
42472
42473        BN.prototype.mulTo = function mulTo(num, out) {
42474          var res;
42475          var len = this.length + num.length;
42476
42477          if (this.length === 10 && num.length === 10) {
42478            res = comb10MulTo(this, num, out);
42479          } else if (len < 63) {
42480            res = smallMulTo(this, num, out);
42481          } else if (len < 1024) {
42482            res = bigMulTo(this, num, out);
42483          } else {
42484            res = jumboMulTo(this, num, out);
42485          }
42486
42487          return res;
42488        }; // Cooley-Tukey algorithm for FFT
42489        // slightly revisited to rely on looping instead of recursion
42490
42491
42492        function FFTM(x, y) {
42493          this.x = x;
42494          this.y = y;
42495        }
42496
42497        FFTM.prototype.makeRBT = function makeRBT(N) {
42498          var t = new Array(N);
42499          var l = BN.prototype._countBits(N) - 1;
42500
42501          for (var i = 0; i < N; i++) {
42502            t[i] = this.revBin(i, l, N);
42503          }
42504
42505          return t;
42506        }; // Returns binary-reversed representation of `x`
42507
42508
42509        FFTM.prototype.revBin = function revBin(x, l, N) {
42510          if (x === 0 || x === N - 1) return x;
42511          var rb = 0;
42512
42513          for (var i = 0; i < l; i++) {
42514            rb |= (x & 1) << l - i - 1;
42515            x >>= 1;
42516          }
42517
42518          return rb;
42519        }; // Performs "tweedling" phase, therefore 'emulating'
42520        // behaviour of the recursive algorithm
42521
42522
42523        FFTM.prototype.permute = function permute(rbt, rws, iws, rtws, itws, N) {
42524          for (var i = 0; i < N; i++) {
42525            rtws[i] = rws[rbt[i]];
42526            itws[i] = iws[rbt[i]];
42527          }
42528        };
42529
42530        FFTM.prototype.transform = function transform(rws, iws, rtws, itws, N, rbt) {
42531          this.permute(rbt, rws, iws, rtws, itws, N);
42532
42533          for (var s = 1; s < N; s <<= 1) {
42534            var l = s << 1;
42535            var rtwdf = Math.cos(2 * Math.PI / l);
42536            var itwdf = Math.sin(2 * Math.PI / l);
42537
42538            for (var p = 0; p < N; p += l) {
42539              var rtwdf_ = rtwdf;
42540              var itwdf_ = itwdf;
42541
42542              for (var j = 0; j < s; j++) {
42543                var re = rtws[p + j];
42544                var ie = itws[p + j];
42545                var ro = rtws[p + j + s];
42546                var io = itws[p + j + s];
42547                var rx = rtwdf_ * ro - itwdf_ * io;
42548                io = rtwdf_ * io + itwdf_ * ro;
42549                ro = rx;
42550                rtws[p + j] = re + ro;
42551                itws[p + j] = ie + io;
42552                rtws[p + j + s] = re - ro;
42553                itws[p + j + s] = ie - io;
42554                /* jshint maxdepth : false */
42555
42556                if (j !== l) {
42557                  rx = rtwdf * rtwdf_ - itwdf * itwdf_;
42558                  itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_;
42559                  rtwdf_ = rx;
42560                }
42561              }
42562            }
42563          }
42564        };
42565
42566        FFTM.prototype.guessLen13b = function guessLen13b(n, m) {
42567          var N = Math.max(m, n) | 1;
42568          var odd = N & 1;
42569          var i = 0;
42570
42571          for (N = N / 2 | 0; N; N = N >>> 1) {
42572            i++;
42573          }
42574
42575          return 1 << i + 1 + odd;
42576        };
42577
42578        FFTM.prototype.conjugate = function conjugate(rws, iws, N) {
42579          if (N <= 1) return;
42580
42581          for (var i = 0; i < N / 2; i++) {
42582            var t = rws[i];
42583            rws[i] = rws[N - i - 1];
42584            rws[N - i - 1] = t;
42585            t = iws[i];
42586            iws[i] = -iws[N - i - 1];
42587            iws[N - i - 1] = -t;
42588          }
42589        };
42590
42591        FFTM.prototype.normalize13b = function normalize13b(ws, N) {
42592          var carry = 0;
42593
42594          for (var i = 0; i < N / 2; i++) {
42595            var w = Math.round(ws[2 * i + 1] / N) * 0x2000 + Math.round(ws[2 * i] / N) + carry;
42596            ws[i] = w & 0x3ffffff;
42597
42598            if (w < 0x4000000) {
42599              carry = 0;
42600            } else {
42601              carry = w / 0x4000000 | 0;
42602            }
42603          }
42604
42605          return ws;
42606        };
42607
42608        FFTM.prototype.convert13b = function convert13b(ws, len, rws, N) {
42609          var carry = 0;
42610
42611          for (var i = 0; i < len; i++) {
42612            carry = carry + (ws[i] | 0);
42613            rws[2 * i] = carry & 0x1fff;
42614            carry = carry >>> 13;
42615            rws[2 * i + 1] = carry & 0x1fff;
42616            carry = carry >>> 13;
42617          } // Pad with zeroes
42618
42619
42620          for (i = 2 * len; i < N; ++i) {
42621            rws[i] = 0;
42622          }
42623
42624          assert(carry === 0);
42625          assert((carry & ~0x1fff) === 0);
42626        };
42627
42628        FFTM.prototype.stub = function stub(N) {
42629          var ph = new Array(N);
42630
42631          for (var i = 0; i < N; i++) {
42632            ph[i] = 0;
42633          }
42634
42635          return ph;
42636        };
42637
42638        FFTM.prototype.mulp = function mulp(x, y, out) {
42639          var N = 2 * this.guessLen13b(x.length, y.length);
42640          var rbt = this.makeRBT(N);
42641
42642          var _ = this.stub(N);
42643
42644          var rws = new Array(N);
42645          var rwst = new Array(N);
42646          var iwst = new Array(N);
42647          var nrws = new Array(N);
42648          var nrwst = new Array(N);
42649          var niwst = new Array(N);
42650          var rmws = out.words;
42651          rmws.length = N;
42652          this.convert13b(x.words, x.length, rws, N);
42653          this.convert13b(y.words, y.length, nrws, N);
42654          this.transform(rws, _, rwst, iwst, N, rbt);
42655          this.transform(nrws, _, nrwst, niwst, N, rbt);
42656
42657          for (var i = 0; i < N; i++) {
42658            var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i];
42659            iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i];
42660            rwst[i] = rx;
42661          }
42662
42663          this.conjugate(rwst, iwst, N);
42664          this.transform(rwst, iwst, rmws, _, N, rbt);
42665          this.conjugate(rmws, _, N);
42666          this.normalize13b(rmws, N);
42667          out.negative = x.negative ^ y.negative;
42668          out.length = x.length + y.length;
42669          return out.strip();
42670        }; // Multiply `this` by `num`
42671
42672
42673        BN.prototype.mul = function mul(num) {
42674          var out = new BN(null);
42675          out.words = new Array(this.length + num.length);
42676          return this.mulTo(num, out);
42677        }; // Multiply employing FFT
42678
42679
42680        BN.prototype.mulf = function mulf(num) {
42681          var out = new BN(null);
42682          out.words = new Array(this.length + num.length);
42683          return jumboMulTo(this, num, out);
42684        }; // In-place Multiplication
42685
42686
42687        BN.prototype.imul = function imul(num) {
42688          return this.clone().mulTo(num, this);
42689        };
42690
42691        BN.prototype.imuln = function imuln(num) {
42692          assert(typeof num === 'number');
42693          assert(num < 0x4000000); // Carry
42694
42695          var carry = 0;
42696
42697          for (var i = 0; i < this.length; i++) {
42698            var w = (this.words[i] | 0) * num;
42699            var lo = (w & 0x3ffffff) + (carry & 0x3ffffff);
42700            carry >>= 26;
42701            carry += w / 0x4000000 | 0; // NOTE: lo is 27bit maximum
42702
42703            carry += lo >>> 26;
42704            this.words[i] = lo & 0x3ffffff;
42705          }
42706
42707          if (carry !== 0) {
42708            this.words[i] = carry;
42709            this.length++;
42710          }
42711
42712          return this;
42713        };
42714
42715        BN.prototype.muln = function muln(num) {
42716          return this.clone().imuln(num);
42717        }; // `this` * `this`
42718
42719
42720        BN.prototype.sqr = function sqr() {
42721          return this.mul(this);
42722        }; // `this` * `this` in-place
42723
42724
42725        BN.prototype.isqr = function isqr() {
42726          return this.imul(this.clone());
42727        }; // Math.pow(`this`, `num`)
42728
42729
42730        BN.prototype.pow = function pow(num) {
42731          var w = toBitArray(num);
42732          if (w.length === 0) return new BN(1); // Skip leading zeroes
42733
42734          var res = this;
42735
42736          for (var i = 0; i < w.length; i++, res = res.sqr()) {
42737            if (w[i] !== 0) break;
42738          }
42739
42740          if (++i < w.length) {
42741            for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) {
42742              if (w[i] === 0) continue;
42743              res = res.mul(q);
42744            }
42745          }
42746
42747          return res;
42748        }; // Shift-left in-place
42749
42750
42751        BN.prototype.iushln = function iushln(bits) {
42752          assert(typeof bits === 'number' && bits >= 0);
42753          var r = bits % 26;
42754          var s = (bits - r) / 26;
42755          var carryMask = 0x3ffffff >>> 26 - r << 26 - r;
42756          var i;
42757
42758          if (r !== 0) {
42759            var carry = 0;
42760
42761            for (i = 0; i < this.length; i++) {
42762              var newCarry = this.words[i] & carryMask;
42763              var c = (this.words[i] | 0) - newCarry << r;
42764              this.words[i] = c | carry;
42765              carry = newCarry >>> 26 - r;
42766            }
42767
42768            if (carry) {
42769              this.words[i] = carry;
42770              this.length++;
42771            }
42772          }
42773
42774          if (s !== 0) {
42775            for (i = this.length - 1; i >= 0; i--) {
42776              this.words[i + s] = this.words[i];
42777            }
42778
42779            for (i = 0; i < s; i++) {
42780              this.words[i] = 0;
42781            }
42782
42783            this.length += s;
42784          }
42785
42786          return this.strip();
42787        };
42788
42789        BN.prototype.ishln = function ishln(bits) {
42790          // TODO(indutny): implement me
42791          assert(this.negative === 0);
42792          return this.iushln(bits);
42793        }; // Shift-right in-place
42794        // NOTE: `hint` is a lowest bit before trailing zeroes
42795        // NOTE: if `extended` is present - it will be filled with destroyed bits
42796
42797
42798        BN.prototype.iushrn = function iushrn(bits, hint, extended) {
42799          assert(typeof bits === 'number' && bits >= 0);
42800          var h;
42801
42802          if (hint) {
42803            h = (hint - hint % 26) / 26;
42804          } else {
42805            h = 0;
42806          }
42807
42808          var r = bits % 26;
42809          var s = Math.min((bits - r) / 26, this.length);
42810          var mask = 0x3ffffff ^ 0x3ffffff >>> r << r;
42811          var maskedWords = extended;
42812          h -= s;
42813          h = Math.max(0, h); // Extended mode, copy masked part
42814
42815          if (maskedWords) {
42816            for (var i = 0; i < s; i++) {
42817              maskedWords.words[i] = this.words[i];
42818            }
42819
42820            maskedWords.length = s;
42821          }
42822
42823          if (s === 0) {// No-op, we should not move anything at all
42824          } else if (this.length > s) {
42825            this.length -= s;
42826
42827            for (i = 0; i < this.length; i++) {
42828              this.words[i] = this.words[i + s];
42829            }
42830          } else {
42831            this.words[0] = 0;
42832            this.length = 1;
42833          }
42834
42835          var carry = 0;
42836
42837          for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) {
42838            var word = this.words[i] | 0;
42839            this.words[i] = carry << 26 - r | word >>> r;
42840            carry = word & mask;
42841          } // Push carried bits as a mask
42842
42843
42844          if (maskedWords && carry !== 0) {
42845            maskedWords.words[maskedWords.length++] = carry;
42846          }
42847
42848          if (this.length === 0) {
42849            this.words[0] = 0;
42850            this.length = 1;
42851          }
42852
42853          return this.strip();
42854        };
42855
42856        BN.prototype.ishrn = function ishrn(bits, hint, extended) {
42857          // TODO(indutny): implement me
42858          assert(this.negative === 0);
42859          return this.iushrn(bits, hint, extended);
42860        }; // Shift-left
42861
42862
42863        BN.prototype.shln = function shln(bits) {
42864          return this.clone().ishln(bits);
42865        };
42866
42867        BN.prototype.ushln = function ushln(bits) {
42868          return this.clone().iushln(bits);
42869        }; // Shift-right
42870
42871
42872        BN.prototype.shrn = function shrn(bits) {
42873          return this.clone().ishrn(bits);
42874        };
42875
42876        BN.prototype.ushrn = function ushrn(bits) {
42877          return this.clone().iushrn(bits);
42878        }; // Test if n bit is set
42879
42880
42881        BN.prototype.testn = function testn(bit) {
42882          assert(typeof bit === 'number' && bit >= 0);
42883          var r = bit % 26;
42884          var s = (bit - r) / 26;
42885          var q = 1 << r; // Fast case: bit is much higher than all existing words
42886
42887          if (this.length <= s) return false; // Check bit and return
42888
42889          var w = this.words[s];
42890          return !!(w & q);
42891        }; // Return only lowers bits of number (in-place)
42892
42893
42894        BN.prototype.imaskn = function imaskn(bits) {
42895          assert(typeof bits === 'number' && bits >= 0);
42896          var r = bits % 26;
42897          var s = (bits - r) / 26;
42898          assert(this.negative === 0, 'imaskn works only with positive numbers');
42899
42900          if (this.length <= s) {
42901            return this;
42902          }
42903
42904          if (r !== 0) {
42905            s++;
42906          }
42907
42908          this.length = Math.min(s, this.length);
42909
42910          if (r !== 0) {
42911            var mask = 0x3ffffff ^ 0x3ffffff >>> r << r;
42912            this.words[this.length - 1] &= mask;
42913          }
42914
42915          return this.strip();
42916        }; // Return only lowers bits of number
42917
42918
42919        BN.prototype.maskn = function maskn(bits) {
42920          return this.clone().imaskn(bits);
42921        }; // Add plain number `num` to `this`
42922
42923
42924        BN.prototype.iaddn = function iaddn(num) {
42925          assert(typeof num === 'number');
42926          assert(num < 0x4000000);
42927          if (num < 0) return this.isubn(-num); // Possible sign change
42928
42929          if (this.negative !== 0) {
42930            if (this.length === 1 && (this.words[0] | 0) < num) {
42931              this.words[0] = num - (this.words[0] | 0);
42932              this.negative = 0;
42933              return this;
42934            }
42935
42936            this.negative = 0;
42937            this.isubn(num);
42938            this.negative = 1;
42939            return this;
42940          } // Add without checks
42941
42942
42943          return this._iaddn(num);
42944        };
42945
42946        BN.prototype._iaddn = function _iaddn(num) {
42947          this.words[0] += num; // Carry
42948
42949          for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) {
42950            this.words[i] -= 0x4000000;
42951
42952            if (i === this.length - 1) {
42953              this.words[i + 1] = 1;
42954            } else {
42955              this.words[i + 1]++;
42956            }
42957          }
42958
42959          this.length = Math.max(this.length, i + 1);
42960          return this;
42961        }; // Subtract plain number `num` from `this`
42962
42963
42964        BN.prototype.isubn = function isubn(num) {
42965          assert(typeof num === 'number');
42966          assert(num < 0x4000000);
42967          if (num < 0) return this.iaddn(-num);
42968
42969          if (this.negative !== 0) {
42970            this.negative = 0;
42971            this.iaddn(num);
42972            this.negative = 1;
42973            return this;
42974          }
42975
42976          this.words[0] -= num;
42977
42978          if (this.length === 1 && this.words[0] < 0) {
42979            this.words[0] = -this.words[0];
42980            this.negative = 1;
42981          } else {
42982            // Carry
42983            for (var i = 0; i < this.length && this.words[i] < 0; i++) {
42984              this.words[i] += 0x4000000;
42985              this.words[i + 1] -= 1;
42986            }
42987          }
42988
42989          return this.strip();
42990        };
42991
42992        BN.prototype.addn = function addn(num) {
42993          return this.clone().iaddn(num);
42994        };
42995
42996        BN.prototype.subn = function subn(num) {
42997          return this.clone().isubn(num);
42998        };
42999
43000        BN.prototype.iabs = function iabs() {
43001          this.negative = 0;
43002          return this;
43003        };
43004
43005        BN.prototype.abs = function abs() {
43006          return this.clone().iabs();
43007        };
43008
43009        BN.prototype._ishlnsubmul = function _ishlnsubmul(num, mul, shift) {
43010          var len = num.length + shift;
43011          var i;
43012
43013          this._expand(len);
43014
43015          var w;
43016          var carry = 0;
43017
43018          for (i = 0; i < num.length; i++) {
43019            w = (this.words[i + shift] | 0) + carry;
43020            var right = (num.words[i] | 0) * mul;
43021            w -= right & 0x3ffffff;
43022            carry = (w >> 26) - (right / 0x4000000 | 0);
43023            this.words[i + shift] = w & 0x3ffffff;
43024          }
43025
43026          for (; i < this.length - shift; i++) {
43027            w = (this.words[i + shift] | 0) + carry;
43028            carry = w >> 26;
43029            this.words[i + shift] = w & 0x3ffffff;
43030          }
43031
43032          if (carry === 0) return this.strip(); // Subtraction overflow
43033
43034          assert(carry === -1);
43035          carry = 0;
43036
43037          for (i = 0; i < this.length; i++) {
43038            w = -(this.words[i] | 0) + carry;
43039            carry = w >> 26;
43040            this.words[i] = w & 0x3ffffff;
43041          }
43042
43043          this.negative = 1;
43044          return this.strip();
43045        };
43046
43047        BN.prototype._wordDiv = function _wordDiv(num, mode) {
43048          var shift = this.length - num.length;
43049          var a = this.clone();
43050          var b = num; // Normalize
43051
43052          var bhi = b.words[b.length - 1] | 0;
43053
43054          var bhiBits = this._countBits(bhi);
43055
43056          shift = 26 - bhiBits;
43057
43058          if (shift !== 0) {
43059            b = b.ushln(shift);
43060            a.iushln(shift);
43061            bhi = b.words[b.length - 1] | 0;
43062          } // Initialize quotient
43063
43064
43065          var m = a.length - b.length;
43066          var q;
43067
43068          if (mode !== 'mod') {
43069            q = new BN(null);
43070            q.length = m + 1;
43071            q.words = new Array(q.length);
43072
43073            for (var i = 0; i < q.length; i++) {
43074              q.words[i] = 0;
43075            }
43076          }
43077
43078          var diff = a.clone()._ishlnsubmul(b, 1, m);
43079
43080          if (diff.negative === 0) {
43081            a = diff;
43082
43083            if (q) {
43084              q.words[m] = 1;
43085            }
43086          }
43087
43088          for (var j = m - 1; j >= 0; j--) {
43089            var qj = (a.words[b.length + j] | 0) * 0x4000000 + (a.words[b.length + j - 1] | 0); // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max
43090            // (0x7ffffff)
43091
43092            qj = Math.min(qj / bhi | 0, 0x3ffffff);
43093
43094            a._ishlnsubmul(b, qj, j);
43095
43096            while (a.negative !== 0) {
43097              qj--;
43098              a.negative = 0;
43099
43100              a._ishlnsubmul(b, 1, j);
43101
43102              if (!a.isZero()) {
43103                a.negative ^= 1;
43104              }
43105            }
43106
43107            if (q) {
43108              q.words[j] = qj;
43109            }
43110          }
43111
43112          if (q) {
43113            q.strip();
43114          }
43115
43116          a.strip(); // Denormalize
43117
43118          if (mode !== 'div' && shift !== 0) {
43119            a.iushrn(shift);
43120          }
43121
43122          return {
43123            div: q || null,
43124            mod: a
43125          };
43126        }; // NOTE: 1) `mode` can be set to `mod` to request mod only,
43127        //       to `div` to request div only, or be absent to
43128        //       request both div & mod
43129        //       2) `positive` is true if unsigned mod is requested
43130
43131
43132        BN.prototype.divmod = function divmod(num, mode, positive) {
43133          assert(!num.isZero());
43134
43135          if (this.isZero()) {
43136            return {
43137              div: new BN(0),
43138              mod: new BN(0)
43139            };
43140          }
43141
43142          var div, mod, res;
43143
43144          if (this.negative !== 0 && num.negative === 0) {
43145            res = this.neg().divmod(num, mode);
43146
43147            if (mode !== 'mod') {
43148              div = res.div.neg();
43149            }
43150
43151            if (mode !== 'div') {
43152              mod = res.mod.neg();
43153
43154              if (positive && mod.negative !== 0) {
43155                mod.iadd(num);
43156              }
43157            }
43158
43159            return {
43160              div: div,
43161              mod: mod
43162            };
43163          }
43164
43165          if (this.negative === 0 && num.negative !== 0) {
43166            res = this.divmod(num.neg(), mode);
43167
43168            if (mode !== 'mod') {
43169              div = res.div.neg();
43170            }
43171
43172            return {
43173              div: div,
43174              mod: res.mod
43175            };
43176          }
43177
43178          if ((this.negative & num.negative) !== 0) {
43179            res = this.neg().divmod(num.neg(), mode);
43180
43181            if (mode !== 'div') {
43182              mod = res.mod.neg();
43183
43184              if (positive && mod.negative !== 0) {
43185                mod.isub(num);
43186              }
43187            }
43188
43189            return {
43190              div: res.div,
43191              mod: mod
43192            };
43193          } // Both numbers are positive at this point
43194          // Strip both numbers to approximate shift value
43195
43196
43197          if (num.length > this.length || this.cmp(num) < 0) {
43198            return {
43199              div: new BN(0),
43200              mod: this
43201            };
43202          } // Very short reduction
43203
43204
43205          if (num.length === 1) {
43206            if (mode === 'div') {
43207              return {
43208                div: this.divn(num.words[0]),
43209                mod: null
43210              };
43211            }
43212
43213            if (mode === 'mod') {
43214              return {
43215                div: null,
43216                mod: new BN(this.modn(num.words[0]))
43217              };
43218            }
43219
43220            return {
43221              div: this.divn(num.words[0]),
43222              mod: new BN(this.modn(num.words[0]))
43223            };
43224          }
43225
43226          return this._wordDiv(num, mode);
43227        }; // Find `this` / `num`
43228
43229
43230        BN.prototype.div = function div(num) {
43231          return this.divmod(num, 'div', false).div;
43232        }; // Find `this` % `num`
43233
43234
43235        BN.prototype.mod = function mod(num) {
43236          return this.divmod(num, 'mod', false).mod;
43237        };
43238
43239        BN.prototype.umod = function umod(num) {
43240          return this.divmod(num, 'mod', true).mod;
43241        }; // Find Round(`this` / `num`)
43242
43243
43244        BN.prototype.divRound = function divRound(num) {
43245          var dm = this.divmod(num); // Fast case - exact division
43246
43247          if (dm.mod.isZero()) return dm.div;
43248          var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod;
43249          var half = num.ushrn(1);
43250          var r2 = num.andln(1);
43251          var cmp = mod.cmp(half); // Round down
43252
43253          if (cmp < 0 || r2 === 1 && cmp === 0) return dm.div; // Round up
43254
43255          return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1);
43256        };
43257
43258        BN.prototype.modn = function modn(num) {
43259          assert(num <= 0x3ffffff);
43260          var p = (1 << 26) % num;
43261          var acc = 0;
43262
43263          for (var i = this.length - 1; i >= 0; i--) {
43264            acc = (p * acc + (this.words[i] | 0)) % num;
43265          }
43266
43267          return acc;
43268        }; // In-place division by number
43269
43270
43271        BN.prototype.idivn = function idivn(num) {
43272          assert(num <= 0x3ffffff);
43273          var carry = 0;
43274
43275          for (var i = this.length - 1; i >= 0; i--) {
43276            var w = (this.words[i] | 0) + carry * 0x4000000;
43277            this.words[i] = w / num | 0;
43278            carry = w % num;
43279          }
43280
43281          return this.strip();
43282        };
43283
43284        BN.prototype.divn = function divn(num) {
43285          return this.clone().idivn(num);
43286        };
43287
43288        BN.prototype.egcd = function egcd(p) {
43289          assert(p.negative === 0);
43290          assert(!p.isZero());
43291          var x = this;
43292          var y = p.clone();
43293
43294          if (x.negative !== 0) {
43295            x = x.umod(p);
43296          } else {
43297            x = x.clone();
43298          } // A * x + B * y = x
43299
43300
43301          var A = new BN(1);
43302          var B = new BN(0); // C * x + D * y = y
43303
43304          var C = new BN(0);
43305          var D = new BN(1);
43306          var g = 0;
43307
43308          while (x.isEven() && y.isEven()) {
43309            x.iushrn(1);
43310            y.iushrn(1);
43311            ++g;
43312          }
43313
43314          var yp = y.clone();
43315          var xp = x.clone();
43316
43317          while (!x.isZero()) {
43318            for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1) {
43319              ;
43320            }
43321
43322            if (i > 0) {
43323              x.iushrn(i);
43324
43325              while (i-- > 0) {
43326                if (A.isOdd() || B.isOdd()) {
43327                  A.iadd(yp);
43328                  B.isub(xp);
43329                }
43330
43331                A.iushrn(1);
43332                B.iushrn(1);
43333              }
43334            }
43335
43336            for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1) {
43337              ;
43338            }
43339
43340            if (j > 0) {
43341              y.iushrn(j);
43342
43343              while (j-- > 0) {
43344                if (C.isOdd() || D.isOdd()) {
43345                  C.iadd(yp);
43346                  D.isub(xp);
43347                }
43348
43349                C.iushrn(1);
43350                D.iushrn(1);
43351              }
43352            }
43353
43354            if (x.cmp(y) >= 0) {
43355              x.isub(y);
43356              A.isub(C);
43357              B.isub(D);
43358            } else {
43359              y.isub(x);
43360              C.isub(A);
43361              D.isub(B);
43362            }
43363          }
43364
43365          return {
43366            a: C,
43367            b: D,
43368            gcd: y.iushln(g)
43369          };
43370        }; // This is reduced incarnation of the binary EEA
43371        // above, designated to invert members of the
43372        // _prime_ fields F(p) at a maximal speed
43373
43374
43375        BN.prototype._invmp = function _invmp(p) {
43376          assert(p.negative === 0);
43377          assert(!p.isZero());
43378          var a = this;
43379          var b = p.clone();
43380
43381          if (a.negative !== 0) {
43382            a = a.umod(p);
43383          } else {
43384            a = a.clone();
43385          }
43386
43387          var x1 = new BN(1);
43388          var x2 = new BN(0);
43389          var delta = b.clone();
43390
43391          while (a.cmpn(1) > 0 && b.cmpn(1) > 0) {
43392            for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1) {
43393              ;
43394            }
43395
43396            if (i > 0) {
43397              a.iushrn(i);
43398
43399              while (i-- > 0) {
43400                if (x1.isOdd()) {
43401                  x1.iadd(delta);
43402                }
43403
43404                x1.iushrn(1);
43405              }
43406            }
43407
43408            for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1) {
43409              ;
43410            }
43411
43412            if (j > 0) {
43413              b.iushrn(j);
43414
43415              while (j-- > 0) {
43416                if (x2.isOdd()) {
43417                  x2.iadd(delta);
43418                }
43419
43420                x2.iushrn(1);
43421              }
43422            }
43423
43424            if (a.cmp(b) >= 0) {
43425              a.isub(b);
43426              x1.isub(x2);
43427            } else {
43428              b.isub(a);
43429              x2.isub(x1);
43430            }
43431          }
43432
43433          var res;
43434
43435          if (a.cmpn(1) === 0) {
43436            res = x1;
43437          } else {
43438            res = x2;
43439          }
43440
43441          if (res.cmpn(0) < 0) {
43442            res.iadd(p);
43443          }
43444
43445          return res;
43446        };
43447
43448        BN.prototype.gcd = function gcd(num) {
43449          if (this.isZero()) return num.abs();
43450          if (num.isZero()) return this.abs();
43451          var a = this.clone();
43452          var b = num.clone();
43453          a.negative = 0;
43454          b.negative = 0; // Remove common factor of two
43455
43456          for (var shift = 0; a.isEven() && b.isEven(); shift++) {
43457            a.iushrn(1);
43458            b.iushrn(1);
43459          }
43460
43461          do {
43462            while (a.isEven()) {
43463              a.iushrn(1);
43464            }
43465
43466            while (b.isEven()) {
43467              b.iushrn(1);
43468            }
43469
43470            var r = a.cmp(b);
43471
43472            if (r < 0) {
43473              // Swap `a` and `b` to make `a` always bigger than `b`
43474              var t = a;
43475              a = b;
43476              b = t;
43477            } else if (r === 0 || b.cmpn(1) === 0) {
43478              break;
43479            }
43480
43481            a.isub(b);
43482          } while (true);
43483
43484          return b.iushln(shift);
43485        }; // Invert number in the field F(num)
43486
43487
43488        BN.prototype.invm = function invm(num) {
43489          return this.egcd(num).a.umod(num);
43490        };
43491
43492        BN.prototype.isEven = function isEven() {
43493          return (this.words[0] & 1) === 0;
43494        };
43495
43496        BN.prototype.isOdd = function isOdd() {
43497          return (this.words[0] & 1) === 1;
43498        }; // And first word and num
43499
43500
43501        BN.prototype.andln = function andln(num) {
43502          return this.words[0] & num;
43503        }; // Increment at the bit position in-line
43504
43505
43506        BN.prototype.bincn = function bincn(bit) {
43507          assert(typeof bit === 'number');
43508          var r = bit % 26;
43509          var s = (bit - r) / 26;
43510          var q = 1 << r; // Fast case: bit is much higher than all existing words
43511
43512          if (this.length <= s) {
43513            this._expand(s + 1);
43514
43515            this.words[s] |= q;
43516            return this;
43517          } // Add bit and propagate, if needed
43518
43519
43520          var carry = q;
43521
43522          for (var i = s; carry !== 0 && i < this.length; i++) {
43523            var w = this.words[i] | 0;
43524            w += carry;
43525            carry = w >>> 26;
43526            w &= 0x3ffffff;
43527            this.words[i] = w;
43528          }
43529
43530          if (carry !== 0) {
43531            this.words[i] = carry;
43532            this.length++;
43533          }
43534
43535          return this;
43536        };
43537
43538        BN.prototype.isZero = function isZero() {
43539          return this.length === 1 && this.words[0] === 0;
43540        };
43541
43542        BN.prototype.cmpn = function cmpn(num) {
43543          var negative = num < 0;
43544          if (this.negative !== 0 && !negative) return -1;
43545          if (this.negative === 0 && negative) return 1;
43546          this.strip();
43547          var res;
43548
43549          if (this.length > 1) {
43550            res = 1;
43551          } else {
43552            if (negative) {
43553              num = -num;
43554            }
43555
43556            assert(num <= 0x3ffffff, 'Number is too big');
43557            var w = this.words[0] | 0;
43558            res = w === num ? 0 : w < num ? -1 : 1;
43559          }
43560
43561          if (this.negative !== 0) return -res | 0;
43562          return res;
43563        }; // Compare two numbers and return:
43564        // 1 - if `this` > `num`
43565        // 0 - if `this` == `num`
43566        // -1 - if `this` < `num`
43567
43568
43569        BN.prototype.cmp = function cmp(num) {
43570          if (this.negative !== 0 && num.negative === 0) return -1;
43571          if (this.negative === 0 && num.negative !== 0) return 1;
43572          var res = this.ucmp(num);
43573          if (this.negative !== 0) return -res | 0;
43574          return res;
43575        }; // Unsigned comparison
43576
43577
43578        BN.prototype.ucmp = function ucmp(num) {
43579          // At this point both numbers have the same sign
43580          if (this.length > num.length) return 1;
43581          if (this.length < num.length) return -1;
43582          var res = 0;
43583
43584          for (var i = this.length - 1; i >= 0; i--) {
43585            var a = this.words[i] | 0;
43586            var b = num.words[i] | 0;
43587            if (a === b) continue;
43588
43589            if (a < b) {
43590              res = -1;
43591            } else if (a > b) {
43592              res = 1;
43593            }
43594
43595            break;
43596          }
43597
43598          return res;
43599        };
43600
43601        BN.prototype.gtn = function gtn(num) {
43602          return this.cmpn(num) === 1;
43603        };
43604
43605        BN.prototype.gt = function gt(num) {
43606          return this.cmp(num) === 1;
43607        };
43608
43609        BN.prototype.gten = function gten(num) {
43610          return this.cmpn(num) >= 0;
43611        };
43612
43613        BN.prototype.gte = function gte(num) {
43614          return this.cmp(num) >= 0;
43615        };
43616
43617        BN.prototype.ltn = function ltn(num) {
43618          return this.cmpn(num) === -1;
43619        };
43620
43621        BN.prototype.lt = function lt(num) {
43622          return this.cmp(num) === -1;
43623        };
43624
43625        BN.prototype.lten = function lten(num) {
43626          return this.cmpn(num) <= 0;
43627        };
43628
43629        BN.prototype.lte = function lte(num) {
43630          return this.cmp(num) <= 0;
43631        };
43632
43633        BN.prototype.eqn = function eqn(num) {
43634          return this.cmpn(num) === 0;
43635        };
43636
43637        BN.prototype.eq = function eq(num) {
43638          return this.cmp(num) === 0;
43639        }; //
43640        // A reduce context, could be using montgomery or something better, depending
43641        // on the `m` itself.
43642        //
43643
43644
43645        BN.red = function red(num) {
43646          return new Red(num);
43647        };
43648
43649        BN.prototype.toRed = function toRed(ctx) {
43650          assert(!this.red, 'Already a number in reduction context');
43651          assert(this.negative === 0, 'red works only with positives');
43652          return ctx.convertTo(this)._forceRed(ctx);
43653        };
43654
43655        BN.prototype.fromRed = function fromRed() {
43656          assert(this.red, 'fromRed works only with numbers in reduction context');
43657          return this.red.convertFrom(this);
43658        };
43659
43660        BN.prototype._forceRed = function _forceRed(ctx) {
43661          this.red = ctx;
43662          return this;
43663        };
43664
43665        BN.prototype.forceRed = function forceRed(ctx) {
43666          assert(!this.red, 'Already a number in reduction context');
43667          return this._forceRed(ctx);
43668        };
43669
43670        BN.prototype.redAdd = function redAdd(num) {
43671          assert(this.red, 'redAdd works only with red numbers');
43672          return this.red.add(this, num);
43673        };
43674
43675        BN.prototype.redIAdd = function redIAdd(num) {
43676          assert(this.red, 'redIAdd works only with red numbers');
43677          return this.red.iadd(this, num);
43678        };
43679
43680        BN.prototype.redSub = function redSub(num) {
43681          assert(this.red, 'redSub works only with red numbers');
43682          return this.red.sub(this, num);
43683        };
43684
43685        BN.prototype.redISub = function redISub(num) {
43686          assert(this.red, 'redISub works only with red numbers');
43687          return this.red.isub(this, num);
43688        };
43689
43690        BN.prototype.redShl = function redShl(num) {
43691          assert(this.red, 'redShl works only with red numbers');
43692          return this.red.shl(this, num);
43693        };
43694
43695        BN.prototype.redMul = function redMul(num) {
43696          assert(this.red, 'redMul works only with red numbers');
43697
43698          this.red._verify2(this, num);
43699
43700          return this.red.mul(this, num);
43701        };
43702
43703        BN.prototype.redIMul = function redIMul(num) {
43704          assert(this.red, 'redMul works only with red numbers');
43705
43706          this.red._verify2(this, num);
43707
43708          return this.red.imul(this, num);
43709        };
43710
43711        BN.prototype.redSqr = function redSqr() {
43712          assert(this.red, 'redSqr works only with red numbers');
43713
43714          this.red._verify1(this);
43715
43716          return this.red.sqr(this);
43717        };
43718
43719        BN.prototype.redISqr = function redISqr() {
43720          assert(this.red, 'redISqr works only with red numbers');
43721
43722          this.red._verify1(this);
43723
43724          return this.red.isqr(this);
43725        }; // Square root over p
43726
43727
43728        BN.prototype.redSqrt = function redSqrt() {
43729          assert(this.red, 'redSqrt works only with red numbers');
43730
43731          this.red._verify1(this);
43732
43733          return this.red.sqrt(this);
43734        };
43735
43736        BN.prototype.redInvm = function redInvm() {
43737          assert(this.red, 'redInvm works only with red numbers');
43738
43739          this.red._verify1(this);
43740
43741          return this.red.invm(this);
43742        }; // Return negative clone of `this` % `red modulo`
43743
43744
43745        BN.prototype.redNeg = function redNeg() {
43746          assert(this.red, 'redNeg works only with red numbers');
43747
43748          this.red._verify1(this);
43749
43750          return this.red.neg(this);
43751        };
43752
43753        BN.prototype.redPow = function redPow(num) {
43754          assert(this.red && !num.red, 'redPow(normalNum)');
43755
43756          this.red._verify1(this);
43757
43758          return this.red.pow(this, num);
43759        }; // Prime numbers with efficient reduction
43760
43761
43762        var primes = {
43763          k256: null,
43764          p224: null,
43765          p192: null,
43766          p25519: null
43767        }; // Pseudo-Mersenne prime
43768
43769        function MPrime(name, p) {
43770          // P = 2 ^ N - K
43771          this.name = name;
43772          this.p = new BN(p, 16);
43773          this.n = this.p.bitLength();
43774          this.k = new BN(1).iushln(this.n).isub(this.p);
43775          this.tmp = this._tmp();
43776        }
43777
43778        MPrime.prototype._tmp = function _tmp() {
43779          var tmp = new BN(null);
43780          tmp.words = new Array(Math.ceil(this.n / 13));
43781          return tmp;
43782        };
43783
43784        MPrime.prototype.ireduce = function ireduce(num) {
43785          // Assumes that `num` is less than `P^2`
43786          // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P)
43787          var r = num;
43788          var rlen;
43789
43790          do {
43791            this.split(r, this.tmp);
43792            r = this.imulK(r);
43793            r = r.iadd(this.tmp);
43794            rlen = r.bitLength();
43795          } while (rlen > this.n);
43796
43797          var cmp = rlen < this.n ? -1 : r.ucmp(this.p);
43798
43799          if (cmp === 0) {
43800            r.words[0] = 0;
43801            r.length = 1;
43802          } else if (cmp > 0) {
43803            r.isub(this.p);
43804          } else {
43805            if (r.strip !== undefined) {
43806              // r is BN v4 instance
43807              r.strip();
43808            } else {
43809              // r is BN v5 instance
43810              r._strip();
43811            }
43812          }
43813
43814          return r;
43815        };
43816
43817        MPrime.prototype.split = function split(input, out) {
43818          input.iushrn(this.n, 0, out);
43819        };
43820
43821        MPrime.prototype.imulK = function imulK(num) {
43822          return num.imul(this.k);
43823        };
43824
43825        function K256() {
43826          MPrime.call(this, 'k256', 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f');
43827        }
43828
43829        inherits(K256, MPrime);
43830
43831        K256.prototype.split = function split(input, output) {
43832          // 256 = 9 * 26 + 22
43833          var mask = 0x3fffff;
43834          var outLen = Math.min(input.length, 9);
43835
43836          for (var i = 0; i < outLen; i++) {
43837            output.words[i] = input.words[i];
43838          }
43839
43840          output.length = outLen;
43841
43842          if (input.length <= 9) {
43843            input.words[0] = 0;
43844            input.length = 1;
43845            return;
43846          } // Shift by 9 limbs
43847
43848
43849          var prev = input.words[9];
43850          output.words[output.length++] = prev & mask;
43851
43852          for (i = 10; i < input.length; i++) {
43853            var next = input.words[i] | 0;
43854            input.words[i - 10] = (next & mask) << 4 | prev >>> 22;
43855            prev = next;
43856          }
43857
43858          prev >>>= 22;
43859          input.words[i - 10] = prev;
43860
43861          if (prev === 0 && input.length > 10) {
43862            input.length -= 10;
43863          } else {
43864            input.length -= 9;
43865          }
43866        };
43867
43868        K256.prototype.imulK = function imulK(num) {
43869          // K = 0x1000003d1 = [ 0x40, 0x3d1 ]
43870          num.words[num.length] = 0;
43871          num.words[num.length + 1] = 0;
43872          num.length += 2; // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390
43873
43874          var lo = 0;
43875
43876          for (var i = 0; i < num.length; i++) {
43877            var w = num.words[i] | 0;
43878            lo += w * 0x3d1;
43879            num.words[i] = lo & 0x3ffffff;
43880            lo = w * 0x40 + (lo / 0x4000000 | 0);
43881          } // Fast length reduction
43882
43883
43884          if (num.words[num.length - 1] === 0) {
43885            num.length--;
43886
43887            if (num.words[num.length - 1] === 0) {
43888              num.length--;
43889            }
43890          }
43891
43892          return num;
43893        };
43894
43895        function P224() {
43896          MPrime.call(this, 'p224', 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001');
43897        }
43898
43899        inherits(P224, MPrime);
43900
43901        function P192() {
43902          MPrime.call(this, 'p192', 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff');
43903        }
43904
43905        inherits(P192, MPrime);
43906
43907        function P25519() {
43908          // 2 ^ 255 - 19
43909          MPrime.call(this, '25519', '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed');
43910        }
43911
43912        inherits(P25519, MPrime);
43913
43914        P25519.prototype.imulK = function imulK(num) {
43915          // K = 0x13
43916          var carry = 0;
43917
43918          for (var i = 0; i < num.length; i++) {
43919            var hi = (num.words[i] | 0) * 0x13 + carry;
43920            var lo = hi & 0x3ffffff;
43921            hi >>>= 26;
43922            num.words[i] = lo;
43923            carry = hi;
43924          }
43925
43926          if (carry !== 0) {
43927            num.words[num.length++] = carry;
43928          }
43929
43930          return num;
43931        }; // Exported mostly for testing purposes, use plain name instead
43932
43933
43934        BN._prime = function prime(name) {
43935          // Cached version of prime
43936          if (primes[name]) return primes[name];
43937          var prime;
43938
43939          if (name === 'k256') {
43940            prime = new K256();
43941          } else if (name === 'p224') {
43942            prime = new P224();
43943          } else if (name === 'p192') {
43944            prime = new P192();
43945          } else if (name === 'p25519') {
43946            prime = new P25519();
43947          } else {
43948            throw new Error('Unknown prime ' + name);
43949          }
43950
43951          primes[name] = prime;
43952          return prime;
43953        }; //
43954        // Base reduction engine
43955        //
43956
43957
43958        function Red(m) {
43959          if (typeof m === 'string') {
43960            var prime = BN._prime(m);
43961
43962            this.m = prime.p;
43963            this.prime = prime;
43964          } else {
43965            assert(m.gtn(1), 'modulus must be greater than 1');
43966            this.m = m;
43967            this.prime = null;
43968          }
43969        }
43970
43971        Red.prototype._verify1 = function _verify1(a) {
43972          assert(a.negative === 0, 'red works only with positives');
43973          assert(a.red, 'red works only with red numbers');
43974        };
43975
43976        Red.prototype._verify2 = function _verify2(a, b) {
43977          assert((a.negative | b.negative) === 0, 'red works only with positives');
43978          assert(a.red && a.red === b.red, 'red works only with red numbers');
43979        };
43980
43981        Red.prototype.imod = function imod(a) {
43982          if (this.prime) return this.prime.ireduce(a)._forceRed(this);
43983          return a.umod(this.m)._forceRed(this);
43984        };
43985
43986        Red.prototype.neg = function neg(a) {
43987          if (a.isZero()) {
43988            return a.clone();
43989          }
43990
43991          return this.m.sub(a)._forceRed(this);
43992        };
43993
43994        Red.prototype.add = function add(a, b) {
43995          this._verify2(a, b);
43996
43997          var res = a.add(b);
43998
43999          if (res.cmp(this.m) >= 0) {
44000            res.isub(this.m);
44001          }
44002
44003          return res._forceRed(this);
44004        };
44005
44006        Red.prototype.iadd = function iadd(a, b) {
44007          this._verify2(a, b);
44008
44009          var res = a.iadd(b);
44010
44011          if (res.cmp(this.m) >= 0) {
44012            res.isub(this.m);
44013          }
44014
44015          return res;
44016        };
44017
44018        Red.prototype.sub = function sub(a, b) {
44019          this._verify2(a, b);
44020
44021          var res = a.sub(b);
44022
44023          if (res.cmpn(0) < 0) {
44024            res.iadd(this.m);
44025          }
44026
44027          return res._forceRed(this);
44028        };
44029
44030        Red.prototype.isub = function isub(a, b) {
44031          this._verify2(a, b);
44032
44033          var res = a.isub(b);
44034
44035          if (res.cmpn(0) < 0) {
44036            res.iadd(this.m);
44037          }
44038
44039          return res;
44040        };
44041
44042        Red.prototype.shl = function shl(a, num) {
44043          this._verify1(a);
44044
44045          return this.imod(a.ushln(num));
44046        };
44047
44048        Red.prototype.imul = function imul(a, b) {
44049          this._verify2(a, b);
44050
44051          return this.imod(a.imul(b));
44052        };
44053
44054        Red.prototype.mul = function mul(a, b) {
44055          this._verify2(a, b);
44056
44057          return this.imod(a.mul(b));
44058        };
44059
44060        Red.prototype.isqr = function isqr(a) {
44061          return this.imul(a, a.clone());
44062        };
44063
44064        Red.prototype.sqr = function sqr(a) {
44065          return this.mul(a, a);
44066        };
44067
44068        Red.prototype.sqrt = function sqrt(a) {
44069          if (a.isZero()) return a.clone();
44070          var mod3 = this.m.andln(3);
44071          assert(mod3 % 2 === 1); // Fast case
44072
44073          if (mod3 === 3) {
44074            var pow = this.m.add(new BN(1)).iushrn(2);
44075            return this.pow(a, pow);
44076          } // Tonelli-Shanks algorithm (Totally unoptimized and slow)
44077          //
44078          // Find Q and S, that Q * 2 ^ S = (P - 1)
44079
44080
44081          var q = this.m.subn(1);
44082          var s = 0;
44083
44084          while (!q.isZero() && q.andln(1) === 0) {
44085            s++;
44086            q.iushrn(1);
44087          }
44088
44089          assert(!q.isZero());
44090          var one = new BN(1).toRed(this);
44091          var nOne = one.redNeg(); // Find quadratic non-residue
vendor: 5,130 bytes, lines 44092-44276
44092          // NOTE: Max is such because of generalized Riemann hypothesis.
44093
44094          var lpow = this.m.subn(1).iushrn(1);
44095          var z = this.m.bitLength();
44096          z = new BN(2 * z * z).toRed(this);
44097
44098          while (this.pow(z, lpow).cmp(nOne) !== 0) {
44099            z.redIAdd(nOne);
44100          }
44101
44102          var c = this.pow(z, q);
44103          var r = this.pow(a, q.addn(1).iushrn(1));
44104          var t = this.pow(a, q);
44105          var m = s;
44106
44107          while (t.cmp(one) !== 0) {
44108            var tmp = t;
44109
44110            for (var i = 0; tmp.cmp(one) !== 0; i++) {
44111              tmp = tmp.redSqr();
44112            }
44113
44114            assert(i < m);
44115            var b = this.pow(c, new BN(1).iushln(m - i - 1));
44116            r = r.redMul(b);
44117            c = b.redSqr();
44118            t = t.redMul(c);
44119            m = i;
44120          }
44121
44122          return r;
44123        };
44124
44125        Red.prototype.invm = function invm(a) {
44126          var inv = a._invmp(this.m);
44127
44128          if (inv.negative !== 0) {
44129            inv.negative = 0;
44130            return this.imod(inv).redNeg();
44131          } else {
44132            return this.imod(inv);
44133          }
44134        };
44135
44136        Red.prototype.pow = function pow(a, num) {
44137          if (num.isZero()) return new BN(1).toRed(this);
44138          if (num.cmpn(1) === 0) return a.clone();
44139          var windowSize = 4;
44140          var wnd = new Array(1 << windowSize);
44141          wnd[0] = new BN(1).toRed(this);
44142          wnd[1] = a;
44143
44144          for (var i = 2; i < wnd.length; i++) {
44145            wnd[i] = this.mul(wnd[i - 1], a);
44146          }
44147
44148          var res = wnd[0];
44149          var current = 0;
44150          var currentLen = 0;
44151          var start = num.bitLength() % 26;
44152
44153          if (start === 0) {
44154            start = 26;
44155          }
44156
44157          for (i = num.length - 1; i >= 0; i--) {
44158            var word = num.words[i];
44159
44160            for (var j = start - 1; j >= 0; j--) {
44161              var bit = word >> j & 1;
44162
44163              if (res !== wnd[0]) {
44164                res = this.sqr(res);
44165              }
44166
44167              if (bit === 0 && current === 0) {
44168                currentLen = 0;
44169                continue;
44170              }
44171
44172              current <<= 1;
44173              current |= bit;
44174              currentLen++;
44175              if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue;
44176              res = this.mul(res, wnd[current]);
44177              currentLen = 0;
44178              current = 0;
44179            }
44180
44181            start = 26;
44182          }
44183
44184          return res;
44185        };
44186
44187        Red.prototype.convertTo = function convertTo(num) {
44188          var r = num.umod(this.m);
44189          return r === num ? r.clone() : r;
44190        };
44191
44192        Red.prototype.convertFrom = function convertFrom(num) {
44193          var res = num.clone();
44194          res.red = null;
44195          return res;
44196        }; //
44197        // Montgomery method engine
44198        //
44199
44200
44201        BN.mont = function mont(num) {
44202          return new Mont(num);
44203        };
44204
44205        function Mont(m) {
44206          Red.call(this, m);
44207          this.shift = this.m.bitLength();
44208
44209          if (this.shift % 26 !== 0) {
44210            this.shift += 26 - this.shift % 26;
44211          }
44212
44213          this.r = new BN(1).iushln(this.shift);
44214          this.r2 = this.imod(this.r.sqr());
44215          this.rinv = this.r._invmp(this.m);
44216          this.minv = this.rinv.mul(this.r).isubn(1).div(this.m);
44217          this.minv = this.minv.umod(this.r);
44218          this.minv = this.r.sub(this.minv);
44219        }
44220
44221        inherits(Mont, Red);
44222
44223        Mont.prototype.convertTo = function convertTo(num) {
44224          return this.imod(num.ushln(this.shift));
44225        };
44226
44227        Mont.prototype.convertFrom = function convertFrom(num) {
44228          var r = this.imod(num.mul(this.rinv));
44229          r.red = null;
44230          return r;
44231        };
44232
44233        Mont.prototype.imul = function imul(a, b) {
44234          if (a.isZero() || b.isZero()) {
44235            a.words[0] = 0;
44236            a.length = 1;
44237            return a;
44238          }
44239
44240          var t = a.imul(b);
44241          var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);
44242          var u = t.isub(c).iushrn(this.shift);
44243          var res = u;
44244
44245          if (u.cmp(this.m) >= 0) {
44246            res = u.isub(this.m);
44247          } else if (u.cmpn(0) < 0) {
44248            res = u.iadd(this.m);
44249          }
44250
44251          return res._forceRed(this);
44252        };
44253
44254        Mont.prototype.mul = function mul(a, b) {
44255          if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this);
44256          var t = a.mul(b);
44257          var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);
44258          var u = t.isub(c).iushrn(this.shift);
44259          var res = u;
44260
44261          if (u.cmp(this.m) >= 0) {
44262            res = u.isub(this.m);
44263          } else if (u.cmpn(0) < 0) {
44264            res = u.iadd(this.m);
44265          }
44266
44267          return res._forceRed(this);
44268        };
44269
44270        Mont.prototype.invm = function invm(a) {
44271          // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R
44272          var res = this.imod(a._invmp(this.m).mul(this.r2));
44273          return res._forceRed(this);
44274        };
44275      })(typeof module === 'undefined' || module, this);
44276    }, {
vendor: 4,423 bytes, lines 44277-44399
44277      "buffer": 183
44278    }],
44279    180: [function (require, module, exports) {
44280      'use strict';
44281
44282      exports.byteLength = byteLength;
44283      exports.toByteArray = toByteArray;
44284      exports.fromByteArray = fromByteArray;
44285      var lookup = [];
44286      var revLookup = [];
44287      var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array;
44288      var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
44289
44290      for (var i = 0, len = code.length; i < len; ++i) {
44291        lookup[i] = code[i];
44292        revLookup[code.charCodeAt(i)] = i;
44293      } // Support decoding URL-safe base64 strings, as Node.js does.
44294      // See: https://en.wikipedia.org/wiki/Base64#URL_applications
44295
44296
44297      revLookup['-'.charCodeAt(0)] = 62;
44298      revLookup['_'.charCodeAt(0)] = 63;
44299
44300      function getLens(b64) {
44301        var len = b64.length;
44302
44303        if (len % 4 > 0) {
44304          throw new Error('Invalid string. Length must be a multiple of 4');
44305        } // Trim off extra bytes after placeholder bytes are found
44306        // See: https://github.com/beatgammit/base64-js/issues/42
44307
44308
44309        var validLen = b64.indexOf('=');
44310        if (validLen === -1) validLen = len;
44311        var placeHoldersLen = validLen === len ? 0 : 4 - validLen % 4;
44312        return [validLen, placeHoldersLen];
44313      } // base64 is 4/3 + up to two characters of the original data
44314
44315
44316      function byteLength(b64) {
44317        var lens = getLens(b64);
44318        var validLen = lens[0];
44319        var placeHoldersLen = lens[1];
44320        return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
44321      }
44322
44323      function _byteLength(b64, validLen, placeHoldersLen) {
44324        return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
44325      }
44326
44327      function toByteArray(b64) {
44328        var tmp;
44329        var lens = getLens(b64);
44330        var validLen = lens[0];
44331        var placeHoldersLen = lens[1];
44332        var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen));
44333        var curByte = 0; // if there are placeholders, only get up to the last complete 4 chars
44334
44335        var len = placeHoldersLen > 0 ? validLen - 4 : validLen;
44336        var i;
44337
44338        for (i = 0; i < len; i += 4) {
44339          tmp = revLookup[b64.charCodeAt(i)] << 18 | revLookup[b64.charCodeAt(i + 1)] << 12 | revLookup[b64.charCodeAt(i + 2)] << 6 | revLookup[b64.charCodeAt(i + 3)];
44340          arr[curByte++] = tmp >> 16 & 0xFF;
44341          arr[curByte++] = tmp >> 8 & 0xFF;
44342          arr[curByte++] = tmp & 0xFF;
44343        }
44344
44345        if (placeHoldersLen === 2) {
44346          tmp = revLookup[b64.charCodeAt(i)] << 2 | revLookup[b64.charCodeAt(i + 1)] >> 4;
44347          arr[curByte++] = tmp & 0xFF;
44348        }
44349
44350        if (placeHoldersLen === 1) {
44351          tmp = revLookup[b64.charCodeAt(i)] << 10 | revLookup[b64.charCodeAt(i + 1)] << 4 | revLookup[b64.charCodeAt(i + 2)] >> 2;
44352          arr[curByte++] = tmp >> 8 & 0xFF;
44353          arr[curByte++] = tmp & 0xFF;
44354        }
44355
44356        return arr;
44357      }
44358
44359      function tripletToBase64(num) {
44360        return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F];
44361      }
44362
44363      function encodeChunk(uint8, start, end) {
44364        var tmp;
44365        var output = [];
44366
44367        for (var i = start; i < end; i += 3) {
44368          tmp = (uint8[i] << 16 & 0xFF0000) + (uint8[i + 1] << 8 & 0xFF00) + (uint8[i + 2] & 0xFF);
44369          output.push(tripletToBase64(tmp));
44370        }
44371
44372        return output.join('');
44373      }
44374
44375      function fromByteArray(uint8) {
44376        var tmp;
44377        var len = uint8.length;
44378        var extraBytes = len % 3; // if we have 1 byte left, pad 2 bytes
44379
44380        var parts = [];
44381        var maxChunkLength = 16383; // must be multiple of 3
44382        // go through the array every three bytes, we'll deal with trailing stuff later
44383
44384        for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
44385          parts.push(encodeChunk(uint8, i, i + maxChunkLength > len2 ? len2 : i + maxChunkLength));
44386        } // pad the end with zeros, but make sure to not forget the extra bytes
44387
44388
44389        if (extraBytes === 1) {
44390          tmp = uint8[len - 1];
44391          parts.push(lookup[tmp >> 2] + lookup[tmp << 4 & 0x3F] + '==');
44392        } else if (extraBytes === 2) {
44393          tmp = (uint8[len - 2] << 8) + uint8[len - 1];
44394          parts.push(lookup[tmp >> 10] + lookup[tmp >> 4 & 0x3F] + lookup[tmp << 2 & 0x3F] + '=');
44395        }
44396
44397        return parts.join('');
44398      }
44399    }, {}],
44400    181: [function (require, module, exports) {
44401      (function (module, exports) {
44402        'use strict'; // Utils
44403
44404        function assert(val, msg) {
44405          if (!val) throw new Error(msg || 'Assertion failed');
44406        } // Could use `inherits` module, but don't want to move from single file
44407        // architecture yet.
44408
44409
44410        function inherits(ctor, superCtor) {
44411          ctor.super_ = superCtor;
44412
44413          var TempCtor = function TempCtor() {};
44414
44415          TempCtor.prototype = superCtor.prototype;
44416          ctor.prototype = new TempCtor();
44417          ctor.prototype.constructor = ctor;
44418        } // BN
44419
44420
44421        function BN(number, base, endian) {
44422          if (BN.isBN(number)) {
44423            return number;
44424          }
44425
44426          this.negative = 0;
44427          this.words = null;
44428          this.length = 0; // Reduction context
44429
44430          this.red = null;
44431
44432          if (number !== null) {
44433            if (base === 'le' || base === 'be') {
44434              endian = base;
44435              base = 10;
44436            }
44437
44438            this._init(number || 0, base || 10, endian || 'be');
44439          }
44440        }
44441
44442        if (_typeof2(module) === 'object') {
44443          module.exports = BN;
44444        } else {
44445          exports.BN = BN;
44446        }
44447
44448        BN.BN = BN;
44449        BN.wordSize = 26;
44450        var Buffer;
44451
44452        try {
44453          Buffer = require('buffer').Buffer;
44454        } catch (e) {}
44455
44456        BN.isBN = function isBN(num) {
44457          if (num instanceof BN) {
44458            return true;
44459          }
44460
44461          return num !== null && _typeof2(num) === 'object' && num.constructor.wordSize === BN.wordSize && Array.isArray(num.words);
44462        };
44463
44464        BN.max = function max(left, right) {
44465          if (left.cmp(right) > 0) return left;
44466          return right;
44467        };
44468
44469        BN.min = function min(left, right) {
44470          if (left.cmp(right) < 0) return left;
44471          return right;
44472        };
44473
44474        BN.prototype._init = function init(number, base, endian) {
44475          if (typeof number === 'number') {
44476            return this._initNumber(number, base, endian);
44477          }
44478
44479          if (_typeof2(number) === 'object') {
44480            return this._initArray(number, base, endian);
44481          }
44482
44483          if (base === 'hex') {
44484            base = 16;
44485          }
44486
44487          assert(base === (base | 0) && base >= 2 && base <= 36);
44488          number = number.toString().replace(/\s+/g, '');
44489          var start = 0;
44490
44491          if (number[0] === '-') {
44492            start++;
44493          }
44494
44495          if (base === 16) {
44496            this._parseHex(number, start);
44497          } else {
44498            this._parseBase(number, base, start);
44499          }
44500
44501          if (number[0] === '-') {
44502            this.negative = 1;
44503          }
44504
44505          this._strip();
44506
44507          if (endian !== 'le') return;
44508
44509          this._initArray(this.toArray(), base, endian);
44510        };
44511
44512        BN.prototype._initNumber = function _initNumber(number, base, endian) {
44513          if (number < 0) {
44514            this.negative = 1;
44515            number = -number;
44516          }
44517
44518          if (number < 0x4000000) {
44519            this.words = [number & 0x3ffffff];
44520            this.length = 1;
44521          } else if (number < 0x10000000000000) {
44522            this.words = [number & 0x3ffffff, number / 0x4000000 & 0x3ffffff];
44523            this.length = 2;
44524          } else {
44525            assert(number < 0x20000000000000); // 2 ^ 53 (unsafe)
44526
44527            this.words = [number & 0x3ffffff, number / 0x4000000 & 0x3ffffff, 1];
44528            this.length = 3;
44529          }
44530
44531          if (endian !== 'le') return; // Reverse the bytes
44532
44533          this._initArray(this.toArray(), base, endian);
44534        };
44535
44536        BN.prototype._initArray = function _initArray(number, base, endian) {
44537          // Perhaps a Uint8Array
44538          assert(typeof number.length === 'number');
44539
44540          if (number.length <= 0) {
44541            this.words = [0];
44542            this.length = 1;
44543            return this;
44544          }
44545
44546          this.length = Math.ceil(number.length / 3);
44547          this.words = new Array(this.length);
44548
44549          for (var i = 0; i < this.length; i++) {
44550            this.words[i] = 0;
44551          }
44552
44553          var j, w;
44554          var off = 0;
44555
44556          if (endian === 'be') {
44557            for (i = number.length - 1, j = 0; i >= 0; i -= 3) {
44558              w = number[i] | number[i - 1] << 8 | number[i - 2] << 16;
44559              this.words[j] |= w << off & 0x3ffffff;
44560              this.words[j + 1] = w >>> 26 - off & 0x3ffffff;
44561              off += 24;
44562
44563              if (off >= 26) {
44564                off -= 26;
44565                j++;
44566              }
44567            }
44568          } else if (endian === 'le') {
44569            for (i = 0, j = 0; i < number.length; i += 3) {
44570              w = number[i] | number[i + 1] << 8 | number[i + 2] << 16;
44571              this.words[j] |= w << off & 0x3ffffff;
44572              this.words[j + 1] = w >>> 26 - off & 0x3ffffff;
44573              off += 24;
44574
44575              if (off >= 26) {
44576                off -= 26;
44577                j++;
44578              }
44579            }
44580          }
44581
44582          return this._strip();
44583        };
44584
44585        function parseHex(str, start, end) {
44586          var r = 0;
44587          var len = Math.min(str.length, end);
44588          var z = 0;
44589
44590          for (var i = start; i < len; i++) {
44591            var c = str.charCodeAt(i) - 48;
44592            r <<= 4;
44593            var b; // 'a' - 'f'
44594
44595            if (c >= 49 && c <= 54) {
44596              b = c - 49 + 0xa; // 'A' - 'F'
44597            } else if (c >= 17 && c <= 22) {
44598              b = c - 17 + 0xa; // '0' - '9'
44599            } else {
44600              b = c;
44601            }
44602
44603            r |= b;
44604            z |= b;
44605          }
44606
44607          assert(!(z & 0xf0), 'Invalid character in ' + str);
44608          return r;
44609        }
44610
44611        BN.prototype._parseHex = function _parseHex(number, start) {
44612          // Create possibly bigger array to ensure that it fits the number
44613          this.length = Math.ceil((number.length - start) / 6);
44614          this.words = new Array(this.length);
44615
44616          for (var i = 0; i < this.length; i++) {
44617            this.words[i] = 0;
44618          }
44619
44620          var j, w; // Scan 24-bit chunks and add them to the number
44621
44622          var off = 0;
44623
44624          for (i = number.length - 6, j = 0; i >= start; i -= 6) {
44625            w = parseHex(number, i, i + 6);
44626            this.words[j] |= w << off & 0x3ffffff; // NOTE: `0x3fffff` is intentional here, 26bits max shift + 24bit hex limb
44627
44628            this.words[j + 1] |= w >>> 26 - off & 0x3fffff;
44629            off += 24;
44630
44631            if (off >= 26) {
44632              off -= 26;
44633              j++;
44634            }
44635          }
44636
44637          if (i + 6 !== start) {
44638            w = parseHex(number, start, i + 6);
44639            this.words[j] |= w << off & 0x3ffffff;
44640            this.words[j + 1] |= w >>> 26 - off & 0x3fffff;
44641          }
44642
44643          this._strip();
44644        };
44645
44646        function parseBase(str, start, end, mul) {
44647          var r = 0;
44648          var b = 0;
44649          var len = Math.min(str.length, end);
44650
44651          for (var i = start; i < len; i++) {
44652            var c = str.charCodeAt(i) - 48;
44653            r *= mul; // 'a'
44654
44655            if (c >= 49) {
44656              b = c - 49 + 0xa; // 'A'
44657            } else if (c >= 17) {
44658              b = c - 17 + 0xa; // '0' - '9'
44659            } else {
44660              b = c;
44661            }
44662
44663            assert(c >= 0 && b < mul, 'Invalid character');
44664            r += b;
44665          }
44666
44667          return r;
44668        }
44669
44670        BN.prototype._parseBase = function _parseBase(number, base, start) {
44671          // Initialize as zero
44672          this.words = [0];
44673          this.length = 1; // Find length of limb in base
44674
44675          for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) {
44676            limbLen++;
44677          }
44678
44679          limbLen--;
44680          limbPow = limbPow / base | 0;
44681          var total = number.length - start;
44682          var mod = total % limbLen;
44683          var end = Math.min(total, total - mod) + start;
44684          var word = 0;
44685
44686          for (var i = start; i < end; i += limbLen) {
44687            word = parseBase(number, i, i + limbLen, base);
44688            this.imuln(limbPow);
44689
44690            if (this.words[0] + word < 0x4000000) {
44691              this.words[0] += word;
44692            } else {
44693              this._iaddn(word);
44694            }
44695          }
44696
44697          if (mod !== 0) {
44698            var pow = 1;
44699            word = parseBase(number, i, number.length, base);
44700
44701            for (i = 0; i < mod; i++) {
44702              pow *= base;
44703            }
44704
44705            this.imuln(pow);
44706
44707            if (this.words[0] + word < 0x4000000) {
44708              this.words[0] += word;
44709            } else {
44710              this._iaddn(word);
44711            }
44712          }
44713        };
44714
44715        BN.prototype.copy = function copy(dest) {
44716          dest.words = new Array(this.length);
44717
44718          for (var i = 0; i < this.length; i++) {
44719            dest.words[i] = this.words[i];
44720          }
44721
44722          dest.length = this.length;
44723          dest.negative = this.negative;
44724          dest.red = this.red;
44725        };
44726
44727        function move(dest, src) {
44728          dest.words = src.words;
44729          dest.length = src.length;
44730          dest.negative = src.negative;
44731          dest.red = src.red;
44732        }
44733
44734        BN.prototype._move = function _move(dest) {
44735          move(dest, this);
44736        };
44737
44738        BN.prototype.clone = function clone() {
44739          var r = new BN(null);
44740          this.copy(r);
44741          return r;
44742        };
44743
44744        BN.prototype._expand = function _expand(size) {
44745          while (this.length < size) {
44746            this.words[this.length++] = 0;
44747          }
44748
44749          return this;
44750        }; // Remove leading `0` from `this`
44751
44752
44753        BN.prototype._strip = function strip() {
44754          while (this.length > 1 && this.words[this.length - 1] === 0) {
44755            this.length--;
44756          }
44757
44758          return this._normSign();
44759        };
44760
44761        BN.prototype._normSign = function _normSign() {
vendor: 90,476 bytes, lines 44762-47788
44762          // -0 = 0
44763          if (this.length === 1 && this.words[0] === 0) {
44764            this.negative = 0;
44765          }
44766
44767          return this;
44768        }; // Check Symbol.for because not everywhere where Symbol defined
44769        // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol#Browser_compatibility
44770
44771
44772        if (typeof Symbol !== 'undefined' && typeof Symbol.for === 'function') {
44773          BN.prototype[Symbol.for('nodejs.util.inspect.custom')] = inspect;
44774        } else {
44775          BN.prototype.inspect = inspect;
44776        }
44777
44778        function inspect() {
44779          return (this.red ? '<BN-R: ' : '<BN: ') + this.toString(16) + '>';
44780        }
44781        /*
44782         var zeros = [];
44783        var groupSizes = [];
44784        var groupBases = [];
44785         var s = '';
44786        var i = -1;
44787        while (++i < BN.wordSize) {
44788          zeros[i] = s;
44789          s += '0';
44790        }
44791        groupSizes[0] = 0;
44792        groupSizes[1] = 0;
44793        groupBases[0] = 0;
44794        groupBases[1] = 0;
44795        var base = 2 - 1;
44796        while (++base < 36 + 1) {
44797          var groupSize = 0;
44798          var groupBase = 1;
44799          while (groupBase < (1 << BN.wordSize) / base) {
44800            groupBase *= base;
44801            groupSize += 1;
44802          }
44803          groupSizes[base] = groupSize;
44804          groupBases[base] = groupBase;
44805        }
44806         */
44807
44808
44809        var zeros = ['', '0', '00', '000', '0000', '00000', '000000', '0000000', '00000000', '000000000', '0000000000', '00000000000', '000000000000', '0000000000000', '00000000000000', '000000000000000', '0000000000000000', '00000000000000000', '000000000000000000', '0000000000000000000', '00000000000000000000', '000000000000000000000', '0000000000000000000000', '00000000000000000000000', '000000000000000000000000', '0000000000000000000000000'];
44810        var groupSizes = [0, 0, 25, 16, 12, 11, 10, 9, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5];
44811        var groupBases = [0, 0, 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625, 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632, 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176];
44812
44813        BN.prototype.toString = function toString(base, padding) {
44814          base = base || 10;
44815          padding = padding | 0 || 1;
44816          var out;
44817
44818          if (base === 16 || base === 'hex') {
44819            out = '';
44820            var off = 0;
44821            var carry = 0;
44822
44823            for (var i = 0; i < this.length; i++) {
44824              var w = this.words[i];
44825              var word = ((w << off | carry) & 0xffffff).toString(16);
44826              carry = w >>> 24 - off & 0xffffff;
44827
44828              if (carry !== 0 || i !== this.length - 1) {
44829                out = zeros[6 - word.length] + word + out;
44830              } else {
44831                out = word + out;
44832              }
44833
44834              off += 2;
44835
44836              if (off >= 26) {
44837                off -= 26;
44838                i--;
44839              }
44840            }
44841
44842            if (carry !== 0) {
44843              out = carry.toString(16) + out;
44844            }
44845
44846            while (out.length % padding !== 0) {
44847              out = '0' + out;
44848            }
44849
44850            if (this.negative !== 0) {
44851              out = '-' + out;
44852            }
44853
44854            return out;
44855          }
44856
44857          if (base === (base | 0) && base >= 2 && base <= 36) {
44858            // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base));
44859            var groupSize = groupSizes[base]; // var groupBase = Math.pow(base, groupSize);
44860
44861            var groupBase = groupBases[base];
44862            out = '';
44863            var c = this.clone();
44864            c.negative = 0;
44865
44866            while (!c.isZero()) {
44867              var r = c.modrn(groupBase).toString(base);
44868              c = c.idivn(groupBase);
44869
44870              if (!c.isZero()) {
44871                out = zeros[groupSize - r.length] + r + out;
44872              } else {
44873                out = r + out;
44874              }
44875            }
44876
44877            if (this.isZero()) {
44878              out = '0' + out;
44879            }
44880
44881            while (out.length % padding !== 0) {
44882              out = '0' + out;
44883            }
44884
44885            if (this.negative !== 0) {
44886              out = '-' + out;
44887            }
44888
44889            return out;
44890          }
44891
44892          assert(false, 'Base should be between 2 and 36');
44893        };
44894
44895        BN.prototype.toNumber = function toNumber() {
44896          var ret = this.words[0];
44897
44898          if (this.length === 2) {
44899            ret += this.words[1] * 0x4000000;
44900          } else if (this.length === 3 && this.words[2] === 0x01) {
44901            // NOTE: at this stage it is known that the top bit is set
44902            ret += 0x10000000000000 + this.words[1] * 0x4000000;
44903          } else if (this.length > 2) {
44904            assert(false, 'Number can only safely store up to 53 bits');
44905          }
44906
44907          return this.negative !== 0 ? -ret : ret;
44908        };
44909
44910        BN.prototype.toJSON = function toJSON() {
44911          return this.toString(16, 2);
44912        };
44913
44914        if (Buffer) {
44915          BN.prototype.toBuffer = function toBuffer(endian, length) {
44916            return this.toArrayLike(Buffer, endian, length);
44917          };
44918        }
44919
44920        BN.prototype.toArray = function toArray(endian, length) {
44921          return this.toArrayLike(Array, endian, length);
44922        };
44923
44924        var allocate = function allocate(ArrayType, size) {
44925          if (ArrayType.allocUnsafe) {
44926            return ArrayType.allocUnsafe(size);
44927          }
44928
44929          return new ArrayType(size);
44930        };
44931
44932        BN.prototype.toArrayLike = function toArrayLike(ArrayType, endian, length) {
44933          this._strip();
44934
44935          var byteLength = this.byteLength();
44936          var reqLength = length || Math.max(1, byteLength);
44937          assert(byteLength <= reqLength, 'byte array longer than desired length');
44938          assert(reqLength > 0, 'Requested array length <= 0');
44939          var res = allocate(ArrayType, reqLength);
44940          var postfix = endian === 'le' ? 'LE' : 'BE';
44941          this['_toArrayLike' + postfix](res, byteLength);
44942          return res;
44943        };
44944
44945        BN.prototype._toArrayLikeLE = function _toArrayLikeLE(res, byteLength) {
44946          var position = 0;
44947          var carry = 0;
44948
44949          for (var i = 0, shift = 0; i < this.length; i++) {
44950            var word = this.words[i] << shift | carry;
44951            res[position++] = word & 0xff;
44952
44953            if (position < res.length) {
44954              res[position++] = word >> 8 & 0xff;
44955            }
44956
44957            if (position < res.length) {
44958              res[position++] = word >> 16 & 0xff;
44959            }
44960
44961            if (shift === 6) {
44962              if (position < res.length) {
44963                res[position++] = word >> 24 & 0xff;
44964              }
44965
44966              carry = 0;
44967              shift = 0;
44968            } else {
44969              carry = word >>> 24;
44970              shift += 2;
44971            }
44972          }
44973
44974          if (position < res.length) {
44975            res[position++] = carry;
44976
44977            while (position < res.length) {
44978              res[position++] = 0;
44979            }
44980          }
44981        };
44982
44983        BN.prototype._toArrayLikeBE = function _toArrayLikeBE(res, byteLength) {
44984          var position = res.length - 1;
44985          var carry = 0;
44986
44987          for (var i = 0, shift = 0; i < this.length; i++) {
44988            var word = this.words[i] << shift | carry;
44989            res[position--] = word & 0xff;
44990
44991            if (position >= 0) {
44992              res[position--] = word >> 8 & 0xff;
44993            }
44994
44995            if (position >= 0) {
44996              res[position--] = word >> 16 & 0xff;
44997            }
44998
44999            if (shift === 6) {
45000              if (position >= 0) {
45001                res[position--] = word >> 24 & 0xff;
45002              }
45003
45004              carry = 0;
45005              shift = 0;
45006            } else {
45007              carry = word >>> 24;
45008              shift += 2;
45009            }
45010          }
45011
45012          if (position >= 0) {
45013            res[position--] = carry;
45014
45015            while (position >= 0) {
45016              res[position--] = 0;
45017            }
45018          }
45019        };
45020
45021        if (Math.clz32) {
45022          BN.prototype._countBits = function _countBits(w) {
45023            return 32 - Math.clz32(w);
45024          };
45025        } else {
45026          BN.prototype._countBits = function _countBits(w) {
45027            var t = w;
45028            var r = 0;
45029
45030            if (t >= 0x1000) {
45031              r += 13;
45032              t >>>= 13;
45033            }
45034
45035            if (t >= 0x40) {
45036              r += 7;
45037              t >>>= 7;
45038            }
45039
45040            if (t >= 0x8) {
45041              r += 4;
45042              t >>>= 4;
45043            }
45044
45045            if (t >= 0x02) {
45046              r += 2;
45047              t >>>= 2;
45048            }
45049
45050            return r + t;
45051          };
45052        }
45053
45054        BN.prototype._zeroBits = function _zeroBits(w) {
45055          // Short-cut
45056          if (w === 0) return 26;
45057          var t = w;
45058          var r = 0;
45059
45060          if ((t & 0x1fff) === 0) {
45061            r += 13;
45062            t >>>= 13;
45063          }
45064
45065          if ((t & 0x7f) === 0) {
45066            r += 7;
45067            t >>>= 7;
45068          }
45069
45070          if ((t & 0xf) === 0) {
45071            r += 4;
45072            t >>>= 4;
45073          }
45074
45075          if ((t & 0x3) === 0) {
45076            r += 2;
45077            t >>>= 2;
45078          }
45079
45080          if ((t & 0x1) === 0) {
45081            r++;
45082          }
45083
45084          return r;
45085        }; // Return number of used bits in a BN
45086
45087
45088        BN.prototype.bitLength = function bitLength() {
45089          var w = this.words[this.length - 1];
45090
45091          var hi = this._countBits(w);
45092
45093          return (this.length - 1) * 26 + hi;
45094        };
45095
45096        function toBitArray(num) {
45097          var w = new Array(num.bitLength());
45098
45099          for (var bit = 0; bit < w.length; bit++) {
45100            var off = bit / 26 | 0;
45101            var wbit = bit % 26;
45102            w[bit] = num.words[off] >>> wbit & 0x01;
45103          }
45104
45105          return w;
45106        } // Number of trailing zero bits
45107
45108
45109        BN.prototype.zeroBits = function zeroBits() {
45110          if (this.isZero()) return 0;
45111          var r = 0;
45112
45113          for (var i = 0; i < this.length; i++) {
45114            var b = this._zeroBits(this.words[i]);
45115
45116            r += b;
45117            if (b !== 26) break;
45118          }
45119
45120          return r;
45121        };
45122
45123        BN.prototype.byteLength = function byteLength() {
45124          return Math.ceil(this.bitLength() / 8);
45125        };
45126
45127        BN.prototype.toTwos = function toTwos(width) {
45128          if (this.negative !== 0) {
45129            return this.abs().inotn(width).iaddn(1);
45130          }
45131
45132          return this.clone();
45133        };
45134
45135        BN.prototype.fromTwos = function fromTwos(width) {
45136          if (this.testn(width - 1)) {
45137            return this.notn(width).iaddn(1).ineg();
45138          }
45139
45140          return this.clone();
45141        };
45142
45143        BN.prototype.isNeg = function isNeg() {
45144          return this.negative !== 0;
45145        }; // Return negative clone of `this`
45146
45147
45148        BN.prototype.neg = function neg() {
45149          return this.clone().ineg();
45150        };
45151
45152        BN.prototype.ineg = function ineg() {
45153          if (!this.isZero()) {
45154            this.negative ^= 1;
45155          }
45156
45157          return this;
45158        }; // Or `num` with `this` in-place
45159
45160
45161        BN.prototype.iuor = function iuor(num) {
45162          while (this.length < num.length) {
45163            this.words[this.length++] = 0;
45164          }
45165
45166          for (var i = 0; i < num.length; i++) {
45167            this.words[i] = this.words[i] | num.words[i];
45168          }
45169
45170          return this._strip();
45171        };
45172
45173        BN.prototype.ior = function ior(num) {
45174          assert((this.negative | num.negative) === 0);
45175          return this.iuor(num);
45176        }; // Or `num` with `this`
45177
45178
45179        BN.prototype.or = function or(num) {
45180          if (this.length > num.length) return this.clone().ior(num);
45181          return num.clone().ior(this);
45182        };
45183
45184        BN.prototype.uor = function uor(num) {
45185          if (this.length > num.length) return this.clone().iuor(num);
45186          return num.clone().iuor(this);
45187        }; // And `num` with `this` in-place
45188
45189
45190        BN.prototype.iuand = function iuand(num) {
45191          // b = min-length(num, this)
45192          var b;
45193
45194          if (this.length > num.length) {
45195            b = num;
45196          } else {
45197            b = this;
45198          }
45199
45200          for (var i = 0; i < b.length; i++) {
45201            this.words[i] = this.words[i] & num.words[i];
45202          }
45203
45204          this.length = b.length;
45205          return this._strip();
45206        };
45207
45208        BN.prototype.iand = function iand(num) {
45209          assert((this.negative | num.negative) === 0);
45210          return this.iuand(num);
45211        }; // And `num` with `this`
45212
45213
45214        BN.prototype.and = function and(num) {
45215          if (this.length > num.length) return this.clone().iand(num);
45216          return num.clone().iand(this);
45217        };
45218
45219        BN.prototype.uand = function uand(num) {
45220          if (this.length > num.length) return this.clone().iuand(num);
45221          return num.clone().iuand(this);
45222        }; // Xor `num` with `this` in-place
45223
45224
45225        BN.prototype.iuxor = function iuxor(num) {
45226          // a.length > b.length
45227          var a;
45228          var b;
45229
45230          if (this.length > num.length) {
45231            a = this;
45232            b = num;
45233          } else {
45234            a = num;
45235            b = this;
45236          }
45237
45238          for (var i = 0; i < b.length; i++) {
45239            this.words[i] = a.words[i] ^ b.words[i];
45240          }
45241
45242          if (this !== a) {
45243            for (; i < a.length; i++) {
45244              this.words[i] = a.words[i];
45245            }
45246          }
45247
45248          this.length = a.length;
45249          return this._strip();
45250        };
45251
45252        BN.prototype.ixor = function ixor(num) {
45253          assert((this.negative | num.negative) === 0);
45254          return this.iuxor(num);
45255        }; // Xor `num` with `this`
45256
45257
45258        BN.prototype.xor = function xor(num) {
45259          if (this.length > num.length) return this.clone().ixor(num);
45260          return num.clone().ixor(this);
45261        };
45262
45263        BN.prototype.uxor = function uxor(num) {
45264          if (this.length > num.length) return this.clone().iuxor(num);
45265          return num.clone().iuxor(this);
45266        }; // Not ``this`` with ``width`` bitwidth
45267
45268
45269        BN.prototype.inotn = function inotn(width) {
45270          assert(typeof width === 'number' && width >= 0);
45271          var bytesNeeded = Math.ceil(width / 26) | 0;
45272          var bitsLeft = width % 26; // Extend the buffer with leading zeroes
45273
45274          this._expand(bytesNeeded);
45275
45276          if (bitsLeft > 0) {
45277            bytesNeeded--;
45278          } // Handle complete words
45279
45280
45281          for (var i = 0; i < bytesNeeded; i++) {
45282            this.words[i] = ~this.words[i] & 0x3ffffff;
45283          } // Handle the residue
45284
45285
45286          if (bitsLeft > 0) {
45287            this.words[i] = ~this.words[i] & 0x3ffffff >> 26 - bitsLeft;
45288          } // And remove leading zeroes
45289
45290
45291          return this._strip();
45292        };
45293
45294        BN.prototype.notn = function notn(width) {
45295          return this.clone().inotn(width);
45296        }; // Set `bit` of `this`
45297
45298
45299        BN.prototype.setn = function setn(bit, val) {
45300          assert(typeof bit === 'number' && bit >= 0);
45301          var off = bit / 26 | 0;
45302          var wbit = bit % 26;
45303
45304          this._expand(off + 1);
45305
45306          if (val) {
45307            this.words[off] = this.words[off] | 1 << wbit;
45308          } else {
45309            this.words[off] = this.words[off] & ~(1 << wbit);
45310          }
45311
45312          return this._strip();
45313        }; // Add `num` to `this` in-place
45314
45315
45316        BN.prototype.iadd = function iadd(num) {
45317          var r; // negative + positive
45318
45319          if (this.negative !== 0 && num.negative === 0) {
45320            this.negative = 0;
45321            r = this.isub(num);
45322            this.negative ^= 1;
45323            return this._normSign(); // positive + negative
45324          } else if (this.negative === 0 && num.negative !== 0) {
45325            num.negative = 0;
45326            r = this.isub(num);
45327            num.negative = 1;
45328            return r._normSign();
45329          } // a.length > b.length
45330
45331
45332          var a, b;
45333
45334          if (this.length > num.length) {
45335            a = this;
45336            b = num;
45337          } else {
45338            a = num;
45339            b = this;
45340          }
45341
45342          var carry = 0;
45343
45344          for (var i = 0; i < b.length; i++) {
45345            r = (a.words[i] | 0) + (b.words[i] | 0) + carry;
45346            this.words[i] = r & 0x3ffffff;
45347            carry = r >>> 26;
45348          }
45349
45350          for (; carry !== 0 && i < a.length; i++) {
45351            r = (a.words[i] | 0) + carry;
45352            this.words[i] = r & 0x3ffffff;
45353            carry = r >>> 26;
45354          }
45355
45356          this.length = a.length;
45357
45358          if (carry !== 0) {
45359            this.words[this.length] = carry;
45360            this.length++; // Copy the rest of the words
45361          } else if (a !== this) {
45362            for (; i < a.length; i++) {
45363              this.words[i] = a.words[i];
45364            }
45365          }
45366
45367          return this;
45368        }; // Add `num` to `this`
45369
45370
45371        BN.prototype.add = function add(num) {
45372          var res;
45373
45374          if (num.negative !== 0 && this.negative === 0) {
45375            num.negative = 0;
45376            res = this.sub(num);
45377            num.negative ^= 1;
45378            return res;
45379          } else if (num.negative === 0 && this.negative !== 0) {
45380            this.negative = 0;
45381            res = num.sub(this);
45382            this.negative = 1;
45383            return res;
45384          }
45385
45386          if (this.length > num.length) return this.clone().iadd(num);
45387          return num.clone().iadd(this);
45388        }; // Subtract `num` from `this` in-place
45389
45390
45391        BN.prototype.isub = function isub(num) {
45392          // this - (-num) = this + num
45393          if (num.negative !== 0) {
45394            num.negative = 0;
45395            var r = this.iadd(num);
45396            num.negative = 1;
45397            return r._normSign(); // -this - num = -(this + num)
45398          } else if (this.negative !== 0) {
45399            this.negative = 0;
45400            this.iadd(num);
45401            this.negative = 1;
45402            return this._normSign();
45403          } // At this point both numbers are positive
45404
45405
45406          var cmp = this.cmp(num); // Optimization - zeroify
45407
45408          if (cmp === 0) {
45409            this.negative = 0;
45410            this.length = 1;
45411            this.words[0] = 0;
45412            return this;
45413          } // a > b
45414
45415
45416          var a, b;
45417
45418          if (cmp > 0) {
45419            a = this;
45420            b = num;
45421          } else {
45422            a = num;
45423            b = this;
45424          }
45425
45426          var carry = 0;
45427
45428          for (var i = 0; i < b.length; i++) {
45429            r = (a.words[i] | 0) - (b.words[i] | 0) + carry;
45430            carry = r >> 26;
45431            this.words[i] = r & 0x3ffffff;
45432          }
45433
45434          for (; carry !== 0 && i < a.length; i++) {
45435            r = (a.words[i] | 0) + carry;
45436            carry = r >> 26;
45437            this.words[i] = r & 0x3ffffff;
45438          } // Copy rest of the words
45439
45440
45441          if (carry === 0 && i < a.length && a !== this) {
45442            for (; i < a.length; i++) {
45443              this.words[i] = a.words[i];
45444            }
45445          }
45446
45447          this.length = Math.max(this.length, i);
45448
45449          if (a !== this) {
45450            this.negative = 1;
45451          }
45452
45453          return this._strip();
45454        }; // Subtract `num` from `this`
45455
45456
45457        BN.prototype.sub = function sub(num) {
45458          return this.clone().isub(num);
45459        };
45460
45461        function smallMulTo(self, num, out) {
45462          out.negative = num.negative ^ self.negative;
45463          var len = self.length + num.length | 0;
45464          out.length = len;
45465          len = len - 1 | 0; // Peel one iteration (compiler can't do it, because of code complexity)
45466
45467          var a = self.words[0] | 0;
45468          var b = num.words[0] | 0;
45469          var r = a * b;
45470          var lo = r & 0x3ffffff;
45471          var carry = r / 0x4000000 | 0;
45472          out.words[0] = lo;
45473
45474          for (var k = 1; k < len; k++) {
45475            // Sum all words with the same `i + j = k` and accumulate `ncarry`,
45476            // note that ncarry could be >= 0x3ffffff
45477            var ncarry = carry >>> 26;
45478            var rword = carry & 0x3ffffff;
45479            var maxJ = Math.min(k, num.length - 1);
45480
45481            for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {
45482              var i = k - j | 0;
45483              a = self.words[i] | 0;
45484              b = num.words[j] | 0;
45485              r = a * b + rword;
45486              ncarry += r / 0x4000000 | 0;
45487              rword = r & 0x3ffffff;
45488            }
45489
45490            out.words[k] = rword | 0;
45491            carry = ncarry | 0;
45492          }
45493
45494          if (carry !== 0) {
45495            out.words[k] = carry | 0;
45496          } else {
45497            out.length--;
45498          }
45499
45500          return out._strip();
45501        } // TODO(indutny): it may be reasonable to omit it for users who don't need
45502        // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit
45503        // multiplication (like elliptic secp256k1).
45504
45505
45506        var comb10MulTo = function comb10MulTo(self, num, out) {
45507          var a = self.words;
45508          var b = num.words;
45509          var o = out.words;
45510          var c = 0;
45511          var lo;
45512          var mid;
45513          var hi;
45514          var a0 = a[0] | 0;
45515          var al0 = a0 & 0x1fff;
45516          var ah0 = a0 >>> 13;
45517          var a1 = a[1] | 0;
45518          var al1 = a1 & 0x1fff;
45519          var ah1 = a1 >>> 13;
45520          var a2 = a[2] | 0;
45521          var al2 = a2 & 0x1fff;
45522          var ah2 = a2 >>> 13;
45523          var a3 = a[3] | 0;
45524          var al3 = a3 & 0x1fff;
45525          var ah3 = a3 >>> 13;
45526          var a4 = a[4] | 0;
45527          var al4 = a4 & 0x1fff;
45528          var ah4 = a4 >>> 13;
45529          var a5 = a[5] | 0;
45530          var al5 = a5 & 0x1fff;
45531          var ah5 = a5 >>> 13;
45532          var a6 = a[6] | 0;
45533          var al6 = a6 & 0x1fff;
45534          var ah6 = a6 >>> 13;
45535          var a7 = a[7] | 0;
45536          var al7 = a7 & 0x1fff;
45537          var ah7 = a7 >>> 13;
45538          var a8 = a[8] | 0;
45539          var al8 = a8 & 0x1fff;
45540          var ah8 = a8 >>> 13;
45541          var a9 = a[9] | 0;
45542          var al9 = a9 & 0x1fff;
45543          var ah9 = a9 >>> 13;
45544          var b0 = b[0] | 0;
45545          var bl0 = b0 & 0x1fff;
45546          var bh0 = b0 >>> 13;
45547          var b1 = b[1] | 0;
45548          var bl1 = b1 & 0x1fff;
45549          var bh1 = b1 >>> 13;
45550          var b2 = b[2] | 0;
45551          var bl2 = b2 & 0x1fff;
45552          var bh2 = b2 >>> 13;
45553          var b3 = b[3] | 0;
45554          var bl3 = b3 & 0x1fff;
45555          var bh3 = b3 >>> 13;
45556          var b4 = b[4] | 0;
45557          var bl4 = b4 & 0x1fff;
45558          var bh4 = b4 >>> 13;
45559          var b5 = b[5] | 0;
45560          var bl5 = b5 & 0x1fff;
45561          var bh5 = b5 >>> 13;
45562          var b6 = b[6] | 0;
45563          var bl6 = b6 & 0x1fff;
45564          var bh6 = b6 >>> 13;
45565          var b7 = b[7] | 0;
45566          var bl7 = b7 & 0x1fff;
45567          var bh7 = b7 >>> 13;
45568          var b8 = b[8] | 0;
45569          var bl8 = b8 & 0x1fff;
45570          var bh8 = b8 >>> 13;
45571          var b9 = b[9] | 0;
45572          var bl9 = b9 & 0x1fff;
45573          var bh9 = b9 >>> 13;
45574          out.negative = self.negative ^ num.negative;
45575          out.length = 19;
45576          /* k = 0 */
45577
45578          lo = Math.imul(al0, bl0);
45579          mid = Math.imul(al0, bh0);
45580          mid = mid + Math.imul(ah0, bl0) | 0;
45581          hi = Math.imul(ah0, bh0);
45582          var w0 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;
45583          c = (hi + (mid >>> 13) | 0) + (w0 >>> 26) | 0;
45584          w0 &= 0x3ffffff;
45585          /* k = 1 */
45586
45587          lo = Math.imul(al1, bl0);
45588          mid = Math.imul(al1, bh0);
45589          mid = mid + Math.imul(ah1, bl0) | 0;
45590          hi = Math.imul(ah1, bh0);
45591          lo = lo + Math.imul(al0, bl1) | 0;
45592          mid = mid + Math.imul(al0, bh1) | 0;
45593          mid = mid + Math.imul(ah0, bl1) | 0;
45594          hi = hi + Math.imul(ah0, bh1) | 0;
45595          var w1 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;
45596          c = (hi + (mid >>> 13) | 0) + (w1 >>> 26) | 0;
45597          w1 &= 0x3ffffff;
45598          /* k = 2 */
45599
45600          lo = Math.imul(al2, bl0);
45601          mid = Math.imul(al2, bh0);
45602          mid = mid + Math.imul(ah2, bl0) | 0;
45603          hi = Math.imul(ah2, bh0);
45604          lo = lo + Math.imul(al1, bl1) | 0;
45605          mid = mid + Math.imul(al1, bh1) | 0;
45606          mid = mid + Math.imul(ah1, bl1) | 0;
45607          hi = hi + Math.imul(ah1, bh1) | 0;
45608          lo = lo + Math.imul(al0, bl2) | 0;
45609          mid = mid + Math.imul(al0, bh2) | 0;
45610          mid = mid + Math.imul(ah0, bl2) | 0;
45611          hi = hi + Math.imul(ah0, bh2) | 0;
45612          var w2 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;
45613          c = (hi + (mid >>> 13) | 0) + (w2 >>> 26) | 0;
45614          w2 &= 0x3ffffff;
45615          /* k = 3 */
45616
45617          lo = Math.imul(al3, bl0);
45618          mid = Math.imul(al3, bh0);
45619          mid = mid + Math.imul(ah3, bl0) | 0;
45620          hi = Math.imul(ah3, bh0);
45621          lo = lo + Math.imul(al2, bl1) | 0;
45622          mid = mid + Math.imul(al2, bh1) | 0;
45623          mid = mid + Math.imul(ah2, bl1) | 0;
45624          hi = hi + Math.imul(ah2, bh1) | 0;
45625          lo = lo + Math.imul(al1, bl2) | 0;
45626          mid = mid + Math.imul(al1, bh2) | 0;
45627          mid = mid + Math.imul(ah1, bl2) | 0;
45628          hi = hi + Math.imul(ah1, bh2) | 0;
45629          lo = lo + Math.imul(al0, bl3) | 0;
45630          mid = mid + Math.imul(al0, bh3) | 0;
45631          mid = mid + Math.imul(ah0, bl3) | 0;
45632          hi = hi + Math.imul(ah0, bh3) | 0;
45633          var w3 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;
45634          c = (hi + (mid >>> 13) | 0) + (w3 >>> 26) | 0;
45635          w3 &= 0x3ffffff;
45636          /* k = 4 */
45637
45638          lo = Math.imul(al4, bl0);
45639          mid = Math.imul(al4, bh0);
45640          mid = mid + Math.imul(ah4, bl0) | 0;
45641          hi = Math.imul(ah4, bh0);
45642          lo = lo + Math.imul(al3, bl1) | 0;
45643          mid = mid + Math.imul(al3, bh1) | 0;
45644          mid = mid + Math.imul(ah3, bl1) | 0;
45645          hi = hi + Math.imul(ah3, bh1) | 0;
45646          lo = lo + Math.imul(al2, bl2) | 0;
45647          mid = mid + Math.imul(al2, bh2) | 0;
45648          mid = mid + Math.imul(ah2, bl2) | 0;
45649          hi = hi + Math.imul(ah2, bh2) | 0;
45650          lo = lo + Math.imul(al1, bl3) | 0;
45651          mid = mid + Math.imul(al1, bh3) | 0;
45652          mid = mid + Math.imul(ah1, bl3) | 0;
45653          hi = hi + Math.imul(ah1, bh3) | 0;
45654          lo = lo + Math.imul(al0, bl4) | 0;
45655          mid = mid + Math.imul(al0, bh4) | 0;
45656          mid = mid + Math.imul(ah0, bl4) | 0;
45657          hi = hi + Math.imul(ah0, bh4) | 0;
45658          var w4 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;
45659          c = (hi + (mid >>> 13) | 0) + (w4 >>> 26) | 0;
45660          w4 &= 0x3ffffff;
45661          /* k = 5 */
45662
45663          lo = Math.imul(al5, bl0);
45664          mid = Math.imul(al5, bh0);
45665          mid = mid + Math.imul(ah5, bl0) | 0;
45666          hi = Math.imul(ah5, bh0);
45667          lo = lo + Math.imul(al4, bl1) | 0;
45668          mid = mid + Math.imul(al4, bh1) | 0;
45669          mid = mid + Math.imul(ah4, bl1) | 0;
45670          hi = hi + Math.imul(ah4, bh1) | 0;
45671          lo = lo + Math.imul(al3, bl2) | 0;
45672          mid = mid + Math.imul(al3, bh2) | 0;
45673          mid = mid + Math.imul(ah3, bl2) | 0;
45674          hi = hi + Math.imul(ah3, bh2) | 0;
45675          lo = lo + Math.imul(al2, bl3) | 0;
45676          mid = mid + Math.imul(al2, bh3) | 0;
45677          mid = mid + Math.imul(ah2, bl3) | 0;
45678          hi = hi + Math.imul(ah2, bh3) | 0;
45679          lo = lo + Math.imul(al1, bl4) | 0;
45680          mid = mid + Math.imul(al1, bh4) | 0;
45681          mid = mid + Math.imul(ah1, bl4) | 0;
45682          hi = hi + Math.imul(ah1, bh4) | 0;
45683          lo = lo + Math.imul(al0, bl5) | 0;
45684          mid = mid + Math.imul(al0, bh5) | 0;
45685          mid = mid + Math.imul(ah0, bl5) | 0;
45686          hi = hi + Math.imul(ah0, bh5) | 0;
45687          var w5 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;
45688          c = (hi + (mid >>> 13) | 0) + (w5 >>> 26) | 0;
45689          w5 &= 0x3ffffff;
45690          /* k = 6 */
45691
45692          lo = Math.imul(al6, bl0);
45693          mid = Math.imul(al6, bh0);
45694          mid = mid + Math.imul(ah6, bl0) | 0;
45695          hi = Math.imul(ah6, bh0);
45696          lo = lo + Math.imul(al5, bl1) | 0;
45697          mid = mid + Math.imul(al5, bh1) | 0;
45698          mid = mid + Math.imul(ah5, bl1) | 0;
45699          hi = hi + Math.imul(ah5, bh1) | 0;
45700          lo = lo + Math.imul(al4, bl2) | 0;
45701          mid = mid + Math.imul(al4, bh2) | 0;
45702          mid = mid + Math.imul(ah4, bl2) | 0;
45703          hi = hi + Math.imul(ah4, bh2) | 0;
45704          lo = lo + Math.imul(al3, bl3) | 0;
45705          mid = mid + Math.imul(al3, bh3) | 0;
45706          mid = mid + Math.imul(ah3, bl3) | 0;
45707          hi = hi + Math.imul(ah3, bh3) | 0;
45708          lo = lo + Math.imul(al2, bl4) | 0;
45709          mid = mid + Math.imul(al2, bh4) | 0;
45710          mid = mid + Math.imul(ah2, bl4) | 0;
45711          hi = hi + Math.imul(ah2, bh4) | 0;
45712          lo = lo + Math.imul(al1, bl5) | 0;
45713          mid = mid + Math.imul(al1, bh5) | 0;
45714          mid = mid + Math.imul(ah1, bl5) | 0;
45715          hi = hi + Math.imul(ah1, bh5) | 0;
45716          lo = lo + Math.imul(al0, bl6) | 0;
45717          mid = mid + Math.imul(al0, bh6) | 0;
45718          mid = mid + Math.imul(ah0, bl6) | 0;
45719          hi = hi + Math.imul(ah0, bh6) | 0;
45720          var w6 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;
45721          c = (hi + (mid >>> 13) | 0) + (w6 >>> 26) | 0;
45722          w6 &= 0x3ffffff;
45723          /* k = 7 */
45724
45725          lo = Math.imul(al7, bl0);
45726          mid = Math.imul(al7, bh0);
45727          mid = mid + Math.imul(ah7, bl0) | 0;
45728          hi = Math.imul(ah7, bh0);
45729          lo = lo + Math.imul(al6, bl1) | 0;
45730          mid = mid + Math.imul(al6, bh1) | 0;
45731          mid = mid + Math.imul(ah6, bl1) | 0;
45732          hi = hi + Math.imul(ah6, bh1) | 0;
45733          lo = lo + Math.imul(al5, bl2) | 0;
45734          mid = mid + Math.imul(al5, bh2) | 0;
45735          mid = mid + Math.imul(ah5, bl2) | 0;
45736          hi = hi + Math.imul(ah5, bh2) | 0;
45737          lo = lo + Math.imul(al4, bl3) | 0;
45738          mid = mid + Math.imul(al4, bh3) | 0;
45739          mid = mid + Math.imul(ah4, bl3) | 0;
45740          hi = hi + Math.imul(ah4, bh3) | 0;
45741          lo = lo + Math.imul(al3, bl4) | 0;
45742          mid = mid + Math.imul(al3, bh4) | 0;
45743          mid = mid + Math.imul(ah3, bl4) | 0;
45744          hi = hi + Math.imul(ah3, bh4) | 0;
45745          lo = lo + Math.imul(al2, bl5) | 0;
45746          mid = mid + Math.imul(al2, bh5) | 0;
45747          mid = mid + Math.imul(ah2, bl5) | 0;
45748          hi = hi + Math.imul(ah2, bh5) | 0;
45749          lo = lo + Math.imul(al1, bl6) | 0;
45750          mid = mid + Math.imul(al1, bh6) | 0;
45751          mid = mid + Math.imul(ah1, bl6) | 0;
45752          hi = hi + Math.imul(ah1, bh6) | 0;
45753          lo = lo + Math.imul(al0, bl7) | 0;
45754          mid = mid + Math.imul(al0, bh7) | 0;
45755          mid = mid + Math.imul(ah0, bl7) | 0;
45756          hi = hi + Math.imul(ah0, bh7) | 0;
45757          var w7 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;
45758          c = (hi + (mid >>> 13) | 0) + (w7 >>> 26) | 0;
45759          w7 &= 0x3ffffff;
45760          /* k = 8 */
45761
45762          lo = Math.imul(al8, bl0);
45763          mid = Math.imul(al8, bh0);
45764          mid = mid + Math.imul(ah8, bl0) | 0;
45765          hi = Math.imul(ah8, bh0);
45766          lo = lo + Math.imul(al7, bl1) | 0;
45767          mid = mid + Math.imul(al7, bh1) | 0;
45768          mid = mid + Math.imul(ah7, bl1) | 0;
45769          hi = hi + Math.imul(ah7, bh1) | 0;
45770          lo = lo + Math.imul(al6, bl2) | 0;
45771          mid = mid + Math.imul(al6, bh2) | 0;
45772          mid = mid + Math.imul(ah6, bl2) | 0;
45773          hi = hi + Math.imul(ah6, bh2) | 0;
45774          lo = lo + Math.imul(al5, bl3) | 0;
45775          mid = mid + Math.imul(al5, bh3) | 0;
45776          mid = mid + Math.imul(ah5, bl3) | 0;
45777          hi = hi + Math.imul(ah5, bh3) | 0;
45778          lo = lo + Math.imul(al4, bl4) | 0;
45779          mid = mid + Math.imul(al4, bh4) | 0;
45780          mid = mid + Math.imul(ah4, bl4) | 0;
45781          hi = hi + Math.imul(ah4, bh4) | 0;
45782          lo = lo + Math.imul(al3, bl5) | 0;
45783          mid = mid + Math.imul(al3, bh5) | 0;
45784          mid = mid + Math.imul(ah3, bl5) | 0;
45785          hi = hi + Math.imul(ah3, bh5) | 0;
45786          lo = lo + Math.imul(al2, bl6) | 0;
45787          mid = mid + Math.imul(al2, bh6) | 0;
45788          mid = mid + Math.imul(ah2, bl6) | 0;
45789          hi = hi + Math.imul(ah2, bh6) | 0;
45790          lo = lo + Math.imul(al1, bl7) | 0;
45791          mid = mid + Math.imul(al1, bh7) | 0;
45792          mid = mid + Math.imul(ah1, bl7) | 0;
45793          hi = hi + Math.imul(ah1, bh7) | 0;
45794          lo = lo + Math.imul(al0, bl8) | 0;
45795          mid = mid + Math.imul(al0, bh8) | 0;
45796          mid = mid + Math.imul(ah0, bl8) | 0;
45797          hi = hi + Math.imul(ah0, bh8) | 0;
45798          var w8 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;
45799          c = (hi + (mid >>> 13) | 0) + (w8 >>> 26) | 0;
45800          w8 &= 0x3ffffff;
45801          /* k = 9 */
45802
45803          lo = Math.imul(al9, bl0);
45804          mid = Math.imul(al9, bh0);
45805          mid = mid + Math.imul(ah9, bl0) | 0;
45806          hi = Math.imul(ah9, bh0);
45807          lo = lo + Math.imul(al8, bl1) | 0;
45808          mid = mid + Math.imul(al8, bh1) | 0;
45809          mid = mid + Math.imul(ah8, bl1) | 0;
45810          hi = hi + Math.imul(ah8, bh1) | 0;
45811          lo = lo + Math.imul(al7, bl2) | 0;
45812          mid = mid + Math.imul(al7, bh2) | 0;
45813          mid = mid + Math.imul(ah7, bl2) | 0;
45814          hi = hi + Math.imul(ah7, bh2) | 0;
45815          lo = lo + Math.imul(al6, bl3) | 0;
45816          mid = mid + Math.imul(al6, bh3) | 0;
45817          mid = mid + Math.imul(ah6, bl3) | 0;
45818          hi = hi + Math.imul(ah6, bh3) | 0;
45819          lo = lo + Math.imul(al5, bl4) | 0;
45820          mid = mid + Math.imul(al5, bh4) | 0;
45821          mid = mid + Math.imul(ah5, bl4) | 0;
45822          hi = hi + Math.imul(ah5, bh4) | 0;
45823          lo = lo + Math.imul(al4, bl5) | 0;
45824          mid = mid + Math.imul(al4, bh5) | 0;
45825          mid = mid + Math.imul(ah4, bl5) | 0;
45826          hi = hi + Math.imul(ah4, bh5) | 0;
45827          lo = lo + Math.imul(al3, bl6) | 0;
45828          mid = mid + Math.imul(al3, bh6) | 0;
45829          mid = mid + Math.imul(ah3, bl6) | 0;
45830          hi = hi + Math.imul(ah3, bh6) | 0;
45831          lo = lo + Math.imul(al2, bl7) | 0;
45832          mid = mid + Math.imul(al2, bh7) | 0;
45833          mid = mid + Math.imul(ah2, bl7) | 0;
45834          hi = hi + Math.imul(ah2, bh7) | 0;
45835          lo = lo + Math.imul(al1, bl8) | 0;
45836          mid = mid + Math.imul(al1, bh8) | 0;
45837          mid = mid + Math.imul(ah1, bl8) | 0;
45838          hi = hi + Math.imul(ah1, bh8) | 0;
45839          lo = lo + Math.imul(al0, bl9) | 0;
45840          mid = mid + Math.imul(al0, bh9) | 0;
45841          mid = mid + Math.imul(ah0, bl9) | 0;
45842          hi = hi + Math.imul(ah0, bh9) | 0;
45843          var w9 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;
45844          c = (hi + (mid >>> 13) | 0) + (w9 >>> 26) | 0;
45845          w9 &= 0x3ffffff;
45846          /* k = 10 */
45847
45848          lo = Math.imul(al9, bl1);
45849          mid = Math.imul(al9, bh1);
45850          mid = mid + Math.imul(ah9, bl1) | 0;
45851          hi = Math.imul(ah9, bh1);
45852          lo = lo + Math.imul(al8, bl2) | 0;
45853          mid = mid + Math.imul(al8, bh2) | 0;
45854          mid = mid + Math.imul(ah8, bl2) | 0;
45855          hi = hi + Math.imul(ah8, bh2) | 0;
45856          lo = lo + Math.imul(al7, bl3) | 0;
45857          mid = mid + Math.imul(al7, bh3) | 0;
45858          mid = mid + Math.imul(ah7, bl3) | 0;
45859          hi = hi + Math.imul(ah7, bh3) | 0;
45860          lo = lo + Math.imul(al6, bl4) | 0;
45861          mid = mid + Math.imul(al6, bh4) | 0;
45862          mid = mid + Math.imul(ah6, bl4) | 0;
45863          hi = hi + Math.imul(ah6, bh4) | 0;
45864          lo = lo + Math.imul(al5, bl5) | 0;
45865          mid = mid + Math.imul(al5, bh5) | 0;
45866          mid = mid + Math.imul(ah5, bl5) | 0;
45867          hi = hi + Math.imul(ah5, bh5) | 0;
45868          lo = lo + Math.imul(al4, bl6) | 0;
45869          mid = mid + Math.imul(al4, bh6) | 0;
45870          mid = mid + Math.imul(ah4, bl6) | 0;
45871          hi = hi + Math.imul(ah4, bh6) | 0;
45872          lo = lo + Math.imul(al3, bl7) | 0;
45873          mid = mid + Math.imul(al3, bh7) | 0;
45874          mid = mid + Math.imul(ah3, bl7) | 0;
45875          hi = hi + Math.imul(ah3, bh7) | 0;
45876          lo = lo + Math.imul(al2, bl8) | 0;
45877          mid = mid + Math.imul(al2, bh8) | 0;
45878          mid = mid + Math.imul(ah2, bl8) | 0;
45879          hi = hi + Math.imul(ah2, bh8) | 0;
45880          lo = lo + Math.imul(al1, bl9) | 0;
45881          mid = mid + Math.imul(al1, bh9) | 0;
45882          mid = mid + Math.imul(ah1, bl9) | 0;
45883          hi = hi + Math.imul(ah1, bh9) | 0;
45884          var w10 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;
45885          c = (hi + (mid >>> 13) | 0) + (w10 >>> 26) | 0;
45886          w10 &= 0x3ffffff;
45887          /* k = 11 */
45888
45889          lo = Math.imul(al9, bl2);
45890          mid = Math.imul(al9, bh2);
45891          mid = mid + Math.imul(ah9, bl2) | 0;
45892          hi = Math.imul(ah9, bh2);
45893          lo = lo + Math.imul(al8, bl3) | 0;
45894          mid = mid + Math.imul(al8, bh3) | 0;
45895          mid = mid + Math.imul(ah8, bl3) | 0;
45896          hi = hi + Math.imul(ah8, bh3) | 0;
45897          lo = lo + Math.imul(al7, bl4) | 0;
45898          mid = mid + Math.imul(al7, bh4) | 0;
45899          mid = mid + Math.imul(ah7, bl4) | 0;
45900          hi = hi + Math.imul(ah7, bh4) | 0;
45901          lo = lo + Math.imul(al6, bl5) | 0;
45902          mid = mid + Math.imul(al6, bh5) | 0;
45903          mid = mid + Math.imul(ah6, bl5) | 0;
45904          hi = hi + Math.imul(ah6, bh5) | 0;
45905          lo = lo + Math.imul(al5, bl6) | 0;
45906          mid = mid + Math.imul(al5, bh6) | 0;
45907          mid = mid + Math.imul(ah5, bl6) | 0;
45908          hi = hi + Math.imul(ah5, bh6) | 0;
45909          lo = lo + Math.imul(al4, bl7) | 0;
45910          mid = mid + Math.imul(al4, bh7) | 0;
45911          mid = mid + Math.imul(ah4, bl7) | 0;
45912          hi = hi + Math.imul(ah4, bh7) | 0;
45913          lo = lo + Math.imul(al3, bl8) | 0;
45914          mid = mid + Math.imul(al3, bh8) | 0;
45915          mid = mid + Math.imul(ah3, bl8) | 0;
45916          hi = hi + Math.imul(ah3, bh8) | 0;
45917          lo = lo + Math.imul(al2, bl9) | 0;
45918          mid = mid + Math.imul(al2, bh9) | 0;
45919          mid = mid + Math.imul(ah2, bl9) | 0;
45920          hi = hi + Math.imul(ah2, bh9) | 0;
45921          var w11 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;
45922          c = (hi + (mid >>> 13) | 0) + (w11 >>> 26) | 0;
45923          w11 &= 0x3ffffff;
45924          /* k = 12 */
45925
45926          lo = Math.imul(al9, bl3);
45927          mid = Math.imul(al9, bh3);
45928          mid = mid + Math.imul(ah9, bl3) | 0;
45929          hi = Math.imul(ah9, bh3);
45930          lo = lo + Math.imul(al8, bl4) | 0;
45931          mid = mid + Math.imul(al8, bh4) | 0;
45932          mid = mid + Math.imul(ah8, bl4) | 0;
45933          hi = hi + Math.imul(ah8, bh4) | 0;
45934          lo = lo + Math.imul(al7, bl5) | 0;
45935          mid = mid + Math.imul(al7, bh5) | 0;
45936          mid = mid + Math.imul(ah7, bl5) | 0;
45937          hi = hi + Math.imul(ah7, bh5) | 0;
45938          lo = lo + Math.imul(al6, bl6) | 0;
45939          mid = mid + Math.imul(al6, bh6) | 0;
45940          mid = mid + Math.imul(ah6, bl6) | 0;
45941          hi = hi + Math.imul(ah6, bh6) | 0;
45942          lo = lo + Math.imul(al5, bl7) | 0;
45943          mid = mid + Math.imul(al5, bh7) | 0;
45944          mid = mid + Math.imul(ah5, bl7) | 0;
45945          hi = hi + Math.imul(ah5, bh7) | 0;
45946          lo = lo + Math.imul(al4, bl8) | 0;
45947          mid = mid + Math.imul(al4, bh8) | 0;
45948          mid = mid + Math.imul(ah4, bl8) | 0;
45949          hi = hi + Math.imul(ah4, bh8) | 0;
45950          lo = lo + Math.imul(al3, bl9) | 0;
45951          mid = mid + Math.imul(al3, bh9) | 0;
45952          mid = mid + Math.imul(ah3, bl9) | 0;
45953          hi = hi + Math.imul(ah3, bh9) | 0;
45954          var w12 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;
45955          c = (hi + (mid >>> 13) | 0) + (w12 >>> 26) | 0;
45956          w12 &= 0x3ffffff;
45957          /* k = 13 */
45958
45959          lo = Math.imul(al9, bl4);
45960          mid = Math.imul(al9, bh4);
45961          mid = mid + Math.imul(ah9, bl4) | 0;
45962          hi = Math.imul(ah9, bh4);
45963          lo = lo + Math.imul(al8, bl5) | 0;
45964          mid = mid + Math.imul(al8, bh5) | 0;
45965          mid = mid + Math.imul(ah8, bl5) | 0;
45966          hi = hi + Math.imul(ah8, bh5) | 0;
45967          lo = lo + Math.imul(al7, bl6) | 0;
45968          mid = mid + Math.imul(al7, bh6) | 0;
45969          mid = mid + Math.imul(ah7, bl6) | 0;
45970          hi = hi + Math.imul(ah7, bh6) | 0;
45971          lo = lo + Math.imul(al6, bl7) | 0;
45972          mid = mid + Math.imul(al6, bh7) | 0;
45973          mid = mid + Math.imul(ah6, bl7) | 0;
45974          hi = hi + Math.imul(ah6, bh7) | 0;
45975          lo = lo + Math.imul(al5, bl8) | 0;
45976          mid = mid + Math.imul(al5, bh8) | 0;
45977          mid = mid + Math.imul(ah5, bl8) | 0;
45978          hi = hi + Math.imul(ah5, bh8) | 0;
45979          lo = lo + Math.imul(al4, bl9) | 0;
45980          mid = mid + Math.imul(al4, bh9) | 0;
45981          mid = mid + Math.imul(ah4, bl9) | 0;
45982          hi = hi + Math.imul(ah4, bh9) | 0;
45983          var w13 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;
45984          c = (hi + (mid >>> 13) | 0) + (w13 >>> 26) | 0;
45985          w13 &= 0x3ffffff;
45986          /* k = 14 */
45987
45988          lo = Math.imul(al9, bl5);
45989          mid = Math.imul(al9, bh5);
45990          mid = mid + Math.imul(ah9, bl5) | 0;
45991          hi = Math.imul(ah9, bh5);
45992          lo = lo + Math.imul(al8, bl6) | 0;
45993          mid = mid + Math.imul(al8, bh6) | 0;
45994          mid = mid + Math.imul(ah8, bl6) | 0;
45995          hi = hi + Math.imul(ah8, bh6) | 0;
45996          lo = lo + Math.imul(al7, bl7) | 0;
45997          mid = mid + Math.imul(al7, bh7) | 0;
45998          mid = mid + Math.imul(ah7, bl7) | 0;
45999          hi = hi + Math.imul(ah7, bh7) | 0;
46000          lo = lo + Math.imul(al6, bl8) | 0;
46001          mid = mid + Math.imul(al6, bh8) | 0;
46002          mid = mid + Math.imul(ah6, bl8) | 0;
46003          hi = hi + Math.imul(ah6, bh8) | 0;
46004          lo = lo + Math.imul(al5, bl9) | 0;
46005          mid = mid + Math.imul(al5, bh9) | 0;
46006          mid = mid + Math.imul(ah5, bl9) | 0;
46007          hi = hi + Math.imul(ah5, bh9) | 0;
46008          var w14 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;
46009          c = (hi + (mid >>> 13) | 0) + (w14 >>> 26) | 0;
46010          w14 &= 0x3ffffff;
46011          /* k = 15 */
46012
46013          lo = Math.imul(al9, bl6);
46014          mid = Math.imul(al9, bh6);
46015          mid = mid + Math.imul(ah9, bl6) | 0;
46016          hi = Math.imul(ah9, bh6);
46017          lo = lo + Math.imul(al8, bl7) | 0;
46018          mid = mid + Math.imul(al8, bh7) | 0;
46019          mid = mid + Math.imul(ah8, bl7) | 0;
46020          hi = hi + Math.imul(ah8, bh7) | 0;
46021          lo = lo + Math.imul(al7, bl8) | 0;
46022          mid = mid + Math.imul(al7, bh8) | 0;
46023          mid = mid + Math.imul(ah7, bl8) | 0;
46024          hi = hi + Math.imul(ah7, bh8) | 0;
46025          lo = lo + Math.imul(al6, bl9) | 0;
46026          mid = mid + Math.imul(al6, bh9) | 0;
46027          mid = mid + Math.imul(ah6, bl9) | 0;
46028          hi = hi + Math.imul(ah6, bh9) | 0;
46029          var w15 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;
46030          c = (hi + (mid >>> 13) | 0) + (w15 >>> 26) | 0;
46031          w15 &= 0x3ffffff;
46032          /* k = 16 */
46033
46034          lo = Math.imul(al9, bl7);
46035          mid = Math.imul(al9, bh7);
46036          mid = mid + Math.imul(ah9, bl7) | 0;
46037          hi = Math.imul(ah9, bh7);
46038          lo = lo + Math.imul(al8, bl8) | 0;
46039          mid = mid + Math.imul(al8, bh8) | 0;
46040          mid = mid + Math.imul(ah8, bl8) | 0;
46041          hi = hi + Math.imul(ah8, bh8) | 0;
46042          lo = lo + Math.imul(al7, bl9) | 0;
46043          mid = mid + Math.imul(al7, bh9) | 0;
46044          mid = mid + Math.imul(ah7, bl9) | 0;
46045          hi = hi + Math.imul(ah7, bh9) | 0;
46046          var w16 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;
46047          c = (hi + (mid >>> 13) | 0) + (w16 >>> 26) | 0;
46048          w16 &= 0x3ffffff;
46049          /* k = 17 */
46050
46051          lo = Math.imul(al9, bl8);
46052          mid = Math.imul(al9, bh8);
46053          mid = mid + Math.imul(ah9, bl8) | 0;
46054          hi = Math.imul(ah9, bh8);
46055          lo = lo + Math.imul(al8, bl9) | 0;
46056          mid = mid + Math.imul(al8, bh9) | 0;
46057          mid = mid + Math.imul(ah8, bl9) | 0;
46058          hi = hi + Math.imul(ah8, bh9) | 0;
46059          var w17 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;
46060          c = (hi + (mid >>> 13) | 0) + (w17 >>> 26) | 0;
46061          w17 &= 0x3ffffff;
46062          /* k = 18 */
46063
46064          lo = Math.imul(al9, bl9);
46065          mid = Math.imul(al9, bh9);
46066          mid = mid + Math.imul(ah9, bl9) | 0;
46067          hi = Math.imul(ah9, bh9);
46068          var w18 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;
46069          c = (hi + (mid >>> 13) | 0) + (w18 >>> 26) | 0;
46070          w18 &= 0x3ffffff;
46071          o[0] = w0;
46072          o[1] = w1;
46073          o[2] = w2;
46074          o[3] = w3;
46075          o[4] = w4;
46076          o[5] = w5;
46077          o[6] = w6;
46078          o[7] = w7;
46079          o[8] = w8;
46080          o[9] = w9;
46081          o[10] = w10;
46082          o[11] = w11;
46083          o[12] = w12;
46084          o[13] = w13;
46085          o[14] = w14;
46086          o[15] = w15;
46087          o[16] = w16;
46088          o[17] = w17;
46089          o[18] = w18;
46090
46091          if (c !== 0) {
46092            o[19] = c;
46093            out.length++;
46094          }
46095
46096          return out;
46097        }; // Polyfill comb
46098
46099
46100        if (!Math.imul) {
46101          comb10MulTo = smallMulTo;
46102        }
46103
46104        function bigMulTo(self, num, out) {
46105          out.negative = num.negative ^ self.negative;
46106          out.length = self.length + num.length;
46107          var carry = 0;
46108          var hncarry = 0;
46109
46110          for (var k = 0; k < out.length - 1; k++) {
46111            // Sum all words with the same `i + j = k` and accumulate `ncarry`,
46112            // note that ncarry could be >= 0x3ffffff
46113            var ncarry = hncarry;
46114            hncarry = 0;
46115            var rword = carry & 0x3ffffff;
46116            var maxJ = Math.min(k, num.length - 1);
46117
46118            for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {
46119              var i = k - j;
46120              var a = self.words[i] | 0;
46121              var b = num.words[j] | 0;
46122              var r = a * b;
46123              var lo = r & 0x3ffffff;
46124              ncarry = ncarry + (r / 0x4000000 | 0) | 0;
46125              lo = lo + rword | 0;
46126              rword = lo & 0x3ffffff;
46127              ncarry = ncarry + (lo >>> 26) | 0;
46128              hncarry += ncarry >>> 26;
46129              ncarry &= 0x3ffffff;
46130            }
46131
46132            out.words[k] = rword;
46133            carry = ncarry;
46134            ncarry = hncarry;
46135          }
46136
46137          if (carry !== 0) {
46138            out.words[k] = carry;
46139          } else {
46140            out.length--;
46141          }
46142
46143          return out._strip();
46144        }
46145
46146        function jumboMulTo(self, num, out) {
46147          // Temporary disable, see https://github.com/indutny/bn.js/issues/211
46148          // var fftm = new FFTM();
46149          // return fftm.mulp(self, num, out);
46150          return bigMulTo(self, num, out);
46151        }
46152
46153        BN.prototype.mulTo = function mulTo(num, out) {
46154          var res;
46155          var len = this.length + num.length;
46156
46157          if (this.length === 10 && num.length === 10) {
46158            res = comb10MulTo(this, num, out);
46159          } else if (len < 63) {
46160            res = smallMulTo(this, num, out);
46161          } else if (len < 1024) {
46162            res = bigMulTo(this, num, out);
46163          } else {
46164            res = jumboMulTo(this, num, out);
46165          }
46166
46167          return res;
46168        }; // Cooley-Tukey algorithm for FFT
46169        // slightly revisited to rely on looping instead of recursion
46170
46171
46172        function FFTM(x, y) {
46173          this.x = x;
46174          this.y = y;
46175        }
46176
46177        FFTM.prototype.makeRBT = function makeRBT(N) {
46178          var t = new Array(N);
46179          var l = BN.prototype._countBits(N) - 1;
46180
46181          for (var i = 0; i < N; i++) {
46182            t[i] = this.revBin(i, l, N);
46183          }
46184
46185          return t;
46186        }; // Returns binary-reversed representation of `x`
46187
46188
46189        FFTM.prototype.revBin = function revBin(x, l, N) {
46190          if (x === 0 || x === N - 1) return x;
46191          var rb = 0;
46192
46193          for (var i = 0; i < l; i++) {
46194            rb |= (x & 1) << l - i - 1;
46195            x >>= 1;
46196          }
46197
46198          return rb;
46199        }; // Performs "tweedling" phase, therefore 'emulating'
46200        // behaviour of the recursive algorithm
46201
46202
46203        FFTM.prototype.permute = function permute(rbt, rws, iws, rtws, itws, N) {
46204          for (var i = 0; i < N; i++) {
46205            rtws[i] = rws[rbt[i]];
46206            itws[i] = iws[rbt[i]];
46207          }
46208        };
46209
46210        FFTM.prototype.transform = function transform(rws, iws, rtws, itws, N, rbt) {
46211          this.permute(rbt, rws, iws, rtws, itws, N);
46212
46213          for (var s = 1; s < N; s <<= 1) {
46214            var l = s << 1;
46215            var rtwdf = Math.cos(2 * Math.PI / l);
46216            var itwdf = Math.sin(2 * Math.PI / l);
46217
46218            for (var p = 0; p < N; p += l) {
46219              var rtwdf_ = rtwdf;
46220              var itwdf_ = itwdf;
46221
46222              for (var j = 0; j < s; j++) {
46223                var re = rtws[p + j];
46224                var ie = itws[p + j];
46225                var ro = rtws[p + j + s];
46226                var io = itws[p + j + s];
46227                var rx = rtwdf_ * ro - itwdf_ * io;
46228                io = rtwdf_ * io + itwdf_ * ro;
46229                ro = rx;
46230                rtws[p + j] = re + ro;
46231                itws[p + j] = ie + io;
46232                rtws[p + j + s] = re - ro;
46233                itws[p + j + s] = ie - io;
46234                /* jshint maxdepth : false */
46235
46236                if (j !== l) {
46237                  rx = rtwdf * rtwdf_ - itwdf * itwdf_;
46238                  itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_;
46239                  rtwdf_ = rx;
46240                }
46241              }
46242            }
46243          }
46244        };
46245
46246        FFTM.prototype.guessLen13b = function guessLen13b(n, m) {
46247          var N = Math.max(m, n) | 1;
46248          var odd = N & 1;
46249          var i = 0;
46250
46251          for (N = N / 2 | 0; N; N = N >>> 1) {
46252            i++;
46253          }
46254
46255          return 1 << i + 1 + odd;
46256        };
46257
46258        FFTM.prototype.conjugate = function conjugate(rws, iws, N) {
46259          if (N <= 1) return;
46260
46261          for (var i = 0; i < N / 2; i++) {
46262            var t = rws[i];
46263            rws[i] = rws[N - i - 1];
46264            rws[N - i - 1] = t;
46265            t = iws[i];
46266            iws[i] = -iws[N - i - 1];
46267            iws[N - i - 1] = -t;
46268          }
46269        };
46270
46271        FFTM.prototype.normalize13b = function normalize13b(ws, N) {
46272          var carry = 0;
46273
46274          for (var i = 0; i < N / 2; i++) {
46275            var w = Math.round(ws[2 * i + 1] / N) * 0x2000 + Math.round(ws[2 * i] / N) + carry;
46276            ws[i] = w & 0x3ffffff;
46277
46278            if (w < 0x4000000) {
46279              carry = 0;
46280            } else {
46281              carry = w / 0x4000000 | 0;
46282            }
46283          }
46284
46285          return ws;
46286        };
46287
46288        FFTM.prototype.convert13b = function convert13b(ws, len, rws, N) {
46289          var carry = 0;
46290
46291          for (var i = 0; i < len; i++) {
46292            carry = carry + (ws[i] | 0);
46293            rws[2 * i] = carry & 0x1fff;
46294            carry = carry >>> 13;
46295            rws[2 * i + 1] = carry & 0x1fff;
46296            carry = carry >>> 13;
46297          } // Pad with zeroes
46298
46299
46300          for (i = 2 * len; i < N; ++i) {
46301            rws[i] = 0;
46302          }
46303
46304          assert(carry === 0);
46305          assert((carry & ~0x1fff) === 0);
46306        };
46307
46308        FFTM.prototype.stub = function stub(N) {
46309          var ph = new Array(N);
46310
46311          for (var i = 0; i < N; i++) {
46312            ph[i] = 0;
46313          }
46314
46315          return ph;
46316        };
46317
46318        FFTM.prototype.mulp = function mulp(x, y, out) {
46319          var N = 2 * this.guessLen13b(x.length, y.length);
46320          var rbt = this.makeRBT(N);
46321
46322          var _ = this.stub(N);
46323
46324          var rws = new Array(N);
46325          var rwst = new Array(N);
46326          var iwst = new Array(N);
46327          var nrws = new Array(N);
46328          var nrwst = new Array(N);
46329          var niwst = new Array(N);
46330          var rmws = out.words;
46331          rmws.length = N;
46332          this.convert13b(x.words, x.length, rws, N);
46333          this.convert13b(y.words, y.length, nrws, N);
46334          this.transform(rws, _, rwst, iwst, N, rbt);
46335          this.transform(nrws, _, nrwst, niwst, N, rbt);
46336
46337          for (var i = 0; i < N; i++) {
46338            var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i];
46339            iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i];
46340            rwst[i] = rx;
46341          }
46342
46343          this.conjugate(rwst, iwst, N);
46344          this.transform(rwst, iwst, rmws, _, N, rbt);
46345          this.conjugate(rmws, _, N);
46346          this.normalize13b(rmws, N);
46347          out.negative = x.negative ^ y.negative;
46348          out.length = x.length + y.length;
46349          return out._strip();
46350        }; // Multiply `this` by `num`
46351
46352
46353        BN.prototype.mul = function mul(num) {
46354          var out = new BN(null);
46355          out.words = new Array(this.length + num.length);
46356          return this.mulTo(num, out);
46357        }; // Multiply employing FFT
46358
46359
46360        BN.prototype.mulf = function mulf(num) {
46361          var out = new BN(null);
46362          out.words = new Array(this.length + num.length);
46363          return jumboMulTo(this, num, out);
46364        }; // In-place Multiplication
46365
46366
46367        BN.prototype.imul = function imul(num) {
46368          return this.clone().mulTo(num, this);
46369        };
46370
46371        BN.prototype.imuln = function imuln(num) {
46372          var isNegNum = num < 0;
46373          if (isNegNum) num = -num;
46374          assert(typeof num === 'number');
46375          assert(num < 0x4000000); // Carry
46376
46377          var carry = 0;
46378
46379          for (var i = 0; i < this.length; i++) {
46380            var w = (this.words[i] | 0) * num;
46381            var lo = (w & 0x3ffffff) + (carry & 0x3ffffff);
46382            carry >>= 26;
46383            carry += w / 0x4000000 | 0; // NOTE: lo is 27bit maximum
46384
46385            carry += lo >>> 26;
46386            this.words[i] = lo & 0x3ffffff;
46387          }
46388
46389          if (carry !== 0) {
46390            this.words[i] = carry;
46391            this.length++;
46392          }
46393
46394          return isNegNum ? this.ineg() : this;
46395        };
46396
46397        BN.prototype.muln = function muln(num) {
46398          return this.clone().imuln(num);
46399        }; // `this` * `this`
46400
46401
46402        BN.prototype.sqr = function sqr() {
46403          return this.mul(this);
46404        }; // `this` * `this` in-place
46405
46406
46407        BN.prototype.isqr = function isqr() {
46408          return this.imul(this.clone());
46409        }; // Math.pow(`this`, `num`)
46410
46411
46412        BN.prototype.pow = function pow(num) {
46413          var w = toBitArray(num);
46414          if (w.length === 0) return new BN(1); // Skip leading zeroes
46415
46416          var res = this;
46417
46418          for (var i = 0; i < w.length; i++, res = res.sqr()) {
46419            if (w[i] !== 0) break;
46420          }
46421
46422          if (++i < w.length) {
46423            for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) {
46424              if (w[i] === 0) continue;
46425              res = res.mul(q);
46426            }
46427          }
46428
46429          return res;
46430        }; // Shift-left in-place
46431
46432
46433        BN.prototype.iushln = function iushln(bits) {
46434          assert(typeof bits === 'number' && bits >= 0);
46435          var r = bits % 26;
46436          var s = (bits - r) / 26;
46437          var carryMask = 0x3ffffff >>> 26 - r << 26 - r;
46438          var i;
46439
46440          if (r !== 0) {
46441            var carry = 0;
46442
46443            for (i = 0; i < this.length; i++) {
46444              var newCarry = this.words[i] & carryMask;
46445              var c = (this.words[i] | 0) - newCarry << r;
46446              this.words[i] = c | carry;
46447              carry = newCarry >>> 26 - r;
46448            }
46449
46450            if (carry) {
46451              this.words[i] = carry;
46452              this.length++;
46453            }
46454          }
46455
46456          if (s !== 0) {
46457            for (i = this.length - 1; i >= 0; i--) {
46458              this.words[i + s] = this.words[i];
46459            }
46460
46461            for (i = 0; i < s; i++) {
46462              this.words[i] = 0;
46463            }
46464
46465            this.length += s;
46466          }
46467
46468          return this._strip();
46469        };
46470
46471        BN.prototype.ishln = function ishln(bits) {
46472          // TODO(indutny): implement me
46473          assert(this.negative === 0);
46474          return this.iushln(bits);
46475        }; // Shift-right in-place
46476        // NOTE: `hint` is a lowest bit before trailing zeroes
46477        // NOTE: if `extended` is present - it will be filled with destroyed bits
46478
46479
46480        BN.prototype.iushrn = function iushrn(bits, hint, extended) {
46481          assert(typeof bits === 'number' && bits >= 0);
46482          var h;
46483
46484          if (hint) {
46485            h = (hint - hint % 26) / 26;
46486          } else {
46487            h = 0;
46488          }
46489
46490          var r = bits % 26;
46491          var s = Math.min((bits - r) / 26, this.length);
46492          var mask = 0x3ffffff ^ 0x3ffffff >>> r << r;
46493          var maskedWords = extended;
46494          h -= s;
46495          h = Math.max(0, h); // Extended mode, copy masked part
46496
46497          if (maskedWords) {
46498            for (var i = 0; i < s; i++) {
46499              maskedWords.words[i] = this.words[i];
46500            }
46501
46502            maskedWords.length = s;
46503          }
46504
46505          if (s === 0) {// No-op, we should not move anything at all
46506          } else if (this.length > s) {
46507            this.length -= s;
46508
46509            for (i = 0; i < this.length; i++) {
46510              this.words[i] = this.words[i + s];
46511            }
46512          } else {
46513            this.words[0] = 0;
46514            this.length = 1;
46515          }
46516
46517          var carry = 0;
46518
46519          for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) {
46520            var word = this.words[i] | 0;
46521            this.words[i] = carry << 26 - r | word >>> r;
46522            carry = word & mask;
46523          } // Push carried bits as a mask
46524
46525
46526          if (maskedWords && carry !== 0) {
46527            maskedWords.words[maskedWords.length++] = carry;
46528          }
46529
46530          if (this.length === 0) {
46531            this.words[0] = 0;
46532            this.length = 1;
46533          }
46534
46535          return this._strip();
46536        };
46537
46538        BN.prototype.ishrn = function ishrn(bits, hint, extended) {
46539          // TODO(indutny): implement me
46540          assert(this.negative === 0);
46541          return this.iushrn(bits, hint, extended);
46542        }; // Shift-left
46543
46544
46545        BN.prototype.shln = function shln(bits) {
46546          return this.clone().ishln(bits);
46547        };
46548
46549        BN.prototype.ushln = function ushln(bits) {
46550          return this.clone().iushln(bits);
46551        }; // Shift-right
46552
46553
46554        BN.prototype.shrn = function shrn(bits) {
46555          return this.clone().ishrn(bits);
46556        };
46557
46558        BN.prototype.ushrn = function ushrn(bits) {
46559          return this.clone().iushrn(bits);
46560        }; // Test if n bit is set
46561
46562
46563        BN.prototype.testn = function testn(bit) {
46564          assert(typeof bit === 'number' && bit >= 0);
46565          var r = bit % 26;
46566          var s = (bit - r) / 26;
46567          var q = 1 << r; // Fast case: bit is much higher than all existing words
46568
46569          if (this.length <= s) return false; // Check bit and return
46570
46571          var w = this.words[s];
46572          return !!(w & q);
46573        }; // Return only lowers bits of number (in-place)
46574
46575
46576        BN.prototype.imaskn = function imaskn(bits) {
46577          assert(typeof bits === 'number' && bits >= 0);
46578          var r = bits % 26;
46579          var s = (bits - r) / 26;
46580          assert(this.negative === 0, 'imaskn works only with positive numbers');
46581
46582          if (this.length <= s) {
46583            return this;
46584          }
46585
46586          if (r !== 0) {
46587            s++;
46588          }
46589
46590          this.length = Math.min(s, this.length);
46591
46592          if (r !== 0) {
46593            var mask = 0x3ffffff ^ 0x3ffffff >>> r << r;
46594            this.words[this.length - 1] &= mask;
46595          }
46596
46597          return this._strip();
46598        }; // Return only lowers bits of number
46599
46600
46601        BN.prototype.maskn = function maskn(bits) {
46602          return this.clone().imaskn(bits);
46603        }; // Add plain number `num` to `this`
46604
46605
46606        BN.prototype.iaddn = function iaddn(num) {
46607          assert(typeof num === 'number');
46608          assert(num < 0x4000000);
46609          if (num < 0) return this.isubn(-num); // Possible sign change
46610
46611          if (this.negative !== 0) {
46612            if (this.length === 1 && (this.words[0] | 0) <= num) {
46613              this.words[0] = num - (this.words[0] | 0);
46614              this.negative = 0;
46615              return this;
46616            }
46617
46618            this.negative = 0;
46619            this.isubn(num);
46620            this.negative = 1;
46621            return this;
46622          } // Add without checks
46623
46624
46625          return this._iaddn(num);
46626        };
46627
46628        BN.prototype._iaddn = function _iaddn(num) {
46629          this.words[0] += num; // Carry
46630
46631          for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) {
46632            this.words[i] -= 0x4000000;
46633
46634            if (i === this.length - 1) {
46635              this.words[i + 1] = 1;
46636            } else {
46637              this.words[i + 1]++;
46638            }
46639          }
46640
46641          this.length = Math.max(this.length, i + 1);
46642          return this;
46643        }; // Subtract plain number `num` from `this`
46644
46645
46646        BN.prototype.isubn = function isubn(num) {
46647          assert(typeof num === 'number');
46648          assert(num < 0x4000000);
46649          if (num < 0) return this.iaddn(-num);
46650
46651          if (this.negative !== 0) {
46652            this.negative = 0;
46653            this.iaddn(num);
46654            this.negative = 1;
46655            return this;
46656          }
46657
46658          this.words[0] -= num;
46659
46660          if (this.length === 1 && this.words[0] < 0) {
46661            this.words[0] = -this.words[0];
46662            this.negative = 1;
46663          } else {
46664            // Carry
46665            for (var i = 0; i < this.length && this.words[i] < 0; i++) {
46666              this.words[i] += 0x4000000;
46667              this.words[i + 1] -= 1;
46668            }
46669          }
46670
46671          return this._strip();
46672        };
46673
46674        BN.prototype.addn = function addn(num) {
46675          return this.clone().iaddn(num);
46676        };
46677
46678        BN.prototype.subn = function subn(num) {
46679          return this.clone().isubn(num);
46680        };
46681
46682        BN.prototype.iabs = function iabs() {
46683          this.negative = 0;
46684          return this;
46685        };
46686
46687        BN.prototype.abs = function abs() {
46688          return this.clone().iabs();
46689        };
46690
46691        BN.prototype._ishlnsubmul = function _ishlnsubmul(num, mul, shift) {
46692          var len = num.length + shift;
46693          var i;
46694
46695          this._expand(len);
46696
46697          var w;
46698          var carry = 0;
46699
46700          for (i = 0; i < num.length; i++) {
46701            w = (this.words[i + shift] | 0) + carry;
46702            var right = (num.words[i] | 0) * mul;
46703            w -= right & 0x3ffffff;
46704            carry = (w >> 26) - (right / 0x4000000 | 0);
46705            this.words[i + shift] = w & 0x3ffffff;
46706          }
46707
46708          for (; i < this.length - shift; i++) {
46709            w = (this.words[i + shift] | 0) + carry;
46710            carry = w >> 26;
46711            this.words[i + shift] = w & 0x3ffffff;
46712          }
46713
46714          if (carry === 0) return this._strip(); // Subtraction overflow
46715
46716          assert(carry === -1);
46717          carry = 0;
46718
46719          for (i = 0; i < this.length; i++) {
46720            w = -(this.words[i] | 0) + carry;
46721            carry = w >> 26;
46722            this.words[i] = w & 0x3ffffff;
46723          }
46724
46725          this.negative = 1;
46726          return this._strip();
46727        };
46728
46729        BN.prototype._wordDiv = function _wordDiv(num, mode) {
46730          var shift = this.length - num.length;
46731          var a = this.clone();
46732          var b = num; // Normalize
46733
46734          var bhi = b.words[b.length - 1] | 0;
46735
46736          var bhiBits = this._countBits(bhi);
46737
46738          shift = 26 - bhiBits;
46739
46740          if (shift !== 0) {
46741            b = b.ushln(shift);
46742            a.iushln(shift);
46743            bhi = b.words[b.length - 1] | 0;
46744          } // Initialize quotient
46745
46746
46747          var m = a.length - b.length;
46748          var q;
46749
46750          if (mode !== 'mod') {
46751            q = new BN(null);
46752            q.length = m + 1;
46753            q.words = new Array(q.length);
46754
46755            for (var i = 0; i < q.length; i++) {
46756              q.words[i] = 0;
46757            }
46758          }
46759
46760          var diff = a.clone()._ishlnsubmul(b, 1, m);
46761
46762          if (diff.negative === 0) {
46763            a = diff;
46764
46765            if (q) {
46766              q.words[m] = 1;
46767            }
46768          }
46769
46770          for (var j = m - 1; j >= 0; j--) {
46771            var qj = (a.words[b.length + j] | 0) * 0x4000000 + (a.words[b.length + j - 1] | 0); // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max
46772            // (0x7ffffff)
46773
46774            qj = Math.min(qj / bhi | 0, 0x3ffffff);
46775
46776            a._ishlnsubmul(b, qj, j);
46777
46778            while (a.negative !== 0) {
46779              qj--;
46780              a.negative = 0;
46781
46782              a._ishlnsubmul(b, 1, j);
46783
46784              if (!a.isZero()) {
46785                a.negative ^= 1;
46786              }
46787            }
46788
46789            if (q) {
46790              q.words[j] = qj;
46791            }
46792          }
46793
46794          if (q) {
46795            q._strip();
46796          }
46797
46798          a._strip(); // Denormalize
46799
46800
46801          if (mode !== 'div' && shift !== 0) {
46802            a.iushrn(shift);
46803          }
46804
46805          return {
46806            div: q || null,
46807            mod: a
46808          };
46809        }; // NOTE: 1) `mode` can be set to `mod` to request mod only,
46810        //       to `div` to request div only, or be absent to
46811        //       request both div & mod
46812        //       2) `positive` is true if unsigned mod is requested
46813
46814
46815        BN.prototype.divmod = function divmod(num, mode, positive) {
46816          assert(!num.isZero());
46817
46818          if (this.isZero()) {
46819            return {
46820              div: new BN(0),
46821              mod: new BN(0)
46822            };
46823          }
46824
46825          var div, mod, res;
46826
46827          if (this.negative !== 0 && num.negative === 0) {
46828            res = this.neg().divmod(num, mode);
46829
46830            if (mode !== 'mod') {
46831              div = res.div.neg();
46832            }
46833
46834            if (mode !== 'div') {
46835              mod = res.mod.neg();
46836
46837              if (positive && mod.negative !== 0) {
46838                mod.iadd(num);
46839              }
46840            }
46841
46842            return {
46843              div: div,
46844              mod: mod
46845            };
46846          }
46847
46848          if (this.negative === 0 && num.negative !== 0) {
46849            res = this.divmod(num.neg(), mode);
46850
46851            if (mode !== 'mod') {
46852              div = res.div.neg();
46853            }
46854
46855            return {
46856              div: div,
46857              mod: res.mod
46858            };
46859          }
46860
46861          if ((this.negative & num.negative) !== 0) {
46862            res = this.neg().divmod(num.neg(), mode);
46863
46864            if (mode !== 'div') {
46865              mod = res.mod.neg();
46866
46867              if (positive && mod.negative !== 0) {
46868                mod.isub(num);
46869              }
46870            }
46871
46872            return {
46873              div: res.div,
46874              mod: mod
46875            };
46876          } // Both numbers are positive at this point
46877          // Strip both numbers to approximate shift value
46878
46879
46880          if (num.length > this.length || this.cmp(num) < 0) {
46881            return {
46882              div: new BN(0),
46883              mod: this
46884            };
46885          } // Very short reduction
46886
46887
46888          if (num.length === 1) {
46889            if (mode === 'div') {
46890              return {
46891                div: this.divn(num.words[0]),
46892                mod: null
46893              };
46894            }
46895
46896            if (mode === 'mod') {
46897              return {
46898                div: null,
46899                mod: new BN(this.modrn(num.words[0]))
46900              };
46901            }
46902
46903            return {
46904              div: this.divn(num.words[0]),
46905              mod: new BN(this.modrn(num.words[0]))
46906            };
46907          }
46908
46909          return this._wordDiv(num, mode);
46910        }; // Find `this` / `num`
46911
46912
46913        BN.prototype.div = function div(num) {
46914          return this.divmod(num, 'div', false).div;
46915        }; // Find `this` % `num`
46916
46917
46918        BN.prototype.mod = function mod(num) {
46919          return this.divmod(num, 'mod', false).mod;
46920        };
46921
46922        BN.prototype.umod = function umod(num) {
46923          return this.divmod(num, 'mod', true).mod;
46924        }; // Find Round(`this` / `num`)
46925
46926
46927        BN.prototype.divRound = function divRound(num) {
46928          var dm = this.divmod(num); // Fast case - exact division
46929
46930          if (dm.mod.isZero()) return dm.div;
46931          var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod;
46932          var half = num.ushrn(1);
46933          var r2 = num.andln(1);
46934          var cmp = mod.cmp(half); // Round down
46935
46936          if (cmp < 0 || r2 === 1 && cmp === 0) return dm.div; // Round up
46937
46938          return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1);
46939        };
46940
46941        BN.prototype.modrn = function modrn(num) {
46942          var isNegNum = num < 0;
46943          if (isNegNum) num = -num;
46944          assert(num <= 0x3ffffff);
46945          var p = (1 << 26) % num;
46946          var acc = 0;
46947
46948          for (var i = this.length - 1; i >= 0; i--) {
46949            acc = (p * acc + (this.words[i] | 0)) % num;
46950          }
46951
46952          return isNegNum ? -acc : acc;
46953        }; // WARNING: DEPRECATED
46954
46955
46956        BN.prototype.modn = function modn(num) {
46957          return this.modrn(num);
46958        }; // In-place division by number
46959
46960
46961        BN.prototype.idivn = function idivn(num) {
46962          var isNegNum = num < 0;
46963          if (isNegNum) num = -num;
46964          assert(num <= 0x3ffffff);
46965          var carry = 0;
46966
46967          for (var i = this.length - 1; i >= 0; i--) {
46968            var w = (this.words[i] | 0) + carry * 0x4000000;
46969            this.words[i] = w / num | 0;
46970            carry = w % num;
46971          }
46972
46973          this._strip();
46974
46975          return isNegNum ? this.ineg() : this;
46976        };
46977
46978        BN.prototype.divn = function divn(num) {
46979          return this.clone().idivn(num);
46980        };
46981
46982        BN.prototype.egcd = function egcd(p) {
46983          assert(p.negative === 0);
46984          assert(!p.isZero());
46985          var x = this;
46986          var y = p.clone();
46987
46988          if (x.negative !== 0) {
46989            x = x.umod(p);
46990          } else {
46991            x = x.clone();
46992          } // A * x + B * y = x
46993
46994
46995          var A = new BN(1);
46996          var B = new BN(0); // C * x + D * y = y
46997
46998          var C = new BN(0);
46999          var D = new BN(1);
47000          var g = 0;
47001
47002          while (x.isEven() && y.isEven()) {
47003            x.iushrn(1);
47004            y.iushrn(1);
47005            ++g;
47006          }
47007
47008          var yp = y.clone();
47009          var xp = x.clone();
47010
47011          while (!x.isZero()) {
47012            for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1) {
47013              ;
47014            }
47015
47016            if (i > 0) {
47017              x.iushrn(i);
47018
47019              while (i-- > 0) {
47020                if (A.isOdd() || B.isOdd()) {
47021                  A.iadd(yp);
47022                  B.isub(xp);
47023                }
47024
47025                A.iushrn(1);
47026                B.iushrn(1);
47027              }
47028            }
47029
47030            for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1) {
47031              ;
47032            }
47033
47034            if (j > 0) {
47035              y.iushrn(j);
47036
47037              while (j-- > 0) {
47038                if (C.isOdd() || D.isOdd()) {
47039                  C.iadd(yp);
47040                  D.isub(xp);
47041                }
47042
47043                C.iushrn(1);
47044                D.iushrn(1);
47045              }
47046            }
47047
47048            if (x.cmp(y) >= 0) {
47049              x.isub(y);
47050              A.isub(C);
47051              B.isub(D);
47052            } else {
47053              y.isub(x);
47054              C.isub(A);
47055              D.isub(B);
47056            }
47057          }
47058
47059          return {
47060            a: C,
47061            b: D,
47062            gcd: y.iushln(g)
47063          };
47064        }; // This is reduced incarnation of the binary EEA
47065        // above, designated to invert members of the
47066        // _prime_ fields F(p) at a maximal speed
47067
47068
47069        BN.prototype._invmp = function _invmp(p) {
47070          assert(p.negative === 0);
47071          assert(!p.isZero());
47072          var a = this;
47073          var b = p.clone();
47074
47075          if (a.negative !== 0) {
47076            a = a.umod(p);
47077          } else {
47078            a = a.clone();
47079          }
47080
47081          var x1 = new BN(1);
47082          var x2 = new BN(0);
47083          var delta = b.clone();
47084
47085          while (a.cmpn(1) > 0 && b.cmpn(1) > 0) {
47086            for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1) {
47087              ;
47088            }
47089
47090            if (i > 0) {
47091              a.iushrn(i);
47092
47093              while (i-- > 0) {
47094                if (x1.isOdd()) {
47095                  x1.iadd(delta);
47096                }
47097
47098                x1.iushrn(1);
47099              }
47100            }
47101
47102            for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1) {
47103              ;
47104            }
47105
47106            if (j > 0) {
47107              b.iushrn(j);
47108
47109              while (j-- > 0) {
47110                if (x2.isOdd()) {
47111                  x2.iadd(delta);
47112                }
47113
47114                x2.iushrn(1);
47115              }
47116            }
47117
47118            if (a.cmp(b) >= 0) {
47119              a.isub(b);
47120              x1.isub(x2);
47121            } else {
47122              b.isub(a);
47123              x2.isub(x1);
47124            }
47125          }
47126
47127          var res;
47128
47129          if (a.cmpn(1) === 0) {
47130            res = x1;
47131          } else {
47132            res = x2;
47133          }
47134
47135          if (res.cmpn(0) < 0) {
47136            res.iadd(p);
47137          }
47138
47139          return res;
47140        };
47141
47142        BN.prototype.gcd = function gcd(num) {
47143          if (this.isZero()) return num.abs();
47144          if (num.isZero()) return this.abs();
47145          var a = this.clone();
47146          var b = num.clone();
47147          a.negative = 0;
47148          b.negative = 0; // Remove common factor of two
47149
47150          for (var shift = 0; a.isEven() && b.isEven(); shift++) {
47151            a.iushrn(1);
47152            b.iushrn(1);
47153          }
47154
47155          do {
47156            while (a.isEven()) {
47157              a.iushrn(1);
47158            }
47159
47160            while (b.isEven()) {
47161              b.iushrn(1);
47162            }
47163
47164            var r = a.cmp(b);
47165
47166            if (r < 0) {
47167              // Swap `a` and `b` to make `a` always bigger than `b`
47168              var t = a;
47169              a = b;
47170              b = t;
47171            } else if (r === 0 || b.cmpn(1) === 0) {
47172              break;
47173            }
47174
47175            a.isub(b);
47176          } while (true);
47177
47178          return b.iushln(shift);
47179        }; // Invert number in the field F(num)
47180
47181
47182        BN.prototype.invm = function invm(num) {
47183          return this.egcd(num).a.umod(num);
47184        };
47185
47186        BN.prototype.isEven = function isEven() {
47187          return (this.words[0] & 1) === 0;
47188        };
47189
47190        BN.prototype.isOdd = function isOdd() {
47191          return (this.words[0] & 1) === 1;
47192        }; // And first word and num
47193
47194
47195        BN.prototype.andln = function andln(num) {
47196          return this.words[0] & num;
47197        }; // Increment at the bit position in-line
47198
47199
47200        BN.prototype.bincn = function bincn(bit) {
47201          assert(typeof bit === 'number');
47202          var r = bit % 26;
47203          var s = (bit - r) / 26;
47204          var q = 1 << r; // Fast case: bit is much higher than all existing words
47205
47206          if (this.length <= s) {
47207            this._expand(s + 1);
47208
47209            this.words[s] |= q;
47210            return this;
47211          } // Add bit and propagate, if needed
47212
47213
47214          var carry = q;
47215
47216          for (var i = s; carry !== 0 && i < this.length; i++) {
47217            var w = this.words[i] | 0;
47218            w += carry;
47219            carry = w >>> 26;
47220            w &= 0x3ffffff;
47221            this.words[i] = w;
47222          }
47223
47224          if (carry !== 0) {
47225            this.words[i] = carry;
47226            this.length++;
47227          }
47228
47229          return this;
47230        };
47231
47232        BN.prototype.isZero = function isZero() {
47233          return this.length === 1 && this.words[0] === 0;
47234        };
47235
47236        BN.prototype.cmpn = function cmpn(num) {
47237          var negative = num < 0;
47238          if (this.negative !== 0 && !negative) return -1;
47239          if (this.negative === 0 && negative) return 1;
47240
47241          this._strip();
47242
47243          var res;
47244
47245          if (this.length > 1) {
47246            res = 1;
47247          } else {
47248            if (negative) {
47249              num = -num;
47250            }
47251
47252            assert(num <= 0x3ffffff, 'Number is too big');
47253            var w = this.words[0] | 0;
47254            res = w === num ? 0 : w < num ? -1 : 1;
47255          }
47256
47257          if (this.negative !== 0) return -res | 0;
47258          return res;
47259        }; // Compare two numbers and return:
47260        // 1 - if `this` > `num`
47261        // 0 - if `this` == `num`
47262        // -1 - if `this` < `num`
47263
47264
47265        BN.prototype.cmp = function cmp(num) {
47266          if (this.negative !== 0 && num.negative === 0) return -1;
47267          if (this.negative === 0 && num.negative !== 0) return 1;
47268          var res = this.ucmp(num);
47269          if (this.negative !== 0) return -res | 0;
47270          return res;
47271        }; // Unsigned comparison
47272
47273
47274        BN.prototype.ucmp = function ucmp(num) {
47275          // At this point both numbers have the same sign
47276          if (this.length > num.length) return 1;
47277          if (this.length < num.length) return -1;
47278          var res = 0;
47279
47280          for (var i = this.length - 1; i >= 0; i--) {
47281            var a = this.words[i] | 0;
47282            var b = num.words[i] | 0;
47283            if (a === b) continue;
47284
47285            if (a < b) {
47286              res = -1;
47287            } else if (a > b) {
47288              res = 1;
47289            }
47290
47291            break;
47292          }
47293
47294          return res;
47295        };
47296
47297        BN.prototype.gtn = function gtn(num) {
47298          return this.cmpn(num) === 1;
47299        };
47300
47301        BN.prototype.gt = function gt(num) {
47302          return this.cmp(num) === 1;
47303        };
47304
47305        BN.prototype.gten = function gten(num) {
47306          return this.cmpn(num) >= 0;
47307        };
47308
47309        BN.prototype.gte = function gte(num) {
47310          return this.cmp(num) >= 0;
47311        };
47312
47313        BN.prototype.ltn = function ltn(num) {
47314          return this.cmpn(num) === -1;
47315        };
47316
47317        BN.prototype.lt = function lt(num) {
47318          return this.cmp(num) === -1;
47319        };
47320
47321        BN.prototype.lten = function lten(num) {
47322          return this.cmpn(num) <= 0;
47323        };
47324
47325        BN.prototype.lte = function lte(num) {
47326          return this.cmp(num) <= 0;
47327        };
47328
47329        BN.prototype.eqn = function eqn(num) {
47330          return this.cmpn(num) === 0;
47331        };
47332
47333        BN.prototype.eq = function eq(num) {
47334          return this.cmp(num) === 0;
47335        }; //
47336        // A reduce context, could be using montgomery or something better, depending
47337        // on the `m` itself.
47338        //
47339
47340
47341        BN.red = function red(num) {
47342          return new Red(num);
47343        };
47344
47345        BN.prototype.toRed = function toRed(ctx) {
47346          assert(!this.red, 'Already a number in reduction context');
47347          assert(this.negative === 0, 'red works only with positives');
47348          return ctx.convertTo(this)._forceRed(ctx);
47349        };
47350
47351        BN.prototype.fromRed = function fromRed() {
47352          assert(this.red, 'fromRed works only with numbers in reduction context');
47353          return this.red.convertFrom(this);
47354        };
47355
47356        BN.prototype._forceRed = function _forceRed(ctx) {
47357          this.red = ctx;
47358          return this;
47359        };
47360
47361        BN.prototype.forceRed = function forceRed(ctx) {
47362          assert(!this.red, 'Already a number in reduction context');
47363          return this._forceRed(ctx);
47364        };
47365
47366        BN.prototype.redAdd = function redAdd(num) {
47367          assert(this.red, 'redAdd works only with red numbers');
47368          return this.red.add(this, num);
47369        };
47370
47371        BN.prototype.redIAdd = function redIAdd(num) {
47372          assert(this.red, 'redIAdd works only with red numbers');
47373          return this.red.iadd(this, num);
47374        };
47375
47376        BN.prototype.redSub = function redSub(num) {
47377          assert(this.red, 'redSub works only with red numbers');
47378          return this.red.sub(this, num);
47379        };
47380
47381        BN.prototype.redISub = function redISub(num) {
47382          assert(this.red, 'redISub works only with red numbers');
47383          return this.red.isub(this, num);
47384        };
47385
47386        BN.prototype.redShl = function redShl(num) {
47387          assert(this.red, 'redShl works only with red numbers');
47388          return this.red.shl(this, num);
47389        };
47390
47391        BN.prototype.redMul = function redMul(num) {
47392          assert(this.red, 'redMul works only with red numbers');
47393
47394          this.red._verify2(this, num);
47395
47396          return this.red.mul(this, num);
47397        };
47398
47399        BN.prototype.redIMul = function redIMul(num) {
47400          assert(this.red, 'redMul works only with red numbers');
47401
47402          this.red._verify2(this, num);
47403
47404          return this.red.imul(this, num);
47405        };
47406
47407        BN.prototype.redSqr = function redSqr() {
47408          assert(this.red, 'redSqr works only with red numbers');
47409
47410          this.red._verify1(this);
47411
47412          return this.red.sqr(this);
47413        };
47414
47415        BN.prototype.redISqr = function redISqr() {
47416          assert(this.red, 'redISqr works only with red numbers');
47417
47418          this.red._verify1(this);
47419
47420          return this.red.isqr(this);
47421        }; // Square root over p
47422
47423
47424        BN.prototype.redSqrt = function redSqrt() {
47425          assert(this.red, 'redSqrt works only with red numbers');
47426
47427          this.red._verify1(this);
47428
47429          return this.red.sqrt(this);
47430        };
47431
47432        BN.prototype.redInvm = function redInvm() {
47433          assert(this.red, 'redInvm works only with red numbers');
47434
47435          this.red._verify1(this);
47436
47437          return this.red.invm(this);
47438        }; // Return negative clone of `this` % `red modulo`
47439
47440
47441        BN.prototype.redNeg = function redNeg() {
47442          assert(this.red, 'redNeg works only with red numbers');
47443
47444          this.red._verify1(this);
47445
47446          return this.red.neg(this);
47447        };
47448
47449        BN.prototype.redPow = function redPow(num) {
47450          assert(this.red && !num.red, 'redPow(normalNum)');
47451
47452          this.red._verify1(this);
47453
47454          return this.red.pow(this, num);
47455        }; // Prime numbers with efficient reduction
47456
47457
47458        var primes = {
47459          k256: null,
47460          p224: null,
47461          p192: null,
47462          p25519: null
47463        }; // Pseudo-Mersenne prime
47464
47465        function MPrime(name, p) {
47466          // P = 2 ^ N - K
47467          this.name = name;
47468          this.p = new BN(p, 16);
47469          this.n = this.p.bitLength();
47470          this.k = new BN(1).iushln(this.n).isub(this.p);
47471          this.tmp = this._tmp();
47472        }
47473
47474        MPrime.prototype._tmp = function _tmp() {
47475          var tmp = new BN(null);
47476          tmp.words = new Array(Math.ceil(this.n / 13));
47477          return tmp;
47478        };
47479
47480        MPrime.prototype.ireduce = function ireduce(num) {
47481          // Assumes that `num` is less than `P^2`
47482          // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P)
47483          var r = num;
47484          var rlen;
47485
47486          do {
47487            this.split(r, this.tmp);
47488            r = this.imulK(r);
47489            r = r.iadd(this.tmp);
47490            rlen = r.bitLength();
47491          } while (rlen > this.n);
47492
47493          var cmp = rlen < this.n ? -1 : r.ucmp(this.p);
47494
47495          if (cmp === 0) {
47496            r.words[0] = 0;
47497            r.length = 1;
47498          } else if (cmp > 0) {
47499            r.isub(this.p);
47500          } else {
47501            if (r.strip !== undefined) {
47502              // r is a BN v4 instance
47503              r.strip();
47504            } else {
47505              // r is a BN v5 instance
47506              r._strip();
47507            }
47508          }
47509
47510          return r;
47511        };
47512
47513        MPrime.prototype.split = function split(input, out) {
47514          input.iushrn(this.n, 0, out);
47515        };
47516
47517        MPrime.prototype.imulK = function imulK(num) {
47518          return num.imul(this.k);
47519        };
47520
47521        function K256() {
47522          MPrime.call(this, 'k256', 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f');
47523        }
47524
47525        inherits(K256, MPrime);
47526
47527        K256.prototype.split = function split(input, output) {
47528          // 256 = 9 * 26 + 22
47529          var mask = 0x3fffff;
47530          var outLen = Math.min(input.length, 9);
47531
47532          for (var i = 0; i < outLen; i++) {
47533            output.words[i] = input.words[i];
47534          }
47535
47536          output.length = outLen;
47537
47538          if (input.length <= 9) {
47539            input.words[0] = 0;
47540            input.length = 1;
47541            return;
47542          } // Shift by 9 limbs
47543
47544
47545          var prev = input.words[9];
47546          output.words[output.length++] = prev & mask;
47547
47548          for (i = 10; i < input.length; i++) {
47549            var next = input.words[i] | 0;
47550            input.words[i - 10] = (next & mask) << 4 | prev >>> 22;
47551            prev = next;
47552          }
47553
47554          prev >>>= 22;
47555          input.words[i - 10] = prev;
47556
47557          if (prev === 0 && input.length > 10) {
47558            input.length -= 10;
47559          } else {
47560            input.length -= 9;
47561          }
47562        };
47563
47564        K256.prototype.imulK = function imulK(num) {
47565          // K = 0x1000003d1 = [ 0x40, 0x3d1 ]
47566          num.words[num.length] = 0;
47567          num.words[num.length + 1] = 0;
47568          num.length += 2; // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390
47569
47570          var lo = 0;
47571
47572          for (var i = 0; i < num.length; i++) {
47573            var w = num.words[i] | 0;
47574            lo += w * 0x3d1;
47575            num.words[i] = lo & 0x3ffffff;
47576            lo = w * 0x40 + (lo / 0x4000000 | 0);
47577          } // Fast length reduction
47578
47579
47580          if (num.words[num.length - 1] === 0) {
47581            num.length--;
47582
47583            if (num.words[num.length - 1] === 0) {
47584              num.length--;
47585            }
47586          }
47587
47588          return num;
47589        };
47590
47591        function P224() {
47592          MPrime.call(this, 'p224', 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001');
47593        }
47594
47595        inherits(P224, MPrime);
47596
47597        function P192() {
47598          MPrime.call(this, 'p192', 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff');
47599        }
47600
47601        inherits(P192, MPrime);
47602
47603        function P25519() {
47604          // 2 ^ 255 - 19
47605          MPrime.call(this, '25519', '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed');
47606        }
47607
47608        inherits(P25519, MPrime);
47609
47610        P25519.prototype.imulK = function imulK(num) {
47611          // K = 0x13
47612          var carry = 0;
47613
47614          for (var i = 0; i < num.length; i++) {
47615            var hi = (num.words[i] | 0) * 0x13 + carry;
47616            var lo = hi & 0x3ffffff;
47617            hi >>>= 26;
47618            num.words[i] = lo;
47619            carry = hi;
47620          }
47621
47622          if (carry !== 0) {
47623            num.words[num.length++] = carry;
47624          }
47625
47626          return num;
47627        }; // Exported mostly for testing purposes, use plain name instead
47628
47629
47630        BN._prime = function prime(name) {
47631          // Cached version of prime
47632          if (primes[name]) return primes[name];
47633          var prime;
47634
47635          if (name === 'k256') {
47636            prime = new K256();
47637          } else if (name === 'p224') {
47638            prime = new P224();
47639          } else if (name === 'p192') {
47640            prime = new P192();
47641          } else if (name === 'p25519') {
47642            prime = new P25519();
47643          } else {
47644            throw new Error('Unknown prime ' + name);
47645          }
47646
47647          primes[name] = prime;
47648          return prime;
47649        }; //
47650        // Base reduction engine
47651        //
47652
47653
47654        function Red(m) {
47655          if (typeof m === 'string') {
47656            var prime = BN._prime(m);
47657
47658            this.m = prime.p;
47659            this.prime = prime;
47660          } else {
47661            assert(m.gtn(1), 'modulus must be greater than 1');
47662            this.m = m;
47663            this.prime = null;
47664          }
47665        }
47666
47667        Red.prototype._verify1 = function _verify1(a) {
47668          assert(a.negative === 0, 'red works only with positives');
47669          assert(a.red, 'red works only with red numbers');
47670        };
47671
47672        Red.prototype._verify2 = function _verify2(a, b) {
47673          assert((a.negative | b.negative) === 0, 'red works only with positives');
47674          assert(a.red && a.red === b.red, 'red works only with red numbers');
47675        };
47676
47677        Red.prototype.imod = function imod(a) {
47678          if (this.prime) return this.prime.ireduce(a)._forceRed(this);
47679          move(a, a.umod(this.m)._forceRed(this));
47680          return a;
47681        };
47682
47683        Red.prototype.neg = function neg(a) {
47684          if (a.isZero()) {
47685            return a.clone();
47686          }
47687
47688          return this.m.sub(a)._forceRed(this);
47689        };
47690
47691        Red.prototype.add = function add(a, b) {
47692          this._verify2(a, b);
47693
47694          var res = a.add(b);
47695
47696          if (res.cmp(this.m) >= 0) {
47697            res.isub(this.m);
47698          }
47699
47700          return res._forceRed(this);
47701        };
47702
47703        Red.prototype.iadd = function iadd(a, b) {
47704          this._verify2(a, b);
47705
47706          var res = a.iadd(b);
47707
47708          if (res.cmp(this.m) >= 0) {
47709            res.isub(this.m);
47710          }
47711
47712          return res;
47713        };
47714
47715        Red.prototype.sub = function sub(a, b) {
47716          this._verify2(a, b);
47717
47718          var res = a.sub(b);
47719
47720          if (res.cmpn(0) < 0) {
47721            res.iadd(this.m);
47722          }
47723
47724          return res._forceRed(this);
47725        };
47726
47727        Red.prototype.isub = function isub(a, b) {
47728          this._verify2(a, b);
47729
47730          var res = a.isub(b);
47731
47732          if (res.cmpn(0) < 0) {
47733            res.iadd(this.m);
47734          }
47735
47736          return res;
47737        };
47738
47739        Red.prototype.shl = function shl(a, num) {
47740          this._verify1(a);
47741
47742          return this.imod(a.ushln(num));
47743        };
47744
47745        Red.prototype.imul = function imul(a, b) {
47746          this._verify2(a, b);
47747
47748          return this.imod(a.imul(b));
47749        };
47750
47751        Red.prototype.mul = function mul(a, b) {
47752          this._verify2(a, b);
47753
47754          return this.imod(a.mul(b));
47755        };
47756
47757        Red.prototype.isqr = function isqr(a) {
47758          return this.imul(a, a.clone());
47759        };
47760
47761        Red.prototype.sqr = function sqr(a) {
47762          return this.mul(a, a);
47763        };
47764
47765        Red.prototype.sqrt = function sqrt(a) {
47766          if (a.isZero()) return a.clone();
47767          var mod3 = this.m.andln(3);
47768          assert(mod3 % 2 === 1); // Fast case
47769
47770          if (mod3 === 3) {
47771            var pow = this.m.add(new BN(1)).iushrn(2);
47772            return this.pow(a, pow);
47773          } // Tonelli-Shanks algorithm (Totally unoptimized and slow)
47774          //
47775          // Find Q and S, that Q * 2 ^ S = (P - 1)
47776
47777
47778          var q = this.m.subn(1);
47779          var s = 0;
47780
47781          while (!q.isZero() && q.andln(1) === 0) {
47782            s++;
47783            q.iushrn(1);
47784          }
47785
47786          assert(!q.isZero());
47787          var one = new BN(1).toRed(this);
47788          var nOne = one.redNeg(); // Find quadratic non-residue
vendor: 10,912 bytes, lines 47789-48142
47789          // NOTE: Max is such because of generalized Riemann hypothesis.
47790
47791          var lpow = this.m.subn(1).iushrn(1);
47792          var z = this.m.bitLength();
47793          z = new BN(2 * z * z).toRed(this);
47794
47795          while (this.pow(z, lpow).cmp(nOne) !== 0) {
47796            z.redIAdd(nOne);
47797          }
47798
47799          var c = this.pow(z, q);
47800          var r = this.pow(a, q.addn(1).iushrn(1));
47801          var t = this.pow(a, q);
47802          var m = s;
47803
47804          while (t.cmp(one) !== 0) {
47805            var tmp = t;
47806
47807            for (var i = 0; tmp.cmp(one) !== 0; i++) {
47808              tmp = tmp.redSqr();
47809            }
47810
47811            assert(i < m);
47812            var b = this.pow(c, new BN(1).iushln(m - i - 1));
47813            r = r.redMul(b);
47814            c = b.redSqr();
47815            t = t.redMul(c);
47816            m = i;
47817          }
47818
47819          return r;
47820        };
47821
47822        Red.prototype.invm = function invm(a) {
47823          var inv = a._invmp(this.m);
47824
47825          if (inv.negative !== 0) {
47826            inv.negative = 0;
47827            return this.imod(inv).redNeg();
47828          } else {
47829            return this.imod(inv);
47830          }
47831        };
47832
47833        Red.prototype.pow = function pow(a, num) {
47834          if (num.isZero()) return new BN(1).toRed(this);
47835          if (num.cmpn(1) === 0) return a.clone();
47836          var windowSize = 4;
47837          var wnd = new Array(1 << windowSize);
47838          wnd[0] = new BN(1).toRed(this);
47839          wnd[1] = a;
47840
47841          for (var i = 2; i < wnd.length; i++) {
47842            wnd[i] = this.mul(wnd[i - 1], a);
47843          }
47844
47845          var res = wnd[0];
47846          var current = 0;
47847          var currentLen = 0;
47848          var start = num.bitLength() % 26;
47849
47850          if (start === 0) {
47851            start = 26;
47852          }
47853
47854          for (i = num.length - 1; i >= 0; i--) {
47855            var word = num.words[i];
47856
47857            for (var j = start - 1; j >= 0; j--) {
47858              var bit = word >> j & 1;
47859
47860              if (res !== wnd[0]) {
47861                res = this.sqr(res);
47862              }
47863
47864              if (bit === 0 && current === 0) {
47865                currentLen = 0;
47866                continue;
47867              }
47868
47869              current <<= 1;
47870              current |= bit;
47871              currentLen++;
47872              if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue;
47873              res = this.mul(res, wnd[current]);
47874              currentLen = 0;
47875              current = 0;
47876            }
47877
47878            start = 26;
47879          }
47880
47881          return res;
47882        };
47883
47884        Red.prototype.convertTo = function convertTo(num) {
47885          var r = num.umod(this.m);
47886          return r === num ? r.clone() : r;
47887        };
47888
47889        Red.prototype.convertFrom = function convertFrom(num) {
47890          var res = num.clone();
47891          res.red = null;
47892          return res;
47893        }; //
47894        // Montgomery method engine
47895        //
47896
47897
47898        BN.mont = function mont(num) {
47899          return new Mont(num);
47900        };
47901
47902        function Mont(m) {
47903          Red.call(this, m);
47904          this.shift = this.m.bitLength();
47905
47906          if (this.shift % 26 !== 0) {
47907            this.shift += 26 - this.shift % 26;
47908          }
47909
47910          this.r = new BN(1).iushln(this.shift);
47911          this.r2 = this.imod(this.r.sqr());
47912          this.rinv = this.r._invmp(this.m);
47913          this.minv = this.rinv.mul(this.r).isubn(1).div(this.m);
47914          this.minv = this.minv.umod(this.r);
47915          this.minv = this.r.sub(this.minv);
47916        }
47917
47918        inherits(Mont, Red);
47919
47920        Mont.prototype.convertTo = function convertTo(num) {
47921          return this.imod(num.ushln(this.shift));
47922        };
47923
47924        Mont.prototype.convertFrom = function convertFrom(num) {
47925          var r = this.imod(num.mul(this.rinv));
47926          r.red = null;
47927          return r;
47928        };
47929
47930        Mont.prototype.imul = function imul(a, b) {
47931          if (a.isZero() || b.isZero()) {
47932            a.words[0] = 0;
47933            a.length = 1;
47934            return a;
47935          }
47936
47937          var t = a.imul(b);
47938          var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);
47939          var u = t.isub(c).iushrn(this.shift);
47940          var res = u;
47941
47942          if (u.cmp(this.m) >= 0) {
47943            res = u.isub(this.m);
47944          } else if (u.cmpn(0) < 0) {
47945            res = u.iadd(this.m);
47946          }
47947
47948          return res._forceRed(this);
47949        };
47950
47951        Mont.prototype.mul = function mul(a, b) {
47952          if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this);
47953          var t = a.mul(b);
47954          var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);
47955          var u = t.isub(c).iushrn(this.shift);
47956          var res = u;
47957
47958          if (u.cmp(this.m) >= 0) {
47959            res = u.isub(this.m);
47960          } else if (u.cmpn(0) < 0) {
47961            res = u.iadd(this.m);
47962          }
47963
47964          return res._forceRed(this);
47965        };
47966
47967        Mont.prototype.invm = function invm(a) {
47968          // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R
47969          var res = this.imod(a._invmp(this.m).mul(this.r2));
47970          return res._forceRed(this);
47971        };
47972      })(typeof module === 'undefined' || module, this);
47973    }, {
47974      "buffer": 183
47975    }],
47976    182: [function (require, module, exports) {
47977      var r;
47978
47979      module.exports = function rand(len) {
47980        if (!r) r = new Rand(null);
47981        return r.generate(len);
47982      };
47983
47984      function Rand(rand) {
47985        this.rand = rand;
47986      }
47987
47988      module.exports.Rand = Rand;
47989
47990      Rand.prototype.generate = function generate(len) {
47991        return this._rand(len);
47992      }; // Emulate crypto API using randy
47993
47994
47995      Rand.prototype._rand = function _rand(n) {
47996        if (this.rand.getBytes) return this.rand.getBytes(n);
47997        var res = new Uint8Array(n);
47998
47999        for (var i = 0; i < res.length; i++) {
48000          res[i] = this.rand.getByte();
48001        }
48002
48003        return res;
48004      };
48005
48006      if ((typeof self === "undefined" ? "undefined" : _typeof2(self)) === 'object') {
48007        if (self.crypto && self.crypto.getRandomValues) {
48008          // Modern browsers
48009          Rand.prototype._rand = function _rand(n) {
48010            var arr = new Uint8Array(n);
48011            self.crypto.getRandomValues(arr);
48012            return arr;
48013          };
48014        } else if (self.msCrypto && self.msCrypto.getRandomValues) {
48015          // IE
48016          Rand.prototype._rand = function _rand(n) {
48017            var arr = new Uint8Array(n);
48018            self.msCrypto.getRandomValues(arr);
48019            return arr;
48020          }; // Safari's WebWorkers do not have `crypto`
48021
48022        } else if ((typeof window === "undefined" ? "undefined" : _typeof2(window)) === 'object') {
48023          // Old junk
48024          Rand.prototype._rand = function () {
48025            throw new Error('Not implemented yet');
48026          };
48027        }
48028      } else {
48029        // Node.js or Web worker with no crypto support
48030        try {
48031          var crypto = require('crypto');
48032
48033          if (typeof crypto.randomBytes !== 'function') throw new Error('Not supported');
48034
48035          Rand.prototype._rand = function _rand(n) {
48036            return crypto.randomBytes(n);
48037          };
48038        } catch (e) {}
48039      }
48040    }, {
48041      "crypto": 183
48042    }],
48043    183: [function (require, module, exports) {}, {}],
48044    184: [function (require, module, exports) {
48045      // based on the aes implimentation in triple sec
48046      // https://github.com/keybase/triplesec
48047      // which is in turn based on the one from crypto-js
48048      // https://code.google.com/p/crypto-js/
48049      var Buffer = require('safe-buffer').Buffer;
48050
48051      function asUInt32Array(buf) {
48052        if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf);
48053        var len = buf.length / 4 | 0;
48054        var out = new Array(len);
48055
48056        for (var i = 0; i < len; i++) {
48057          out[i] = buf.readUInt32BE(i * 4);
48058        }
48059
48060        return out;
48061      }
48062
48063      function scrubVec(v) {
48064        for (var i = 0; i < v.length; v++) {
48065          v[i] = 0;
48066        }
48067      }
48068
48069      function cryptBlock(M, keySchedule, SUB_MIX, SBOX, nRounds) {
48070        var SUB_MIX0 = SUB_MIX[0];
48071        var SUB_MIX1 = SUB_MIX[1];
48072        var SUB_MIX2 = SUB_MIX[2];
48073        var SUB_MIX3 = SUB_MIX[3];
48074        var s0 = M[0] ^ keySchedule[0];
48075        var s1 = M[1] ^ keySchedule[1];
48076        var s2 = M[2] ^ keySchedule[2];
48077        var s3 = M[3] ^ keySchedule[3];
48078        var t0, t1, t2, t3;
48079        var ksRow = 4;
48080
48081        for (var round = 1; round < nRounds; round++) {
48082          t0 = SUB_MIX0[s0 >>> 24] ^ SUB_MIX1[s1 >>> 16 & 0xff] ^ SUB_MIX2[s2 >>> 8 & 0xff] ^ SUB_MIX3[s3 & 0xff] ^ keySchedule[ksRow++];
48083          t1 = SUB_MIX0[s1 >>> 24] ^ SUB_MIX1[s2 >>> 16 & 0xff] ^ SUB_MIX2[s3 >>> 8 & 0xff] ^ SUB_MIX3[s0 & 0xff] ^ keySchedule[ksRow++];
48084          t2 = SUB_MIX0[s2 >>> 24] ^ SUB_MIX1[s3 >>> 16 & 0xff] ^ SUB_MIX2[s0 >>> 8 & 0xff] ^ SUB_MIX3[s1 & 0xff] ^ keySchedule[ksRow++];
48085          t3 = SUB_MIX0[s3 >>> 24] ^ SUB_MIX1[s0 >>> 16 & 0xff] ^ SUB_MIX2[s1 >>> 8 & 0xff] ^ SUB_MIX3[s2 & 0xff] ^ keySchedule[ksRow++];
48086          s0 = t0;
48087          s1 = t1;
48088          s2 = t2;
48089          s3 = t3;
48090        }
48091
48092        t0 = (SBOX[s0 >>> 24] << 24 | SBOX[s1 >>> 16 & 0xff] << 16 | SBOX[s2 >>> 8 & 0xff] << 8 | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++];
48093        t1 = (SBOX[s1 >>> 24] << 24 | SBOX[s2 >>> 16 & 0xff] << 16 | SBOX[s3 >>> 8 & 0xff] << 8 | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++];
48094        t2 = (SBOX[s2 >>> 24] << 24 | SBOX[s3 >>> 16 & 0xff] << 16 | SBOX[s0 >>> 8 & 0xff] << 8 | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++];
48095        t3 = (SBOX[s3 >>> 24] << 24 | SBOX[s0 >>> 16 & 0xff] << 16 | SBOX[s1 >>> 8 & 0xff] << 8 | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++];
48096        t0 = t0 >>> 0;
48097        t1 = t1 >>> 0;
48098        t2 = t2 >>> 0;
48099        t3 = t3 >>> 0;
48100        return [t0, t1, t2, t3];
48101      } // AES constants
48102
48103
48104      var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36];
48105
48106      var G = function () {
48107        // Compute double table
48108        var d = new Array(256);
48109
48110        for (var j = 0; j < 256; j++) {
48111          if (j < 128) {
48112            d[j] = j << 1;
48113          } else {
48114            d[j] = j << 1 ^ 0x11b;
48115          }
48116        }
48117
48118        var SBOX = [];
48119        var INV_SBOX = [];
48120        var SUB_MIX = [[], [], [], []];
48121        var INV_SUB_MIX = [[], [], [], []]; // Walk GF(2^8)
48122
48123        var x = 0;
48124        var xi = 0;
48125
48126        for (var i = 0; i < 256; ++i) {
48127          // Compute sbox
48128          var sx = xi ^ xi << 1 ^ xi << 2 ^ xi << 3 ^ xi << 4;
48129          sx = sx >>> 8 ^ sx & 0xff ^ 0x63;
48130          SBOX[x] = sx;
48131          INV_SBOX[sx] = x; // Compute multiplication
48132
48133          var x2 = d[x];
48134          var x4 = d[x2];
48135          var x8 = d[x4]; // Compute sub bytes, mix columns tables
48136
48137          var t = d[sx] * 0x101 ^ sx * 0x1010100;
48138          SUB_MIX[0][x] = t << 24 | t >>> 8;
48139          SUB_MIX[1][x] = t << 16 | t >>> 16;
48140          SUB_MIX[2][x] = t << 8 | t >>> 24;
48141          SUB_MIX[3][x] = t; // Compute inv sub bytes, inv mix columns tables
48142
vendor: 18,486 bytes, lines 48143-48789
48143          t = x8 * 0x1010101 ^ x4 * 0x10001 ^ x2 * 0x101 ^ x * 0x1010100;
48144          INV_SUB_MIX[0][sx] = t << 24 | t >>> 8;
48145          INV_SUB_MIX[1][sx] = t << 16 | t >>> 16;
48146          INV_SUB_MIX[2][sx] = t << 8 | t >>> 24;
48147          INV_SUB_MIX[3][sx] = t;
48148
48149          if (x === 0) {
48150            x = xi = 1;
48151          } else {
48152            x = x2 ^ d[d[d[x8 ^ x2]]];
48153            xi ^= d[d[xi]];
48154          }
48155        }
48156
48157        return {
48158          SBOX: SBOX,
48159          INV_SBOX: INV_SBOX,
48160          SUB_MIX: SUB_MIX,
48161          INV_SUB_MIX: INV_SUB_MIX
48162        };
48163      }();
48164
48165      function AES(key) {
48166        this._key = asUInt32Array(key);
48167
48168        this._reset();
48169      }
48170
48171      AES.blockSize = 4 * 4;
48172      AES.keySize = 256 / 8;
48173      AES.prototype.blockSize = AES.blockSize;
48174      AES.prototype.keySize = AES.keySize;
48175
48176      AES.prototype._reset = function () {
48177        var keyWords = this._key;
48178        var keySize = keyWords.length;
48179        var nRounds = keySize + 6;
48180        var ksRows = (nRounds + 1) * 4;
48181        var keySchedule = [];
48182
48183        for (var k = 0; k < keySize; k++) {
48184          keySchedule[k] = keyWords[k];
48185        }
48186
48187        for (k = keySize; k < ksRows; k++) {
48188          var t = keySchedule[k - 1];
48189
48190          if (k % keySize === 0) {
48191            t = t << 8 | t >>> 24;
48192            t = G.SBOX[t >>> 24] << 24 | G.SBOX[t >>> 16 & 0xff] << 16 | G.SBOX[t >>> 8 & 0xff] << 8 | G.SBOX[t & 0xff];
48193            t ^= RCON[k / keySize | 0] << 24;
48194          } else if (keySize > 6 && k % keySize === 4) {
48195            t = G.SBOX[t >>> 24] << 24 | G.SBOX[t >>> 16 & 0xff] << 16 | G.SBOX[t >>> 8 & 0xff] << 8 | G.SBOX[t & 0xff];
48196          }
48197
48198          keySchedule[k] = keySchedule[k - keySize] ^ t;
48199        }
48200
48201        var invKeySchedule = [];
48202
48203        for (var ik = 0; ik < ksRows; ik++) {
48204          var ksR = ksRows - ik;
48205          var tt = keySchedule[ksR - (ik % 4 ? 0 : 4)];
48206
48207          if (ik < 4 || ksR <= 4) {
48208            invKeySchedule[ik] = tt;
48209          } else {
48210            invKeySchedule[ik] = G.INV_SUB_MIX[0][G.SBOX[tt >>> 24]] ^ G.INV_SUB_MIX[1][G.SBOX[tt >>> 16 & 0xff]] ^ G.INV_SUB_MIX[2][G.SBOX[tt >>> 8 & 0xff]] ^ G.INV_SUB_MIX[3][G.SBOX[tt & 0xff]];
48211          }
48212        }
48213
48214        this._nRounds = nRounds;
48215        this._keySchedule = keySchedule;
48216        this._invKeySchedule = invKeySchedule;
48217      };
48218
48219      AES.prototype.encryptBlockRaw = function (M) {
48220        M = asUInt32Array(M);
48221        return cryptBlock(M, this._keySchedule, G.SUB_MIX, G.SBOX, this._nRounds);
48222      };
48223
48224      AES.prototype.encryptBlock = function (M) {
48225        var out = this.encryptBlockRaw(M);
48226        var buf = Buffer.allocUnsafe(16);
48227        buf.writeUInt32BE(out[0], 0);
48228        buf.writeUInt32BE(out[1], 4);
48229        buf.writeUInt32BE(out[2], 8);
48230        buf.writeUInt32BE(out[3], 12);
48231        return buf;
48232      };
48233
48234      AES.prototype.decryptBlock = function (M) {
48235        M = asUInt32Array(M); // swap
48236
48237        var m1 = M[1];
48238        M[1] = M[3];
48239        M[3] = m1;
48240        var out = cryptBlock(M, this._invKeySchedule, G.INV_SUB_MIX, G.INV_SBOX, this._nRounds);
48241        var buf = Buffer.allocUnsafe(16);
48242        buf.writeUInt32BE(out[0], 0);
48243        buf.writeUInt32BE(out[3], 4);
48244        buf.writeUInt32BE(out[2], 8);
48245        buf.writeUInt32BE(out[1], 12);
48246        return buf;
48247      };
48248
48249      AES.prototype.scrub = function () {
48250        scrubVec(this._keySchedule);
48251        scrubVec(this._invKeySchedule);
48252        scrubVec(this._key);
48253      };
48254
48255      module.exports.AES = AES;
48256    }, {
48257      "safe-buffer": 470
48258    }],
48259    185: [function (require, module, exports) {
48260      var aes = require('./aes');
48261
48262      var Buffer = require('safe-buffer').Buffer;
48263
48264      var Transform = require('cipher-base');
48265
48266      var inherits = require('inherits');
48267
48268      var GHASH = require('./ghash');
48269
48270      var xor = require('buffer-xor');
48271
48272      var incr32 = require('./incr32');
48273
48274      function xorTest(a, b) {
48275        var out = 0;
48276        if (a.length !== b.length) out++;
48277        var len = Math.min(a.length, b.length);
48278
48279        for (var i = 0; i < len; ++i) {
48280          out += a[i] ^ b[i];
48281        }
48282
48283        return out;
48284      }
48285
48286      function calcIv(self, iv, ck) {
48287        if (iv.length === 12) {
48288          self._finID = Buffer.concat([iv, Buffer.from([0, 0, 0, 1])]);
48289          return Buffer.concat([iv, Buffer.from([0, 0, 0, 2])]);
48290        }
48291
48292        var ghash = new GHASH(ck);
48293        var len = iv.length;
48294        var toPad = len % 16;
48295        ghash.update(iv);
48296
48297        if (toPad) {
48298          toPad = 16 - toPad;
48299          ghash.update(Buffer.alloc(toPad, 0));
48300        }
48301
48302        ghash.update(Buffer.alloc(8, 0));
48303        var ivBits = len * 8;
48304        var tail = Buffer.alloc(8);
48305        tail.writeUIntBE(ivBits, 0, 8);
48306        ghash.update(tail);
48307        self._finID = ghash.state;
48308        var out = Buffer.from(self._finID);
48309        incr32(out);
48310        return out;
48311      }
48312
48313      function StreamCipher(mode, key, iv, decrypt) {
48314        Transform.call(this);
48315        var h = Buffer.alloc(4, 0);
48316        this._cipher = new aes.AES(key);
48317
48318        var ck = this._cipher.encryptBlock(h);
48319
48320        this._ghash = new GHASH(ck);
48321        iv = calcIv(this, iv, ck);
48322        this._prev = Buffer.from(iv);
48323        this._cache = Buffer.allocUnsafe(0);
48324        this._secCache = Buffer.allocUnsafe(0);
48325        this._decrypt = decrypt;
48326        this._alen = 0;
48327        this._len = 0;
48328        this._mode = mode;
48329        this._authTag = null;
48330        this._called = false;
48331      }
48332
48333      inherits(StreamCipher, Transform);
48334
48335      StreamCipher.prototype._update = function (chunk) {
48336        if (!this._called && this._alen) {
48337          var rump = 16 - this._alen % 16;
48338
48339          if (rump < 16) {
48340            rump = Buffer.alloc(rump, 0);
48341
48342            this._ghash.update(rump);
48343          }
48344        }
48345
48346        this._called = true;
48347
48348        var out = this._mode.encrypt(this, chunk);
48349
48350        if (this._decrypt) {
48351          this._ghash.update(chunk);
48352        } else {
48353          this._ghash.update(out);
48354        }
48355
48356        this._len += chunk.length;
48357        return out;
48358      };
48359
48360      StreamCipher.prototype._final = function () {
48361        if (this._decrypt && !this._authTag) throw new Error('Unsupported state or unable to authenticate data');
48362        var tag = xor(this._ghash.final(this._alen * 8, this._len * 8), this._cipher.encryptBlock(this._finID));
48363        if (this._decrypt && xorTest(tag, this._authTag)) throw new Error('Unsupported state or unable to authenticate data');
48364        this._authTag = tag;
48365
48366        this._cipher.scrub();
48367      };
48368
48369      StreamCipher.prototype.getAuthTag = function getAuthTag() {
48370        if (this._decrypt || !Buffer.isBuffer(this._authTag)) throw new Error('Attempting to get auth tag in unsupported state');
48371        return this._authTag;
48372      };
48373
48374      StreamCipher.prototype.setAuthTag = function setAuthTag(tag) {
48375        if (!this._decrypt) throw new Error('Attempting to set auth tag in unsupported state');
48376        this._authTag = tag;
48377      };
48378
48379      StreamCipher.prototype.setAAD = function setAAD(buf) {
48380        if (this._called) throw new Error('Attempting to set AAD in unsupported state');
48381
48382        this._ghash.update(buf);
48383
48384        this._alen += buf.length;
48385      };
48386
48387      module.exports = StreamCipher;
48388    }, {
48389      "./aes": 184,
48390      "./ghash": 189,
48391      "./incr32": 190,
48392      "buffer-xor": 215,
48393      "cipher-base": 216,
48394      "inherits": 364,
48395      "safe-buffer": 470
48396    }],
48397    186: [function (require, module, exports) {
48398      var ciphers = require('./encrypter');
48399
48400      var deciphers = require('./decrypter');
48401
48402      var modes = require('./modes/list.json');
48403
48404      function getCiphers() {
48405        return Object.keys(modes);
48406      }
48407
48408      exports.createCipher = exports.Cipher = ciphers.createCipher;
48409      exports.createCipheriv = exports.Cipheriv = ciphers.createCipheriv;
48410      exports.createDecipher = exports.Decipher = deciphers.createDecipher;
48411      exports.createDecipheriv = exports.Decipheriv = deciphers.createDecipheriv;
48412      exports.listCiphers = exports.getCiphers = getCiphers;
48413    }, {
48414      "./decrypter": 187,
48415      "./encrypter": 188,
48416      "./modes/list.json": 198
48417    }],
48418    187: [function (require, module, exports) {
48419      var AuthCipher = require('./authCipher');
48420
48421      var Buffer = require('safe-buffer').Buffer;
48422
48423      var MODES = require('./modes');
48424
48425      var StreamCipher = require('./streamCipher');
48426
48427      var Transform = require('cipher-base');
48428
48429      var aes = require('./aes');
48430
48431      var ebtk = require('evp_bytestokey');
48432
48433      var inherits = require('inherits');
48434
48435      function Decipher(mode, key, iv) {
48436        Transform.call(this);
48437        this._cache = new Splitter();
48438        this._last = void 0;
48439        this._cipher = new aes.AES(key);
48440        this._prev = Buffer.from(iv);
48441        this._mode = mode;
48442        this._autopadding = true;
48443      }
48444
48445      inherits(Decipher, Transform);
48446
48447      Decipher.prototype._update = function (data) {
48448        this._cache.add(data);
48449
48450        var chunk;
48451        var thing;
48452        var out = [];
48453
48454        while (chunk = this._cache.get(this._autopadding)) {
48455          thing = this._mode.decrypt(this, chunk);
48456          out.push(thing);
48457        }
48458
48459        return Buffer.concat(out);
48460      };
48461
48462      Decipher.prototype._final = function () {
48463        var chunk = this._cache.flush();
48464
48465        if (this._autopadding) {
48466          return unpad(this._mode.decrypt(this, chunk));
48467        } else if (chunk) {
48468          throw new Error('data not multiple of block length');
48469        }
48470      };
48471
48472      Decipher.prototype.setAutoPadding = function (setTo) {
48473        this._autopadding = !!setTo;
48474        return this;
48475      };
48476
48477      function Splitter() {
48478        this.cache = Buffer.allocUnsafe(0);
48479      }
48480
48481      Splitter.prototype.add = function (data) {
48482        this.cache = Buffer.concat([this.cache, data]);
48483      };
48484
48485      Splitter.prototype.get = function (autoPadding) {
48486        var out;
48487
48488        if (autoPadding) {
48489          if (this.cache.length > 16) {
48490            out = this.cache.slice(0, 16);
48491            this.cache = this.cache.slice(16);
48492            return out;
48493          }
48494        } else {
48495          if (this.cache.length >= 16) {
48496            out = this.cache.slice(0, 16);
48497            this.cache = this.cache.slice(16);
48498            return out;
48499          }
48500        }
48501
48502        return null;
48503      };
48504
48505      Splitter.prototype.flush = function () {
48506        if (this.cache.length) return this.cache;
48507      };
48508
48509      function unpad(last) {
48510        var padded = last[15];
48511
48512        if (padded < 1 || padded > 16) {
48513          throw new Error('unable to decrypt data');
48514        }
48515
48516        var i = -1;
48517
48518        while (++i < padded) {
48519          if (last[i + (16 - padded)] !== padded) {
48520            throw new Error('unable to decrypt data');
48521          }
48522        }
48523
48524        if (padded === 16) return;
48525        return last.slice(0, 16 - padded);
48526      }
48527
48528      function createDecipheriv(suite, password, iv) {
48529        var config = MODES[suite.toLowerCase()];
48530        if (!config) throw new TypeError('invalid suite type');
48531        if (typeof iv === 'string') iv = Buffer.from(iv);
48532        if (config.mode !== 'GCM' && iv.length !== config.iv) throw new TypeError('invalid iv length ' + iv.length);
48533        if (typeof password === 'string') password = Buffer.from(password);
48534        if (password.length !== config.key / 8) throw new TypeError('invalid key length ' + password.length);
48535
48536        if (config.type === 'stream') {
48537          return new StreamCipher(config.module, password, iv, true);
48538        } else if (config.type === 'auth') {
48539          return new AuthCipher(config.module, password, iv, true);
48540        }
48541
48542        return new Decipher(config.module, password, iv);
48543      }
48544
48545      function createDecipher(suite, password) {
48546        var config = MODES[suite.toLowerCase()];
48547        if (!config) throw new TypeError('invalid suite type');
48548        var keys = ebtk(password, false, config.key, config.iv);
48549        return createDecipheriv(suite, keys.key, keys.iv);
48550      }
48551
48552      exports.createDecipher = createDecipher;
48553      exports.createDecipheriv = createDecipheriv;
48554    }, {
48555      "./aes": 184,
48556      "./authCipher": 185,
48557      "./modes": 197,
48558      "./streamCipher": 200,
48559      "cipher-base": 216,
48560      "evp_bytestokey": 345,
48561      "inherits": 364,
48562      "safe-buffer": 470
48563    }],
48564    188: [function (require, module, exports) {
48565      var MODES = require('./modes');
48566
48567      var AuthCipher = require('./authCipher');
48568
48569      var Buffer = require('safe-buffer').Buffer;
48570
48571      var StreamCipher = require('./streamCipher');
48572
48573      var Transform = require('cipher-base');
48574
48575      var aes = require('./aes');
48576
48577      var ebtk = require('evp_bytestokey');
48578
48579      var inherits = require('inherits');
48580
48581      function Cipher(mode, key, iv) {
48582        Transform.call(this);
48583        this._cache = new Splitter();
48584        this._cipher = new aes.AES(key);
48585        this._prev = Buffer.from(iv);
48586        this._mode = mode;
48587        this._autopadding = true;
48588      }
48589
48590      inherits(Cipher, Transform);
48591
48592      Cipher.prototype._update = function (data) {
48593        this._cache.add(data);
48594
48595        var chunk;
48596        var thing;
48597        var out = [];
48598
48599        while (chunk = this._cache.get()) {
48600          thing = this._mode.encrypt(this, chunk);
48601          out.push(thing);
48602        }
48603
48604        return Buffer.concat(out);
48605      };
48606
48607      var PADDING = Buffer.alloc(16, 0x10);
48608
48609      Cipher.prototype._final = function () {
48610        var chunk = this._cache.flush();
48611
48612        if (this._autopadding) {
48613          chunk = this._mode.encrypt(this, chunk);
48614
48615          this._cipher.scrub();
48616
48617          return chunk;
48618        }
48619
48620        if (!chunk.equals(PADDING)) {
48621          this._cipher.scrub();
48622
48623          throw new Error('data not multiple of block length');
48624        }
48625      };
48626
48627      Cipher.prototype.setAutoPadding = function (setTo) {
48628        this._autopadding = !!setTo;
48629        return this;
48630      };
48631
48632      function Splitter() {
48633        this.cache = Buffer.allocUnsafe(0);
48634      }
48635
48636      Splitter.prototype.add = function (data) {
48637        this.cache = Buffer.concat([this.cache, data]);
48638      };
48639
48640      Splitter.prototype.get = function () {
48641        if (this.cache.length > 15) {
48642          var out = this.cache.slice(0, 16);
48643          this.cache = this.cache.slice(16);
48644          return out;
48645        }
48646
48647        return null;
48648      };
48649
48650      Splitter.prototype.flush = function () {
48651        var len = 16 - this.cache.length;
48652        var padBuff = Buffer.allocUnsafe(len);
48653        var i = -1;
48654
48655        while (++i < len) {
48656          padBuff.writeUInt8(len, i);
48657        }
48658
48659        return Buffer.concat([this.cache, padBuff]);
48660      };
48661
48662      function createCipheriv(suite, password, iv) {
48663        var config = MODES[suite.toLowerCase()];
48664        if (!config) throw new TypeError('invalid suite type');
48665        if (typeof password === 'string') password = Buffer.from(password);
48666        if (password.length !== config.key / 8) throw new TypeError('invalid key length ' + password.length);
48667        if (typeof iv === 'string') iv = Buffer.from(iv);
48668        if (config.mode !== 'GCM' && iv.length !== config.iv) throw new TypeError('invalid iv length ' + iv.length);
48669
48670        if (config.type === 'stream') {
48671          return new StreamCipher(config.module, password, iv);
48672        } else if (config.type === 'auth') {
48673          return new AuthCipher(config.module, password, iv);
48674        }
48675
48676        return new Cipher(config.module, password, iv);
48677      }
48678
48679      function createCipher(suite, password) {
48680        var config = MODES[suite.toLowerCase()];
48681        if (!config) throw new TypeError('invalid suite type');
48682        var keys = ebtk(password, false, config.key, config.iv);
48683        return createCipheriv(suite, keys.key, keys.iv);
48684      }
48685
48686      exports.createCipheriv = createCipheriv;
48687      exports.createCipher = createCipher;
48688    }, {
48689      "./aes": 184,
48690      "./authCipher": 185,
48691      "./modes": 197,
48692      "./streamCipher": 200,
48693      "cipher-base": 216,
48694      "evp_bytestokey": 345,
48695      "inherits": 364,
48696      "safe-buffer": 470
48697    }],
48698    189: [function (require, module, exports) {
48699      var Buffer = require('safe-buffer').Buffer;
48700
48701      var ZEROES = Buffer.alloc(16, 0);
48702
48703      function toArray(buf) {
48704        return [buf.readUInt32BE(0), buf.readUInt32BE(4), buf.readUInt32BE(8), buf.readUInt32BE(12)];
48705      }
48706
48707      function fromArray(out) {
48708        var buf = Buffer.allocUnsafe(16);
48709        buf.writeUInt32BE(out[0] >>> 0, 0);
48710        buf.writeUInt32BE(out[1] >>> 0, 4);
48711        buf.writeUInt32BE(out[2] >>> 0, 8);
48712        buf.writeUInt32BE(out[3] >>> 0, 12);
48713        return buf;
48714      }
48715
48716      function GHASH(key) {
48717        this.h = key;
48718        this.state = Buffer.alloc(16, 0);
48719        this.cache = Buffer.allocUnsafe(0);
48720      } // from http://bitwiseshiftleft.github.io/sjcl/doc/symbols/src/core_gcm.js.html
48721      // by Juho Vähä-Herttua
48722
48723
48724      GHASH.prototype.ghash = function (block) {
48725        var i = -1;
48726
48727        while (++i < block.length) {
48728          this.state[i] ^= block[i];
48729        }
48730
48731        this._multiply();
48732      };
48733
48734      GHASH.prototype._multiply = function () {
48735        var Vi = toArray(this.h);
48736        var Zi = [0, 0, 0, 0];
48737        var j, xi, lsbVi;
48738        var i = -1;
48739
48740        while (++i < 128) {
48741          xi = (this.state[~~(i / 8)] & 1 << 7 - i % 8) !== 0;
48742
48743          if (xi) {
48744            // Z_i+1 = Z_i ^ V_i
48745            Zi[0] ^= Vi[0];
48746            Zi[1] ^= Vi[1];
48747            Zi[2] ^= Vi[2];
48748            Zi[3] ^= Vi[3];
48749          } // Store the value of LSB(V_i)
48750
48751
48752          lsbVi = (Vi[3] & 1) !== 0; // V_i+1 = V_i >> 1
48753
48754          for (j = 3; j > 0; j--) {
48755            Vi[j] = Vi[j] >>> 1 | (Vi[j - 1] & 1) << 31;
48756          }
48757
48758          Vi[0] = Vi[0] >>> 1; // If LSB(V_i) is 1, V_i+1 = (V_i >> 1) ^ R
48759
48760          if (lsbVi) {
48761            Vi[0] = Vi[0] ^ 0xe1 << 24;
48762          }
48763        }
48764
48765        this.state = fromArray(Zi);
48766      };
48767
48768      GHASH.prototype.update = function (buf) {
48769        this.cache = Buffer.concat([this.cache, buf]);
48770        var chunk;
48771
48772        while (this.cache.length >= 16) {
48773          chunk = this.cache.slice(0, 16);
48774          this.cache = this.cache.slice(16);
48775          this.ghash(chunk);
48776        }
48777      };
48778
48779      GHASH.prototype.final = function (abl, bl) {
48780        if (this.cache.length) {
48781          this.ghash(Buffer.concat([this.cache, ZEROES], 16));
48782        }
48783
48784        this.ghash(fromArray([0, abl, 0, bl]));
48785        return this.state;
48786      };
48787
48788      module.exports = GHASH;
48789    }, {
vendor: 6,070 bytes, lines 48790-49016
48790      "safe-buffer": 470
48791    }],
48792    190: [function (require, module, exports) {
48793      function incr32(iv) {
48794        var len = iv.length;
48795        var item;
48796
48797        while (len--) {
48798          item = iv.readUInt8(len);
48799
48800          if (item === 255) {
48801            iv.writeUInt8(0, len);
48802          } else {
48803            item++;
48804            iv.writeUInt8(item, len);
48805            break;
48806          }
48807        }
48808      }
48809
48810      module.exports = incr32;
48811    }, {}],
48812    191: [function (require, module, exports) {
48813      var xor = require('buffer-xor');
48814
48815      exports.encrypt = function (self, block) {
48816        var data = xor(block, self._prev);
48817        self._prev = self._cipher.encryptBlock(data);
48818        return self._prev;
48819      };
48820
48821      exports.decrypt = function (self, block) {
48822        var pad = self._prev;
48823        self._prev = block;
48824
48825        var out = self._cipher.decryptBlock(block);
48826
48827        return xor(out, pad);
48828      };
48829    }, {
48830      "buffer-xor": 215
48831    }],
48832    192: [function (require, module, exports) {
48833      var Buffer = require('safe-buffer').Buffer;
48834
48835      var xor = require('buffer-xor');
48836
48837      function encryptStart(self, data, decrypt) {
48838        var len = data.length;
48839        var out = xor(data, self._cache);
48840        self._cache = self._cache.slice(len);
48841        self._prev = Buffer.concat([self._prev, decrypt ? data : out]);
48842        return out;
48843      }
48844
48845      exports.encrypt = function (self, data, decrypt) {
48846        var out = Buffer.allocUnsafe(0);
48847        var len;
48848
48849        while (data.length) {
48850          if (self._cache.length === 0) {
48851            self._cache = self._cipher.encryptBlock(self._prev);
48852            self._prev = Buffer.allocUnsafe(0);
48853          }
48854
48855          if (self._cache.length <= data.length) {
48856            len = self._cache.length;
48857            out = Buffer.concat([out, encryptStart(self, data.slice(0, len), decrypt)]);
48858            data = data.slice(len);
48859          } else {
48860            out = Buffer.concat([out, encryptStart(self, data, decrypt)]);
48861            break;
48862          }
48863        }
48864
48865        return out;
48866      };
48867    }, {
48868      "buffer-xor": 215,
48869      "safe-buffer": 470
48870    }],
48871    193: [function (require, module, exports) {
48872      var Buffer = require('safe-buffer').Buffer;
48873
48874      function encryptByte(self, byteParam, decrypt) {
48875        var pad;
48876        var i = -1;
48877        var len = 8;
48878        var out = 0;
48879        var bit, value;
48880
48881        while (++i < len) {
48882          pad = self._cipher.encryptBlock(self._prev);
48883          bit = byteParam & 1 << 7 - i ? 0x80 : 0;
48884          value = pad[0] ^ bit;
48885          out += (value & 0x80) >> i % 8;
48886          self._prev = shiftIn(self._prev, decrypt ? bit : value);
48887        }
48888
48889        return out;
48890      }
48891
48892      function shiftIn(buffer, value) {
48893        var len = buffer.length;
48894        var i = -1;
48895        var out = Buffer.allocUnsafe(buffer.length);
48896        buffer = Buffer.concat([buffer, Buffer.from([value])]);
48897
48898        while (++i < len) {
48899          out[i] = buffer[i] << 1 | buffer[i + 1] >> 7;
48900        }
48901
48902        return out;
48903      }
48904
48905      exports.encrypt = function (self, chunk, decrypt) {
48906        var len = chunk.length;
48907        var out = Buffer.allocUnsafe(len);
48908        var i = -1;
48909
48910        while (++i < len) {
48911          out[i] = encryptByte(self, chunk[i], decrypt);
48912        }
48913
48914        return out;
48915      };
48916    }, {
48917      "safe-buffer": 470
48918    }],
48919    194: [function (require, module, exports) {
48920      var Buffer = require('safe-buffer').Buffer;
48921
48922      function encryptByte(self, byteParam, decrypt) {
48923        var pad = self._cipher.encryptBlock(self._prev);
48924
48925        var out = pad[0] ^ byteParam;
48926        self._prev = Buffer.concat([self._prev.slice(1), Buffer.from([decrypt ? byteParam : out])]);
48927        return out;
48928      }
48929
48930      exports.encrypt = function (self, chunk, decrypt) {
48931        var len = chunk.length;
48932        var out = Buffer.allocUnsafe(len);
48933        var i = -1;
48934
48935        while (++i < len) {
48936          out[i] = encryptByte(self, chunk[i], decrypt);
48937        }
48938
48939        return out;
48940      };
48941    }, {
48942      "safe-buffer": 470
48943    }],
48944    195: [function (require, module, exports) {
48945      var xor = require('buffer-xor');
48946
48947      var Buffer = require('safe-buffer').Buffer;
48948
48949      var incr32 = require('../incr32');
48950
48951      function getBlock(self) {
48952        var out = self._cipher.encryptBlockRaw(self._prev);
48953
48954        incr32(self._prev);
48955        return out;
48956      }
48957
48958      var blockSize = 16;
48959
48960      exports.encrypt = function (self, chunk) {
48961        var chunkNum = Math.ceil(chunk.length / blockSize);
48962        var start = self._cache.length;
48963        self._cache = Buffer.concat([self._cache, Buffer.allocUnsafe(chunkNum * blockSize)]);
48964
48965        for (var i = 0; i < chunkNum; i++) {
48966          var out = getBlock(self);
48967          var offset = start + i * blockSize;
48968
48969          self._cache.writeUInt32BE(out[0], offset + 0);
48970
48971          self._cache.writeUInt32BE(out[1], offset + 4);
48972
48973          self._cache.writeUInt32BE(out[2], offset + 8);
48974
48975          self._cache.writeUInt32BE(out[3], offset + 12);
48976        }
48977
48978        var pad = self._cache.slice(0, chunk.length);
48979
48980        self._cache = self._cache.slice(chunk.length);
48981        return xor(chunk, pad);
48982      };
48983    }, {
48984      "../incr32": 190,
48985      "buffer-xor": 215,
48986      "safe-buffer": 470
48987    }],
48988    196: [function (require, module, exports) {
48989      exports.encrypt = function (self, block) {
48990        return self._cipher.encryptBlock(block);
48991      };
48992
48993      exports.decrypt = function (self, block) {
48994        return self._cipher.decryptBlock(block);
48995      };
48996    }, {}],
48997    197: [function (require, module, exports) {
48998      var modeModules = {
48999        ECB: require('./ecb'),
49000        CBC: require('./cbc'),
49001        CFB: require('./cfb'),
49002        CFB8: require('./cfb8'),
49003        CFB1: require('./cfb1'),
49004        OFB: require('./ofb'),
49005        CTR: require('./ctr'),
49006        GCM: require('./ctr')
49007      };
49008
49009      var modes = require('./list.json');
49010
49011      for (var key in modes) {
49012        modes[key].module = modeModules[modes[key].mode];
49013      }
49014
49015      module.exports = modes;
49016    }, {
49017      "./cbc": 191,
49018      "./cfb": 192,
49019      "./cfb1": 193,
49020      "./cfb8": 194,
49021      "./ctr": 195,
49022      "./ecb": 196,
49023      "./list.json": 198,
49024      "./ofb": 199
49025    }],
49026    198: [function (require, module, exports) {
49027      module.exports = {
49028        "aes-128-ecb": {
49029          "cipher": "AES",
49030          "key": 128,
49031          "iv": 0,
49032          "mode": "ECB",
49033          "type": "block"
49034        },
49035        "aes-192-ecb": {
49036          "cipher": "AES",
49037          "key": 192,
49038          "iv": 0,
49039          "mode": "ECB",
49040          "type": "block"
49041        },
49042        "aes-256-ecb": {
49043          "cipher": "AES",
49044          "key": 256,
49045          "iv": 0,
49046          "mode": "ECB",
49047          "type": "block"
49048        },
49049        "aes-128-cbc": {
49050          "cipher": "AES",
49051          "key": 128,
49052          "iv": 16,
49053          "mode": "CBC",
49054          "type": "block"
49055        },
49056        "aes-192-cbc": {
49057          "cipher": "AES",
49058          "key": 192,
49059          "iv": 16,
49060          "mode": "CBC",
49061          "type": "block"
49062        },
49063        "aes-256-cbc": {
49064          "cipher": "AES",
49065          "key": 256,
49066          "iv": 16,
49067          "mode": "CBC",
49068          "type": "block"
49069        },
49070        "aes128": {
49071          "cipher": "AES",
49072          "key": 128,
49073          "iv": 16,
49074          "mode": "CBC",
49075          "type": "block"
49076        },
49077        "aes192": {
49078          "cipher": "AES",
49079          "key": 192,
49080          "iv": 16,
49081          "mode": "CBC",
49082          "type": "block"
49083        },
49084        "aes256": {
49085          "cipher": "AES",
49086          "key": 256,
49087          "iv": 16,
49088          "mode": "CBC",
49089          "type": "block"
49090        },
49091        "aes-128-cfb": {
49092          "cipher": "AES",
49093          "key": 128,
49094          "iv": 16,
49095          "mode": "CFB",
49096          "type": "stream"
49097        },
49098        "aes-192-cfb": {
49099          "cipher": "AES",
49100          "key": 192,
49101          "iv": 16,
49102          "mode": "CFB",
49103          "type": "stream"
49104        },
49105        "aes-256-cfb": {
49106          "cipher": "AES",
49107          "key": 256,
49108          "iv": 16,
49109          "mode": "CFB",
49110          "type": "stream"
49111        },
49112        "aes-128-cfb8": {
49113          "cipher": "AES",
49114          "key": 128,
49115          "iv": 16,
49116          "mode": "CFB8",
49117          "type": "stream"
49118        },
49119        "aes-192-cfb8": {
49120          "cipher": "AES",
49121          "key": 192,
49122          "iv": 16,
49123          "mode": "CFB8",
49124          "type": "stream"
49125        },
49126        "aes-256-cfb8": {
49127          "cipher": "AES",
49128          "key": 256,
49129          "iv": 16,
49130          "mode": "CFB8",
49131          "type": "stream"
49132        },
49133        "aes-128-cfb1": {
49134          "cipher": "AES",
49135          "key": 128,
49136          "iv": 16,
49137          "mode": "CFB1",
49138          "type": "stream"
49139        },
49140        "aes-192-cfb1": {
49141          "cipher": "AES",
49142          "key": 192,
49143          "iv": 16,
49144          "mode": "CFB1",
49145          "type": "stream"
49146        },
49147        "aes-256-cfb1": {
49148          "cipher": "AES",
49149          "key": 256,
49150          "iv": 16,
49151          "mode": "CFB1",
49152          "type": "stream"
49153        },
49154        "aes-128-ofb": {
49155          "cipher": "AES",
49156          "key": 128,
49157          "iv": 16,
49158          "mode": "OFB",
49159          "type": "stream"
49160        },
49161        "aes-192-ofb": {
49162          "cipher": "AES",
49163          "key": 192,
49164          "iv": 16,
49165          "mode": "OFB",
49166          "type": "stream"
49167        },
49168        "aes-256-ofb": {
49169          "cipher": "AES",
49170          "key": 256,
49171          "iv": 16,
49172          "mode": "OFB",
49173          "type": "stream"
49174        },
49175        "aes-128-ctr": {
49176          "cipher": "AES",
49177          "key": 128,
49178          "iv": 16,
49179          "mode": "CTR",
49180          "type": "stream"
49181        },
49182        "aes-192-ctr": {
49183          "cipher": "AES",
49184          "key": 192,
49185          "iv": 16,
49186          "mode": "CTR",
49187          "type": "stream"
49188        },
49189        "aes-256-ctr": {
49190          "cipher": "AES",
49191          "key": 256,
49192          "iv": 16,
49193          "mode": "CTR",
49194          "type": "stream"
49195        },
49196        "aes-128-gcm": {
49197          "cipher": "AES",
49198          "key": 128,
49199          "iv": 12,
49200          "mode": "GCM",
49201          "type": "auth"
49202        },
49203        "aes-192-gcm": {
49204          "cipher": "AES",
49205          "key": 192,
49206          "iv": 12,
49207          "mode": "GCM",
49208          "type": "auth"
49209        },
49210        "aes-256-gcm": {
49211          "cipher": "AES",
49212          "key": 256,
49213          "iv": 12,
49214          "mode": "GCM",
49215          "type": "auth"
49216        }
49217      };
49218    }, {}],
vendor: 4,201 bytes, lines 49219-49358
49219    199: [function (require, module, exports) {
49220      (function (Buffer) {
49221        var xor = require('buffer-xor');
49222
49223        function getBlock(self) {
49224          self._prev = self._cipher.encryptBlock(self._prev);
49225          return self._prev;
49226        }
49227
49228        exports.encrypt = function (self, chunk) {
49229          while (self._cache.length < chunk.length) {
49230            self._cache = Buffer.concat([self._cache, getBlock(self)]);
49231          }
49232
49233          var pad = self._cache.slice(0, chunk.length);
49234
49235          self._cache = self._cache.slice(chunk.length);
49236          return xor(chunk, pad);
49237        };
49238      }).call(this, require("buffer").Buffer);
49239    }, {
49240      "buffer": 214,
49241      "buffer-xor": 215
49242    }],
49243    200: [function (require, module, exports) {
49244      var aes = require('./aes');
49245
49246      var Buffer = require('safe-buffer').Buffer;
49247
49248      var Transform = require('cipher-base');
49249
49250      var inherits = require('inherits');
49251
49252      function StreamCipher(mode, key, iv, decrypt) {
49253        Transform.call(this);
49254        this._cipher = new aes.AES(key);
49255        this._prev = Buffer.from(iv);
49256        this._cache = Buffer.allocUnsafe(0);
49257        this._secCache = Buffer.allocUnsafe(0);
49258        this._decrypt = decrypt;
49259        this._mode = mode;
49260      }
49261
49262      inherits(StreamCipher, Transform);
49263
49264      StreamCipher.prototype._update = function (chunk) {
49265        return this._mode.encrypt(this, chunk, this._decrypt);
49266      };
49267
49268      StreamCipher.prototype._final = function () {
49269        this._cipher.scrub();
49270      };
49271
49272      module.exports = StreamCipher;
49273    }, {
49274      "./aes": 184,
49275      "cipher-base": 216,
49276      "inherits": 364,
49277      "safe-buffer": 470
49278    }],
49279    201: [function (require, module, exports) {
49280      var DES = require('browserify-des');
49281
49282      var aes = require('browserify-aes/browser');
49283
49284      var aesModes = require('browserify-aes/modes');
49285
49286      var desModes = require('browserify-des/modes');
49287
49288      var ebtk = require('evp_bytestokey');
49289
49290      function createCipher(suite, password) {
49291        suite = suite.toLowerCase();
49292        var keyLen, ivLen;
49293
49294        if (aesModes[suite]) {
49295          keyLen = aesModes[suite].key;
49296          ivLen = aesModes[suite].iv;
49297        } else if (desModes[suite]) {
49298          keyLen = desModes[suite].key * 8;
49299          ivLen = desModes[suite].iv;
49300        } else {
49301          throw new TypeError('invalid suite type');
49302        }
49303
49304        var keys = ebtk(password, false, keyLen, ivLen);
49305        return createCipheriv(suite, keys.key, keys.iv);
49306      }
49307
49308      function createDecipher(suite, password) {
49309        suite = suite.toLowerCase();
49310        var keyLen, ivLen;
49311
49312        if (aesModes[suite]) {
49313          keyLen = aesModes[suite].key;
49314          ivLen = aesModes[suite].iv;
49315        } else if (desModes[suite]) {
49316          keyLen = desModes[suite].key * 8;
49317          ivLen = desModes[suite].iv;
49318        } else {
49319          throw new TypeError('invalid suite type');
49320        }
49321
49322        var keys = ebtk(password, false, keyLen, ivLen);
49323        return createDecipheriv(suite, keys.key, keys.iv);
49324      }
49325
49326      function createCipheriv(suite, key, iv) {
49327        suite = suite.toLowerCase();
49328        if (aesModes[suite]) return aes.createCipheriv(suite, key, iv);
49329        if (desModes[suite]) return new DES({
49330          key: key,
49331          iv: iv,
49332          mode: suite
49333        });
49334        throw new TypeError('invalid suite type');
49335      }
49336
49337      function createDecipheriv(suite, key, iv) {
49338        suite = suite.toLowerCase();
49339        if (aesModes[suite]) return aes.createDecipheriv(suite, key, iv);
49340        if (desModes[suite]) return new DES({
49341          key: key,
49342          iv: iv,
49343          mode: suite,
49344          decrypt: true
49345        });
49346        throw new TypeError('invalid suite type');
49347      }
49348
49349      function getCiphers() {
49350        return Object.keys(desModes).concat(aes.getCiphers());
49351      }
49352
49353      exports.createCipher = exports.Cipher = createCipher;
49354      exports.createCipheriv = exports.Cipheriv = createCipheriv;
49355      exports.createDecipher = exports.Decipher = createDecipher;
49356      exports.createDecipheriv = exports.Decipheriv = createDecipheriv;
49357      exports.listCiphers = exports.getCiphers = getCiphers;
49358    }, {
49359      "browserify-aes/browser": 186,
49360      "browserify-aes/modes": 197,
49361      "browserify-des": 202,
49362      "browserify-des/modes": 203,
49363      "evp_bytestokey": 345
49364    }],
49365    202: [function (require, module, exports) {
49366      var CipherBase = require('cipher-base');
49367
49368      var des = require('des.js');
49369
49370      var inherits = require('inherits');
49371
49372      var Buffer = require('safe-buffer').Buffer;
49373
49374      var modes = {
49375        'des-ede3-cbc': des.CBC.instantiate(des.EDE),
49376        'des-ede3': des.EDE,
49377        'des-ede-cbc': des.CBC.instantiate(des.EDE),
49378        'des-ede': des.EDE,
49379        'des-cbc': des.CBC.instantiate(des.DES),
49380        'des-ecb': des.DES
49381      };
49382      modes.des = modes['des-cbc'];
49383      modes.des3 = modes['des-ede3-cbc'];
49384      module.exports = DES;
49385      inherits(DES, CipherBase);
49386
49387      function DES(opts) {
49388        CipherBase.call(this);
49389        var modeName = opts.mode.toLowerCase();
49390        var mode = modes[modeName];
49391        var type;
49392
49393        if (opts.decrypt) {
49394          type = 'decrypt';
49395        } else {
49396          type = 'encrypt';
49397        }
49398
49399        var key = opts.key;
49400
49401        if (!Buffer.isBuffer(key)) {
49402          key = Buffer.from(key);
49403        }
49404
49405        if (modeName === 'des-ede' || modeName === 'des-ede-cbc') {
49406          key = Buffer.concat([key, key.slice(0, 8)]);
49407        }
49408
49409        var iv = opts.iv;
49410
49411        if (!Buffer.isBuffer(iv)) {
49412          iv = Buffer.from(iv);
49413        }
49414
49415        this._des = mode.create({
49416          key: key,
49417          iv: iv,
49418          type: type
49419        });
49420      }
49421
49422      DES.prototype._update = function (data) {
49423        return Buffer.from(this._des.update(data));
49424      };
49425
49426      DES.prototype._final = function () {
49427        return Buffer.from(this._des.final());
49428      };
49429    }, {
49430      "cipher-base": 216,
49431      "des.js": 316,
49432      "inherits": 364,
49433      "safe-buffer": 470
49434    }],
49435    203: [function (require, module, exports) {
49436      exports['des-ecb'] = {
49437        key: 8,
49438        iv: 0
49439      };
49440      exports['des-cbc'] = exports.des = {
49441        key: 8,
49442        iv: 8
49443      };
49444      exports['des-ede3-cbc'] = exports.des3 = {
49445        key: 24,
49446        iv: 8
49447      };
49448      exports['des-ede3'] = {
49449        key: 24,
49450        iv: 0
49451      };
49452      exports['des-ede-cbc'] = {
49453        key: 16,
49454        iv: 8
49455      };
49456      exports['des-ede'] = {
49457        key: 16,
49458        iv: 0
49459      };
49460    }, {}],
49461    204: [function (require, module, exports) {
49462      (function (Buffer) {
49463        var bn = require('bn.js');
49464
49465        var randomBytes = require('randombytes');
49466
49467        module.exports = crt;
49468
49469        function blind(priv) {
49470          var r = getr(priv);
49471          var blinder = r.toRed(bn.mont(priv.modulus)).redPow(new bn(priv.publicExponent)).fromRed();
49472          return {
49473            blinder: blinder,
49474            unblinder: r.invm(priv.modulus)
49475          };
49476        }
49477
49478        function crt(msg, priv) {
49479          var blinds = blind(priv);
49480          var len = priv.modulus.byteLength();
49481          var mod = bn.mont(priv.modulus);
49482          var blinded = new bn(msg).mul(blinds.blinder).umod(priv.modulus);
49483          var c1 = blinded.toRed(bn.mont(priv.prime1));
49484          var c2 = blinded.toRed(bn.mont(priv.prime2));
49485          var qinv = priv.coefficient;
49486          var p = priv.prime1;
49487          var q = priv.prime2;
49488          var m1 = c1.redPow(priv.exponent1);
49489          var m2 = c2.redPow(priv.exponent2);
49490          m1 = m1.fromRed();
49491          m2 = m2.fromRed();
49492          var h = m1.isub(m2).imul(qinv).umod(p);
49493          h.imul(q);
49494          m2.iadd(h);
49495          return new Buffer(m2.imul(blinds.unblinder).umod(priv.modulus).toArray(false, len));
49496        }
49497
49498        crt.getr = getr;
49499
49500        function getr(priv) {
49501          var len = priv.modulus.byteLength();
49502          var r = new bn(randomBytes(len));
49503
49504          while (r.cmp(priv.modulus) >= 0 || !r.umod(priv.prime1) || !r.umod(priv.prime2)) {
49505            r = new bn(randomBytes(len));
49506          }
49507
49508          return r;
49509        }
49510      }).call(this, require("buffer").Buffer);
49511    }, {
49512      "bn.js": 205,
49513      "buffer": 214,
49514      "randombytes": 451
49515    }],
49516    205: [function (require, module, exports) {
49517      arguments[4][179][0].apply(exports, arguments);
49518    }, {
49519      "buffer": 183,
49520      "dup": 179
49521    }],
49522    206: [function (require, module, exports) {
49523      module.exports = require('./browser/algorithms.json');
49524    }, {
49525      "./browser/algorithms.json": 207
49526    }],
49527    207: [function (require, module, exports) {
49528      module.exports = {
49529        "sha224WithRSAEncryption": {
49530          "sign": "rsa",
49531          "hash": "sha224",
49532          "id": "302d300d06096086480165030402040500041c"
49533        },
49534        "RSA-SHA224": {
49535          "sign": "ecdsa/rsa",
49536          "hash": "sha224",
49537          "id": "302d300d06096086480165030402040500041c"
49538        },
49539        "sha256WithRSAEncryption": {
49540          "sign": "rsa",
49541          "hash": "sha256",
49542          "id": "3031300d060960864801650304020105000420"
49543        },
49544        "RSA-SHA256": {
49545          "sign": "ecdsa/rsa",
49546          "hash": "sha256",
49547          "id": "3031300d060960864801650304020105000420"
49548        },
49549        "sha384WithRSAEncryption": {
49550          "sign": "rsa",
49551          "hash": "sha384",
49552          "id": "3041300d060960864801650304020205000430"
49553        },
49554        "RSA-SHA384": {
49555          "sign": "ecdsa/rsa",
49556          "hash": "sha384",
49557          "id": "3041300d060960864801650304020205000430"
49558        },
49559        "sha512WithRSAEncryption": {
49560          "sign": "rsa",
49561          "hash": "sha512",
49562          "id": "3051300d060960864801650304020305000440"
49563        },
49564        "RSA-SHA512": {
49565          "sign": "ecdsa/rsa",
49566          "hash": "sha512",
49567          "id": "3051300d060960864801650304020305000440"
49568        },
49569        "RSA-SHA1": {
49570          "sign": "rsa",
49571          "hash": "sha1",
49572          "id": "3021300906052b0e03021a05000414"
49573        },
49574        "ecdsa-with-SHA1": {
49575          "sign": "ecdsa",
49576          "hash": "sha1",
49577          "id": ""
49578        },
49579        "sha256": {
49580          "sign": "ecdsa",
49581          "hash": "sha256",
49582          "id": ""
49583        },
49584        "sha224": {
49585          "sign": "ecdsa",
49586          "hash": "sha224",
49587          "id": ""
49588        },
49589        "sha384": {
49590          "sign": "ecdsa",
49591          "hash": "sha384",
49592          "id": ""
49593        },
49594        "sha512": {
49595          "sign": "ecdsa",
49596          "hash": "sha512",
49597          "id": ""
49598        },
49599        "DSA-SHA": {
49600          "sign": "dsa",
49601          "hash": "sha1",
49602          "id": ""
49603        },
49604        "DSA-SHA1": {
49605          "sign": "dsa",
49606          "hash": "sha1",
49607          "id": ""
49608        },
49609        "DSA": {
49610          "sign": "dsa",
49611          "hash": "sha1",
49612          "id": ""
49613        },
49614        "DSA-WITH-SHA224": {
49615          "sign": "dsa",
49616          "hash": "sha224",
49617          "id": ""
49618        },
49619        "DSA-SHA224": {
49620          "sign": "dsa",
49621          "hash": "sha224",
49622          "id": ""
49623        },
49624        "DSA-WITH-SHA256": {
49625          "sign": "dsa",
49626          "hash": "sha256",
49627          "id": ""
49628        },
49629        "DSA-SHA256": {
49630          "sign": "dsa",
49631          "hash": "sha256",
49632          "id": ""
49633        },
49634        "DSA-WITH-SHA384": {
49635          "sign": "dsa",
49636          "hash": "sha384",
49637          "id": ""
49638        },
49639        "DSA-SHA384": {
49640          "sign": "dsa",
49641          "hash": "sha384",
49642          "id": ""
49643        },
49644        "DSA-WITH-SHA512": {
49645          "sign": "dsa",
49646          "hash": "sha512",
49647          "id": ""
49648        },
49649        "DSA-SHA512": {
49650          "sign": "dsa",
49651          "hash": "sha512",
49652          "id": ""
49653        },
49654        "DSA-RIPEMD160": {
49655          "sign": "dsa",
49656          "hash": "rmd160",
49657          "id": ""
49658        },
49659        "ripemd160WithRSA": {
49660          "sign": "rsa",
49661          "hash": "rmd160",
49662          "id": "3021300906052b2403020105000414"
49663        },
49664        "RSA-RIPEMD160": {
49665          "sign": "rsa",
49666          "hash": "rmd160",
49667          "id": "3021300906052b2403020105000414"
49668        },
49669        "md5WithRSAEncryption": {
49670          "sign": "rsa",
49671          "hash": "md5",
49672          "id": "3020300c06082a864886f70d020505000410"
49673        },
49674        "RSA-MD5": {
49675          "sign": "rsa",
49676          "hash": "md5",
49677          "id": "3020300c06082a864886f70d020505000410"
49678        }
49679      };
49680    }, {}],
vendor: 13,498 bytes, lines 49681-50147
49681    208: [function (require, module, exports) {
49682      module.exports = {
49683        "1.3.132.0.10": "secp256k1",
49684        "1.3.132.0.33": "p224",
49685        "1.2.840.10045.3.1.1": "p192",
49686        "1.2.840.10045.3.1.7": "p256",
49687        "1.3.132.0.34": "p384",
49688        "1.3.132.0.35": "p521"
49689      };
49690    }, {}],
49691    209: [function (require, module, exports) {
49692      var Buffer = require('safe-buffer').Buffer;
49693
49694      var createHash = require('create-hash');
49695
49696      var stream = require('readable-stream');
49697
49698      var inherits = require('inherits');
49699
49700      var sign = require('./sign');
49701
49702      var verify = require('./verify');
49703
49704      var algorithms = require('./algorithms.json');
49705
49706      Object.keys(algorithms).forEach(function (key) {
49707        algorithms[key].id = Buffer.from(algorithms[key].id, 'hex');
49708        algorithms[key.toLowerCase()] = algorithms[key];
49709      });
49710
49711      function Sign(algorithm) {
49712        stream.Writable.call(this);
49713        var data = algorithms[algorithm];
49714        if (!data) throw new Error('Unknown message digest');
49715        this._hashType = data.hash;
49716        this._hash = createHash(data.hash);
49717        this._tag = data.id;
49718        this._signType = data.sign;
49719      }
49720
49721      inherits(Sign, stream.Writable);
49722
49723      Sign.prototype._write = function _write(data, _, done) {
49724        this._hash.update(data);
49725
49726        done();
49727      };
49728
49729      Sign.prototype.update = function update(data, enc) {
49730        if (typeof data === 'string') data = Buffer.from(data, enc);
49731
49732        this._hash.update(data);
49733
49734        return this;
49735      };
49736
49737      Sign.prototype.sign = function signMethod(key, enc) {
49738        this.end();
49739
49740        var hash = this._hash.digest();
49741
49742        var sig = sign(hash, key, this._hashType, this._signType, this._tag);
49743        return enc ? sig.toString(enc) : sig;
49744      };
49745
49746      function Verify(algorithm) {
49747        stream.Writable.call(this);
49748        var data = algorithms[algorithm];
49749        if (!data) throw new Error('Unknown message digest');
49750        this._hash = createHash(data.hash);
49751        this._tag = data.id;
49752        this._signType = data.sign;
49753      }
49754
49755      inherits(Verify, stream.Writable);
49756
49757      Verify.prototype._write = function _write(data, _, done) {
49758        this._hash.update(data);
49759
49760        done();
49761      };
49762
49763      Verify.prototype.update = function update(data, enc) {
49764        if (typeof data === 'string') data = Buffer.from(data, enc);
49765
49766        this._hash.update(data);
49767
49768        return this;
49769      };
49770
49771      Verify.prototype.verify = function verifyMethod(key, sig, enc) {
49772        if (typeof sig === 'string') sig = Buffer.from(sig, enc);
49773        this.end();
49774
49775        var hash = this._hash.digest();
49776
49777        return verify(sig, hash, key, this._signType, this._tag);
49778      };
49779
49780      function createSign(algorithm) {
49781        return new Sign(algorithm);
49782      }
49783
49784      function createVerify(algorithm) {
49785        return new Verify(algorithm);
49786      }
49787
49788      module.exports = {
49789        Sign: createSign,
49790        Verify: createVerify,
49791        createSign: createSign,
49792        createVerify: createVerify
49793      };
49794    }, {
49795      "./algorithms.json": 207,
49796      "./sign": 210,
49797      "./verify": 211,
49798      "create-hash": 308,
49799      "inherits": 364,
49800      "readable-stream": 467,
49801      "safe-buffer": 212
49802    }],
49803    210: [function (require, module, exports) {
49804      // much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js
49805      var Buffer = require('safe-buffer').Buffer;
49806
49807      var createHmac = require('create-hmac');
49808
49809      var crt = require('browserify-rsa');
49810
49811      var EC = require('elliptic').ec;
49812
49813      var BN = require('bn.js');
49814
49815      var parseKeys = require('parse-asn1');
49816
49817      var curves = require('./curves.json');
49818
49819      function sign(hash, key, hashType, signType, tag) {
49820        var priv = parseKeys(key);
49821
49822        if (priv.curve) {
49823          // rsa keys can be interpreted as ecdsa ones in openssl
49824          if (signType !== 'ecdsa' && signType !== 'ecdsa/rsa') throw new Error('wrong private key type');
49825          return ecSign(hash, priv);
49826        } else if (priv.type === 'dsa') {
49827          if (signType !== 'dsa') throw new Error('wrong private key type');
49828          return dsaSign(hash, priv, hashType);
49829        } else {
49830          if (signType !== 'rsa' && signType !== 'ecdsa/rsa') throw new Error('wrong private key type');
49831        }
49832
49833        hash = Buffer.concat([tag, hash]);
49834        var len = priv.modulus.byteLength();
49835        var pad = [0, 1];
49836
49837        while (hash.length + pad.length + 1 < len) {
49838          pad.push(0xff);
49839        }
49840
49841        pad.push(0x00);
49842        var i = -1;
49843
49844        while (++i < hash.length) {
49845          pad.push(hash[i]);
49846        }
49847
49848        var out = crt(pad, priv);
49849        return out;
49850      }
49851
49852      function ecSign(hash, priv) {
49853        var curveId = curves[priv.curve.join('.')];
49854        if (!curveId) throw new Error('unknown curve ' + priv.curve.join('.'));
49855        var curve = new EC(curveId);
49856        var key = curve.keyFromPrivate(priv.privateKey);
49857        var out = key.sign(hash);
49858        return Buffer.from(out.toDER());
49859      }
49860
49861      function dsaSign(hash, priv, algo) {
49862        var x = priv.params.priv_key;
49863        var p = priv.params.p;
49864        var q = priv.params.q;
49865        var g = priv.params.g;
49866        var r = new BN(0);
49867        var k;
49868        var H = bits2int(hash, q).mod(q);
49869        var s = false;
49870        var kv = getKey(x, q, hash, algo);
49871
49872        while (s === false) {
49873          k = makeKey(q, kv, algo);
49874          r = makeR(g, k, p, q);
49875          s = k.invm(q).imul(H.add(x.mul(r))).mod(q);
49876
49877          if (s.cmpn(0) === 0) {
49878            s = false;
49879            r = new BN(0);
49880          }
49881        }
49882
49883        return toDER(r, s);
49884      }
49885
49886      function toDER(r, s) {
49887        r = r.toArray();
49888        s = s.toArray(); // Pad values
49889
49890        if (r[0] & 0x80) r = [0].concat(r);
49891        if (s[0] & 0x80) s = [0].concat(s);
49892        var total = r.length + s.length + 4;
49893        var res = [0x30, total, 0x02, r.length];
49894        res = res.concat(r, [0x02, s.length], s);
49895        return Buffer.from(res);
49896      }
49897
49898      function getKey(x, q, hash, algo) {
49899        x = Buffer.from(x.toArray());
49900
49901        if (x.length < q.byteLength()) {
49902          var zeros = Buffer.alloc(q.byteLength() - x.length);
49903          x = Buffer.concat([zeros, x]);
49904        }
49905
49906        var hlen = hash.length;
49907        var hbits = bits2octets(hash, q);
49908        var v = Buffer.alloc(hlen);
49909        v.fill(1);
49910        var k = Buffer.alloc(hlen);
49911        k = createHmac(algo, k).update(v).update(Buffer.from([0])).update(x).update(hbits).digest();
49912        v = createHmac(algo, k).update(v).digest();
49913        k = createHmac(algo, k).update(v).update(Buffer.from([1])).update(x).update(hbits).digest();
49914        v = createHmac(algo, k).update(v).digest();
49915        return {
49916          k: k,
49917          v: v
49918        };
49919      }
49920
49921      function bits2int(obits, q) {
49922        var bits = new BN(obits);
49923        var shift = (obits.length << 3) - q.bitLength();
49924        if (shift > 0) bits.ishrn(shift);
49925        return bits;
49926      }
49927
49928      function bits2octets(bits, q) {
49929        bits = bits2int(bits, q);
49930        bits = bits.mod(q);
49931        var out = Buffer.from(bits.toArray());
49932
49933        if (out.length < q.byteLength()) {
49934          var zeros = Buffer.alloc(q.byteLength() - out.length);
49935          out = Buffer.concat([zeros, out]);
49936        }
49937
49938        return out;
49939      }
49940
49941      function makeKey(q, kv, algo) {
49942        var t;
49943        var k;
49944
49945        do {
49946          t = Buffer.alloc(0);
49947
49948          while (t.length * 8 < q.bitLength()) {
49949            kv.v = createHmac(algo, kv.k).update(kv.v).digest();
49950            t = Buffer.concat([t, kv.v]);
49951          }
49952
49953          k = bits2int(t, q);
49954          kv.k = createHmac(algo, kv.k).update(kv.v).update(Buffer.from([0])).digest();
49955          kv.v = createHmac(algo, kv.k).update(kv.v).digest();
49956        } while (k.cmp(q) !== -1);
49957
49958        return k;
49959      }
49960
49961      function makeR(g, k, p, q) {
49962        return g.toRed(BN.mont(p)).redPow(k).fromRed().mod(q);
49963      }
49964
49965      module.exports = sign;
49966      module.exports.getKey = getKey;
49967      module.exports.makeKey = makeKey;
49968    }, {
49969      "./curves.json": 208,
49970      "bn.js": 181,
49971      "browserify-rsa": 204,
49972      "create-hmac": 310,
49973      "elliptic": 327,
49974      "parse-asn1": 436,
49975      "safe-buffer": 212
49976    }],
49977    211: [function (require, module, exports) {
49978      // much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js
49979      var Buffer = require('safe-buffer').Buffer;
49980
49981      var BN = require('bn.js');
49982
49983      var EC = require('elliptic').ec;
49984
49985      var parseKeys = require('parse-asn1');
49986
49987      var curves = require('./curves.json');
49988
49989      function verify(sig, hash, key, signType, tag) {
49990        var pub = parseKeys(key);
49991
49992        if (pub.type === 'ec') {
49993          // rsa keys can be interpreted as ecdsa ones in openssl
49994          if (signType !== 'ecdsa' && signType !== 'ecdsa/rsa') throw new Error('wrong public key type');
49995          return ecVerify(sig, hash, pub);
49996        } else if (pub.type === 'dsa') {
49997          if (signType !== 'dsa') throw new Error('wrong public key type');
49998          return dsaVerify(sig, hash, pub);
49999        } else {
50000          if (signType !== 'rsa' && signType !== 'ecdsa/rsa') throw new Error('wrong public key type');
50001        }
50002
50003        hash = Buffer.concat([tag, hash]);
50004        var len = pub.modulus.byteLength();
50005        var pad = [1];
50006        var padNum = 0;
50007
50008        while (hash.length + pad.length + 2 < len) {
50009          pad.push(0xff);
50010          padNum++;
50011        }
50012
50013        pad.push(0x00);
50014        var i = -1;
50015
50016        while (++i < hash.length) {
50017          pad.push(hash[i]);
50018        }
50019
50020        pad = Buffer.from(pad);
50021        var red = BN.mont(pub.modulus);
50022        sig = new BN(sig).toRed(red);
50023        sig = sig.redPow(new BN(pub.publicExponent));
50024        sig = Buffer.from(sig.fromRed().toArray());
50025        var out = padNum < 8 ? 1 : 0;
50026        len = Math.min(sig.length, pad.length);
50027        if (sig.length !== pad.length) out = 1;
50028        i = -1;
50029
50030        while (++i < len) {
50031          out |= sig[i] ^ pad[i];
50032        }
50033
50034        return out === 0;
50035      }
50036
50037      function ecVerify(sig, hash, pub) {
50038        var curveId = curves[pub.data.algorithm.curve.join('.')];
50039        if (!curveId) throw new Error('unknown curve ' + pub.data.algorithm.curve.join('.'));
50040        var curve = new EC(curveId);
50041        var pubkey = pub.data.subjectPrivateKey.data;
50042        return curve.verify(hash, sig, pubkey);
50043      }
50044
50045      function dsaVerify(sig, hash, pub) {
50046        var p = pub.data.p;
50047        var q = pub.data.q;
50048        var g = pub.data.g;
50049        var y = pub.data.pub_key;
50050        var unpacked = parseKeys.signature.decode(sig, 'der');
50051        var s = unpacked.s;
50052        var r = unpacked.r;
50053        checkValue(s, q);
50054        checkValue(r, q);
50055        var montp = BN.mont(p);
50056        var w = s.invm(q);
50057        var v = g.toRed(montp).redPow(new BN(hash).mul(w).mod(q)).fromRed().mul(y.toRed(montp).redPow(r.mul(w).mod(q)).fromRed()).mod(p).mod(q);
50058        return v.cmp(r) === 0;
50059      }
50060
50061      function checkValue(b, q) {
50062        if (b.cmpn(0) <= 0) throw new Error('invalid sig');
50063        if (b.cmp(q) >= q) throw new Error('invalid sig');
50064      }
50065
50066      module.exports = verify;
50067    }, {
50068      "./curves.json": 208,
50069      "bn.js": 181,
50070      "elliptic": 327,
50071      "parse-asn1": 436,
50072      "safe-buffer": 212
50073    }],
50074    212: [function (require, module, exports) {
50075      /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
50076
50077      /* eslint-disable node/no-deprecated-api */
50078      var buffer = require('buffer');
50079
50080      var Buffer = buffer.Buffer; // alternative to using Object.keys for old browsers
50081
50082      function copyProps(src, dst) {
50083        for (var key in src) {
50084          dst[key] = src[key];
50085        }
50086      }
50087
50088      if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
50089        module.exports = buffer;
50090      } else {
50091        // Copy properties from require('buffer')
50092        copyProps(buffer, exports);
50093        exports.Buffer = SafeBuffer;
50094      }
50095
50096      function SafeBuffer(arg, encodingOrOffset, length) {
50097        return Buffer(arg, encodingOrOffset, length);
50098      }
50099
50100      SafeBuffer.prototype = Object.create(Buffer.prototype); // Copy static methods from Buffer
50101
50102      copyProps(Buffer, SafeBuffer);
50103
50104      SafeBuffer.from = function (arg, encodingOrOffset, length) {
50105        if (typeof arg === 'number') {
50106          throw new TypeError('Argument must not be a number');
50107        }
50108
50109        return Buffer(arg, encodingOrOffset, length);
50110      };
50111
50112      SafeBuffer.alloc = function (size, fill, encoding) {
50113        if (typeof size !== 'number') {
50114          throw new TypeError('Argument must be a number');
50115        }
50116
50117        var buf = Buffer(size);
50118
50119        if (fill !== undefined) {
50120          if (typeof encoding === 'string') {
50121            buf.fill(fill, encoding);
50122          } else {
50123            buf.fill(fill);
50124          }
50125        } else {
50126          buf.fill(0);
50127        }
50128
50129        return buf;
50130      };
50131
50132      SafeBuffer.allocUnsafe = function (size) {
50133        if (typeof size !== 'number') {
50134          throw new TypeError('Argument must be a number');
50135        }
50136
50137        return Buffer(size);
50138      };
50139
50140      SafeBuffer.allocUnsafeSlow = function (size) {
50141        if (typeof size !== 'number') {
50142          throw new TypeError('Argument must be a number');
50143        }
50144
50145        return buffer.SlowBuffer(size);
50146      };
50147    }, {
vendor: 6,955 bytes, lines 50148-50333
50148      "buffer": 214
50149    }],
50150    213: [function (require, module, exports) {
50151      arguments[4][183][0].apply(exports, arguments);
50152    }, {
50153      "dup": 183
50154    }],
50155    214: [function (require, module, exports) {
50156      (function (Buffer) {
50157        /*!
50158         * The buffer module from node.js, for the browser.
50159         *
50160         * @author   Feross Aboukhadijeh <https://feross.org>
50161         * @license  MIT
50162         */
50163
50164        /* eslint-disable no-proto */
50165        'use strict';
50166
50167        var base64 = require('base64-js');
50168
50169        var ieee754 = require('ieee754');
50170
50171        exports.Buffer = Buffer;
50172        exports.SlowBuffer = SlowBuffer;
50173        exports.INSPECT_MAX_BYTES = 50;
50174        var K_MAX_LENGTH = 0x7fffffff;
50175        exports.kMaxLength = K_MAX_LENGTH;
50176        /**
50177         * If `Buffer.TYPED_ARRAY_SUPPORT`:
50178         *   === true    Use Uint8Array implementation (fastest)
50179         *   === false   Print warning and recommend using `buffer` v4.x which has an Object
50180         *               implementation (most compatible, even IE6)
50181         *
50182         * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
50183         * Opera 11.6+, iOS 4.2+.
50184         *
50185         * We report that the browser does not support typed arrays if the are not subclassable
50186         * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`
50187         * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support
50188         * for __proto__ and has a buggy typed array implementation.
50189         */
50190
50191        Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport();
50192
50193        if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' && typeof console.error === 'function') {
50194          console.error('This browser lacks typed array (Uint8Array) support which is required by ' + '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.');
50195        }
50196
50197        function typedArraySupport() {
50198          // Can typed array instances can be augmented?
50199          try {
50200            var arr = new Uint8Array(1);
50201            arr.__proto__ = {
50202              __proto__: Uint8Array.prototype,
50203              foo: function foo() {
50204                return 42;
50205              }
50206            };
50207            return arr.foo() === 42;
50208          } catch (e) {
50209            return false;
50210          }
50211        }
50212
50213        Object.defineProperty(Buffer.prototype, 'parent', {
50214          enumerable: true,
50215          get: function get() {
50216            if (!Buffer.isBuffer(this)) return undefined;
50217            return this.buffer;
50218          }
50219        });
50220        Object.defineProperty(Buffer.prototype, 'offset', {
50221          enumerable: true,
50222          get: function get() {
50223            if (!Buffer.isBuffer(this)) return undefined;
50224            return this.byteOffset;
50225          }
50226        });
50227
50228        function createBuffer(length) {
50229          if (length > K_MAX_LENGTH) {
50230            throw new RangeError('The value "' + length + '" is invalid for option "size"');
50231          } // Return an augmented `Uint8Array` instance
50232
50233
50234          var buf = new Uint8Array(length);
50235          buf.__proto__ = Buffer.prototype;
50236          return buf;
50237        }
50238        /**
50239         * The Buffer constructor returns instances of `Uint8Array` that have their
50240         * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
50241         * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
50242         * and the `Uint8Array` methods. Square bracket notation works as expected -- it
50243         * returns a single octet.
50244         *
50245         * The `Uint8Array` prototype remains unmodified.
50246         */
50247
50248
50249        function Buffer(arg, encodingOrOffset, length) {
50250          // Common case.
50251          if (typeof arg === 'number') {
50252            if (typeof encodingOrOffset === 'string') {
50253              throw new TypeError('The "string" argument must be of type string. Received type number');
50254            }
50255
50256            return allocUnsafe(arg);
50257          }
50258
50259          return from(arg, encodingOrOffset, length);
50260        } // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
50261
50262
50263        if (typeof Symbol !== 'undefined' && Symbol.species != null && Buffer[Symbol.species] === Buffer) {
50264          Object.defineProperty(Buffer, Symbol.species, {
50265            value: null,
50266            configurable: true,
50267            enumerable: false,
50268            writable: false
50269          });
50270        }
50271
50272        Buffer.poolSize = 8192; // not used by this implementation
50273
50274        function from(value, encodingOrOffset, length) {
50275          if (typeof value === 'string') {
50276            return fromString(value, encodingOrOffset);
50277          }
50278
50279          if (ArrayBuffer.isView(value)) {
50280            return fromArrayLike(value);
50281          }
50282
50283          if (value == null) {
50284            throw TypeError('The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + 'or Array-like Object. Received type ' + _typeof2(value));
50285          }
50286
50287          if (isInstance(value, ArrayBuffer) || value && isInstance(value.buffer, ArrayBuffer)) {
50288            return fromArrayBuffer(value, encodingOrOffset, length);
50289          }
50290
50291          if (typeof value === 'number') {
50292            throw new TypeError('The "value" argument must not be of type number. Received type number');
50293          }
50294
50295          var valueOf = value.valueOf && value.valueOf();
50296
50297          if (valueOf != null && valueOf !== value) {
50298            return Buffer.from(valueOf, encodingOrOffset, length);
50299          }
50300
50301          var b = fromObject(value);
50302          if (b) return b;
50303
50304          if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === 'function') {
50305            return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length);
50306          }
50307
50308          throw new TypeError('The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + 'or Array-like Object. Received type ' + _typeof2(value));
50309        }
50310        /**
50311         * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
50312         * if value is a number.
50313         * Buffer.from(str[, encoding])
50314         * Buffer.from(array)
50315         * Buffer.from(buffer)
50316         * Buffer.from(arrayBuffer[, byteOffset[, length]])
50317         **/
50318
50319
50320        Buffer.from = function (value, encodingOrOffset, length) {
50321          return from(value, encodingOrOffset, length);
50322        }; // Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:
50323        // https://github.com/feross/buffer/pull/148
50324
50325
50326        Buffer.prototype.__proto__ = Uint8Array.prototype;
50327        Buffer.__proto__ = Uint8Array;
50328
50329        function assertSize(size) {
50330          if (typeof size !== 'number') {
50331            throw new TypeError('"size" argument must be of type number');
50332          } else if (size < 0) {
50333            throw new RangeError('The value "' + size + '" is invali
vendor: 4,267 bytes, lines 50333-50472
50333d for option "size"');
50334          }
50335        }
50336
50337        function alloc(size, fill, encoding) {
50338          assertSize(size);
50339
50340          if (size <= 0) {
50341            return createBuffer(size);
50342          }
50343
50344          if (fill !== undefined) {
50345            // Only pay attention to encoding if it's a string. This
50346            // prevents accidentally sending in a number that would
50347            // be interpretted as a start offset.
50348            return typeof encoding === 'string' ? createBuffer(size).fill(fill, encoding) : createBuffer(size).fill(fill);
50349          }
50350
50351          return createBuffer(size);
50352        }
50353        /**
50354         * Creates a new filled Buffer instance.
50355         * alloc(size[, fill[, encoding]])
50356         **/
50357
50358
50359        Buffer.alloc = function (size, fill, encoding) {
50360          return alloc(size, fill, encoding);
50361        };
50362
50363        function allocUnsafe(size) {
50364          assertSize(size);
50365          return createBuffer(size < 0 ? 0 : checked(size) | 0);
50366        }
50367        /**
50368         * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
50369         * */
50370
50371
50372        Buffer.allocUnsafe = function (size) {
50373          return allocUnsafe(size);
50374        };
50375        /**
50376         * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
50377         */
50378
50379
50380        Buffer.allocUnsafeSlow = function (size) {
50381          return allocUnsafe(size);
50382        };
50383
50384        function fromString(string, encoding) {
50385          if (typeof encoding !== 'string' || encoding === '') {
50386            encoding = 'utf8';
50387          }
50388
50389          if (!Buffer.isEncoding(encoding)) {
50390            throw new TypeError('Unknown encoding: ' + encoding);
50391          }
50392
50393          var length = byteLength(string, encoding) | 0;
50394          var buf = createBuffer(length);
50395          var actual = buf.write(string, encoding);
50396
50397          if (actual !== length) {
50398            // Writing a hex string, for example, that contains invalid characters will
50399            // cause everything after the first invalid character to be ignored. (e.g.
50400            // 'abxxcd' will be treated as 'ab')
50401            buf = buf.slice(0, actual);
50402          }
50403
50404          return buf;
50405        }
50406
50407        function fromArrayLike(array) {
50408          var length = array.length < 0 ? 0 : checked(array.length) | 0;
50409          var buf = createBuffer(length);
50410
50411          for (var i = 0; i < length; i += 1) {
50412            buf[i] = array[i] & 255;
50413          }
50414
50415          return buf;
50416        }
50417
50418        function fromArrayBuffer(array, byteOffset, length) {
50419          if (byteOffset < 0 || array.byteLength < byteOffset) {
50420            throw new RangeError('"offset" is outside of buffer bounds');
50421          }
50422
50423          if (array.byteLength < byteOffset + (length || 0)) {
50424            throw new RangeError('"length" is outside of buffer bounds');
50425          }
50426
50427          var buf;
50428
50429          if (byteOffset === undefined && length === undefined) {
50430            buf = new Uint8Array(array);
50431          } else if (length === undefined) {
50432            buf = new Uint8Array(array, byteOffset);
50433          } else {
50434            buf = new Uint8Array(array, byteOffset, length);
50435          } // Return an augmented `Uint8Array` instance
50436
50437
50438          buf.__proto__ = Buffer.prototype;
50439          return buf;
50440        }
50441
50442        function fromObject(obj) {
50443          if (Buffer.isBuffer(obj)) {
50444            var len = checked(obj.length) | 0;
50445            var buf = createBuffer(len);
50446
50447            if (buf.length === 0) {
50448              return buf;
50449            }
50450
50451            obj.copy(buf, 0, 0, len);
50452            return buf;
50453          }
50454
50455          if (obj.length !== undefined) {
50456            if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {
50457              return createBuffer(0);
50458            }
50459
50460            return fromArrayLike(obj);
50461          }
50462
50463          if (obj.type === 'Buffer' && Array.isArray(obj.data)) {
50464            return fromArrayLike(obj.data);
50465          }
50466        }
50467
50468        function checked(length) {
50469          // Note: cannot use `length < K_MAX_LENGTH` here because that fails when
50470          // length is NaN (which is otherwise coerced to zero.)
50471          if (length >= K_MAX_LENGTH) {
50472            throw new RangeError('Attempt to allocate Buffer larger than maximum ' + '
vendor: 8,944 bytes, lines 50472-50776
50472size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes');
50473          }
50474
50475          return length | 0;
50476        }
50477
50478        function SlowBuffer(length) {
50479          if (+length != length) {
50480            // eslint-disable-line eqeqeq
50481            length = 0;
50482          }
50483
50484          return Buffer.alloc(+length);
50485        }
50486
50487        Buffer.isBuffer = function isBuffer(b) {
50488          return b != null && b._isBuffer === true && b !== Buffer.prototype; // so Buffer.isBuffer(Buffer.prototype) will be false
50489        };
50490
50491        Buffer.compare = function compare(a, b) {
50492          if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength);
50493          if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength);
50494
50495          if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
50496            throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');
50497          }
50498
50499          if (a === b) return 0;
50500          var x = a.length;
50501          var y = b.length;
50502
50503          for (var i = 0, len = Math.min(x, y); i < len; ++i) {
50504            if (a[i] !== b[i]) {
50505              x = a[i];
50506              y = b[i];
50507              break;
50508            }
50509          }
50510
50511          if (x < y) return -1;
50512          if (y < x) return 1;
50513          return 0;
50514        };
50515
50516        Buffer.isEncoding = function isEncoding(encoding) {
50517          switch (String(encoding).toLowerCase()) {
50518            case 'hex':
50519            case 'utf8':
50520            case 'utf-8':
50521            case 'ascii':
50522            case 'latin1':
50523            case 'binary':
50524            case 'base64':
50525            case 'ucs2':
50526            case 'ucs-2':
50527            case 'utf16le':
50528            case 'utf-16le':
50529              return true;
50530
50531            default:
50532              return false;
50533          }
50534        };
50535
50536        Buffer.concat = function concat(list, length) {
50537          if (!Array.isArray(list)) {
50538            throw new TypeError('"list" argument must be an Array of Buffers');
50539          }
50540
50541          if (list.length === 0) {
50542            return Buffer.alloc(0);
50543          }
50544
50545          var i;
50546
50547          if (length === undefined) {
50548            length = 0;
50549
50550            for (i = 0; i < list.length; ++i) {
50551              length += list[i].length;
50552            }
50553          }
50554
50555          var buffer = Buffer.allocUnsafe(length);
50556          var pos = 0;
50557
50558          for (i = 0; i < list.length; ++i) {
50559            var buf = list[i];
50560
50561            if (isInstance(buf, Uint8Array)) {
50562              buf = Buffer.from(buf);
50563            }
50564
50565            if (!Buffer.isBuffer(buf)) {
50566              throw new TypeError('"list" argument must be an Array of Buffers');
50567            }
50568
50569            buf.copy(buffer, pos);
50570            pos += buf.length;
50571          }
50572
50573          return buffer;
50574        };
50575
50576        function byteLength(string, encoding) {
50577          if (Buffer.isBuffer(string)) {
50578            return string.length;
50579          }
50580
50581          if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {
50582            return string.byteLength;
50583          }
50584
50585          if (typeof string !== 'string') {
50586            throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' + 'Received type ' + _typeof2(string));
50587          }
50588
50589          var len = string.length;
50590          var mustMatch = arguments.length > 2 && arguments[2] === true;
50591          if (!mustMatch && len === 0) return 0; // Use a for loop to avoid recursion
50592
50593          var loweredCase = false;
50594
50595          for (;;) {
50596            switch (encoding) {
50597              case 'ascii':
50598              case 'latin1':
50599              case 'binary':
50600                return len;
50601
50602              case 'utf8':
50603              case 'utf-8':
50604                return utf8ToBytes(string).length;
50605
50606              case 'ucs2':
50607              case 'ucs-2':
50608              case 'utf16le':
50609              case 'utf-16le':
50610                return len * 2;
50611
50612              case 'hex':
50613                return len >>> 1;
50614
50615              case 'base64':
50616                return base64ToBytes(string).length;
50617
50618              default:
50619                if (loweredCase) {
50620                  return mustMatch ? -1 : utf8ToBytes(string).length; // assume utf8
50621                }
50622
50623                encoding = ('' + encoding).toLowerCase();
50624                loweredCase = true;
50625            }
50626          }
50627        }
50628
50629        Buffer.byteLength = byteLength;
50630
50631        function slowToString(encoding, start, end) {
50632          var loweredCase = false; // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
50633          // property of a typed array.
50634          // This behaves neither like String nor Uint8Array in that we set start/end
50635          // to their upper/lower bounds if the value passed is out of range.
50636          // undefined is handled specially as per ECMA-262 6th Edition,
50637          // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
50638
50639          if (start === undefined || start < 0) {
50640            start = 0;
50641          } // Return early if start > this.length. Done here to prevent potential uint32
50642          // coercion fail below.
50643
50644
50645          if (start > this.length) {
50646            return '';
50647          }
50648
50649          if (end === undefined || end > this.length) {
50650            end = this.length;
50651          }
50652
50653          if (end <= 0) {
50654            return '';
50655          } // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
50656
50657
50658          end >>>= 0;
50659          start >>>= 0;
50660
50661          if (end <= start) {
50662            return '';
50663          }
50664
50665          if (!encoding) encoding = 'utf8';
50666
50667          while (true) {
50668            switch (encoding) {
50669              case 'hex':
50670                return hexSlice(this, start, end);
50671
50672              case 'utf8':
50673              case 'utf-8':
50674                return utf8Slice(this, start, end);
50675
50676              case 'ascii':
50677                return asciiSlice(this, start, end);
50678
50679              case 'latin1':
50680              case 'binary':
50681                return latin1Slice(this, start, end);
50682
50683              case 'base64':
50684                return base64Slice(this, start, end);
50685
50686              case 'ucs2':
50687              case 'ucs-2':
50688              case 'utf16le':
50689              case 'utf-16le':
50690                return utf16leSlice(this, start, end);
50691
50692              default:
50693                if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding);
50694                encoding = (encoding + '').toLowerCase();
50695                loweredCase = true;
50696            }
50697          }
50698        } // This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)
50699        // to detect a Buffer instance. It's not possible to use `instanceof Buffer`
50700        // reliably in a browserify context because there could be multiple different
50701        // copies of the 'buffer' package in use. This method works even for Buffer
50702        // instances that were created from another copy of the `buffer` package.
50703        // See: https://github.com/feross/buffer/issues/154
50704
50705
50706        Buffer.prototype._isBuffer = true;
50707
50708        function swap(b, n, m) {
50709          var i = b[n];
50710          b[n] = b[m];
50711          b[m] = i;
50712        }
50713
50714        Buffer.prototype.swap16 = function swap16() {
50715          var len = this.length;
50716
50717          if (len % 2 !== 0) {
50718            throw new RangeError('Buffer size must be a multiple of 16-bits');
50719          }
50720
50721          for (var i = 0; i < len; i += 2) {
50722            swap(this, i, i + 1);
50723          }
50724
50725          return this;
50726        };
50727
50728        Buffer.prototype.swap32 = function swap32() {
50729          var len = this.length;
50730
50731          if (len % 4 !== 0) {
50732            throw new RangeError('Buffer size must be a multiple of 32-bits');
50733          }
50734
50735          for (var i = 0; i < len; i += 4) {
50736            swap(this, i, i + 3);
50737            swap(this, i + 1, i + 2);
50738          }
50739
50740          return this;
50741        };
50742
50743        Buffer.prototype.swap64 = function swap64() {
50744          var len = this.length;
50745
50746          if (len % 8 !== 0) {
50747            throw new RangeError('Buffer size must be a multiple of 64-bits');
50748          }
50749
50750          for (var i = 0; i < len; i += 8) {
50751            swap(this, i, i + 7);
50752            swap(this, i + 1, i + 6);
50753            swap(this, i + 2, i + 5);
50754            swap(this, i + 3, i + 4);
50755          }
50756
50757          return this;
50758        };
50759
50760        Buffer.prototype.toString = function toString() {
50761          var length = this.length;
50762          if (length === 0) return '';
50763          if (arguments.length === 0) return utf8Slice(this, 0, length);
50764          return slowToString.apply(this, arguments);
50765        };
50766
50767        Buffer.prototype.toLocaleString = Buffer.prototype.toString;
50768
50769        Buffer.prototype.equals = function equals(b) {
50770          if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer');
50771          if (this === b) return true;
50772          return Buffer.compare(this, b) === 0;
50773        };
50774
50775        Buffer.prototype.inspect = function inspect() {
50776          var str = '';
vendor: 3,926 bytes, lines 50777-50893
50777          var max = exports.INSPECT_MAX_BYTES;
50778          str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim();
50779          if (this.length > max) str += ' ... ';
50780          return '<Buffer ' + str + '>';
50781        };
50782
50783        Buffer.prototype.compare = function compare(target, start, end, thisStart, thisEnd) {
50784          if (isInstance(target, Uint8Array)) {
50785            target = Buffer.from(target, target.offset, target.byteLength);
50786          }
50787
50788          if (!Buffer.isBuffer(target)) {
50789            throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. ' + 'Received type ' + _typeof2(target));
50790          }
50791
50792          if (start === undefined) {
50793            start = 0;
50794          }
50795
50796          if (end === undefined) {
50797            end = target ? target.length : 0;
50798          }
50799
50800          if (thisStart === undefined) {
50801            thisStart = 0;
50802          }
50803
50804          if (thisEnd === undefined) {
50805            thisEnd = this.length;
50806          }
50807
50808          if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
50809            throw new RangeError('out of range index');
50810          }
50811
50812          if (thisStart >= thisEnd && start >= end) {
50813            return 0;
50814          }
50815
50816          if (thisStart >= thisEnd) {
50817            return -1;
50818          }
50819
50820          if (start >= end) {
50821            return 1;
50822          }
50823
50824          start >>>= 0;
50825          end >>>= 0;
50826          thisStart >>>= 0;
50827          thisEnd >>>= 0;
50828          if (this === target) return 0;
50829          var x = thisEnd - thisStart;
50830          var y = end - start;
50831          var len = Math.min(x, y);
50832          var thisCopy = this.slice(thisStart, thisEnd);
50833          var targetCopy = target.slice(start, end);
50834
50835          for (var i = 0; i < len; ++i) {
50836            if (thisCopy[i] !== targetCopy[i]) {
50837              x = thisCopy[i];
50838              y = targetCopy[i];
50839              break;
50840            }
50841          }
50842
50843          if (x < y) return -1;
50844          if (y < x) return 1;
50845          return 0;
50846        }; // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
50847        // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
50848        //
50849        // Arguments:
50850        // - buffer - a Buffer to search
50851        // - val - a string, Buffer, or number
50852        // - byteOffset - an index into `buffer`; will be clamped to an int32
50853        // - encoding - an optional encoding, relevant is val is a string
50854        // - dir - true for indexOf, false for lastIndexOf
50855
50856
50857        function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {
50858          // Empty buffer means no match
50859          if (buffer.length === 0) return -1; // Normalize byteOffset
50860
50861          if (typeof byteOffset === 'string') {
50862            encoding = byteOffset;
50863            byteOffset = 0;
50864          } else if (byteOffset > 0x7fffffff) {
50865            byteOffset = 0x7fffffff;
50866          } else if (byteOffset < -0x80000000) {
50867            byteOffset = -0x80000000;
50868          }
50869
50870          byteOffset = +byteOffset; // Coerce to Number.
50871
50872          if (numberIsNaN(byteOffset)) {
50873            // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
50874            byteOffset = dir ? 0 : buffer.length - 1;
50875          } // Normalize byteOffset: negative offsets start from the end of the buffer
50876
50877
50878          if (byteOffset < 0) byteOffset = buffer.length + byteOffset;
50879
50880          if (byteOffset >= buffer.length) {
50881            if (dir) return -1;else byteOffset = buffer.length - 1;
50882          } else if (byteOffset < 0) {
50883            if (dir) byteOffset = 0;else return -1;
50884          } // Normalize val
50885
50886
50887          if (typeof val === 'string') {
50888            val = Buffer.from(val, encoding);
50889          } // Finally, search either indexOf (if dir is true) or lastIndexOf
50890
50891
50892          if (Buffer.isBuffer(val)) {
50893            // Special case: looking for empty string/buffer always fail
vendor: 9,979 bytes, lines 50893-51194
50893s
50894            if (val.length === 0) {
50895              return -1;
50896            }
50897
50898            return arrayIndexOf(buffer, val, byteOffset, encoding, dir);
50899          } else if (typeof val === 'number') {
50900            val = val & 0xFF; // Search for a byte value [0-255]
50901
50902            if (typeof Uint8Array.prototype.indexOf === 'function') {
50903              if (dir) {
50904                return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset);
50905              } else {
50906                return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset);
50907              }
50908            }
50909
50910            return arrayIndexOf(buffer, [val], byteOffset, encoding, dir);
50911          }
50912
50913          throw new TypeError('val must be string, number or Buffer');
50914        }
50915
50916        function arrayIndexOf(arr, val, byteOffset, encoding, dir) {
50917          var indexSize = 1;
50918          var arrLength = arr.length;
50919          var valLength = val.length;
50920
50921          if (encoding !== undefined) {
50922            encoding = String(encoding).toLowerCase();
50923
50924            if (encoding === 'ucs2' || encoding === 'ucs-2' || encoding === 'utf16le' || encoding === 'utf-16le') {
50925              if (arr.length < 2 || val.length < 2) {
50926                return -1;
50927              }
50928
50929              indexSize = 2;
50930              arrLength /= 2;
50931              valLength /= 2;
50932              byteOffset /= 2;
50933            }
50934          }
50935
50936          function read(buf, i) {
50937            if (indexSize === 1) {
50938              return buf[i];
50939            } else {
50940              return buf.readUInt16BE(i * indexSize);
50941            }
50942          }
50943
50944          var i;
50945
50946          if (dir) {
50947            var foundIndex = -1;
50948
50949            for (i = byteOffset; i < arrLength; i++) {
50950              if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
50951                if (foundIndex === -1) foundIndex = i;
50952                if (i - foundIndex + 1 === valLength) return foundIndex * indexSize;
50953              } else {
50954                if (foundIndex !== -1) i -= i - foundIndex;
50955                foundIndex = -1;
50956              }
50957            }
50958          } else {
50959            if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;
50960
50961            for (i = byteOffset; i >= 0; i--) {
50962              var found = true;
50963
50964              for (var j = 0; j < valLength; j++) {
50965                if (read(arr, i + j) !== read(val, j)) {
50966                  found = false;
50967                  break;
50968                }
50969              }
50970
50971              if (found) return i;
50972            }
50973          }
50974
50975          return -1;
50976        }
50977
50978        Buffer.prototype.includes = function includes(val, byteOffset, encoding) {
50979          return this.indexOf(val, byteOffset, encoding) !== -1;
50980        };
50981
50982        Buffer.prototype.indexOf = function indexOf(val, byteOffset, encoding) {
50983          return bidirectionalIndexOf(this, val, byteOffset, encoding, true);
50984        };
50985
50986        Buffer.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) {
50987          return bidirectionalIndexOf(this, val, byteOffset, encoding, false);
50988        };
50989
50990        function hexWrite(buf, string, offset, length) {
50991          offset = Number(offset) || 0;
50992          var remaining = buf.length - offset;
50993
50994          if (!length) {
50995            length = remaining;
50996          } else {
50997            length = Number(length);
50998
50999            if (length > remaining) {
51000              length = remaining;
51001            }
51002          }
51003
51004          var strLen = string.length;
51005
51006          if (length > strLen / 2) {
51007            length = strLen / 2;
51008          }
51009
51010          for (var i = 0; i < length; ++i) {
51011            var parsed = parseInt(string.substr(i * 2, 2), 16);
51012            if (numberIsNaN(parsed)) return i;
51013            buf[offset + i] = parsed;
51014          }
51015
51016          return i;
51017        }
51018
51019        function utf8Write(buf, string, offset, length) {
51020          return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length);
51021        }
51022
51023        function asciiWrite(buf, string, offset, length) {
51024          return blitBuffer(asciiToBytes(string), buf, offset, length);
51025        }
51026
51027        function latin1Write(buf, string, offset, length) {
51028          return asciiWrite(buf, string, offset, length);
51029        }
51030
51031        function base64Write(buf, string, offset, length) {
51032          return blitBuffer(base64ToBytes(string), buf, offset, length);
51033        }
51034
51035        function ucs2Write(buf, string, offset, length) {
51036          return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length);
51037        }
51038
51039        Buffer.prototype.write = function write(string, offset, length, encoding) {
51040          // Buffer#write(string)
51041          if (offset === undefined) {
51042            encoding = 'utf8';
51043            length = this.length;
51044            offset = 0; // Buffer#write(string, encoding)
51045          } else if (length === undefined && typeof offset === 'string') {
51046            encoding = offset;
51047            length = this.length;
51048            offset = 0; // Buffer#write(string, offset[, length][, encoding])
51049          } else if (isFinite(offset)) {
51050            offset = offset >>> 0;
51051
51052            if (isFinite(length)) {
51053              length = length >>> 0;
51054              if (encoding === undefined) encoding = 'utf8';
51055            } else {
51056              encoding = length;
51057              length = undefined;
51058            }
51059          } else {
51060            throw new Error('Buffer.write(string, encoding, offset[, length]) is no longer supported');
51061          }
51062
51063          var remaining = this.length - offset;
51064          if (length === undefined || length > remaining) length = remaining;
51065
51066          if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) {
51067            throw new RangeError('Attempt to write outside buffer bounds');
51068          }
51069
51070          if (!encoding) encoding = 'utf8';
51071          var loweredCase = false;
51072
51073          for (;;) {
51074            switch (encoding) {
51075              case 'hex':
51076                return hexWrite(this, string, offset, length);
51077
51078              case 'utf8':
51079              case 'utf-8':
51080                return utf8Write(this, string, offset, length);
51081
51082              case 'ascii':
51083                return asciiWrite(this, string, offset, length);
51084
51085              case 'latin1':
51086              case 'binary':
51087                return latin1Write(this, string, offset, length);
51088
51089              case 'base64':
51090                // Warning: maxLength not taken into account in base64Write
51091                return base64Write(this, string, offset, length);
51092
51093              case 'ucs2':
51094              case 'ucs-2':
51095              case 'utf16le':
51096              case 'utf-16le':
51097                return ucs2Write(this, string, offset, length);
51098
51099              default:
51100                if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding);
51101                encoding = ('' + encoding).toLowerCase();
51102                loweredCase = true;
51103            }
51104          }
51105        };
51106
51107        Buffer.prototype.toJSON = function toJSON() {
51108          return {
51109            type: 'Buffer',
51110            data: Array.prototype.slice.call(this._arr || this, 0)
51111          };
51112        };
51113
51114        function base64Slice(buf, start, end) {
51115          if (start === 0 && end === buf.length) {
51116            return base64.fromByteArray(buf);
51117          } else {
51118            return base64.fromByteArray(buf.slice(start, end));
51119          }
51120        }
51121
51122        function utf8Slice(buf, start, end) {
51123          end = Math.min(buf.length, end);
51124          var res = [];
51125          var i = start;
51126
51127          while (i < end) {
51128            var firstByte = buf[i];
51129            var codePoint = null;
51130            var bytesPerSequence = firstByte > 0xEF ? 4 : firstByte > 0xDF ? 3 : firstByte > 0xBF ? 2 : 1;
51131
51132            if (i + bytesPerSequence <= end) {
51133              var secondByte, thirdByte, fourthByte, tempCodePoint;
51134
51135              switch (bytesPerSequence) {
51136                case 1:
51137                  if (firstByte < 0x80) {
51138                    codePoint = firstByte;
51139                  }
51140
51141                  break;
51142
51143                case 2:
51144                  secondByte = buf[i + 1];
51145
51146                  if ((secondByte & 0xC0) === 0x80) {
51147                    tempCodePoint = (firstByte & 0x1F) << 0x6 | secondByte & 0x3F;
51148
51149                    if (tempCodePoint > 0x7F) {
51150                      codePoint = tempCodePoint;
51151                    }
51152                  }
51153
51154                  break;
51155
51156                case 3:
51157                  secondByte = buf[i + 1];
51158                  thirdByte = buf[i + 2];
51159
51160                  if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
51161                    tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | thirdByte & 0x3F;
51162
51163                    if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
51164                      codePoint = tempCodePoint;
51165                    }
51166                  }
51167
51168                  break;
51169
51170                case 4:
51171                  secondByte = buf[i + 1];
51172                  thirdByte = buf[i + 2];
51173                  fourthByte = buf[i + 3];
51174
51175                  if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
51176                    tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | fourthByte & 0x3F;
51177
51178                    if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
51179                      codePoint = tempCodePoint;
51180                    }
51181                  }
51182
51183              }
51184            }
51185
51186            if (codePoint === null) {
51187              // we did not generate a valid codePoint so insert a
51188              // replacement char (U+FFFD) and advance only 1 byte
51189              codePoint = 0xFFFD;
51190              bytesPerSequence = 1;
51191            } else if (codePoint > 0xFFFF) {
51192              // encode to utf16 (surrogate pair dance)
51193              codePoint -= 0x10000;
51194              res.push(codePoint >>>
vendor: 19,000 bytes, lines 51194-51734
51194 10 & 0x3FF | 0xD800);
51195              codePoint = 0xDC00 | codePoint & 0x3FF;
51196            }
51197
51198            res.push(codePoint);
51199            i += bytesPerSequence;
51200          }
51201
51202          return decodeCodePointsArray(res);
51203        } // Based on http://stackoverflow.com/a/22747272/680742, the browser with
51204        // the lowest limit is Chrome, with 0x10000 args.
51205        // We go 1 magnitude less, for safety
51206
51207
51208        var MAX_ARGUMENTS_LENGTH = 0x1000;
51209
51210        function decodeCodePointsArray(codePoints) {
51211          var len = codePoints.length;
51212
51213          if (len <= MAX_ARGUMENTS_LENGTH) {
51214            return String.fromCharCode.apply(String, codePoints); // avoid extra slice()
51215          } // Decode in chunks to avoid "call stack size exceeded".
51216
51217
51218          var res = '';
51219          var i = 0;
51220
51221          while (i < len) {
51222            res += String.fromCharCode.apply(String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH));
51223          }
51224
51225          return res;
51226        }
51227
51228        function asciiSlice(buf, start, end) {
51229          var ret = '';
51230          end = Math.min(buf.length, end);
51231
51232          for (var i = start; i < end; ++i) {
51233            ret += String.fromCharCode(buf[i] & 0x7F);
51234          }
51235
51236          return ret;
51237        }
51238
51239        function latin1Slice(buf, start, end) {
51240          var ret = '';
51241          end = Math.min(buf.length, end);
51242
51243          for (var i = start; i < end; ++i) {
51244            ret += String.fromCharCode(buf[i]);
51245          }
51246
51247          return ret;
51248        }
51249
51250        function hexSlice(buf, start, end) {
51251          var len = buf.length;
51252          if (!start || start < 0) start = 0;
51253          if (!end || end < 0 || end > len) end = len;
51254          var out = '';
51255
51256          for (var i = start; i < end; ++i) {
51257            out += toHex(buf[i]);
51258          }
51259
51260          return out;
51261        }
51262
51263        function utf16leSlice(buf, start, end) {
51264          var bytes = buf.slice(start, end);
51265          var res = '';
51266
51267          for (var i = 0; i < bytes.length; i += 2) {
51268            res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);
51269          }
51270
51271          return res;
51272        }
51273
51274        Buffer.prototype.slice = function slice(start, end) {
51275          var len = this.length;
51276          start = ~~start;
51277          end = end === undefined ? len : ~~end;
51278
51279          if (start < 0) {
51280            start += len;
51281            if (start < 0) start = 0;
51282          } else if (start > len) {
51283            start = len;
51284          }
51285
51286          if (end < 0) {
51287            end += len;
51288            if (end < 0) end = 0;
51289          } else if (end > len) {
51290            end = len;
51291          }
51292
51293          if (end < start) end = start;
51294          var newBuf = this.subarray(start, end); // Return an augmented `Uint8Array` instance
51295
51296          newBuf.__proto__ = Buffer.prototype;
51297          return newBuf;
51298        };
51299        /*
51300         * Need to make sure that buffer isn't trying to write out of bounds.
51301         */
51302
51303
51304        function checkOffset(offset, ext, length) {
51305          if (offset % 1 !== 0 || offset < 0) throw new RangeError('offset is not uint');
51306          if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length');
51307        }
51308
51309        Buffer.prototype.readUIntLE = function readUIntLE(offset, byteLength, noAssert) {
51310          offset = offset >>> 0;
51311          byteLength = byteLength >>> 0;
51312          if (!noAssert) checkOffset(offset, byteLength, this.length);
51313          var val = this[offset];
51314          var mul = 1;
51315          var i = 0;
51316
51317          while (++i < byteLength && (mul *= 0x100)) {
51318            val += this[offset + i] * mul;
51319          }
51320
51321          return val;
51322        };
51323
51324        Buffer.prototype.readUIntBE = function readUIntBE(offset, byteLength, noAssert) {
51325          offset = offset >>> 0;
51326          byteLength = byteLength >>> 0;
51327
51328          if (!noAssert) {
51329            checkOffset(offset, byteLength, this.length);
51330          }
51331
51332          var val = this[offset + --byteLength];
51333          var mul = 1;
51334
51335          while (byteLength > 0 && (mul *= 0x100)) {
51336            val += this[offset + --byteLength] * mul;
51337          }
51338
51339          return val;
51340        };
51341
51342        Buffer.prototype.readUInt8 = function readUInt8(offset, noAssert) {
51343          offset = offset >>> 0;
51344          if (!noAssert) checkOffset(offset, 1, this.length);
51345          return this[offset];
51346        };
51347
51348        Buffer.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) {
51349          offset = offset >>> 0;
51350          if (!noAssert) checkOffset(offset, 2, this.length);
51351          return this[offset] | this[offset + 1] << 8;
51352        };
51353
51354        Buffer.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) {
51355          offset = offset >>> 0;
51356          if (!noAssert) checkOffset(offset, 2, this.length);
51357          return this[offset] << 8 | this[offset + 1];
51358        };
51359
51360        Buffer.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) {
51361          offset = offset >>> 0;
51362          if (!noAssert) checkOffset(offset, 4, this.length);
51363          return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 0x1000000;
51364        };
51365
51366        Buffer.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {
51367          offset = offset >>> 0;
51368          if (!noAssert) checkOffset(offset, 4, this.length);
51369          return this[offset] * 0x1000000 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);
51370        };
51371
51372        Buffer.prototype.readIntLE = function readIntLE(offset, byteLength, noAssert) {
51373          offset = offset >>> 0;
51374          byteLength = byteLength >>> 0;
51375          if (!noAssert) checkOffset(offset, byteLength, this.length);
51376          var val = this[offset];
51377          var mul = 1;
51378          var i = 0;
51379
51380          while (++i < byteLength && (mul *= 0x100)) {
51381            val += this[offset + i] * mul;
51382          }
51383
51384          mul *= 0x80;
51385          if (val >= mul) val -= Math.pow(2, 8 * byteLength);
51386          return val;
51387        };
51388
51389        Buffer.prototype.readIntBE = function readIntBE(offset, byteLength, noAssert) {
51390          offset = offset >>> 0;
51391          byteLength = byteLength >>> 0;
51392          if (!noAssert) checkOffset(offset, byteLength, this.length);
51393          var i = byteLength;
51394          var mul = 1;
51395          var val = this[offset + --i];
51396
51397          while (i > 0 && (mul *= 0x100)) {
51398            val += this[offset + --i] * mul;
51399          }
51400
51401          mul *= 0x80;
51402          if (val >= mul) val -= Math.pow(2, 8 * byteLength);
51403          return val;
51404        };
51405
51406        Buffer.prototype.readInt8 = function readInt8(offset, noAssert) {
51407          offset = offset >>> 0;
51408          if (!noAssert) checkOffset(offset, 1, this.length);
51409          if (!(this[offset] & 0x80)) return this[offset];
51410          return (0xff - this[offset] + 1) * -1;
51411        };
51412
51413        Buffer.prototype.readInt16LE = function readInt16LE(offset, noAssert) {
51414          offset = offset >>> 0;
51415          if (!noAssert) checkOffset(offset, 2, this.length);
51416          var val = this[offset] | this[offset + 1] << 8;
51417          return val & 0x8000 ? val | 0xFFFF0000 : val;
51418        };
51419
51420        Buffer.prototype.readInt16BE = function readInt16BE(offset, noAssert) {
51421          offset = offset >>> 0;
51422          if (!noAssert) checkOffset(offset, 2, this.length);
51423          var val = this[offset + 1] | this[offset] << 8;
51424          return val & 0x8000 ? val | 0xFFFF0000 : val;
51425        };
51426
51427        Buffer.prototype.readInt32LE = function readInt32LE(offset, noAssert) {
51428          offset = offset >>> 0;
51429          if (!noAssert) checkOffset(offset, 4, this.length);
51430          return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;
51431        };
51432
51433        Buffer.prototype.readInt32BE = function readInt32BE(offset, noAssert) {
51434          offset = offset >>> 0;
51435          if (!noAssert) checkOffset(offset, 4, this.length);
51436          return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];
51437        };
51438
51439        Buffer.prototype.readFloatLE = function readFloatLE(offset, noAssert) {
51440          offset = offset >>> 0;
51441          if (!noAssert) checkOffset(offset, 4, this.length);
51442          return ieee754.read(this, offset, true, 23, 4);
51443        };
51444
51445        Buffer.prototype.readFloatBE = function readFloatBE(offset, noAssert) {
51446          offset = offset >>> 0;
51447          if (!noAssert) checkOffset(offset, 4, this.length);
51448          return ieee754.read(this, offset, false, 23, 4);
51449        };
51450
51451        Buffer.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {
51452          offset = offset >>> 0;
51453          if (!noAssert) checkOffset(offset, 8, this.length);
51454          return ieee754.read(this, offset, true, 52, 8);
51455        };
51456
51457        Buffer.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {
51458          offset = offset >>> 0;
51459          if (!noAssert) checkOffset(offset, 8, this.length);
51460          return ieee754.read(this, offset, false, 52, 8);
51461        };
51462
51463        function checkInt(buf, value, offset, ext, max, min) {
51464          if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance');
51465          if (value > max || value < min) throw new RangeError('"value" argument is out of bounds');
51466          if (offset + ext > buf.length) throw new RangeError('Index out of range');
51467        }
51468
51469        Buffer.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength, noAssert) {
51470          value = +value;
51471          offset = offset >>> 0;
51472          byteLength = byteLength >>> 0;
51473
51474          if (!noAssert) {
51475            var maxBytes = Math.pow(2, 8 * byteLength) - 1;
51476            checkInt(this, value, offset, byteLength, maxBytes, 0);
51477          }
51478
51479          var mul = 1;
51480          var i = 0;
51481          this[offset] = value & 0xFF;
51482
51483          while (++i < byteLength && (mul *= 0x100)) {
51484            this[offset + i] = value / mul & 0xFF;
51485          }
51486
51487          return offset + byteLength;
51488        };
51489
51490        Buffer.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength, noAssert) {
51491          value = +value;
51492          offset = offset >>> 0;
51493          byteLength = byteLength >>> 0;
51494
51495          if (!noAssert) {
51496            var maxBytes = Math.pow(2, 8 * byteLength) - 1;
51497            checkInt(this, value, offset, byteLength, maxBytes, 0);
51498          }
51499
51500          var i = byteLength - 1;
51501          var mul = 1;
51502          this[offset + i] = value & 0xFF;
51503
51504          while (--i >= 0 && (mul *= 0x100)) {
51505            this[offset + i] = value / mul & 0xFF;
51506          }
51507
51508          return offset + byteLength;
51509        };
51510
51511        Buffer.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) {
51512          value = +value;
51513          offset = offset >>> 0;
51514          if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0);
51515          this[offset] = value & 0xff;
51516          return offset + 1;
51517        };
51518
51519        Buffer.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) {
51520          value = +value;
51521          offset = offset >>> 0;
51522          if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
51523          this[offset] = value & 0xff;
51524          this[offset + 1] = value >>> 8;
51525          return offset + 2;
51526        };
51527
51528        Buffer.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) {
51529          value = +value;
51530          offset = offset >>> 0;
51531          if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
51532          this[offset] = value >>> 8;
51533          this[offset + 1] = value & 0xff;
51534          return offset + 2;
51535        };
51536
51537        Buffer.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) {
51538          value = +value;
51539          offset = offset >>> 0;
51540          if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
51541          this[offset + 3] = value >>> 24;
51542          this[offset + 2] = value >>> 16;
51543          this[offset + 1] = value >>> 8;
51544          this[offset] = value & 0xff;
51545          return offset + 4;
51546        };
51547
51548        Buffer.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) {
51549          value = +value;
51550          offset = offset >>> 0;
51551          if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
51552          this[offset] = value >>> 24;
51553          this[offset + 1] = value >>> 16;
51554          this[offset + 2] = value >>> 8;
51555          this[offset + 3] = value & 0xff;
51556          return offset + 4;
51557        };
51558
51559        Buffer.prototype.writeIntLE = function writeIntLE(value, offset, byteLength, noAssert) {
51560          value = +value;
51561          offset = offset >>> 0;
51562
51563          if (!noAssert) {
51564            var limit = Math.pow(2, 8 * byteLength - 1);
51565            checkInt(this, value, offset, byteLength, limit - 1, -limit);
51566          }
51567
51568          var i = 0;
51569          var mul = 1;
51570          var sub = 0;
51571          this[offset] = value & 0xFF;
51572
51573          while (++i < byteLength && (mul *= 0x100)) {
51574            if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
51575              sub = 1;
51576            }
51577
51578            this[offset + i] = (value / mul >> 0) - sub & 0xFF;
51579          }
51580
51581          return offset + byteLength;
51582        };
51583
51584        Buffer.prototype.writeIntBE = function writeIntBE(value, offset, byteLength, noAssert) {
51585          value = +value;
51586          offset = offset >>> 0;
51587
51588          if (!noAssert) {
51589            var limit = Math.pow(2, 8 * byteLength - 1);
51590            checkInt(this, value, offset, byteLength, limit - 1, -limit);
51591          }
51592
51593          var i = byteLength - 1;
51594          var mul = 1;
51595          var sub = 0;
51596          this[offset + i] = value & 0xFF;
51597
51598          while (--i >= 0 && (mul *= 0x100)) {
51599            if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
51600              sub = 1;
51601            }
51602
51603            this[offset + i] = (value / mul >> 0) - sub & 0xFF;
51604          }
51605
51606          return offset + byteLength;
51607        };
51608
51609        Buffer.prototype.writeInt8 = function writeInt8(value, offset, noAssert) {
51610          value = +value;
51611          offset = offset >>> 0;
51612          if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80);
51613          if (value < 0) value = 0xff + value + 1;
51614          this[offset] = value & 0xff;
51615          return offset + 1;
51616        };
51617
51618        Buffer.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) {
51619          value = +value;
51620          offset = offset >>> 0;
51621          if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
51622          this[offset] = value & 0xff;
51623          this[offset + 1] = value >>> 8;
51624          return offset + 2;
51625        };
51626
51627        Buffer.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) {
51628          value = +value;
51629          offset = offset >>> 0;
51630          if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
51631          this[offset] = value >>> 8;
51632          this[offset + 1] = value & 0xff;
51633          return offset + 2;
51634        };
51635
51636        Buffer.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) {
51637          value = +value;
51638          offset = offset >>> 0;
51639          if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
51640          this[offset] = value & 0xff;
51641          this[offset + 1] = value >>> 8;
51642          this[offset + 2] = value >>> 16;
51643          this[offset + 3] = value >>> 24;
51644          return offset + 4;
51645        };
51646
51647        Buffer.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) {
51648          value = +value;
51649          offset = offset >>> 0;
51650          if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
51651          if (value < 0) value = 0xffffffff + value + 1;
51652          this[offset] = value >>> 24;
51653          this[offset + 1] = value >>> 16;
51654          this[offset + 2] = value >>> 8;
51655          this[offset + 3] = value & 0xff;
51656          return offset + 4;
51657        };
51658
51659        function checkIEEE754(buf, value, offset, ext, max, min) {
51660          if (offset + ext > buf.length) throw new RangeError('Index out of range');
51661          if (offset < 0) throw new RangeError('Index out of range');
51662        }
51663
51664        function writeFloat(buf, value, offset, littleEndian, noAssert) {
51665          value = +value;
51666          offset = offset >>> 0;
51667
51668          if (!noAssert) {
51669            checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38);
51670          }
51671
51672          ieee754.write(buf, value, offset, littleEndian, 23, 4);
51673          return offset + 4;
51674        }
51675
51676        Buffer.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) {
51677          return writeFloat(this, value, offset, true, noAssert);
51678        };
51679
51680        Buffer.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) {
51681          return writeFloat(this, value, offset, false, noAssert);
51682        };
51683
51684        function writeDouble(buf, value, offset, littleEndian, noAssert) {
51685          value = +value;
51686          offset = offset >>> 0;
51687
51688          if (!noAssert) {
51689            checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308);
51690          }
51691
51692          ieee754.write(buf, value, offset, littleEndian, 52, 8);
51693          return offset + 8;
51694        }
51695
51696        Buffer.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) {
51697          return writeDouble(this, value, offset, true, noAssert);
51698        };
51699
51700        Buffer.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) {
51701          return writeDouble(this, value, offset, false, noAssert);
51702        }; // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
51703
51704
51705        Buffer.prototype.copy = function copy(target, targetStart, start, end) {
51706          if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer');
51707          if (!start) start = 0;
51708          if (!end && end !== 0) end = this.length;
51709          if (targetStart >= target.length) targetStart = target.length;
51710          if (!targetStart) targetStart = 0;
51711          if (end > 0 && end < start) end = start; // Copy 0 bytes; we're done
51712
51713          if (end === start) return 0;
51714          if (target.length === 0 || this.length === 0) return 0; // Fatal error conditions
51715
51716          if (targetStart < 0) {
51717            throw new RangeError('targetStart out of bounds');
51718          }
51719
51720          if (start < 0 || start >= this.length) throw new RangeError('Index out of range');
51721          if (end < 0) throw new RangeError('sourceEnd out of bounds'); // Are we oob?
51722
51723          if (end > this.length) end = this.length;
51724
51725          if (target.length - targetStart < end - start) {
51726            end = target.length - targetStart + start;
51727          }
51728
51729          var len = end - start;
51730
51731          if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {
51732            // Use built-in when available, missing from IE11
51733            this.copyWithin(targetStart, start, end);
51734          } else if (this === target && start < targetStart && targetStart < end) {
vendor: 7,444 bytes, lines 51735-51957
51735            // descending copy from end
51736            for (var i = len - 1; i >= 0; --i) {
51737              target[i + targetStart] = this[i + start];
51738            }
51739          } else {
51740            Uint8Array.prototype.set.call(target, this.subarray(start, end), targetStart);
51741          }
51742
51743          return len;
51744        }; // Usage:
51745        //    buffer.fill(number[, offset[, end]])
51746        //    buffer.fill(buffer[, offset[, end]])
51747        //    buffer.fill(string[, offset[, end]][, encoding])
51748
51749
51750        Buffer.prototype.fill = function fill(val, start, end, encoding) {
51751          // Handle string cases:
51752          if (typeof val === 'string') {
51753            if (typeof start === 'string') {
51754              encoding = start;
51755              start = 0;
51756              end = this.length;
51757            } else if (typeof end === 'string') {
51758              encoding = end;
51759              end = this.length;
51760            }
51761
51762            if (encoding !== undefined && typeof encoding !== 'string') {
51763              throw new TypeError('encoding must be a string');
51764            }
51765
51766            if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
51767              throw new TypeError('Unknown encoding: ' + encoding);
51768            }
51769
51770            if (val.length === 1) {
51771              var code = val.charCodeAt(0);
51772
51773              if (encoding === 'utf8' && code < 128 || encoding === 'latin1') {
51774                // Fast path: If `val` fits into a single byte, use that numeric value.
51775                val = code;
51776              }
51777            }
51778          } else if (typeof val === 'number') {
51779            val = val & 255;
51780          } // Invalid ranges are not set to a default, so can range check early.
51781
51782
51783          if (start < 0 || this.length < start || this.length < end) {
51784            throw new RangeError('Out of range index');
51785          }
51786
51787          if (end <= start) {
51788            return this;
51789          }
51790
51791          start = start >>> 0;
51792          end = end === undefined ? this.length : end >>> 0;
51793          if (!val) val = 0;
51794          var i;
51795
51796          if (typeof val === 'number') {
51797            for (i = start; i < end; ++i) {
51798              this[i] = val;
51799            }
51800          } else {
51801            var bytes = Buffer.isBuffer(val) ? val : Buffer.from(val, encoding);
51802            var len = bytes.length;
51803
51804            if (len === 0) {
51805              throw new TypeError('The value "' + val + '" is invalid for argument "value"');
51806            }
51807
51808            for (i = 0; i < end - start; ++i) {
51809              this[i + start] = bytes[i % len];
51810            }
51811          }
51812
51813          return this;
51814        }; // HELPER FUNCTIONS
51815        // ================
51816
51817
51818        var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g;
51819
51820        function base64clean(str) {
51821          // Node takes equal signs as end of the Base64 encoding
51822          str = str.split('=')[0]; // Node strips out invalid characters like \n and \t from the string, base64-js does not
51823
51824          str = str.trim().replace(INVALID_BASE64_RE, ''); // Node converts strings with length < 2 to ''
51825
51826          if (str.length < 2) return ''; // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
51827
51828          while (str.length % 4 !== 0) {
51829            str = str + '=';
51830          }
51831
51832          return str;
51833        }
51834
51835        function toHex(n) {
51836          if (n < 16) return '0' + n.toString(16);
51837          return n.toString(16);
51838        }
51839
51840        function utf8ToBytes(string, units) {
51841          units = units || Infinity;
51842          var codePoint;
51843          var length = string.length;
51844          var leadSurrogate = null;
51845          var bytes = [];
51846
51847          for (var i = 0; i < length; ++i) {
51848            codePoint = string.charCodeAt(i); // is surrogate component
51849
51850            if (codePoint > 0xD7FF && codePoint < 0xE000) {
51851              // last char was a lead
51852              if (!leadSurrogate) {
51853                // no lead yet
51854                if (codePoint > 0xDBFF) {
51855                  // unexpected trail
51856                  if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
51857                  continue;
51858                } else if (i + 1 === length) {
51859                  // unpaired lead
51860                  if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
51861                  continue;
51862                } // valid lead
51863
51864
51865                leadSurrogate = codePoint;
51866                continue;
51867              } // 2 leads in a row
51868
51869
51870              if (codePoint < 0xDC00) {
51871                if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
51872                leadSurrogate = codePoint;
51873                continue;
51874              } // valid surrogate pair
51875
51876
51877              codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000;
51878            } else if (leadSurrogate) {
51879              // valid bmp char, but last char was a lead
51880              if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
51881            }
51882
51883            leadSurrogate = null; // encode utf8
51884
51885            if (codePoint < 0x80) {
51886              if ((units -= 1) < 0) break;
51887              bytes.push(codePoint);
51888            } else if (codePoint < 0x800) {
51889              if ((units -= 2) < 0) break;
51890              bytes.push(codePoint >> 0x6 | 0xC0, codePoint & 0x3F | 0x80);
51891            } else if (codePoint < 0x10000) {
51892              if ((units -= 3) < 0) break;
51893              bytes.push(codePoint >> 0xC | 0xE0, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80);
51894            } else if (codePoint < 0x110000) {
51895              if ((units -= 4) < 0) break;
51896              bytes.push(codePoint >> 0x12 | 0xF0, codePoint >> 0xC & 0x3F | 0x80, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80);
51897            } else {
51898              throw new Error('Invalid code point');
51899            }
51900          }
51901
51902          return bytes;
51903        }
51904
51905        function asciiToBytes(str) {
51906          var byteArray = [];
51907
51908          for (var i = 0; i < str.length; ++i) {
51909            // Node's code seems to be doing this and not & 0x7F..
51910            byteArray.push(str.charCodeAt(i) & 0xFF);
51911          }
51912
51913          return byteArray;
51914        }
51915
51916        function utf16leToBytes(str, units) {
51917          var c, hi, lo;
51918          var byteArray = [];
51919
51920          for (var i = 0; i < str.length; ++i) {
51921            if ((units -= 2) < 0) break;
51922            c = str.charCodeAt(i);
51923            hi = c >> 8;
51924            lo = c % 256;
51925            byteArray.push(lo);
51926            byteArray.push(hi);
51927          }
51928
51929          return byteArray;
51930        }
51931
51932        function base64ToBytes(str) {
51933          return base64.toByteArray(base64clean(str));
51934        }
51935
51936        function blitBuffer(src, dst, offset, length) {
51937          for (var i = 0; i < length; ++i) {
51938            if (i + offset >= dst.length || i >= src.length) break;
51939            dst[i + offset] = src[i];
51940          }
51941
51942          return i;
51943        } // ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass
51944        // the `instanceof` check but they should be treated as of that type.
51945        // See: https://github.com/feross/buffer/issues/166
51946
51947
51948        function isInstance(obj, type) {
51949          return obj instanceof type || obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name;
51950        }
51951
51952        function numberIsNaN(obj) {
51953          // For IE11 support
51954          return obj !== obj; // eslint-disable-line no-self-compare
51955        }
51956      }).call(this, require("buffer").Buffer);
51957    }, {
51958      "base64-js": 180,
51959      "buffer": 214,
51960      "ieee754": 362
51961    }],
51962    215: [function (require, module, exports) {
51963      (function (Buffer) {
51964        module.exports = function xor(a, b) {
51965          var length = Math.min(a.length, b.length);
51966          var buffer = new Buffer(length);
51967
51968          for (var i = 0; i < length; ++i) {
51969            buffer[i] = a[i] ^ b[i];
51970          }
51971
51972          return buffer;
51973        };
51974      }).call(this, require("buffer").Buffer);
51975    }, {
51976      "buffer": 214
51977    }],
51978    216: [function (require, module, exports) {
51979      var Buffer = require('safe-buffer').Buffer;
51980
51981      var Transform = require('stream').Transform;
51982
51983      var StringDecoder = require('string_decoder').StringDecoder;
51984
51985      var inherits = require('inherits');
51986
51987      function CipherBase(hashMode) {
51988        Transform.call(this);
51989        this.hashMode = typeof hashMode === 'string';
51990
51991        if (this.hashMode) {
51992          this[hashMode] = this._finalOrDigest;
51993        } else {
51994          this.final = this._finalOrDigest;
51995        }
51996
51997        if (this._final) {
51998          this.__final = this._final;
51999          this._final = null;
52000        }
52001
52002        this._decoder = null;
52003        this._encoding = null;
52004      }
52005
52006      inherits(CipherBase, Transform);
52007
52008      CipherBase.prototype.update = function (data, inputEnc, outputEnc) {
52009        if (typeof data === 'string') {
52010          data = Buffer.from(data, inputEnc);
52011        }
52012
52013        var outData = this._update(data);
52014
52015        if (this.hashMode) return this;
52016
52017        if (outputEnc) {
52018          outData = this._toString(outData, outputEnc);
52019        }
52020
52021        return outData;
52022      };
52023
52024      CipherBase.prototype.setAutoPadding = function () {};
52025
52026      CipherBase.prototype.getAuthTag = function () {
52027        throw new Error('trying to get auth tag in unsupported state');
52028      };
52029
52030      CipherBase.prototype.setAuthTag = function () {
52031        throw new Error('trying to set auth tag in unsupported state');
52032      };
52033
52034      CipherBase.prototype.setAAD = function () {
52035        throw new Error('trying to set aad in unsupported state');
52036      };
52037
52038      CipherBase.prototype._transform = function (data, _, next) {
52039        var err;
52040
52041        try {
52042          if (this.hashMode) {
52043            this._update(data);
52044          } else {
52045            this.push(this._update(data));
52046          }
52047        } catch (e) {
52048          err = e;
52049        } finally {
52050          next(err);
52051        }
52052      };
52053
52054      CipherBase.prototype._flush = function (done) {
52055        var err;
52056
52057        try {
52058          this.push(this.__final());
52059        } catch (e) {
52060          err = e;
52061        }
52062
52063        done(err);
52064      };
52065
52066      CipherBase.prototype._finalOrDigest = function (outputEnc) {
52067        var outData = this.__final() || Buffer.alloc(0);
52068
52069        if (outputEnc) {
52070          outData = this._toString(outData, outputEnc, true);
52071        }
52072
52073        return outData;
52074      };
52075
52076      CipherBase.prototype._toString = function (value, enc, fin) {
52077        if (!this._decoder) {
52078          this._decoder = new StringDecoder(enc);
52079          this._encoding = enc;
52080        }
52081
52082        if (this._encoding !== enc) throw new Error('can\'t switch encodings');
52083
52084        var out = this._decoder.write(value);
52085
52086        if (fin) {
52087          out += this._decoder.end();
52088        }
52089
52090        return out;
52091      };
52092
52093      module.exports = CipherBase;
52094    }, {
52095      "inherits": 364,
52096      "safe-buffer": 470,
52097      "stream": 481,
52098      "string_decoder": 495
52099    }],
52100    217: [function (require, module, exports) {
52101      module.exports = function (it) {
52102        if (typeof it != 'function') {
52103          throw TypeError(String(it) + ' is not a function');
52104        }
52105
52106        return it;
52107      };
52108    }, {}],
52109    218: [function (require, module, exports) {
52110      module.exports = function (it, Constructor, name) {
52111        if (!(it instanceof Constructor)) {
52112          throw TypeError('Incorrect ' + (name ? name + ' ' : '') + 'invocation');
52113        }
52114
52115        return it;
52116      };
52117    }, {}],
52118    219: [function (require, module, exports) {
52119      var isObject = require('../internals/is-object');
52120
52121      module.exports = function (it) {
52122        if (!isObject(it)) {
52123          throw TypeError(String(it) + ' is not an object');
52124        }
52125
52126        return it;
52127      };
52128    }, {
52129      "../internals/is-object": 254
52130    }],
52131    220: [function (require, module, exports) {
52132      var toIndexedObject = require('../internals/to-indexed-object');
52133
52134      var toLength = require('../internals/to-length');
52135
52136      var toAbsoluteIndex = require('../internals/to-absolute-index'); // `Array.prototype.{ indexOf, includes }` methods implementation
52137
52138
52139      var createMethod = function createMethod(IS_INCLUDES) {
52140        return function ($this, el, fromIndex) {
52141          var O = toIndexedObject($this);
52142          var length = toLength(O.length);
52143          var index = toAbsoluteIndex(fromIndex, length);
52144          var value; // Array#includes uses SameValueZero equality algorithm
52145          // eslint-disable-next-line no-self-compare
52146
52147          if (IS_INCLUDES && el != el) while (length > index) {
52148            value = O[index++]; // eslint-disable-next-line no-self-compare
52149
52150            if (value != value) return true; // Array#indexOf ignores holes, Array#includes - not
52151          } else for (; length > index; index++) {
52152            if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
52153          }
52154          return !IS_INCLUDES && -1;
52155        };
52156      };
52157
52158      module.exports = {
52159        // `Array.prototype.includes` method
52160        // https://tc39.github.io/ecma262/#sec-array.prototype.includes
52161        includes: createMethod(true),
52162        // `Array.prototype.indexOf` method
52163        // https://tc39.github.io/ecma262/#sec-array.prototype.indexof
52164        indexOf: createMethod(false)
52165      };
52166    }, {
52167      "../internals/to-absolute-index": 289,
52168      "../internals/to-indexed-object": 290,
52169      "../internals/to-length": 292
52170    }],
52171    221: [function (require, module, exports) {
52172      var bind = require('../internals/function-bind-context');
52173
52174      var IndexedObject = require('../internals/indexed-object');
52175
52176      var toObject = require('../internals/to-object');
52177
52178      var toLength = require('../internals/to-length');
52179
52180      var arraySpeciesCreate = require('../internals/array-species-create');
52181
52182      var push = [].push; // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex }` methods implementation
52183
52184      var createMethod = function createMethod(TYPE) {
52185        var IS_MAP = TYPE == 1;
52186        var IS_FILTER = TYPE == 2;
52187        var IS_SOME = TYPE == 3;
52188        var IS_EVERY = TYPE == 4;
52189        var IS_FIND_INDEX = TYPE == 6;
52190        var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
52191        return function ($this, callbackfn, that, specificCreate) {
52192          var O = toObject($this);
52193          var self = IndexedObject(O);
52194          var boundFunction = bind(callbackfn, that, 3);
52195          var length = toLength(self.length);
52196          var index = 0;
52197          var create = specificCreate || arraySpeciesCreate;
52198          var target = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
52199          var value, result;
52200
52201          for (; length > index; index++) {
52202            if (NO_HOLES || index in self) {
52203              value = self[index];
52204              result = boundFunction(value, index, O);
52205
52206              if (TYPE) {
52207                if (IS_MAP) target[index] = result; // map
52208                else if (result) switch (TYPE) {
52209                    case 3:
52210                      return true;
52211                    // some
52212
52213                    case 5:
52214                      return value;
52215                    // find
52216
52217                    case 6:
52218                      return index;
52219                    // findIndex
52220
52221                    case 2:
52222                      push.call(target, value);
52223                    // filter
52224                  } else if (IS_EVERY) return false; // every
52225              }
52226            }
52227          }
52228
52229          return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
52230        };
52231      };
52232
52233      module.exports = {
52234        // `Array.prototype.forEach` method
52235        // https://tc39.github.io/ecma262/#sec-array.prototype.foreach
52236        forEach: createMethod(0),
52237        // `Array.prototype.map` method
52238        // https://tc39.github.io/ecma262/#sec-array.prototype.map
52239        map: createMethod(1),
52240        // `Array.prototype.filter` method
52241        // https://tc39.github.io/ecma262/#sec-array.prototype.filter
52242        filter: createMethod(2),
52243        // `Array.prototype.some` method
52244        // https://tc39.github.io/ecma262/#sec-array.prototype.some
52245        some: createMethod(3),
52246        // `Array.prototype.every` method
52247        // https://tc39.github.io/ecma262/#sec-array.prototype.every
52248        every: createMethod(4),
52249        // `Array.prototype.find` method
52250        // https://tc39.github.io/ecma262/#sec-array.prototype.find
52251        find: createMethod(5),
52252        // `Array.prototype.findIndex` method
52253        // https://tc39.github.io/ecma262/#sec-array.prototype.findIndex
52254        findIndex: createMethod(6)
52255      };
52256    }, {
52257      "../internals/array-species-create": 222,
52258      "../internals/function-bind-context": 239,
52259      "../internals/indexed-object": 248,
52260      "../internals/to-length": 292,
52261      "../internals/to-object": 293
52262    }],
52263    222: [function (require, module, exports) {
52264      var isObject = require('../internals/is-object');
52265
52266      var isArray = require('../internals/is-array');
52267
52268      var wellKnownSymbol = require('../internals/well-known-symbol');
52269
52270      var SPECIES = wellKnownSymbol('species'); // `ArraySpeciesCreate` abstract operation
52271      // https://tc39.github.io/ecma262/#sec-arrayspeciescreate
52272
52273      module.exports = function (originalArray, length) {
52274        var C;
52275
52276        if (isArray(originalArray)) {
52277          C = originalArray.constructor; // cross-realm fallback
52278
52279          if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;else if (isObject(C)) {
52280            C = C[SPECIES];
52281            if (C === null) C = undefined;
52282          }
52283        }
52284
52285        return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
52286      };
52287    }, {
52288      "../internals/is-array": 252,
52289      "../internals/is-object": 254,
52290      "../internals/well-known-symbol": 299
52291    }],
52292    223: [function (require, module, exports) {
52293      var anObject = require('../internals/an-object'); // call something on iterator step with safe closing on error
52294
52295
52296      module.exports = function (iterator, fn, value, ENTRIES) {
52297        try {
52298          return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value); // 7.4.6 IteratorClose(iterator, completion)
52299        } catch (error) {
52300          var returnMethod = iterator['return'];
52301          if (returnMethod !== undefined) anObject(returnMethod.call(iterator));
52302          throw error;
52303        }
52304      };
52305    }, {
52306      "../internals/an-object": 219
52307    }],
52308    224: [function (require, module, exports) {
52309      var wellKnownSymbol = require('../internals/well-known-symbol');
52310
52311      var ITERATOR = wellKnownSymbol('iterator');
52312      var SAFE_CLOSING = false;
52313
52314      try {
52315        var called = 0;
52316        var iteratorWithReturn = {
52317          next: function next() {
52318            return {
52319              done: !!called++
52320            };
52321          },
52322          'return': function _return() {
52323            SAFE_CLOSING = true;
52324          }
52325        };
52326
52327        iteratorWithReturn[ITERATOR] = function () {
52328          return this;
52329        }; // eslint-disable-next-line no-throw-literal
52330
52331
52332        Array.from(iteratorWithReturn, function () {
52333          throw 2;
52334        });
52335      } catch (error) {
52336        /* empty */
52337      }
52338
52339      module.exports = function (exec, SKIP_CLOSING) {
52340        if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
52341        var ITERATION_SUPPORT = false;
52342
52343        try {
52344          var object = {};
52345
52346          object[ITERATOR] = function () {
52347            return {
52348              next: function next() {
52349                return {
52350                  done: ITERATION_SUPPORT = true
52351                };
52352              }
52353            };
52354          };
52355
52356          exec(object);
52357        } catch (error) {
52358          /* empty */
52359        }
52360
52361        return ITERATION_SUPPORT;
52362      };
52363    }, {
52364      "../internals/well-known-symbol": 299
52365    }],
52366    225: [function (require, module, exports) {
52367      var toString = {}.toString;
52368
52369      module.exports = function (it) {
52370        return toString.call(it).slice(8, -1);
52371      };
52372    }, {}],
52373    226: [function (require, module, exports) {
52374      var TO_STRING_TAG_SUPPORT = require('../internals/to-string-tag-support');
52375
52376      var classofRaw = require('../internals/classof-raw');
52377
52378      var wellKnownSymbol = require('../internals/well-known-symbol');
52379
52380      var TO_STRING_TAG = wellKnownSymbol('toStringTag'); // ES3 wrong here
52381
52382      var CORRECT_ARGUMENTS = classofRaw(function () {
52383        return arguments;
52384      }()) == 'Arguments'; // fallback for IE11 Script Access Denied error
52385
52386      var tryGet = function tryGet(it, key) {
52387        try {
52388          return it[key];
52389        } catch (error) {
52390          /* empty */
52391        }
52392      }; // getting tag from ES6+ `Object.prototype.toString`
52393
52394
52395      module.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
52396        var O, tag, result;
vendor: 4,077 bytes, lines 52397-52511
52397        return it === undefined ? 'Undefined' : it === null ? 'Null' // @@toStringTag case
52398        : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG)) == 'string' ? tag // builtinTag case
52399        : CORRECT_ARGUMENTS ? classofRaw(O) // ES3 arguments fallback
52400        : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
52401      };
52402    }, {
52403      "../internals/classof-raw": 225,
52404      "../internals/to-string-tag-support": 295,
52405      "../internals/well-known-symbol": 299
52406    }],
52407    227: [function (require, module, exports) {
52408      var has = require('../internals/has');
52409
52410      var ownKeys = require('../internals/own-keys');
52411
52412      var getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor');
52413
52414      var definePropertyModule = require('../internals/object-define-property');
52415
52416      module.exports = function (target, source) {
52417        var keys = ownKeys(source);
52418        var defineProperty = definePropertyModule.f;
52419        var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
52420
52421        for (var i = 0; i < keys.length; i++) {
52422          var key = keys[i];
52423          if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
52424        }
52425      };
52426    }, {
52427      "../internals/has": 243,
52428      "../internals/object-define-property": 266,
52429      "../internals/object-get-own-property-descriptor": 267,
52430      "../internals/own-keys": 274
52431    }],
52432    228: [function (require, module, exports) {
52433      var DESCRIPTORS = require('../internals/descriptors');
52434
52435      var definePropertyModule = require('../internals/object-define-property');
52436
52437      var createPropertyDescriptor = require('../internals/create-property-descriptor');
52438
52439      module.exports = DESCRIPTORS ? function (object, key, value) {
52440        return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
52441      } : function (object, key, value) {
52442        object[key] = value;
52443        return object;
52444      };
52445    }, {
52446      "../internals/create-property-descriptor": 229,
52447      "../internals/descriptors": 231,
52448      "../internals/object-define-property": 266
52449    }],
52450    229: [function (require, module, exports) {
52451      module.exports = function (bitmap, value) {
52452        return {
52453          enumerable: !(bitmap & 1),
52454          configurable: !(bitmap & 2),
52455          writable: !(bitmap & 4),
52456          value: value
52457        };
52458      };
52459    }, {}],
52460    230: [function (require, module, exports) {
52461      var path = require('../internals/path');
52462
52463      var has = require('../internals/has');
52464
52465      var wrappedWellKnownSymbolModule = require('../internals/well-known-symbol-wrapped');
52466
52467      var defineProperty = require('../internals/object-define-property').f;
52468
52469      module.exports = function (NAME) {
52470        var _Symbol = path.Symbol || (path.Symbol = {});
52471
52472        if (!has(_Symbol, NAME)) defineProperty(_Symbol, NAME, {
52473          value: wrappedWellKnownSymbolModule.f(NAME)
52474        });
52475      };
52476    }, {
52477      "../internals/has": 243,
52478      "../internals/object-define-property": 266,
52479      "../internals/path": 275,
52480      "../internals/well-known-symbol-wrapped": 298
52481    }],
52482    231: [function (require, module, exports) {
52483      var fails = require('../internals/fails'); // Thank's IE8 for his funny defineProperty
52484
52485
52486      module.exports = !fails(function () {
52487        return Object.defineProperty({}, 1, {
52488          get: function get() {
52489            return 7;
52490          }
52491        })[1] != 7;
52492      });
52493    }, {
52494      "../internals/fails": 238
52495    }],
52496    232: [function (require, module, exports) {
52497      var global = require('../internals/global');
52498
52499      var isObject = require('../internals/is-object');
52500
52501      var document = global.document; // typeof document.createElement is 'object' in old IE
52502
52503      var EXISTS = isObject(document) && isObject(document.createElement);
52504
52505      module.exports = function (it) {
52506        return EXISTS ? document.createElement(it) : {};
52507      };
52508    }, {
52509      "../internals/global": 242,
52510      "../internals/is-object": 254
52511    }],
52512    233: [function (require, module, exports) {
52513      var userAgent = require('../internals/engine-user-agent');
52514
52515      module.exports = /(iphone|ipod|ipad).*applewebkit/i.test(userAgent);
52516    }, {
52517      "../internals/engine-user-agent": 234
52518    }],
52519    234: [function (require, module, exports) {
52520      var getBuiltIn = require('../internals/get-built-in');
52521
52522      module.exports = getBuiltIn('navigator', 'userAgent') || '';
52523    }, {
52524      "../internals/get-built-in": 240
52525    }],
52526    235: [function (require, module, exports) {
52527      var global = require('../internals/global');
52528
52529      var userAgent = require('../internals/engine-user-agent');
52530
52531      var process = global.process;
52532      var versions = process && process.versions;
52533      var v8 = versions && versions.v8;
52534      var match, version;
52535
52536      if (v8) {
52537        match = v8.split('.');
52538        version = match[0] + match[1];
52539      } else if (userAgent) {
52540        match = userAgent.match(/Edge\/(\d+)/);
52541
52542        if (!match || match[1] >= 74) {
52543          match = userAgent.match(/Chrome\/(\d+)/);
52544          if (match) version = match[1];
52545        }
52546      }
52547
52548      module.exports = version && +version;
52549    }, {
52550      "../internals/engine-user-agent": 234,
52551      "../internals/global": 242
52552    }],
52553    236: [function (require, module, exports) {
52554      // IE8- don't enum bug keys
52555      module.exports = ['constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf'];
52556    }, {}],
52557    237: [function (require, module, exports) {
52558      var global = require('../internals/global');
52559
52560      var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;
52561
52562      var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
52563
52564      var redefine = require('../internals/redefine');
52565
52566      var setGlobal = require('../internals/set-global');
52567
52568      var copyConstructorProperties = require('../internals/copy-constructor-properties');
52569
52570      var isForced = require('../internals/is-forced');
52571      /*
52572        options.target      - name of the target object
52573        options.global      - target is the global object
52574        options.stat        - export as static methods of target
52575        options.proto       - export as prototype methods of target
52576        options.real        - real prototype method for the `pure` version
52577        options.forced      - export even if the native feature is available
52578        options.bind        - bind methods to the target, required for the `pure` version
52579        options.wrap        - wrap constructors to preventing global pollution, required for the `pure` version
52580        options.unsafe      - use the simple assignment of property instead of delete + defineProperty
52581        options.sham        - add a flag to not completely full polyfills
52582        options.enumerable  - export as enumerable property
52583        options.noTargetGet - prevent calling a getter on target
52584      */
52585
52586
52587      module.exports = function (options, source) {
52588        var TARGET = options.target;
52589        var GLOBAL = options.global;
52590        var STATIC = options.stat;
52591        var FORCED, target, key, targetProperty, sourceProperty, descriptor;
52592
52593        if (GLOBAL) {
52594          target = global;
52595        } else if (STATIC) {
52596          target = global[TARGET] || setGlobal(TARGET, {});
52597        } else {
52598          target = (global[TARGET] || {}).prototype;
52599        }
52600
52601        if (target) for (key in source) {
52602          sourceProperty = source[key];
52603
52604          if (options.noTargetGet) {
52605            descriptor = getOwnPropertyDescriptor(target, key);
52606            targetProperty = descriptor && descriptor.value;
52607          } else targetProperty = target[key];
52608
52609          FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced); // contained in target
52610
52611          if (!FORCED && targetProperty !== undefined) {
52612            if (_typeof2(sourceProperty) === _typeof2(targetProperty)) continue;
52613            copyConstructorProperties(sourceProperty, targetProperty);
52614          }
52614 // add a flag to not completely full polyfills
52615
52616
52617          if (options.sham || targetProperty && targetProperty.sham) {
52618            createNonEnumerableProperty(sourceProperty, 'sham', true);
52619          } // extend global
52620
52621
52622          redefine(target, key, sourceProperty, options);
52623        }
52624      };
52625    }, {
52626      "../internals/copy-constructor-properties": 227,
52627      "../internals/create-non-enumerable-property": 228,
52628      "../internals/global": 242,
52629      "../internals/is-forced": 253,
52630      "../internals/object-get-own-property-descriptor": 267,
52631      "../internals/redefine": 279,
52632      "../internals/set-global": 281
52633    }],
52634    238: [function (require, module, exports) {
52635      module.exports = function (exec) {
52636        try {
52637          return !!exec();
52638        } catch (error) {
52639          return true;
52640        }
52641      };
52642    }, {}],
52643    239: [function (require, module, exports) {
52644      var aFunction = require('../internals/a-function'); // optional / simple context binding
52645
52646
52647      module.exports = function (fn, that, length) {
52648        aFunction(fn);
52649        if (that === undefined) return fn;
52650
52651        switch (length) {
52652          case 0:
52653            return function () {
52654              return fn.call(that);
52655            };
52656
52657          case 1:
52658            return function (a) {
52659              return fn.call(that, a);
52660            };
52661
52662          case 2:
52663            return function (a, b) {
52664              return fn.call(that, a, b);
52665            };
52666
52667          case 3:
52668            return function (a, b, c) {
52669              return fn.call(that, a, b, c);
52670            };
52671        }
52672
52673        return function ()
52674        /* ...args */
52675        {
52676          return fn.apply(that, arguments);
52677        };
52678      };
52679    }, {
52680      "../internals/a-function": 217
52681    }],
52682    240: [function (require, module, exports) {
52683      var path = require('../internals/path');
52684
52685      var global = require('../internals/global');
52686
52687      var aFunction = function aFunction(variable) {
52688        return typeof variable == 'function' ? variable : undefined;
52689      };
52690
52691      module.exports = function (namespace, method) {
52692        return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global[namespace]) : path[namespace] && path[namespace][method] || global[namespace] && global[namespace][method];
52693      };
52694    }, {
52695      "../internals/global": 242,
52696      "../internals/path": 275
52697    }],
52698    241: [function (require, module, exports) {
52699      var classof = require('../internals/classof');
52700
52701      var Iterators = require('../internals/iterators');
52702
52703      var wellKnownSymbol = require('../internals/well-known-symbol');
52704
52705      var ITERATOR = wellKnownSymbol('iterator');
52706
52707      module.exports = function (it) {
52708        if (it != undefined) return it[ITERATOR] || it['@@iterator'] || Iterators[classof(it)];
52709      };
52710    }, {
52711      "../internals/classof": 226,
52712      "../internals/iterators": 257,
52713      "../internals/well-known-symbol": 299
52714    }],
52715    242: [function (require, module, exports) {
52716      (function (global) {
52717        var check = function check(it) {
52718          return it && it.Math == Math && it;
52719        }; // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
52720
52721
52722        module.exports = // eslint-disable-next-line no-undef
52723        check((typeof globalThis === "undefined" ? "undefined" : _typeof2(globalThis)) == 'object' && globalThis) || check((typeof window === "undefined" ? "undefined" : _typeof2(window)) == 'object' && window) || check((typeof self === "undefined" ? "undefined" : _typeof2(self)) == 'object' && self) || check(_typeof2(global) == 'object' && global) || // eslint-disable-next-line no-new-func
52724        Function('return this')();
52725      }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
52726    }, {}],
52727    243: [function (require, module, exports) {
52728      var hasOwnProperty = {}.hasOwnProperty;
52729
52730      module.exports = function (it, key) {
52731        return hasOwnProperty.call(it, key);
52732      };
52733    }, {}],
52734    244: [function (require, module, exports) {
52735      module.exports = {};
52736    }, {}],
52737    245: [function (require, module, exports) {
52738      var global = require('../internals/global');
52739
52740      module.exports = function (a, b) {
52741        var console = global.console;
52742
52743        if (console && console.error) {
52744          arguments.length === 1 ? console.error(a) : console.error(a, b);
52745        }
52746      };
52747    }, {
52748      "../internals/global": 242
52749    }],
52750    246: [function (require, module, exports) {
52751      var getBuiltIn = require('../internals/get-built-in');
52752
52753      module.exports = getBuiltIn('document', 'documentElement');
52754    }, {
52755      "../internals/get-built-in": 240
52756    }],
52757    247: [function (require, module, exports) {
52758      var DESCRIPTORS = require('../internals/descriptors');
52759
52760      var fails = require('../internals/fails');
52761
52762      var createElement = require('../internals/document-create-element'); // Thank's IE8 for his funny defineProperty
52763
52764
52765      module.exports = !DESCRIPTORS && !fails(function () {
52766        return Object.defineProperty(createElement('div'), 'a', {
52767          get: function get() {
52768            return 7;
52769          }
52770        }).a != 7;
52771      });
52772    }, {
52773      "../internals/descriptors": 231,
52774      "../internals/document-create-element": 232,
52775      "../internals/fails": 238
52776    }],
52777    248: [function (require, module, exports) {
52778      var fails = require('../internals/fails');
52779
52780      var classof = require('../internals/classof-raw');
52781
52782      var split = ''.split; // fallback for non-array-like ES3 and non-enumerable old V8 strings
52783
52784      module.exports = fails(function () {
52785        // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
52786        // eslint-disable-next-line no-prototype-builtins
52787        return !Object('z').propertyIsEnumerable(0);
52788      }) ? function (it) {
52789        return classof(it) == 'String' ? split.call(it, '') : Object(it);
52790      } : Object;
52791    }, {
52792      "../internals/classof-raw": 225,
52793      "../internals/fails": 238
52794    }],
52795    249: [function (require, module, exports) {
52796      var store = require('../internals/shared-store');
52797
52798      var functionToString = Function.toString; // this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper
52799
52800      if (typeof store.inspectSource != 'function') {
52801        store.inspectSource = function (it) {
52802          return functionToString.call(it);
52803        };
52804      }
52805
52806      module.exports = store.inspectSource;
52807    }, {
52808      "../internals/shared-store": 285
52809    }],
52810    250: [function (require, module, exports) {
52811      var NATIVE_WEAK_MAP = require('../internals/native-weak-map');
52812
52813      var global = require('../internals/global');
52814
52815      var isObject = require('../internals/is-object');
52816
52817      var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
52818
52819      var objectHas = require('../internals/has');
52820
52821      var sharedKey = require('../internals/shared-key');
52822
52823      var hiddenKeys = require('../internals/hidden-keys');
52824
52825      var WeakMap = global.WeakMap;
52826      var set, get, has;
52827
52828      var enforce = function enforce(it) {
52829        return has(it) ? get(it) : set(it, {});
52830      };
52831
52832      var getterFor = function getterFor(TYPE) {
52833        return function (it) {
52834          var state;
52835
52836          if (!isObject(it) || (state = get(it)).type !== TYPE) {
52837            throw TypeError('Incompatible receiver, ' + TYPE + ' required');
52838          }
52839
52840          return state;
52841        };
52842      };
52843
52844      if (NATIVE_WEAK_MAP) {
52845        var store = new WeakMap();
52846        var wmget = store.get;
52847        var wmhas = store.has;
52848        var wmset = store.set;
52849
52850        set = function set(it, metadata) {
52851          wmset.call(store, it, metadata);
52852          return metadata;
52853        };
52854
52855        get = function get(it) {
52856          return wmget.call(store, it) || {};
52857        };
52858
52859        has = function has(it) {
52860          return wmhas.call(store, it);
52861        };
52862      } else {
52863        var STATE = sharedKey('state');
52864        hiddenKeys[STATE] = true;
52865
52866        set = function set(it, metadata) {
52867          createNonEnumerableProperty(it, STATE, metadata);
52868          return metadata;
52869        };
52870
52871        get = function get(it) {
52872          return objectHas(it, STATE) ? it[STATE] : {};
52873        };
52874
52875        has = function has(it) {
52876          return objectHas(it, STATE);
52877        };
52878      }
52879
52880      module.exports = {
52881        set: set,
52882        get: get,
52883        has: has,
52884        enforce: enforce,
52885        getterFor: getterFor
52886      };
52887    }, {
52888      "../internals/create-non-enumerable-property": 228,
52889      "../internals/global": 242,
52890      "../internals/has": 243,
52891      "../internals/hidden-keys": 244,
52892      "../internals/is-object": 254,
52893      "../internals/native-weak-map": 261,
52894      "../internals/shared-key": 284
52895    }],
52896    251: [function (require, module, exports) {
52897      var wellKnownSymbol = require('../internals/well-known-symbol');
52898
52899      var Iterators = require('../internals/iterators');
52900
52901      var ITERATOR = wellKnownSymbol('iterator');
52902      var ArrayPrototype = Array.prototype; // check on default Array iterator
52903
52904      module.exports = function (it) {
52905        return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);
52906      };
52907    }, {
52908      "../internals/iterators": 257,
52909      "../internals/well-known-symbol": 299
52910    }],
52911    252: [function (require, module, exports) {
52912      var classof = require('../internals/classof-raw'); // `IsArray` abstract operation
52913      // https://tc39.github.io/ecma262/#sec-isarray
52914
52915
52916      module.exports = Array.isArray || function isArray(arg) {
52917        return classof(arg) == 'Array';
52918      };
52919    }, {
52920      "../internals/classof-raw": 225
52921    }],
52922    253: [function (require, module, exports) {
52923      var fails = require('../internals/fails');
52924
52925      var replacement = /#|\.prototype\./;
52926
52927      var isForced = function isForced(feature, detection) {
52928        var value = data[normalize(feature)];
52929        return value == POLYFILL ? true : value == NATIVE ? false : typeof detection == 'function' ? fails(detection) : !!detection;
52930      };
52931
52932      var normalize = isForced.normalize = function (string) {
52933        return String(string).replace(replacement, '.').toLowerCase();
52934      };
52935
52936      var data = isForced.data = {};
52937      var NATIVE = isForced.NATIVE = 'N';
52938      var POLYFILL = isForced.POLYFILL = 'P';
52939      module.exports = isForced;
52940    }, {
52941      "../internals/fails": 238
52942    }],
52943    254: [function (require, module, exports) {
52944      module.exports = function (it) {
52945        return _typeof2(it) === 'object' ? it !== null : typeof it === 'function';
52946      };
52947    }, {}],
52948    255: [function (require, module, exports) {
52949      module.exports = false;
52950    }, {}],
52951    256: [function (require, module, exports) {
52952      var anObject = require('../internals/an-object');
52953
52954      var isArrayIteratorMethod = require('../internals/is-array-iterator-method');
52955
52956      var toLength = require('../internals/to-length');
52957
52958      var bind = require('../internals/function-bind-context');
52959
52960      var getIteratorMethod = require('../internals/get-iterator-method');
52961
52962      var callWithSafeIterationClosing = require('../internals/call-with-safe-iteration-closing');
52963
52964      var Result = function Result(stopped, result) {
52965        this.stopped = stopped;
52966        this.result = result;
52967      };
52968
52969      var iterate = module.exports = function (iterable, fn, that, AS_ENTRIES, IS_ITERATOR) {
52970        var boundFunction = bind(fn, that, AS_ENTRIES ? 2 : 1);
52971        var iterator, iterFn, index, length, result, next, step;
52972
52973        if (IS_ITERATOR) {
52974          iterator = iterable;
52975        } else {
52976          iterFn = getIteratorMethod(iterable);
52977          if (typeof iterFn != 'function') throw TypeError('Target is not iterable'); // optimisation for array iterators
52978
52979          if (isArrayIteratorMethod(iterFn)) {
52980            for (index = 0, length = toLength(iterable.length); length > index; index++) {
52981              result = AS_ENTRIES ? boundFunction(anObject(step = iterable[index])[0], step[1]) : boundFunction(iterable[index]);
52982              if (result && result instanceof Result) return result;
52983            }
52984
52985            return new Result(false);
52986          }
52987
52988          iterator = iterFn.call(iterable);
52989        }
52990
52991        next = iterator.next;
52992
52993        while (!(step = next.call(iterator)).done) {
52994          result = callWithSafeIterationClosing(iterator, boundFunction, step.value, AS_ENTRIES);
52995          if (_typeof2(result) == 'object' && result && result instanceof Result) return result;
52996        }
52997
52998        return new Result(false);
52999      };
53000
53001      iterate.stop = function (result) {
53002        return new Result(true, result);
53003      };
53004    }, {
53005      "../internals/an-object": 219,
53006      "../internals/call-with-safe-iteration-closing": 223,
53007      "../internals/function-bind-context": 239,
53008      "../internals/get-iterator-method": 241,
53009      "../internals/is-array-iterator-method": 251,
53010      "../internals/to-length": 292
53011    }],
53012    257: [function (require, module, exports) {
53013      arguments[4][244][0].apply(exports, arguments);
53014    }, {
53015      "dup": 244
53016    }],
53017    258: [function (require, module, exports) {
53018      var global = require('../internals/global');
53019
53020      var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;
53021
53022      var classof = require('../internals/classof-raw');
53023
53024      var macrotask = require('../internals/task').set;
53025
53026      var IS_IOS = require('../internals/engine-is-ios');
53027
53028      var MutationObserver = global.MutationObserver || global.WebKitMutationObserver;
53029      var process = global.process;
53030      var Promise = global.Promise;
53031      var IS_NODE = classof(process) == 'process'; // Node.js 11 shows ExperimentalWarning on getting `queueMicrotask`
53032
53033      var queueMicrotaskDescriptor = getOwnPropertyDescriptor(global, 'queueMicrotask');
53034      var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value;
53035      var flush, head, last, notify, toggle, node, promise, then; // modern engines have queueMicrotask method
53036
53037      if (!queueMicrotask) {
53038        flush = function flush() {
53039          var parent, fn;
53040          if (IS_NODE && (parent = process.domain)) parent.exit();
53041
53042          while (head) {
53043            fn = head.fn;
53044            head = head.next;
53045
53046            try {
53047              fn();
53048            } catch (error) {
53049              if (head) notify();else last = undefined;
53050              throw error;
53051            }
53052          }
53053
53054          last = undefined;
53055          if (parent) parent.enter();
53056        }; // Node.js
53057
53058
53059        if (IS_NODE) {
53060          notify = function notify() {
53061            process.nextTick(flush);
53062          }; // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339
53063
53064        } else if (MutationObserver && !IS_IOS) {
53065          toggle = true;
53066          node = document.createTextNode('');
53067          new MutationObserver(flush).observe(node, {
53068            characterData: true
53069          });
53070
53071          notify = function notify() {
53072            node.data = toggle = !toggle;
53073          }; // environments with maybe non-completely correct, but existent Promise
53074
53075        } else if (Promise && Promise.resolve) {
53076          // Promise.resolve without an argument throws an error in LG WebOS 2
53077          promise = Promise.resolve(undefined);
53078          then = promise.then;
53079
53080          notify = function notify() {
53081            then.call(promise, flush);
53082          }; // for other environments - macrotask based on:
53083          // - setImmediate
53084          // - MessageChannel
53085          // - window.postMessag
53086          // - onreadystatechange
53087          // - setTimeout
53088
53089        } else {
53090          notify = function notify() {
53091            // strange IE + webpack dev server bug - use .call(global)
53092            macrotask.call(global, flush);
53093          };
53094        }
53095      }
53096
53097      module.exports = queueMicrotask || function (fn) {
53098        var task = {
53099          fn: fn,
53100          next: undefined
53101        };
53102        if (last) last.next = task;
53103
53104        if (!head) {
53105          head = task;
53106          notify();
53107        }
53108
53109        last = task;
53110      };
53111    }, {
53112      "../internals/classof-raw": 225,
53113      "../internals/engine-is-ios": 233,
53114      "../internals/global": 242,
53115      "../internals/object-get-own-property-descriptor": 267,
53116      "../internals/task": 288
53117    }],
53118    259: [function (require, module, exports) {
53119      var global = require('../internals/global');
53120
53121      module.exports = global.Promise;
53122    }, {
53123      "../internals/global": 242
53124    }],
53125    260: [function (require, module, exports) {
53126      var fails = require('../internals/fails');
53127
53128      module.exports = !!Object.getOwnPropertySymbols && !fails(function () {
53129        // Chrome 38 Symbol has incorrect toString conversion
53130        // eslint-disable-next-line no-undef
53131        return !String(Symbol());
53132      });
53133    }, {
53134      "../internals/fails": 238
53135    }],
53136    261: [function (require, module, exports) {
53137      var global = require('../internals/global');
53138
53139      var inspectSource = require('../internals/inspect-source');
53140
53141      var WeakMap = global.WeakMap;
53142      module.exports = typeof WeakMap === 'function' && /native code/.test(inspectSource(WeakMap));
53143    }, {
53144      "../internals/global": 242,
53145      "../internals/inspect-source": 249
53146    }],
53147    262: [function (require, module, exports) {
53148      'use strict';
53149
53150      var aFunction = require('../internals/a-function');
53151
53152      var PromiseCapability = function PromiseCapability(C) {
53153        var resolve, reject;
53154        this.promise = new C(function ($$resolve, $$reject) {
53155          if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
53156          resolve = $$resolve;
53157          reject = $$reject;
53158        });
53159        this.resolve = aFunction(resolve);
53160        this.reject = aFunction(reject);
53161      }; // 25.4.1.5 NewPromiseCapability(C)
53162
53163
53164      module.exports.f = function (C) {
53165        return new PromiseCapability(C);
53166      };
53167    }, {
53168      "../internals/a-function": 217
53169    }],
53170    263: [function (require, module, exports) {
53171      'use strict';
53172
53173      var DESCRIPTORS = require('../internals/descriptors');
53174
53175      var fails = require('../internals/fails');
53176
53177      var objectKeys = require('../internals/object-keys');
53178
53179      var getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols');
53180
53181      var propertyIsEnumerableModule = require('../internals/object-property-is-enumerable');
53182
53183      var toObject = require('../internals/to-object');
53184
53185      var IndexedObject = require('../internals/indexed-object');
53186
53187      var nativeAssign = Object.assign;
53188      var defineProperty = Object.defineProperty; // `Object.assign` method
53189      // https://tc39.github.io/ecma262/#sec-object.assign
53190
53191      module.exports = !nativeAssign || fails(function () {
53192        // should have correct order of operations (Edge bug)
53193        if (DESCRIPTORS && nativeAssign({
53194          b: 1
53195        }, nativeAssign(defineProperty({}, 'a', {
53196          enumerable: true,
53197          get: function get() {
53198            defineProperty(this, 'b', {
53199              value: 3,
53200              enumerable: false
53201            });
53202          }
53203        }), {
53204          b: 2
53205        })).b !== 1) return true; // should work with symbols and should have deterministic property order (V8 bug)
53206
53207        var A = {};
53208        var B = {}; // eslint-disable-next-line no-undef
53209
53210        var symbol = Symbol();
53211        var alphabet = 'abcdefghijklmnopqrst';
53212        A[symbol] = 7;
53213        alphabet.split('').forEach(function (chr) {
53214          B[chr] = chr;
53215        });
53216        return nativeAssign({}, A)[symbol] != 7 || objectKeys(nativeAssign({}, B)).join('') != alphabet;
53217      }) ? function assign(target, source) {
53218        // eslint-disable-line no-unused-vars
53219        var T = toObject(target);
53220        var argumentsLength = arguments.length;
53221        var index = 1;
53222        var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
53223        var propertyIsEnumerable = propertyIsEnumerableModule.f;
53224
53225        while (argumentsLength > index) {
53226          var S = IndexedObject(arguments[index++]);
53227          var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S);
53228          var length = keys.length;
53229          var j = 0;
53230          var key;
53231
53232          while (length > j) {
53233            key = keys[j++];
53234            if (!DESCRIPTORS || propertyIsEnumerable.call(S, key)) T[key] = S[key];
53235          }
53236        }
53237
53238        return T;
53239      } : nativeAssign;
53240    }, {
53241      "../internals/descriptors": 231,
53242      "../internals/fails": 238,
53243      "../internals/indexed-object": 248,
53244      "../internals/object-get-own-property-symbols": 270,
53245      "../internals/object-keys": 272,
53246      "../internals/object-property-is-enumerable": 273,
53247      "../internals/to-object": 293
53248    }],
53249    264: [function (require, module, exports) {
53250      var anObject = require('../internals/an-object');
53251
53252      var defineProperties = require('../internals/object-define-properties');
53253
53254      var enumBugKeys = require('../internals/enum-bug-keys');
53255
53256      var hiddenKeys = require('../internals/hidden-keys');
53257
53258      var html = require('../internals/html');
53259
53260      var documentCreateElement = require('../internals/document-create-element');
53261
53262      var sharedKey = require('../internals/shared-key');
53263
53264      var GT = '>';
53265      var LT = '<';
53266      var PROTOTYPE = 'prototype';
53267      var SCRIPT = 'script';
53268      var IE_PROTO = sharedKey('IE_PROTO');
53269
53270      var EmptyConstructor = function EmptyConstructor() {
53271        /* empty */
53272      };
53273
53274      var scriptTag = function scriptTag(content) {
53275        return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
53276      }; // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
53277
53278
53279      var NullProtoObjectViaActiveX = function NullProtoObjectViaActiveX(activeXDocument) {
53280        activeXDocument.write(scriptTag(''));
53281        activeXDocument.close();
53282        var temp = activeXDocument.parentWindow.Object;
53283        activeXDocument = null; // avoid memory leak
53284
53285        return temp;
53286      }; // Create object with fake `null` prototype: use iframe Object with cleared prototype
53287
53288
53289      var NullProtoObjectViaIFrame = function NullProtoObjectViaIFrame() {
53290        // Thrash, waste and sodomy: IE GC bug
53291        var iframe = documentCreateElement('iframe');
53292        var JS = 'java' + SCRIPT + ':';
53293        var iframeDocument;
53294        iframe.style.display = 'none';
53295        html.appendChild(iframe); // https://github.com/zloirock/core-js/issues/475
53296
53297        iframe.src = String(JS);
53298        iframeDocument = iframe.contentWindow.document;
53299        iframeDocument.open();
53300        iframeDocument.write(scriptTag('document.F=Object'));
53301        iframeDocument.close();
53302        return iframeDocument.F;
53303      }; // Check for document.domain and active x support
53304      // No need to use active x approach when document.domain is not set
53305      // see https://github.com/es-shims/es5-shim/issues/150
53306      // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
53307      // avoid IE GC bug
53308
53309
53310      var activeXDocument;
53311
53312      var _NullProtoObject = function NullProtoObject() {
53313        try {
53314          /* global ActiveXObject */
53315          activeXDocument = document.domain && new ActiveXObject('htmlfile');
53316        } catch (error) {
53317          /* ignore */
53318        }
53319
53320        _NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame();
53321        var length = enumBugKeys.length;
53322
53323        while (length--) {
53324          delete _NullProtoObject[PROTOTYPE][enumBugKeys[length]];
53325        }
53326
53327        return _NullProtoObject();
53328      };
53329
53330      hiddenKeys[IE_PROTO] = true; // `Object.create` method
53331      // https://tc39.github.io/ecma262/#sec-object.create
53332
53333      module.exports = Object.create || function create(O, Properties) {
53334        var result;
53335
53336        if (O !== null) {
53337          EmptyConstructor[PROTOTYPE] = anObject(O);
53338          result = new EmptyConstructor();
53339          EmptyConstructor[PROTOTYPE] = null; // add "__proto__" for Object.getPrototypeOf polyfill
53340
53341          result[IE_PROTO] = O;
53342        } else result = _NullProtoObject();
53343
53344        return Properties === undefined ? result : defineProperties(result, Properties);
53345      };
53346    }, {
53347      "../internals/an-object": 219,
53348      "../internals/document-create-element": 232,
53349      "../internals/enum-bug-keys": 236,
53350      "../internals/hidden-keys": 244,
53351      "../internals/html": 246,
53352      "../internals/object-define-properties": 265,
53353      "../internals/shared-key": 284
53354    }],
53355    265: [function (require, module, exports) {
53356      var DESCRIPTORS = require('../internals/descriptors');
53357
53358      var definePropertyModule = require('../internals/object-define-property');
53359
53360      var anObject = require('../internals/an-object');
53361
53362      var objectKeys = require('../internals/object-keys'); // `Object.defineProperties` method
53363      // https://tc39.github.io/ecma262/#sec-object.defineproperties
53364
53365
53366      module.exports = DESCRIPTORS ? Object.defineProperties : function defineProperties(O, Properties) {
53367        anObject(O);
53368        var keys = objectKeys(Properties);
53369        var length = keys.length;
53370        var index = 0;
53371        var key;
53372
53373        while (length > index) {
53374          definePropertyModule.f(O, key = keys[index++], Properties[key]);
53375        }
53376
53377        return O;
53378      };
53379    }, {
53380      "../internals/an-object": 219,
53381      "../internals/descriptors": 231,
53382      "../internals/object-define-property": 266,
53383      "../internals/object-keys": 272
53384    }],
53385    266: [function (require, module, exports) {
53386      var DESCRIPTORS = require('../internals/descriptors');
53387
53388      var IE8_DOM_DEFINE = require('../internals/ie8-dom-define');
53389
53390      var anObject = require('../internals/an-object');
53391
53392      var toPrimitive = require('../internals/to-primitive');
53393
53394      var nativeDefineProperty = Object.defineProperty; // `Object.defineProperty` method
53395      // https://tc39.github.io/ecma262/#sec-object.defineproperty
53396
53397      exports.f = DESCRIPTORS ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
53398        anObject(O);
53399        P = toPrimitive(P, true);
53400        anObject(Attributes);
53401        if (IE8_DOM_DEFINE) try {
53402          return nativeDefineProperty(O, P, Attributes);
53403        } catch (error) {
53404          /* empty */
53405        }
53406        if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
53407        if ('value' in Attributes) O[P] = Attributes.value;
53408        return O;
53409      };
53410    }, {
53411      "../internals/an-object": 219,
53412      "../internals/descriptors": 231,
53413      "../internals/ie8-dom-define": 247,
53414      "../internals/to-primitive": 294
53415    }],
53416    267: [function (require, module, exports) {
53417      var DESCRIPTORS = require('../internals/descriptors');
53418
53419      var propertyIsEnumerableModule = require('../internals/object-property-is-enumerable');
53420
53421      var createPropertyDescriptor = require('../internals/create-property-descriptor');
53422
53423      var toIndexedObject = require('../internals/to-indexed-object');
53424
53425      var toPrimitive = require('../internals/to-primitive');
53426
53427      var has = require('../internals/has');
53428
53429      var IE8_DOM_DEFINE = require('../internals/ie8-dom-define');
53430
53431      var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; // `Object.getOwnPropertyDescriptor` method
53432      // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor
53433
53434      exports.f = DESCRIPTORS ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
53435        O = toIndexedObject(O);
53436        P = toPrimitive(P, true);
53437        if (IE8_DOM_DEFINE) try {
53438          return nativeGetOwnPropertyDescriptor(O, P);
53439        } catch (error) {
53440          /* empty */
53441        }
53442        if (has(O, P)) return createPropertyDescriptor(!propertyIsEnumerableModule.f.call(O, P), O[P]);
53443      };
53444    }, {
53445      "../internals/create-property-descriptor": 229,
53446      "../internals/descriptors": 231,
53447      "../internals/has": 243,
53448      "../internals/ie8-dom-define": 247,
53449      "../internals/object-property-is-enumerable": 273,
53450      "../internals/to-indexed-object": 290,
53451      "../internals/to-primitive": 294
53452    }],
53453    268: [function (require, module, exports) {
53454      var toIndexedObject = require('../internals/to-indexed-object');
53455
53456      var nativeGetOwnPropertyNames = require('../internals/object-get-own-property-names').f;
53457
53458      var toString = {}.toString;
53459      var windowNames = (typeof window === "undefined" ? "undefined" : _typeof2(window)) == 'object' && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : [];
53460
53461      var getWindowNames = function getWindowNames(it) {
53462        try {
53463          return nativeGetOwnPropertyNames(it);
53464        } catch (error) {
53465          return windowNames.slice();
53466        }
53467      }; // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
53468
53469
53470      module.exports.f = function getOwnPropertyNames(it) {
53471        return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : nativeGetOwnPropertyNames(toIndexedObject(it));
53472      };
53473    }, {
53474      "../internals/object-get-own-property-names": 269,
53475      "../internals/to-indexed-object": 290
53476    }],
53477    269: [function (require, module, exports) {
53478      var internalObjectKeys = require('../internals/object-keys-internal');
53479
53480      var enumBugKeys = require('../internals/enum-bug-keys');
53481
53482      var hiddenKeys = enumBugKeys.concat('length', 'prototype'); // `Object.getOwnPropertyNames` method
53483      // https://tc39.github.io/ecma262/#sec-object.getownpropertynames
53484
53485      exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
53486        return internalObjectKeys(O, hiddenKeys);
53487      };
53488    }, {
53489      "../internals/enum-bug-keys": 236,
53490      "../internals/object-keys-internal": 271
53491    }],
53492    270: [function (require, module, exports) {
53493      exports.f = Object.getOwnPropertySymbols;
53494    }, {}],
53495    271: [function (require, module, exports) {
53496      var has = require('../internals/has');
53497
53498      var toIndexedObject = require('../internals/to-indexed-object');
53499
53500      var indexOf = require('../internals/array-includes').indexOf;
53501
53502      var hiddenKeys = require('../internals/hidden-keys');
53503
53504      module.exports = function (object, names) {
53505        var O = toIndexedObject(object);
53506        var i = 0;
53507        var result = [];
53508        var key;
53509
53510        for (key in O) {
53511          !has(hiddenKeys, key) && has(O, key) && result.push(key);
53512        } // Don't enum bug & hidden keys
53513
53514
53515        while (names.length > i) {
53516          if (has(O, key = names[i++])) {
53517            ~indexOf(result, key) || result.push(key);
53518          }
53519        }
53520
53521        return result;
53522      };
53523    }, {
vendor: 4,395 bytes, lines 53524-53649
53524      "../internals/array-includes": 220,
53525      "../internals/has": 243,
53526      "../internals/hidden-keys": 244,
53527      "../internals/to-indexed-object": 290
53528    }],
53529    272: [function (require, module, exports) {
53530      var internalObjectKeys = require('../internals/object-keys-internal');
53531
53532      var enumBugKeys = require('../internals/enum-bug-keys'); // `Object.keys` method
53533      // https://tc39.github.io/ecma262/#sec-object.keys
53534
53535
53536      module.exports = Object.keys || function keys(O) {
53537        return internalObjectKeys(O, enumBugKeys);
53538      };
53539    }, {
53540      "../internals/enum-bug-keys": 236,
53541      "../internals/object-keys-internal": 271
53542    }],
53543    273: [function (require, module, exports) {
53544      'use strict';
53545
53546      var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
53547      var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; // Nashorn ~ JDK8 bug
53548
53549      var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({
53550        1: 2
53551      }, 1); // `Object.prototype.propertyIsEnumerable` method implementation
53552      // https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable
53553
53554      exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
53555        var descriptor = getOwnPropertyDescriptor(this, V);
53556        return !!descriptor && descriptor.enumerable;
53557      } : nativePropertyIsEnumerable;
53558    }, {}],
53559    274: [function (require, module, exports) {
53560      var getBuiltIn = require('../internals/get-built-in');
53561
53562      var getOwnPropertyNamesModule = require('../internals/object-get-own-property-names');
53563
53564      var getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols');
53565
53566      var anObject = require('../internals/an-object'); // all object keys, includes non-enumerable and symbols
53567
53568
53569      module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
53570        var keys = getOwnPropertyNamesModule.f(anObject(it));
53571        var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
53572        return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
53573      };
53574    }, {
53575      "../internals/an-object": 219,
53576      "../internals/get-built-in": 240,
53577      "../internals/object-get-own-property-names": 269,
53578      "../internals/object-get-own-property-symbols": 270
53579    }],
53580    275: [function (require, module, exports) {
53581      var global = require('../internals/global');
53582
53583      module.exports = global;
53584    }, {
53585      "../internals/global": 242
53586    }],
53587    276: [function (require, module, exports) {
53588      module.exports = function (exec) {
53589        try {
53590          return {
53591            error: false,
53592            value: exec()
53593          };
53594        } catch (error) {
53595          return {
53596            error: true,
53597            value: error
53598          };
53599        }
53600      };
53601    }, {}],
53602    277: [function (require, module, exports) {
53603      var anObject = require('../internals/an-object');
53604
53605      var isObject = require('../internals/is-object');
53606
53607      var newPromiseCapability = require('../internals/new-promise-capability');
53608
53609      module.exports = function (C, x) {
53610        anObject(C);
53611        if (isObject(x) && x.constructor === C) return x;
53612        var promiseCapability = newPromiseCapability.f(C);
53613        var resolve = promiseCapability.resolve;
53614        resolve(x);
53615        return promiseCapability.promise;
53616      };
53617    }, {
53618      "../internals/an-object": 219,
53619      "../internals/is-object": 254,
53620      "../internals/new-promise-capability": 262
53621    }],
53622    278: [function (require, module, exports) {
53623      var redefine = require('../internals/redefine');
53624
53625      module.exports = function (target, src, options) {
53626        for (var key in src) {
53627          redefine(target, key, src[key], options);
53628        }
53629
53630        return target;
53631      };
53632    }, {
53633      "../internals/redefine": 279
53634    }],
53635    279: [function (require, module, exports) {
53636      var global = require('../internals/global');
53637
53638      var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
53639
53640      var has = require('../internals/has');
53641
53642      var setGlobal = require('../internals/set-global');
53643
53644      var inspectSource = require('../internals/inspect-source');
53645
53646      var InternalStateModule = require('../internals/internal-state');
53647
53648      var getInternalState = InternalStateModule.get;
53649      var enforceInternalState = InternalStateModule.enforce;
53650      var TEMPLATE = String(String).split('String');
53651      (module.exports = function (O, key, value, options) {
53652        var unsafe = options ? !!options.unsafe : false;
53653        var simple = options ? !!options.enumerable : false;
53654        var noTargetGet = options ? !!options.noTargetGet : false;
53655
53656        if (typeof value == 'function') {
53657          if (typeof key == 'string' && !has(value, 'name')) createNonEnumerableProperty(value, 'name', key);
53658          enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : '');
53659        }
53660
53661        if (O === global) {
53662          if (simple) O[key] = value;else setGlobal(key, value);
53663          return;
53664        } else if (!unsafe) {
53665          delete O[key];
53666        } else if (!noTargetGet && O[key]) {
53667          simple = true;
53668        }
53669
53670        if (simple) O[key] = value;else createNonEnumerableProperty(O, key, value); // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
53671      })(Function.prototype, 'toString', function toString() {
53672        return typeof this == 'function' && getInternalState(this).source || inspectSource(this);
53673      });
53674    }, {
53675      "../internals/create-non-enumerable-property": 228,
53676      "../internals/global": 242,
53677      "../internals/has": 243,
53678      "../internals/inspect-source": 249,
53679      "../internals/internal-state": 250,
53680      "../internals/set-global": 281
53681    }],
53682    280: [function (require, module, exports) {
53683      // `RequireObjectCoercible` abstract operation
53684      // https://tc39.github.io/ecma262/#sec-requireobjectcoercible
53685      module.exports = function (it) {
53686        if (it == undefined) throw TypeError("Can't call method on " + it);
53687        return it;
53688      };
53689    }, {}],
53690    281: [function (require, module, exports) {
53691      var global = require('../internals/global');
53692
53693      var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
53694
53695      module.exports = function (key, value) {
53696        try {
53697          createNonEnumerableProperty(global, key, value);
53698        } catch (error) {
53699          global[key] = value;
53700        }
53701
53702        return value;
53703      };
53704    }, {
53705      "../internals/create-non-enumerable-property": 228,
53706      "../internals/global": 242
53707    }],
53708    282: [function (require, module, exports) {
53709      'use strict';
53710
53711      var getBuiltIn = require('../internals/get-built-in');
53712
53713      var definePropertyModule = require('../internals/object-define-property');
53714
53715      var wellKnownSymbol = require('../internals/well-known-symbol');
53716
53717      var DESCRIPTORS = require('../internals/descriptors');
53718
53719      var SPECIES = wellKnownSymbol('species');
53720
53721      module.exports = function (CONSTRUCTOR_NAME) {
53722        var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
53723        var defineProperty = definePropertyModule.f;
53724
53725        if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) {
53726          defineProperty(Constructor, SPECIES, {
53727            configurable: true,
53728            get: function get() {
53729              return this;
53730            }
53731          });
53732        }
53733      };
53734    }, {
53735      "../internals/descriptors": 231,
53736      "../internals/get-built-in": 240,
53737      "../internals/object-define-property": 266,
53738      "../internals/well-known-symbol": 299
53739    }],
53740    283: [function (require, module, exports) {
53741      var defineProperty = require('../internals/object-define-property').f;
53742
53743      var has = require('../internals/has');
53744
53745      var wellKnownSymbol = require('../internals/well-known-symbol');
53746
53747      var TO_STRING_TAG = wellKnownSymbol('toStringTag');
53748
53749      module.exports = function (it, TAG, STATIC) {
53750        if (it && !has(it = STATIC ? it : it.prototype, TO_STRING_TAG)) {
53751          defineProperty(it, TO_STRING_TAG, {
53752            configurable: true,
53753            value: TAG
53754          });
53755        }
53756      };
53757    }, {
53758      "../internals/has": 243,
53759      "../internals/object-define-property": 266,
53760      "../internals/well-known-symbol": 299
53761    }],
53762    284: [function (require, module, exports) {
53763      var shared = require('../internals/shared');
53764
53765      var uid = require('../internals/uid');
53766
53767      var keys = shared('keys');
53768
53769      module.exports = function (key) {
53770        return keys[key] || (keys[key] = uid(key));
53771      };
53772    }, {
53773      "../internals/shared": 286,
53774      "../internals/uid": 296
53775    }],
53776    285: [function (require, module, exports) {
53777      var global = require('../internals/global');
53778
53779      var setGlobal = require('../internals/set-global');
53780
53781      var SHARED = '__core-js_shared__';
53782      var store = global[SHARED] || setGlobal(SHARED, {});
53783      module.exports = store;
53784    }, {
53785      "../internals/global": 242,
53786      "../internals/set-global": 281
53787    }],
53788    286: [function (require, module, exports) {
53789      var IS_PURE = require('../internals/is-pure');
53790
53791      var store = require('../internals/shared-store');
53792
53793      (module.exports = function (key, value) {
53794        return store[key] || (store[key] = value !== undefined ? value : {});
53795      })('versions', []).push({
53796        version: '3.6.5',
53797        mode: IS_PURE ? 'pure' : 'global',
53798        copyright: '© 2020 Denis Pushkarev (zloirock.ru)'
53799      });
53800    }, {
53801      "../internals/is-pure": 255,
53802      "../internals/shared-store": 285
53803    }],
53804    287: [function (require, module, exports) {
53805      var anObject = require('../internals/an-object');
53806
53807      var aFunction = require('../internals/a-function');
53808
53809      var wellKnownSymbol = require('../internals/well-known-symbol');
53810
53811      var SPECIES = wellKnownSymbol('species'); // `SpeciesConstructor` abstract operation
53812      // https://tc39.github.io/ecma262/#sec-speciesconstructor
53813
53814      module.exports = function (O, defaultConstructor) {
53815        var C = anObject(O).constructor;
53816        var S;
53817        return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? defaultConstructor : aFunction(S);
53818      };
53819    }, {
53820      "../internals/a-function": 217,
53821      "../internals/an-object": 219,
53822      "../internals/well-known-symbol": 299
53823    }],
53824    288: [function (require, module, exports) {
53825      var global = require('../internals/global');
53826
53827      var fails = require('../internals/fails');
53828
53829      var classof = require('../internals/classof-raw');
53830
53831      var bind = require('../internals/function-bind-context');
53832
53833      var html = require('../internals/html');
53834
53835      var createElement = require('../internals/document-create-element');
53836
53837      var IS_IOS = require('../internals/engine-is-ios');
53838
53839      var location = global.location;
53840      var set = global.setImmediate;
53841      var clear = global.clearImmediate;
53842      var process = global.process;
53843      var MessageChannel = global.MessageChannel;
53844      var Dispatch = global.Dispatch;
53845      var counter = 0;
53846      var queue = {};
53847      var ONREADYSTATECHANGE = 'onreadystatechange';
53848      var defer, channel, port;
53849
53850      var run = function run(id) {
53851        // eslint-disable-next-line no-prototype-builtins
53852        if (queue.hasOwnProperty(id)) {
53853          var fn = queue[id];
53854          delete queue[id];
53855          fn();
53856        }
53857      };
53858
53859      var runner = function runner(id) {
53860        return function () {
53861          run(id);
53862        };
53863      };
53864
53865      var listener = function listener(event) {
53866        run(event.data);
53867      };
53868
53869      var post = function post(id) {
53870        // old engines have not location.origin
53871        global.postMessage(id + '', location.protocol + '//' + location.host);
53872      }; // Node.js 0.9+ & IE10+ has setImmediate, otherwise:
53873
53874
53875      if (!set || !clear) {
53876        set = function setImmediate(fn) {
53877          var args = [];
53878          var i = 1;
53879
53880          while (arguments.length > i) {
53881            args.push(arguments[i++]);
53882          }
53883
53884          queue[++counter] = function () {
53885            // eslint-disable-next-line no-new-func
53886            (typeof fn == 'function' ? fn : Function(fn)).apply(undefined, args);
53887          };
53888
53889          defer(counter);
53890          return counter;
53891        };
53892
53893        clear = function clearImmediate(id) {
53894          delete queue[id];
53895        }; // Node.js 0.8-
53896
53897
53898        if (classof(process) == 'process') {
53899          defer = function defer(id) {
53900            process.nextTick(runner(id));
53901          }; // Sphere (JS game engine) Dispatch API
53902
53903        } else if (Dispatch && Dispatch.now) {
53904          defer = function defer(id) {
53905            Dispatch.now(runner(id));
53906          }; // Browsers with MessageChannel, includes WebWorkers
53907          // except iOS - https://github.com/zloirock/core-js/issues/624
53908
53909        } else if (MessageChannel && !IS_IOS) {
53910          channel = new MessageChannel();
53911          port = channel.port2;
53912          channel.port1.onmessage = listener;
53913          defer = bind(port.postMessage, port, 1); // Browsers with postMessage, skip WebWorkers
53914          // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
53915        } else if (global.addEventListener && typeof postMessage == 'function' && !global.importScripts && !fails(post) && location.protocol !== 'file:') {
53916          defer = post;
53917          global.addEventListener('message', listener, false); // IE8-
53918        } else if (ONREADYSTATECHANGE in createElement('script')) {
53919          defer = function defer(id) {
53920            html.appendChild(createElement('script'))[ONREADYSTATECHANGE] = function () {
53921              html.removeChild(this);
53922              run(id);
53923            };
53924          }; // Rest old browsers
53925
53926        } else {
53927          defer = function defer(id) {
53928            setTimeout(runner(id), 0);
53929          };
53930        }
53931      }
53932
53933      module.exports = {
53934        set: set,
53935        clear: clear
53936      };
53937    }, {
vendor: 4,123 bytes, lines 53938-54041
53938      "../internals/classof-raw": 225,
53939      "../internals/document-create-element": 232,
53940      "../internals/engine-is-ios": 233,
53941      "../internals/fails": 238,
53942      "../internals/function-bind-context": 239,
53943      "../internals/global": 242,
53944      "../internals/html": 246
53945    }],
53946    289: [function (require, module, exports) {
53947      var toInteger = require('../internals/to-integer');
53948
53949      var max = Math.max;
53950      var min = Math.min; // Helper for a popular repeating case of the spec:
53951      // Let integer be ? ToInteger(index).
53952      // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
53953
53954      module.exports = function (index, length) {
53955        var integer = toInteger(index);
53956        return integer < 0 ? max(integer + length, 0) : min(integer, length);
53957      };
53958    }, {
53959      "../internals/to-integer": 291
53960    }],
53961    290: [function (require, module, exports) {
53962      // toObject with fallback for non-array-like ES3 strings
53963      var IndexedObject = require('../internals/indexed-object');
53964
53965      var requireObjectCoercible = require('../internals/require-object-coercible');
53966
53967      module.exports = function (it) {
53968        return IndexedObject(requireObjectCoercible(it));
53969      };
53970    }, {
53971      "../internals/indexed-object": 248,
53972      "../internals/require-object-coercible": 280
53973    }],
53974    291: [function (require, module, exports) {
53975      var ceil = Math.ceil;
53976      var floor = Math.floor; // `ToInteger` abstract operation
53977      // https://tc39.github.io/ecma262/#sec-tointeger
53978
53979      module.exports = function (argument) {
53980        return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
53981      };
53982    }, {}],
53983    292: [function (require, module, exports) {
53984      var toInteger = require('../internals/to-integer');
53985
53986      var min = Math.min; // `ToLength` abstract operation
53987      // https://tc39.github.io/ecma262/#sec-tolength
53988
53989      module.exports = function (argument) {
53990        return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
53991      };
53992    }, {
53993      "../internals/to-integer": 291
53994    }],
53995    293: [function (require, module, exports) {
53996      var requireObjectCoercible = require('../internals/require-object-coercible'); // `ToObject` abstract operation
53997      // https://tc39.github.io/ecma262/#sec-toobject
53998
53999
54000      module.exports = function (argument) {
54001        return Object(requireObjectCoercible(argument));
54002      };
54003    }, {
54004      "../internals/require-object-coercible": 280
54005    }],
54006    294: [function (require, module, exports) {
54007      var isObject = require('../internals/is-object'); // `ToPrimitive` abstract operation
54008      // https://tc39.github.io/ecma262/#sec-toprimitive
54009      // instead of the ES6 spec version, we didn't implement @@toPrimitive case
54010      // and the second argument - flag - preferred type is a string
54011
54012
54013      module.exports = function (input, PREFERRED_STRING) {
54014        if (!isObject(input)) return input;
54015        var fn, val;
54016        if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
54017        if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;
54018        if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
54019        throw TypeError("Can't convert object to primitive value");
54020      };
54021    }, {
54022      "../internals/is-object": 254
54023    }],
54024    295: [function (require, module, exports) {
54025      var wellKnownSymbol = require('../internals/well-known-symbol');
54026
54027      var TO_STRING_TAG = wellKnownSymbol('toStringTag');
54028      var test = {};
54029      test[TO_STRING_TAG] = 'z';
54030      module.exports = String(test) === '[object z]';
54031    }, {
54032      "../internals/well-known-symbol": 299
54033    }],
54034    296: [function (require, module, exports) {
54035      var id = 0;
54036      var postfix = Math.random();
54037
54038      module.exports = function (key) {
54039        return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
54040      };
54041    }, {}],
54042    297: [function (require, module, exports) {
54043      var NATIVE_SYMBOL = require('../internals/native-symbol');
54044
54045      module.exports = NATIVE_SYMBOL // eslint-disable-next-line no-undef
54046      && !Symbol.sham // eslint-disable-next-line no-undef
54047      && _typeof2(Symbol.iterator) == 'symbol';
54048    }, {
54049      "../internals/native-symbol": 260
54050    }],
54051    298: [function (require, module, exports) {
54052      var wellKnownSymbol = require('../internals/well-known-symbol');
54053
54054      exports.f = wellKnownSymbol;
54055    }, {
54056      "../internals/well-known-symbol": 299
54057    }],
54058    299: [function (require, module, exports) {
54059      var global = require('../internals/global');
54060
54061      var shared = require('../internals/shared');
54062
54063      var has = require('../internals/has');
54064
54065      var uid = require('../internals/uid');
54066
54067      var NATIVE_SYMBOL = require('../internals/native-symbol');
54068
54069      var USE_SYMBOL_AS_UID = require('../internals/use-symbol-as-uid');
54070
54071      var WellKnownSymbolsStore = shared('wks');
54072      var _Symbol2 = global.Symbol;
54073      var createWellKnownSymbol = USE_SYMBOL_AS_UID ? _Symbol2 : _Symbol2 && _Symbol2.withoutSetter || uid;
54074
54075      module.exports = function (name) {
54076        if (!has(WellKnownSymbolsStore, name)) {
54077          if (NATIVE_SYMBOL && has(_Symbol2, name)) WellKnownSymbolsStore[name] = _Symbol2[name];else WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name);
54078        }
54079
54080        return WellKnownSymbolsStore[name];
54081      };
54082    }, {
54083      "../internals/global": 242,
54084      "../internals/has": 243,
54085      "../internals/native-symbol": 260,
54086      "../internals/shared": 286,
54087      "../internals/uid": 296,
54088      "../internals/use-symbol-as-uid": 297
54089    }],
54090    300: [function (require, module, exports) {
54091      var $ = require('../internals/export');
54092
54093      var assign = require('../internals/object-assign'); // `Object.assign` method
54094      // https://tc39.github.io/ecma262/#sec-object.assign
54095
54096
54097      $({
54098        target: 'Object',
54099        stat: true,
54100        forced: Object.assign !== assign
54101      }, {
54102        assign: assign
54103      });
54104    }, {
54105      "../internals/export": 237,
54106      "../internals/object-assign": 263
54107    }],
54108    301: [function (require, module, exports) {
54109      var $ = require('../internals/export');
54110
54111      var toObject = require('../internals/to-object');
54112
54113      var nativeKeys = require('../internals/object-keys');
54114
54115      var fails = require('../internals/fails');
54116
54117      var FAILS_ON_PRIMITIVES = fails(function () {
54118        nativeKeys(1);
54119      }); // `Object.keys` method
54120      // https://tc39.github.io/ecma262/#sec-object.keys
54121
54122      $({
54123        target: 'Object',
54124        stat: true,
54125        forced: FAILS_ON_PRIMITIVES
54126      }, {
54127        keys: function keys(it) {
54128          return nativeKeys(toObject(it));
54129        }
54130      });
54131    }, {
54132      "../internals/export": 237,
54133      "../internals/fails": 238,
54134      "../internals/object-keys": 272,
54135      "../internals/to-object": 293
54136    }],
54137    302: [function (require, module, exports) {
54138      'use strict';
54139
54140      var $ = require('../internals/export');
54141
54142      var IS_PURE = require('../internals/is-pure');
54143
54144      var global = require('../internals/global');
54145
54146      var getBuiltIn = require('../internals/get-built-in');
54147
54148      var NativePromise = require('../internals/native-promise-constructor');
54149
54150      var redefine = require('../internals/redefine');
54151
54152      var redefineAll = require('../internals/redefine-all');
54153
54154      var setToStringTag = require('../internals/set-to-string-tag');
54155
54156      var setSpecies = require('../internals/set-species');
54157
54158      var isObject = require('../internals/is-object');
54159
54160      var aFunction = require('../internals/a-function');
54161
54162      var anInstance = require('../internals/an-instance');
54163
54164      var classof = require('../internals/classof-raw');
54165
54166      var inspectSource = require('../internals/inspect-source');
54167
54168      var iterate = require('../internals/iterate');
54169
54170      var checkCorrectnessOfIteration = require('../internals/check-correctness-of-iteration');
54171
54172      var speciesConstructor = require('../internals/species-constructor');
54173
54174      var task = require('../internals/task').set;
54175
54176      var microtask = require('../internals/microtask');
54177
54178      var promiseResolve = require('../internals/promise-resolve');
54179
54180      var hostReportErrors = require('../internals/host-report-errors');
54181
54182      var newPromiseCapabilityModule = require('../internals/new-promise-capability');
54183
54184      var perform = require('../internals/perform');
54185
54186      var InternalStateModule = require('../internals/internal-state');
54187
54188      var isForced = require('../internals/is-forced');
54189
54190      var wellKnownSymbol = require('../internals/well-known-symbol');
54191
54192      var V8_VERSION = require('../internals/engine-v8-version');
54193
54194      var SPECIES = wellKnownSymbol('species');
54195      var PROMISE = 'Promise';
54196      var getInternalState = InternalStateModule.get;
54197      var setInternalState = InternalStateModule.set;
54198      var getInternalPromiseState = InternalStateModule.getterFor(PROMISE);
54199      var PromiseConstructor = NativePromise;
54200      var TypeError = global.TypeError;
54201      var document = global.document;
54202      var process = global.process;
54203      var $fetch = getBuiltIn('fetch');
54204      var newPromiseCapability = newPromiseCapabilityModule.f;
54205      var newGenericPromiseCapability = newPromiseCapability;
54206      var IS_NODE = classof(process) == 'process';
54207      var DISPATCH_EVENT = !!(document && document.createEvent && global.dispatchEvent);
54208      var UNHANDLED_REJECTION = 'unhandledrejection';
54209      var REJECTION_HANDLED = 'rejectionhandled';
54210      var PENDING = 0;
54211      var FULFILLED = 1;
54212      var REJECTED = 2;
54213      var HANDLED = 1;
54214      var UNHANDLED = 2;
54215      var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
54216      var FORCED = isForced(PROMISE, function () {
54217        var GLOBAL_CORE_JS_PROMISE = inspectSource(PromiseConstructor) !== String(PromiseConstructor);
54218
54219        if (!GLOBAL_CORE_JS_PROMISE) {
54220          // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
54221          // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
54222          // We can't detect it synchronously, so just check versions
54223          if (V8_VERSION === 66) return true; // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
54224
54225          if (!IS_NODE && typeof PromiseRejectionEvent != 'function') return true;
54226        } // We need Promise#finally in the pure version for preventing prototype pollution
54227
54228
54229        if (IS_PURE && !PromiseConstructor.prototype['finally']) return true; // We can't use @@species feature detection in V8 since it causes
54230        // deoptimization and performance degradation
54231        // https://github.com/zloirock/core-js/issues/679
54232
54233        if (V8_VERSION >= 51 && /native code/.test(PromiseConstructor)) return false; // Detect correctness of subclassing with @@species support
54234
54235        var promise = PromiseConstructor.resolve(1);
54236
54237        var FakePromise = function FakePromise(exec) {
54238          exec(function () {
54239            /* empty */
54240          }, function () {
54241            /* empty */
54242          });
54243        };
54244
54245        var constructor = promise.constructor = {};
54246        constructor[SPECIES] = FakePromise;
54247        return !(promise.then(function () {
54248          /* empty */
54249        }) instanceof FakePromise);
54250      });
54251      var INCORRECT_ITERATION = FORCED || !checkCorrectnessOfIteration(function (iterable) {
54252        PromiseConstructor.all(iterable)['catch'](function () {
54253          /* empty */
54254        });
54255      }); // helpers
54256
54257      var isThenable = function isThenable(it) {
54258        var then;
54259        return isObject(it) && typeof (then = it.then) == 'function' ? then : false;
vendor: 4,249 bytes, lines 54260-54383
54260      };
54261
54262      var notify = function notify(promise, state, isReject) {
54263        if (state.notified) return;
54264        state.notified = true;
54265        var chain = state.reactions;
54266        microtask(function () {
54267          var value = state.value;
54268          var ok = state.state == FULFILLED;
54269          var index = 0; // variable length - can't use forEach
54270
54271          while (chain.length > index) {
54272            var reaction = chain[index++];
54273            var handler = ok ? reaction.ok : reaction.fail;
54274            var resolve = reaction.resolve;
54275            var reject = reaction.reject;
54276            var domain = reaction.domain;
54277            var result, then, exited;
54278
54279            try {
54280              if (handler) {
54281                if (!ok) {
54282                  if (state.rejection === UNHANDLED) onHandleUnhandled(promise, state);
54283                  state.rejection = HANDLED;
54284                }
54285
54286                if (handler === true) result = value;else {
54287                  if (domain) domain.enter();
54288                  result = handler(value); // can throw
54289
54290                  if (domain) {
54291                    domain.exit();
54292                    exited = true;
54293                  }
54294                }
54295
54296                if (result === reaction.promise) {
54297                  reject(TypeError('Promise-chain cycle'));
54298                } else if (then = isThenable(result)) {
54299                  then.call(result, resolve, reject);
54300                } else resolve(result);
54301              } else reject(value);
54302            } catch (error) {
54303              if (domain && !exited) domain.exit();
54304              reject(error);
54305            }
54306          }
54307
54308          state.reactions = [];
54309          state.notified = false;
54310          if (isReject && !state.rejection) onUnhandled(promise, state);
54311        });
54312      };
54313
54314      var dispatchEvent = function dispatchEvent(name, promise, reason) {
54315        var event, handler;
54316
54317        if (DISPATCH_EVENT) {
54318          event = document.createEvent('Event');
54319          event.promise = promise;
54320          event.reason = reason;
54321          event.initEvent(name, false, true);
54322          global.dispatchEvent(event);
54323        } else event = {
54324          promise: promise,
54325          reason: reason
54326        };
54327
54328        if (handler = global['on' + name]) handler(event);else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason);
54329      };
54330
54331      var onUnhandled = function onUnhandled(promise, state) {
54332        task.call(global, function () {
54333          var value = state.value;
54334          var IS_UNHANDLED = isUnhandled(state);
54335          var result;
54336
54337          if (IS_UNHANDLED) {
54338            result = perform(function () {
54339              if (IS_NODE) {
54340                process.emit('unhandledRejection', value, promise);
54341              } else dispatchEvent(UNHANDLED_REJECTION, promise, value);
54342            }); // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
54343
54344            state.rejection = IS_NODE || isUnhandled(state) ? UNHANDLED : HANDLED;
54345            if (result.error) throw result.value;
54346          }
54347        });
54348      };
54349
54350      var isUnhandled = function isUnhandled(state) {
54351        return state.rejection !== HANDLED && !state.parent;
54352      };
54353
54354      var onHandleUnhandled = function onHandleUnhandled(promise, state) {
54355        task.call(global, function () {
54356          if (IS_NODE) {
54357            process.emit('rejectionHandled', promise);
54358          } else dispatchEvent(REJECTION_HANDLED, promise, state.value);
54359        });
54360      };
54361
54362      var bind = function bind(fn, promise, state, unwrap) {
54363        return function (value) {
54364          fn(promise, state, value, unwrap);
54365        };
54366      };
54367
54368      var internalReject = function internalReject(promise, state, value, unwrap) {
54369        if (state.done) return;
54370        state.done = true;
54371        if (unwrap) state = unwrap;
54372        state.value = value;
54373        state.state = REJECTED;
54374        notify(promise, state, true);
54375      };
54376
54377      var internalResolve = function internalResolve(promise, state, value, unwrap) {
54378        if (state.done) return;
54379        state.done = true;
54380        if (unwrap) state = unwrap;
54381
54382        try {
54383          if (promise === value) throw TypeError("Promise can't be resolved 
vendor: 5,996 bytes, lines 54383-54554
54383itself");
54384          var then = isThenable(value);
54385
54386          if (then) {
54387            microtask(function () {
54388              var wrapper = {
54389                done: false
54390              };
54391
54392              try {
54393                then.call(value, bind(internalResolve, promise, wrapper, state), bind(internalReject, promise, wrapper, state));
54394              } catch (error) {
54395                internalReject(promise, wrapper, error, state);
54396              }
54397            });
54398          } else {
54399            state.value = value;
54400            state.state = FULFILLED;
54401            notify(promise, state, false);
54402          }
54403        } catch (error) {
54404          internalReject(promise, {
54405            done: false
54406          }, error, state);
54407        }
54408      }; // constructor polyfill
54409
54410
54411      if (FORCED) {
54412        // 25.4.3.1 Promise(executor)
54413        PromiseConstructor = function Promise(executor) {
54414          anInstance(this, PromiseConstructor, PROMISE);
54415          aFunction(executor);
54416          Internal.call(this);
54417          var state = getInternalState(this);
54418
54419          try {
54420            executor(bind(internalResolve, this, state), bind(internalReject, this, state));
54421          } catch (error) {
54422            internalReject(this, state, error);
54423          }
54424        }; // eslint-disable-next-line no-unused-vars
54425
54426
54427        Internal = function Promise(executor) {
54428          setInternalState(this, {
54429            type: PROMISE,
54430            done: false,
54431            notified: false,
54432            parent: false,
54433            reactions: [],
54434            rejection: false,
54435            state: PENDING,
54436            value: undefined
54437          });
54438        };
54439
54440        Internal.prototype = redefineAll(PromiseConstructor.prototype, {
54441          // `Promise.prototype.then` method
54442          // https://tc39.github.io/ecma262/#sec-promise.prototype.then
54443          then: function then(onFulfilled, onRejected) {
54444            var state = getInternalPromiseState(this);
54445            var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor));
54446            reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;
54447            reaction.fail = typeof onRejected == 'function' && onRejected;
54448            reaction.domain = IS_NODE ? process.domain : undefined;
54449            state.parent = true;
54450            state.reactions.push(reaction);
54451            if (state.state != PENDING) notify(this, state, false);
54452            return reaction.promise;
54453          },
54454          // `Promise.prototype.catch` method
54455          // https://tc39.github.io/ecma262/#sec-promise.prototype.catch
54456          'catch': function _catch(onRejected) {
54457            return this.then(undefined, onRejected);
54458          }
54459        });
54460
54461        OwnPromiseCapability = function OwnPromiseCapability() {
54462          var promise = new Internal();
54463          var state = getInternalState(promise);
54464          this.promise = promise;
54465          this.resolve = bind(internalResolve, promise, state);
54466          this.reject = bind(internalReject, promise, state);
54467        };
54468
54469        newPromiseCapabilityModule.f = newPromiseCapability = function newPromiseCapability(C) {
54470          return C === PromiseConstructor || C === PromiseWrapper ? new OwnPromiseCapability(C) : newGenericPromiseCapability(C);
54471        };
54472
54473        if (!IS_PURE && typeof NativePromise == 'function') {
54474          nativeThen = NativePromise.prototype.then; // wrap native Promise#then for native async functions
54475
54476          redefine(NativePromise.prototype, 'then', function then(onFulfilled, onRejected) {
54477            var that = this;
54478            return new PromiseConstructor(function (resolve, reject) {
54479              nativeThen.call(that, resolve, reject);
54480            }).then(onFulfilled, onRejected); // https://github.com/zloirock/core-js/issues/640
54481          }, {
54482            unsafe: true
54483          }); // wrap fetch result
54484
54485          if (typeof $fetch == 'function') $({
54486            global: true,
54487            enumerable: true,
54488            forced: true
54489          }, {
54490            // eslint-disable-next-line no-unused-vars
54491            fetch: function fetch(input
54492            /* , init */
54493            ) {
54494              return promiseResolve(PromiseConstructor, $fetch.apply(global, arguments));
54495            }
54496          });
54497        }
54498      }
54499
54500      $({
54501        global: true,
54502        wrap: true,
54503        forced: FORCED
54504      }, {
54505        Promise: PromiseConstructor
54506      });
54507      setToStringTag(PromiseConstructor, PROMISE, false, true);
54508      setSpecies(PROMISE);
54509      PromiseWrapper = getBuiltIn(PROMISE); // statics
54510
54511      $({
54512        target: PROMISE,
54513        stat: true,
54514        forced: FORCED
54515      }, {
54516        // `Promise.reject` method
54517        // https://tc39.github.io/ecma262/#sec-promise.reject
54518        reject: function reject(r) {
54519          var capability = newPromiseCapability(this);
54520          capability.reject.call(undefined, r);
54521          return capability.promise;
54522        }
54523      });
54524      $({
54525        target: PROMISE,
54526        stat: true,
54527        forced: IS_PURE || FORCED
54528      }, {
54529        // `Promise.resolve` method
54530        // https://tc39.github.io/ecma262/#sec-promise.resolve
54531        resolve: function resolve(x) {
54532          return promiseResolve(IS_PURE && this === PromiseWrapper ? PromiseConstructor : this, x);
54533        }
54534      });
54535      $({
54536        target: PROMISE,
54537        stat: true,
54538        forced: INCORRECT_ITERATION
54539      }, {
54540        // `Promise.all` method
54541        // https://tc39.github.io/ecma262/#sec-promise.all
54542        all: function all(iterable) {
54543          var C = this;
54544          var capability = newPromiseCapability(C);
54545          var resolve = capability.resolve;
54546          var reject = capability.reject;
54547          var result = perform(function () {
54548            var $promiseResolve = aFunction(C.resolve);
54549            var values = [];
54550            var counter = 0;
54551            var remaining = 1;
54552            iterate(iterable, function (promise) {
54553              var index = counter++;
54554              var alreadyCalled = false;
vendor: 5,915 bytes, lines 54555-54711
54555              values.push(undefined);
54556              remaining++;
54557              $promiseResolve.call(C, promise).then(function (value) {
54558                if (alreadyCalled) return;
54559                alreadyCalled = true;
54560                values[index] = value;
54561                --remaining || resolve(values);
54562              }, reject);
54563            });
54564            --remaining || resolve(values);
54565          });
54566          if (result.error) reject(result.value);
54567          return capability.promise;
54568        },
54569        // `Promise.race` method
54570        // https://tc39.github.io/ecma262/#sec-promise.race
54571        race: function race(iterable) {
54572          var C = this;
54573          var capability = newPromiseCapability(C);
54574          var reject = capability.reject;
54575          var result = perform(function () {
54576            var $promiseResolve = aFunction(C.resolve);
54577            iterate(iterable, function (promise) {
54578              $promiseResolve.call(C, promise).then(capability.resolve, reject);
54579            });
54580          });
54581          if (result.error) reject(result.value);
54582          return capability.promise;
54583        }
54584      });
54585    }, {
54586      "../internals/a-function": 217,
54587      "../internals/an-instance": 218,
54588      "../internals/check-correctness-of-iteration": 224,
54589      "../internals/classof-raw": 225,
54590      "../internals/engine-v8-version": 235,
54591      "../internals/export": 237,
54592      "../internals/get-built-in": 240,
54593      "../internals/global": 242,
54594      "../internals/host-report-errors": 245,
54595      "../internals/inspect-source": 249,
54596      "../internals/internal-state": 250,
54597      "../internals/is-forced": 253,
54598      "../internals/is-object": 254,
54599      "../internals/is-pure": 255,
54600      "../internals/iterate": 256,
54601      "../internals/microtask": 258,
54602      "../internals/native-promise-constructor": 259,
54603      "../internals/new-promise-capability": 262,
54604      "../internals/perform": 276,
54605      "../internals/promise-resolve": 277,
54606      "../internals/redefine": 279,
54607      "../internals/redefine-all": 278,
54608      "../internals/set-species": 282,
54609      "../internals/set-to-string-tag": 283,
54610      "../internals/species-constructor": 287,
54611      "../internals/task": 288,
54612      "../internals/well-known-symbol": 299
54613    }],
54614    303: [function (require, module, exports) {
54615      var defineWellKnownSymbol = require('../internals/define-well-known-symbol'); // `Symbol.asyncIterator` well-known symbol
54616      // https://tc39.github.io/ecma262/#sec-symbol.asynciterator
54617
54618
54619      defineWellKnownSymbol('asyncIterator');
54620    }, {
54621      "../internals/define-well-known-symbol": 230
54622    }],
54623    304: [function (require, module, exports) {
54624      'use strict';
54625
54626      var $ = require('../internals/export');
54627
54628      var global = require('../internals/global');
54629
54630      var getBuiltIn = require('../internals/get-built-in');
54631
54632      var IS_PURE = require('../internals/is-pure');
54633
54634      var DESCRIPTORS = require('../internals/descriptors');
54635
54636      var NATIVE_SYMBOL = require('../internals/native-symbol');
54637
54638      var USE_SYMBOL_AS_UID = require('../internals/use-symbol-as-uid');
54639
54640      var fails = require('../internals/fails');
54641
54642      var has = require('../internals/has');
54643
54644      var isArray = require('../internals/is-array');
54645
54646      var isObject = require('../internals/is-object');
54647
54648      var anObject = require('../internals/an-object');
54649
54650      var toObject = require('../internals/to-object');
54651
54652      var toIndexedObject = require('../internals/to-indexed-object');
54653
54654      var toPrimitive = require('../internals/to-primitive');
54655
54656      var createPropertyDescriptor = require('../internals/create-property-descriptor');
54657
54658      var nativeObjectCreate = require('../internals/object-create');
54659
54660      var objectKeys = require('../internals/object-keys');
54661
54662      var getOwnPropertyNamesModule = require('../internals/object-get-own-property-names');
54663
54664      var getOwnPropertyNamesExternal = require('../internals/object-get-own-property-names-external');
54665
54666      var getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols');
54667
54668      var getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor');
54669
54670      var definePropertyModule = require('../internals/object-define-property');
54671
54672      var propertyIsEnumerableModule = require('../internals/object-property-is-enumerable');
54673
54674      var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
54675
54676      var redefine = require('../internals/redefine');
54677
54678      var shared = require('../internals/shared');
54679
54680      var sharedKey = require('../internals/shared-key');
54681
54682      var hiddenKeys = require('../internals/hidden-keys');
54683
54684      var uid = require('../internals/uid');
54685
54686      var wellKnownSymbol = require('../internals/well-known-symbol');
54687
54688      var wrappedWellKnownSymbolModule = require('../internals/well-known-symbol-wrapped');
54689
54690      var defineWellKnownSymbol = require('../internals/define-well-known-symbol');
54691
54692      var setToStringTag = require('../internals/set-to-string-tag');
54693
54694      var InternalStateModule = require('../internals/internal-state');
54695
54696      var $forEach = require('../internals/array-iteration').forEach;
54697
54698      var HIDDEN = sharedKey('hidden');
54699      var SYMBOL = 'Symbol';
54700      var PROTOTYPE = 'prototype';
54701      var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
54702      var setInternalState = InternalStateModule.set;
54703      var getInternalState = InternalStateModule.getterFor(SYMBOL);
54704      var ObjectPrototype = Object[PROTOTYPE];
54705      var $Symbol = global.Symbol;
54706      var $stringify = getBuiltIn('JSON', 'stringify');
54707      var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
54708      var nativeDefineProperty = definePropertyModule.f;
54709      var nativeGetOwnPropertyNames = getOwnPropertyNamesExternal.f;
54710      var nativePropertyIsEnumerable = propertyIsEnumerableModule.f;
54711      var AllSymbols = shared('symbols');
vendor: 5,620 bytes, lines 54712-54843
54712      var ObjectPrototypeSymbols = shared('op-symbols');
54713      var StringToSymbolRegistry = shared('string-to-symbol-registry');
54714      var SymbolToStringRegistry = shared('symbol-to-string-registry');
54715      var WellKnownSymbolsStore = shared('wks');
54716      var QObject = global.QObject; // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
54717
54718      var USE_SETTER = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild; // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
54719
54720      var setSymbolDescriptor = DESCRIPTORS && fails(function () {
54721        return nativeObjectCreate(nativeDefineProperty({}, 'a', {
54722          get: function get() {
54723            return nativeDefineProperty(this, 'a', {
54724              value: 7
54725            }).a;
54726          }
54727        })).a != 7;
54728      }) ? function (O, P, Attributes) {
54729        var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor(ObjectPrototype, P);
54730        if (ObjectPrototypeDescriptor) delete ObjectPrototype[P];
54731        nativeDefineProperty(O, P, Attributes);
54732
54733        if (ObjectPrototypeDescriptor && O !== ObjectPrototype) {
54734          nativeDefineProperty(ObjectPrototype, P, ObjectPrototypeDescriptor);
54735        }
54736      } : nativeDefineProperty;
54737
54738      var wrap = function wrap(tag, description) {
54739        var symbol = AllSymbols[tag] = nativeObjectCreate($Symbol[PROTOTYPE]);
54740        setInternalState(symbol, {
54741          type: SYMBOL,
54742          tag: tag,
54743          description: description
54744        });
54745        if (!DESCRIPTORS) symbol.description = description;
54746        return symbol;
54747      };
54748
54749      var isSymbol = USE_SYMBOL_AS_UID ? function (it) {
54750        return _typeof2(it) == 'symbol';
54751      } : function (it) {
54752        return Object(it) instanceof $Symbol;
54753      };
54754
54755      var $defineProperty = function defineProperty(O, P, Attributes) {
54756        if (O === ObjectPrototype) $defineProperty(ObjectPrototypeSymbols, P, Attributes);
54757        anObject(O);
54758        var key = toPrimitive(P, true);
54759        anObject(Attributes);
54760
54761        if (has(AllSymbols, key)) {
54762          if (!Attributes.enumerable) {
54763            if (!has(O, HIDDEN)) nativeDefineProperty(O, HIDDEN, createPropertyDescriptor(1, {}));
54764            O[HIDDEN][key] = true;
54765          } else {
54766            if (has(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false;
54767            Attributes = nativeObjectCreate(Attributes, {
54768              enumerable: createPropertyDescriptor(0, false)
54769            });
54770          }
54771
54772          return setSymbolDescriptor(O, key, Attributes);
54773        }
54774
54775        return nativeDefineProperty(O, key, Attributes);
54776      };
54777
54778      var $defineProperties = function defineProperties(O, Properties) {
54779        anObject(O);
54780        var properties = toIndexedObject(Properties);
54781        var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties));
54782        $forEach(keys, function (key) {
54783          if (!DESCRIPTORS || $propertyIsEnumerable.call(properties, key)) $defineProperty(O, key, properties[key]);
54784        });
54785        return O;
54786      };
54787
54788      var $create = function create(O, Properties) {
54789        return Properties === undefined ? nativeObjectCreate(O) : $defineProperties(nativeObjectCreate(O), Properties);
54790      };
54791
54792      var $propertyIsEnumerable = function propertyIsEnumerable(V) {
54793        var P = toPrimitive(V, true);
54794        var enumerable = nativePropertyIsEnumerable.call(this, P);
54795        if (this === ObjectPrototype && has(AllSymbols, P) && !has(ObjectPrototypeSymbols, P)) return false;
54796        return enumerable || !has(this, P) || !has(AllSymbols, P) || has(this, HIDDEN) && this[HIDDEN][P] ? enumerable : true;
54797      };
54798
54799      var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) {
54800        var it = toIndexedObject(O);
54801        var key = toPrimitive(P, true);
54802        if (it === ObjectPrototype && has(AllSymbols, key) && !has(ObjectPrototypeSymbols, key)) return;
54803        var descriptor = nativeGetOwnPropertyDescriptor(it, key);
54804
54805        if (descriptor && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) {
54806          descriptor.enumerable = true;
54807        }
54808
54809        return descriptor;
54810      };
54811
54812      var $getOwnPropertyNames = function getOwnPropertyNames(O) {
54813        var names = nativeGetOwnPropertyNames(toIndexedObject(O));
54814        var result = [];
54815        $forEach(names, function (key) {
54816          if (!has(AllSymbols, key) && !has(hiddenKeys, key)) result.push(key);
54817        });
54818        return result;
54819      };
54820
54821      var $getOwnPropertySymbols = function getOwnPropertySymbols(O) {
54822        var IS_OBJECT_PROTOTYPE = O === ObjectPrototype;
54823        var names = nativeGetOwnPropertyNames(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O));
54824        var result = [];
54825        $forEach(names, function (key) {
54826          if (has(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || has(ObjectPrototype, key))) {
54827            result.push(AllSymbols[key]);
54828          }
54829        });
54830        return result;
54831      }; // `Symbol` constructor
54832      // https://tc39.github.io/ecma262/#sec-symbol-constructor
54833
54834
54835      if (!NATIVE_SYMBOL) {
54836        $Symbol = function _Symbol3() {
54837          if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor');
54838          var description = !arguments.length || arguments[0] === undefined ? undefined : String(arguments[0]);
54839          var tag = uid(description);
54840
54841          var setter = function setter(value) {
54842            if (this === ObjectPrototype) setter.call(ObjectPrototypeSymbols, value);
54843            if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
vendor: 5,184 bytes, lines 54844-54987
54844            setSymbolDescriptor(this, tag, createPropertyDescriptor(1, value));
54845          };
54846
54847          if (DESCRIPTORS && USE_SETTER) setSymbolDescriptor(ObjectPrototype, tag, {
54848            configurable: true,
54849            set: setter
54850          });
54851          return wrap(tag, description);
54852        };
54853
54854        redefine($Symbol[PROTOTYPE], 'toString', function toString() {
54855          return getInternalState(this).tag;
54856        });
54857        redefine($Symbol, 'withoutSetter', function (description) {
54858          return wrap(uid(description), description);
54859        });
54860        propertyIsEnumerableModule.f = $propertyIsEnumerable;
54861        definePropertyModule.f = $defineProperty;
54862        getOwnPropertyDescriptorModule.f = $getOwnPropertyDescriptor;
54863        getOwnPropertyNamesModule.f = getOwnPropertyNamesExternal.f = $getOwnPropertyNames;
54864        getOwnPropertySymbolsModule.f = $getOwnPropertySymbols;
54865
54866        wrappedWellKnownSymbolModule.f = function (name) {
54867          return wrap(wellKnownSymbol(name), name);
54868        };
54869
54870        if (DESCRIPTORS) {
54871          // https://github.com/tc39/proposal-Symbol-description
54872          nativeDefineProperty($Symbol[PROTOTYPE], 'description', {
54873            configurable: true,
54874            get: function description() {
54875              return getInternalState(this).description;
54876            }
54877          });
54878
54879          if (!IS_PURE) {
54880            redefine(ObjectPrototype, 'propertyIsEnumerable', $propertyIsEnumerable, {
54881              unsafe: true
54882            });
54883          }
54884        }
54885      }
54886
54887      $({
54888        global: true,
54889        wrap: true,
54890        forced: !NATIVE_SYMBOL,
54891        sham: !NATIVE_SYMBOL
54892      }, {
54893        Symbol: $Symbol
54894      });
54895      $forEach(objectKeys(WellKnownSymbolsStore), function (name) {
54896        defineWellKnownSymbol(name);
54897      });
54898      $({
54899        target: SYMBOL,
54900        stat: true,
54901        forced: !NATIVE_SYMBOL
54902      }, {
54903        // `Symbol.for` method
54904        // https://tc39.github.io/ecma262/#sec-symbol.for
54905        'for': function _for(key) {
54906          var string = String(key);
54907          if (has(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string];
54908          var symbol = $Symbol(string);
54909          StringToSymbolRegistry[string] = symbol;
54910          SymbolToStringRegistry[symbol] = string;
54911          return symbol;
54912        },
54913        // `Symbol.keyFor` method
54914        // https://tc39.github.io/ecma262/#sec-symbol.keyfor
54915        keyFor: function keyFor(sym) {
54916          if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol');
54917          if (has(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym];
54918        },
54919        useSetter: function useSetter() {
54920          USE_SETTER = true;
54921        },
54922        useSimple: function useSimple() {
54923          USE_SETTER = false;
54924        }
54925      });
54926      $({
54927        target: 'Object',
54928        stat: true,
54929        forced: !NATIVE_SYMBOL,
54930        sham: !DESCRIPTORS
54931      }, {
54932        // `Object.create` method
54933        // https://tc39.github.io/ecma262/#sec-object.create
54934        create: $create,
54935        // `Object.defineProperty` method
54936        // https://tc39.github.io/ecma262/#sec-object.defineproperty
54937        defineProperty: $defineProperty,
54938        // `Object.defineProperties` method
54939        // https://tc39.github.io/ecma262/#sec-object.defineproperties
54940        defineProperties: $defineProperties,
54941        // `Object.getOwnPropertyDescriptor` method
54942        // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptors
54943        getOwnPropertyDescriptor: $getOwnPropertyDescriptor
54944      });
54945      $({
54946        target: 'Object',
54947        stat: true,
54948        forced: !NATIVE_SYMBOL
54949      }, {
54950        // `Object.getOwnPropertyNames` method
54951        // https://tc39.github.io/ecma262/#sec-object.getownpropertynames
54952        getOwnPropertyNames: $getOwnPropertyNames,
54953        // `Object.getOwnPropertySymbols` method
54954        // https://tc39.github.io/ecma262/#sec-object.getownpropertysymbols
54955        getOwnPropertySymbols: $getOwnPropertySymbols
54956      }); // Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives
54957      // https://bugs.chromium.org/p/v8/issues/detail?id=3443
54958
54959      $({
54960        target: 'Object',
54961        stat: true,
54962        forced: fails(function () {
54963          getOwnPropertySymbolsModule.f(1);
54964        })
54965      }, {
54966        getOwnPropertySymbols: function getOwnPropertySymbols(it) {
54967          return getOwnPropertySymbolsModule.f(toObject(it));
54968        }
54969      }); // `JSON.stringify` method behavior with symbols
54970      // https://tc39.github.io/ecma262/#sec-json.stringify
54971
54972      if ($stringify) {
54973        var FORCED_JSON_STRINGIFY = !NATIVE_SYMBOL || fails(function () {
54974          var symbol = $Symbol(); // MS Edge converts symbol values to JSON as {}
54975
54976          return $stringify([symbol]) != '[null]' // WebKit converts symbol values to JSON as null
54977          || $stringify({
54978            a: symbol
54979          }) != '{}' // V8 throws on boxed symbols
54980          || $stringify(Object(symbol)) != '{}';
54981        });
54982        $({
54983          target: 'JSON',
54984          stat: true,
54985          forced: FORCED_JSON_STRINGIFY
54986        }, {
54987          // eslint-disable-next-line no-unused-vars
54988          stringify: function stringify(it, replacer, space) {
54989            var args = [it];
54990            var index = 1;
54991            var $replacer;
54992
54993            while (arguments.length > index) {
54994              args.push(arguments[index++]);
54995            }
54996
54997            $replacer = replacer;
54998            if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
54999
55000            if (!isArray(replacer)) replacer = function replacer(key, value) {
55001              if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
55002              if (!isSymbol(value)) return value;
55003            };
55004            args[1] = replacer;
55005            return $stringify.apply(null, args);
55006          }
55007        });
55008      } // `Symbol.prototype[@@toPrimitive]` method
55009      // https://tc39.github.io/ecma262/#sec-symbol.prototype-@@toprimitive
55010
55011
55012      if (!$Symbol[PROTOTYPE][TO_PRIMITIVE]) {
55013        createNonEnumerableProperty($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);
55014      } // `Symbol.prototype[@@toStringTag]` property
55015      // https://tc39.github.io/ecma262/#sec-symbol.prototype-@@tostringtag
55016
55017
55018      setToStringTag($Symbol, SYMBOL);
55019      hiddenKeys[HIDDEN] = true;
55020    }, {
55021      "../internals/an-object": 219,
55022      "../internals/array-iteration": 221,
55023      "../internals/create-non-enumerable-property": 228,
55024      "../internals/create-property-descriptor": 229,
55025      "../internals/define-well-known-symbol": 230,
55026      "../internals/descriptors": 231,
55027      "../internals/export": 237,
55028      "../internals/fails": 238,
55029      "../internals/get-built-in": 240,
55030      "../internals/global": 242,
55031      "../internals/has": 243,
55032      "../internals/hidden-keys": 244,
55033      "../internals/internal-state": 250,
55034      "../internals/is-array": 252,
55035      "../internals/is-object": 254,
55036      "../internals/is-pure": 255,
55037      "../internals/native-symbol": 260,
55038      "../internals/object-create": 264,
55039      "../internals/object-define-property": 266,
55040      "../internals/object-get-own-property-descriptor": 267,
55041      "../internals/object-get-own-property-names": 269,
55042      "../internals/object-get-own-property-names-external": 268,
55043      "../internals/object-get-own-property-symbols": 270,
55044      "../internals/object-keys": 272,
55045      "../internals/object-property-is-enumerable": 273,
55046      "../internals/redefine": 279,
55047      "../internals/set-to-string-tag": 283,
55048      "../internals/shared": 286,
55049      "../internals/shared-key": 284,
55050      "../internals/to-indexed-object": 290,
55051      "../internals/to-object": 293,
55052      "../internals/to-primitive": 294,
55053      "../internals/uid": 296,
55054      "../internals/use-symbol-as-uid": 297,
55055      "../internals/well-known-symbol": 299,
55056      "../internals/well-known-symbol-wrapped": 298
55057    }],
55058    305: [function (require, module, exports) {
55059      (function (Buffer) {
55060        // Copyright Joyent, Inc. and other Node contributors.
55061        //
55062        // Permission is hereby granted, free of charge, to any person obtaining a
55063        // copy of this software and associated documentation files (the
55064        // "Software"), to deal in the Software without restriction, including
55065        // without limitation the rights to use, copy, modify, merge, publish,
55066        // distribute, sublicense, and/or sell copies of the Software, and to permit
55067        // persons to whom the Software is furnished to do so, subject to the
55068        // following conditions:
55069        //
55070        // The above copyright notice and this permission notice shall be included
55071        // in all copies or substantial portions of the Software.
55072        //
55073        // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
55074        // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
55075        // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
55076        // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
55077        // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
55078        // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
55079        // USE OR OTHER DEALINGS IN THE SOFTWARE.
55080        // NOTE: These type checking functions intentionally don't use `instanceof`
55081        // because it is fragile and can be easily faked with `Object.create()`.
55082        function isArray(arg) {
55083          if (Array.isArray) {
55084            return Array.isArray(arg);
55085          }
55086
55087          return objectToString(arg) === '[object Array]';
55088        }
55089
55090        exports.isArray = isArray;
55091
55092        function isBoolean(arg) {
55093          return typeof arg === 'boolean';
55094        }
55095
55096        exports.isBoolean = isBoolean;
55097
55098        function isNull(arg) {
55099          return arg === null;
55100        }
55101
55102        exports.isNull = isNull;
55103
55104        function isNullOrUndefined(arg) {
55105          return arg == null;
55106        }
55107
55108        exports.isNullOrUndefined = isNullOrUndefined;
55109
55110        function isNumber(arg) {
55111          return typeof arg === 'number';
55112        }
55113
55114        exports.isNumber = isNumber;
55115
55116        function isString(arg) {
55117          return typeof arg === 'string';
55118        }
55119
55120        exports.isString = isString;
55121
55122        function isSymbol(arg) {
55123          return _typeof2(arg) === 'symbol';
55124        }
55125
55126        exports.isSymbol = isSymbol;
55127
55128        function isUndefined(arg) {
55129          return arg === void 0;
55130        }
55131
55132        exports.isUndefined = isUndefined;
55133
55134        function isRegExp(re) {
55135          return objectToString(re) === '[object RegExp]';
55136        }
55137
55138        exports.isRegExp = isRegExp;
55139
55140        function isObject(arg) {
55141          return _typeof2(arg) === 'object' && arg !== null;
55142        }
55143
55144        exports.isObject = isObject;
55145
55146        function isDate(d) {
55147          return objectToString(d) === '[object Date]';
55148        }
55149
55150        exports.isDate = isDate;
55151
55152        function isError(e) {
55153          return objectToString(e) === '[object Error]' || e instanceof Error;
55154        }
55155
55156        exports.isError = isError;
55157
55158        function isFunction(arg) {
55159          return typeof arg === 'function';
55160        }
55161
55162        exports.isFunction = isFunction;
55163
55164        function isPrimitive(arg) {
55165          return arg === null || typeof arg === 'boolean' || typeof arg === 'number' || typeof arg === 'string' || _typeof2(arg) === 'symbol' || // ES6 symbol
55166          typeof arg === 'undefined';
55167        }
55168
55169        exports.isPrimitive = isPrimitive;
55170        exports.isBuffer = Buffer.isBuffer;
55171
55172        function objectToString(o) {
55173          return Object.prototype.toString.call(o);
55174        }
55175      }).call(this, {
55176        "isBuffer": require("../../is-buffer/index.js")
55177      });
55178    }, {
vendor: 4,015 bytes, lines 55179-55332
55179      "../../is-buffer/index.js": 365
55180    }],
55181    306: [function (require, module, exports) {
55182      (function (Buffer) {
55183        var elliptic = require('elliptic');
55184
55185        var BN = require('bn.js');
55186
55187        module.exports = function createECDH(curve) {
55188          return new ECDH(curve);
55189        };
55190
55191        var aliases = {
55192          secp256k1: {
55193            name: 'secp256k1',
55194            byteLength: 32
55195          },
55196          secp224r1: {
55197            name: 'p224',
55198            byteLength: 28
55199          },
55200          prime256v1: {
55201            name: 'p256',
55202            byteLength: 32
55203          },
55204          prime192v1: {
55205            name: 'p192',
55206            byteLength: 24
55207          },
55208          ed25519: {
55209            name: 'ed25519',
55210            byteLength: 32
55211          },
55212          secp384r1: {
55213            name: 'p384',
55214            byteLength: 48
55215          },
55216          secp521r1: {
55217            name: 'p521',
55218            byteLength: 66
55219          }
55220        };
55221        aliases.p224 = aliases.secp224r1;
55222        aliases.p256 = aliases.secp256r1 = aliases.prime256v1;
55223        aliases.p192 = aliases.secp192r1 = aliases.prime192v1;
55224        aliases.p384 = aliases.secp384r1;
55225        aliases.p521 = aliases.secp521r1;
55226
55227        function ECDH(curve) {
55228          this.curveType = aliases[curve];
55229
55230          if (!this.curveType) {
55231            this.curveType = {
55232              name: curve
55233            };
55234          }
55235
55236          this.curve = new elliptic.ec(this.curveType.name); // eslint-disable-line new-cap
55237
55238          this.keys = void 0;
55239        }
55240
55241        ECDH.prototype.generateKeys = function (enc, format) {
55242          this.keys = this.curve.genKeyPair();
55243          return this.getPublicKey(enc, format);
55244        };
55245
55246        ECDH.prototype.computeSecret = function (other, inenc, enc) {
55247          inenc = inenc || 'utf8';
55248
55249          if (!Buffer.isBuffer(other)) {
55250            other = new Buffer(other, inenc);
55251          }
55252
55253          var otherPub = this.curve.keyFromPublic(other).getPublic();
55254          var out = otherPub.mul(this.keys.getPrivate()).getX();
55255          return formatReturnValue(out, enc, this.curveType.byteLength);
55256        };
55257
55258        ECDH.prototype.getPublicKey = function (enc, format) {
55259          var key = this.keys.getPublic(format === 'compressed', true);
55260
55261          if (format === 'hybrid') {
55262            if (key[key.length - 1] % 2) {
55263              key[0] = 7;
55264            } else {
55265              key[0] = 6;
55266            }
55267          }
55268
55269          return formatReturnValue(key, enc);
55270        };
55271
55272        ECDH.prototype.getPrivateKey = function (enc) {
55273          return formatReturnValue(this.keys.getPrivate(), enc);
55274        };
55275
55276        ECDH.prototype.setPublicKey = function (pub, enc) {
55277          enc = enc || 'utf8';
55278
55279          if (!Buffer.isBuffer(pub)) {
55280            pub = new Buffer(pub, enc);
55281          }
55282
55283          this.keys._importPublic(pub);
55284
55285          return this;
55286        };
55287
55288        ECDH.prototype.setPrivateKey = function (priv, enc) {
55289          enc = enc || 'utf8';
55290
55291          if (!Buffer.isBuffer(priv)) {
55292            priv = new Buffer(priv, enc);
55293          }
55294
55295          var _priv = new BN(priv);
55296
55297          _priv = _priv.toString(16);
55298          this.keys = this.curve.genKeyPair();
55299
55300          this.keys._importPrivate(_priv);
55301
55302          return this;
55303        };
55304
55305        function formatReturnValue(bn, enc, len) {
55306          if (!Array.isArray(bn)) {
55307            bn = bn.toArray();
55308          }
55309
55310          var buf = new Buffer(bn);
55311
55312          if (len && buf.length < len) {
55313            var zeros = new Buffer(len - buf.length);
55314            zeros.fill(0);
55315            buf = Buffer.concat([zeros, buf]);
55316          }
55317
55318          if (!enc) {
55319            return buf;
55320          } else {
55321            return buf.toString(enc);
55322          }
55323        }
55324      }).call(this, require("buffer").Buffer);
55325    }, {
55326      "bn.js": 307,
55327      "buffer": 214,
55328      "elliptic": 327
55329    }],
55330    307: [function (require, module, exports) {
55331      arguments[4][179][0].apply(exports, arguments);
55332    }, {
vendor: 4,665 bytes, lines 55333-55523
55333      "buffer": 183,
55334      "dup": 179
55335    }],
55336    308: [function (require, module, exports) {
55337      'use strict';
55338
55339      var inherits = require('inherits');
55340
55341      var MD5 = require('md5.js');
55342
55343      var RIPEMD160 = require('ripemd160');
55344
55345      var sha = require('sha.js');
55346
55347      var Base = require('cipher-base');
55348
55349      function Hash(hash) {
55350        Base.call(this, 'digest');
55351        this._hash = hash;
55352      }
55353
55354      inherits(Hash, Base);
55355
55356      Hash.prototype._update = function (data) {
55357        this._hash.update(data);
55358      };
55359
55360      Hash.prototype._final = function () {
55361        return this._hash.digest();
55362      };
55363
55364      module.exports = function createHash(alg) {
55365        alg = alg.toLowerCase();
55366        if (alg === 'md5') return new MD5();
55367        if (alg === 'rmd160' || alg === 'ripemd160') return new RIPEMD160();
55368        return new Hash(sha(alg));
55369      };
55370    }, {
55371      "cipher-base": 216,
55372      "inherits": 364,
55373      "md5.js": 411,
55374      "ripemd160": 469,
55375      "sha.js": 474
55376    }],
55377    309: [function (require, module, exports) {
55378      var MD5 = require('md5.js');
55379
55380      module.exports = function (buffer) {
55381        return new MD5().update(buffer).digest();
55382      };
55383    }, {
55384      "md5.js": 411
55385    }],
55386    310: [function (require, module, exports) {
55387      'use strict';
55388
55389      var inherits = require('inherits');
55390
55391      var Legacy = require('./legacy');
55392
55393      var Base = require('cipher-base');
55394
55395      var Buffer = require('safe-buffer').Buffer;
55396
55397      var md5 = require('create-hash/md5');
55398
55399      var RIPEMD160 = require('ripemd160');
55400
55401      var sha = require('sha.js');
55402
55403      var ZEROS = Buffer.alloc(128);
55404
55405      function Hmac(alg, key) {
55406        Base.call(this, 'digest');
55407
55408        if (typeof key === 'string') {
55409          key = Buffer.from(key);
55410        }
55411
55412        var blocksize = alg === 'sha512' || alg === 'sha384' ? 128 : 64;
55413        this._alg = alg;
55414        this._key = key;
55415
55416        if (key.length > blocksize) {
55417          var hash = alg === 'rmd160' ? new RIPEMD160() : sha(alg);
55418          key = hash.update(key).digest();
55419        } else if (key.length < blocksize) {
55420          key = Buffer.concat([key, ZEROS], blocksize);
55421        }
55422
55423        var ipad = this._ipad = Buffer.allocUnsafe(blocksize);
55424        var opad = this._opad = Buffer.allocUnsafe(blocksize);
55425
55426        for (var i = 0; i < blocksize; i++) {
55427          ipad[i] = key[i] ^ 0x36;
55428          opad[i] = key[i] ^ 0x5C;
55429        }
55430
55431        this._hash = alg === 'rmd160' ? new RIPEMD160() : sha(alg);
55432
55433        this._hash.update(ipad);
55434      }
55435
55436      inherits(Hmac, Base);
55437
55438      Hmac.prototype._update = function (data) {
55439        this._hash.update(data);
55440      };
55441
55442      Hmac.prototype._final = function () {
55443        var h = this._hash.digest();
55444
55445        var hash = this._alg === 'rmd160' ? new RIPEMD160() : sha(this._alg);
55446        return hash.update(this._opad).update(h).digest();
55447      };
55448
55449      module.exports = function createHmac(alg, key) {
55450        alg = alg.toLowerCase();
55451
55452        if (alg === 'rmd160' || alg === 'ripemd160') {
55453          return new Hmac('rmd160', key);
55454        }
55455
55456        if (alg === 'md5') {
55457          return new Legacy(md5, key);
55458        }
55459
55460        return new Hmac(alg, key);
55461      };
55462    }, {
55463      "./legacy": 311,
55464      "cipher-base": 216,
55465      "create-hash/md5": 309,
55466      "inherits": 364,
55467      "ripemd160": 469,
55468      "safe-buffer": 470,
55469      "sha.js": 474
55470    }],
55471    311: [function (require, module, exports) {
55472      'use strict';
55473
55474      var inherits = require('inherits');
55475
55476      var Buffer = require('safe-buffer').Buffer;
55477
55478      var Base = require('cipher-base');
55479
55480      var ZEROS = Buffer.alloc(128);
55481      var blocksize = 64;
55482
55483      function Hmac(alg, key) {
55484        Base.call(this, 'digest');
55485
55486        if (typeof key === 'string') {
55487          key = Buffer.from(key);
55488        }
55489
55490        this._alg = alg;
55491        this._key = key;
55492
55493        if (key.length > blocksize) {
55494          key = alg(key);
55495        } else if (key.length < blocksize) {
55496          key = Buffer.concat([key, ZEROS], blocksize);
55497        }
55498
55499        var ipad = this._ipad = Buffer.allocUnsafe(blocksize);
55500        var opad = this._opad = Buffer.allocUnsafe(blocksize);
55501
55502        for (var i = 0; i < blocksize; i++) {
55503          ipad[i] = key[i] ^ 0x36;
55504          opad[i] = key[i] ^ 0x5C;
55505        }
55506
55507        this._hash = [ipad];
55508      }
55509
55510      inherits(Hmac, Base);
55511
55512      Hmac.prototype._update = function (data) {
55513        this._hash.push(data);
55514      };
55515
55516      Hmac.prototype._final = function () {
55517        var h = this._alg(Buffer.concat(this._hash));
55518
55519        return this._alg(Buffer.concat([this._opad, h]));
55520      };
55521
55522      module.exports = Hmac;
55523    }, {
55524      "cipher-base": 216,
55525      "inherits": 364,
55526      "safe-buffer": 470
55527    }],
55528    312: [function (require, module, exports) {
55529      'use strict';
55530
55531      exports.randomBytes = exports.rng = exports.pseudoRandomBytes = exports.prng = require('randombytes');
55532      exports.createHash = exports.Hash = require('create-hash');
55533      exports.createHmac = exports.Hmac = require('create-hmac');
55534
55535      var algos = require('browserify-sign/algos');
55536
55537      var algoKeys = Object.keys(algos);
55538      var hashes = ['sha1', 'sha224', 'sha256', 'sha384', 'sha512', 'md5', 'rmd160'].concat(algoKeys);
55539
55540      exports.getHashes = function () {
55541        return hashes;
55542      };
55543
55544      var p = require('pbkdf2');
55545
55546      exports.pbkdf2 = p.pbkdf2;
55547      exports.pbkdf2Sync = p.pbkdf2Sync;
55548
55549      var aes = require('browserify-cipher');
55550
55551      exports.Cipher = aes.Cipher;
55552      exports.createCipher = aes.createCipher;
55553      exports.Cipheriv = aes.Cipheriv;
55554      exports.createCipheriv = aes.createCipheriv;
55555      exports.Decipher = aes.Decipher;
55556      exports.createDecipher = aes.createDecipher;
55557      exports.Decipheriv = aes.Decipheriv;
55558      exports.createDecipheriv = aes.createDecipheriv;
55559      exports.getCiphers = aes.getCiphers;
55560      exports.listCiphers = aes.listCiphers;
55561
55562      var dh = require('diffie-hellman');
55563
55564      exports.DiffieHellmanGroup = dh.DiffieHellmanGroup;
55565      exports.createDiffieHellmanGroup = dh.createDiffieHellmanGroup;
55566      exports.getDiffieHellman = dh.getDiffieHellman;
55567      exports.createDiffieHellman = dh.createDiffieHellman;
55568      exports.DiffieHellman = dh.DiffieHellman;
55569
55570      var sign = require('browserify-sign');
55571
55572      exports.createSign = sign.createSign;
55573      exports.Sign = sign.Sign;
55574      exports.createVerify = sign.createVerify;
55575      exports.Verify = sign.Verify;
55576      exports.createECDH = require('create-ecdh');
55577
55578      var publicEncrypt = require('public-encrypt');
55579
55580      exports.publicEncrypt = publicEncrypt.publicEncrypt;
55581      exports.privateEncrypt = publicEncrypt.privateEncrypt;
55582      exports.publicDecrypt = publicEncrypt.publicDecrypt;
55583      exports.privateDecrypt = publicEncrypt.privateDecrypt; // the least I can do is make error messages for the rest of the node.js/crypto api.
55584      // ;[
55585      //   'createCredentials'
55586      // ].forEach(function (name) {
55587      //   exports[name] = function () {
55588      //     throw new Error([
55589      //       'sorry, ' + name + ' is not implemented yet',
55590      //       'we accept pull requests',
55591      //       'https://github.com/crypto-browserify/crypto-browserify'
55592      //     ].join('\n'))
55593      //   }
55594      // })
55595
55596      var rf = require('randomfill');
55597
55598      exports.randomFill = rf.randomFill;
55599      exports.randomFillSync = rf.randomFillSync;
55600
55601      exports.createCredentials = function () {
55602        throw new Error(['sorry, createCredentials is not implemented yet', 'we accept pull requests', 'https://github.com/crypto-browserify/crypto-browserify'].join('\n'));
55603      };
55604
55605      exports.constants = {
55606        'DH_CHECK_P_NOT_SAFE_PRIME': 2,
55607        'DH_CHECK_P_NOT_PRIME': 1,
55608        'DH_UNABLE_TO_CHECK_GENERATOR': 4,
55609        'DH_NOT_SUITABLE_GENERATOR': 8,
55610        'NPN_ENABLED': 1,
55611        'ALPN_ENABLED': 1,
55612        'RSA_PKCS1_PADDING': 1,
55613        'RSA_SSLV23_PADDING': 2,
55614        'RSA_NO_PADDING': 3,
55615        'RSA_PKCS1_OAEP_PADDING': 4,
55616        'RSA_X931_PADDING': 5,
55617        'RSA_PKCS1_PSS_PADDING': 6,
55618        'POINT_CONVERSION_COMPRESSED': 2,
55619        'POINT_CONVERSION_UNCOMPRESSED': 4,
55620        'POINT_CONVERSION_HYBRID': 6
55621      };
55622    }, {
55623      "browserify-cipher": 201,
55624      "browserify-sign": 209,
55625      "browserify-sign/algos": 206,
55626      "create-ecdh": 306,
55627      "create-hash": 308,
55628      "create-hmac": 310,
55629      "diffie-hellman": 322,
55630      "pbkdf2": 437,
55631      "public-encrypt": 444,
55632      "randombytes": 451,
55633      "randomfill": 452
55634    }],
55635    313: [function (require, module, exports) {
55636      !function (t, e) {
55637        "object" == _typeof2(exports) && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : t.dayjs = e();
55638      }(this, function () {
55639        "use strict";
55640
55641        var t = "millisecond",
55642            e = "second",
55643            n = "minute",
55644            r = "hour",
55645            i = "day",
55646            s = "week",
55647            u = "month",
55648            o = "quarter",
55649            a = "year",
55650            h = /^(\d{4})-?(\d{1,2})-?(\d{0,2})[^0-9]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?.?(\d{1,3})?$/,
55651            f = /\[([^\]]+)]|Y{2,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}
55651|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,
55652            c = function c(t, e, n) {
55653          var r = String(t);
55654          return !r || r.length >= e ? t : "" + Array(e + 1 - r.length).join(n) + t;
55655        },
55656            d = {
55657          s: c,
55658          z: function z(t) {
55659            var e = -t.utcOffset(),
55660                n = Math.abs(e),
55661                r = Math.floor(n / 60),
55662                i = n % 60;
55663            return (e <= 0 ? "+" : "-") + c(r, 2, "0") + ":" + c(i, 2, "0");
55664          },
55665          m: function m(t, e) {
55666            var n = 12 * (e.year() - t.year()) + (e.month() - t.month()),
55667                r = t.clone().add(n, u),
55668                i = e - r < 0,
55669                s = t.clone().add(n + (i ? -1 : 1), u);
55670            return Number(-(n + (e - r) / (i ? r - s : s - r)) || 0);
55671          },
55672          a: function a(t) {
55673            return t < 0 ? Math.ceil(t) || 0 : Math.floor(t);
55674          },
55675          p: function p(h) {
55676            return {
55677              M: u,
55678              y: a,
55679              w: s,
55680              d: i,
55681              D: "date",
55682              h: r,
55683              m: n,
55684              s: e,
55685              ms: t,
55686              Q: o
55687            }[h] || String(h || "").toLowerCase().replace(/s$/, "");
55688          },
55689          u: function u(t) {
55690            return void 0 === t;
55691          }
55692        },
55693            $ = {
55694          name: "en",
55695          weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),
55696          months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_")
55697        },
55698            l = "en",
55699            m = {};
55700
55701        m[l] = $;
55702
55703        var y = function y(t) {
55704          return t instanceof v;
55705        },
55706            M = function M(t, e, n) {
55707          var r;
55708          if (!t) return l;
55709          if ("string" == typeof t) m[t] && (r = t), e && (m[t] = e, r = t);else {
55710            var i = t.name;
55711            m[i] = t, r = i;
55712          }
55713          return !n && r && (l = r), r || !n && l;
55714        },
55715            g = function g(t, e) {
55716          if (y(t)) return t.clone();
55717          var n = "object" == _typeof2(e) ? e : {};
55718          return n.date = t, n.args = arguments, new v(n);
55719        },
55720            D = d;
55721
55722        D.l = M, D.i = y, D.w = function (t, e) {
55723          return g(t, {
55724            locale: e.$L,
55725            utc: e.$u,
55726            $offset: e.$offset
55727          });
55728        };
55729
55730        var v = function () {
55731          function c(t) {
55732            this.$L = this.$L || M(t.locale, null, !0), this.parse(t);
55733          }
55734
55735          var d = c.prototype;
55736          return d.parse = function (t) {
55737            this.$d = function (t) {
55738              var e = t.date,
55739                  n = t.utc;
55740              if (null === e) return new Date(NaN);
55741              if (D.u(e)) return new Date();
55742              if (e instanceof Date) return new Date(e);
55743
55744              if ("string" == typeof e && !/Z$/i.test(e)) {
55745                var r = e.match(h);
55746                if (r) return n ? new Date(Date.UTC(r[1], r[2] - 1, r[3] || 1, r[4] || 0, r[5] || 0, r[6] || 0, r[7] || 0)) : new Date(r[1], r[2] - 1, r[3] || 1, r[4] || 0, r[5] || 0, r[6] || 0, r[7] || 0);
55747              }
55748
55749              return new Date(e);
55750            }(t), this.init();
55751          }, d.init = function () {
55752            var t = this.$d;
55753            this.$y = t.getFullYear(), this.$M = t.getMonth(), this.$D = t.getDate(), this.$W = t.getDay(), this.$H = t.getHours(), this.$m = t.getMinutes(), this.$s = t.getSeconds(), this.$ms = t.getMilliseconds();
55754          }, d.$utils = function () {
55755            return D;
55756          }, d.isValid = function () {
55757            return !("Invalid Date" === this.$d.toString());
55758          }, d.isSame = function (t, e) {
55759            var n = g(t);
55760            return this.startOf(e) <= n && n <= this.endOf(e);
55761          }, d.isAfter = function (t, e) {
55762            return g(t) < this.startOf(e);
55763          }, d.isBefore = function (t, e) {
55764            return this.endOf(e) < g(t);
55765          }, d.$g = function (t, e, n) {
55766            return D.u(t) ? this[e] : this.set(n, t);
55767          }, d.year = function (t) {
55768            return this.$g(t, "$y", a);
55769          }, d.month = function (t) {
55770            return this.$g(t, "$M", u);
55771          }, d.day = function (t) {
55772            return this.$g(t, "$W", i);
55773          }, d.date = function (t) {
55774            return this.$g(t, "$D", "date");
55775          }, d.hour = function (t) {
55776            return this.$g(t, "$H", r);
55777          }, d.minute = function (t) {
55778            return this.$g(t, "$m", n);
55779          }, d.second = function (t) {
55780            return this.$g(t, "$s", e);
55781          }, d.millisecond = function (e) {
55782            return this.$g(e, "$ms", t);
55783          }, d.unix = function () {
55784            return Math.floor(this.valueOf() / 1e3);
55785          }, d.valueOf = function () {
55786            return this.$d.getTime();
55787          }, d.startOf = function (t, o) {
55788            var h = this,
55789                f = !!D.u(o) || o,
55790                c = D.p(t),
55791                d = function d(t, e) {
55792              var n = D.w(h.$u ? Date.UTC(h.$y, e, t) : new Date(h.$y, e, t), h);
55793              return f ? n : n.endOf(i);
55794            },
55795                $ = function $(t, e) {
55796              return D.w(h.toDate()[t].apply(h.toDate("s"), (f ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e)), h);
55797            },
55798                l = this.$W,
55799                m = this.$M,
55800                y = this.$D,
55801                M = "set" + (this.$u ? "UTC" : "");
55802
55803            switch (c) {
55804              case a:
55805                return f ? d(1, 0) : d(31, 11);
55806
55807              case u:
55808                return f ? d(1, m) : d(0, m + 1);
55809
55810              case s:
55811                var g = this.$locale().weekStart || 0,
55812                    v = (l < g ? l + 7 : l) - g;
55813                return d(f ? y - v : y + (6 - v), m);
55814
55815              case i:
55816              case "date":
55817                return $(M + "Hours", 0);
55818
55819              case r:
55820                return $(M + "Minutes", 1);
55821
55822              case n:
55823                return $(M + "Seconds", 2);
55824
55825              case e:
55826                return $(M + "Milliseconds", 3);
55827
55828              default:
55829                return this.clone();
55830            }
55831          }, d.endOf = function (t) {
55832            return this.startOf(t, !1);
55833          }, d.$set = function (s, o) {
55834            var h,
55835                f = D.p(s),
55836                c = "set" + (this.$u ? "UTC" : ""),
55837                d = (h = {}, h[i] = c + "Date", h.date = c + "Date", h[u] = c + "Month", h[a] = c + "FullYear", h[r] = c + "Hours", h[n] = c + "Minutes", h[e] = c + "Seconds", h[t] = c + "Milliseconds", h)[f],
55838                $ = f === i ? this.$D + (o - this.$W) : o;
55839
55840            if (f === u || f === a) {
55841              var l = this.clone().set("date", 1);
55842              l.$d[d]($), l.init(), this.$d = l.set("date", Math.min(this.$D, l.daysInMonth())).toDate();
55843            } else d && this.$d[d]($);
55844
55845            return this.init(), this;
55846          }, d.set = function (t, e) {
55847            return this.clone().$set(t, e);
55848          }, d.get = function (t) {
55849            return this[D.p(t)]();
55850          }, d.add = function (t, o) {
55851            var h,
55852                f = this;
55853            t = Number(t);
55854
55855            var c = D.p(o),
55856                d = function d(e) {
55857              var n = g(f);
55858              return D.w(n.date(n.date() + Math.round(e * t)), f);
55859            };
55860
55861            if (c === u) return this.set(u, this.$M + t);
55862            if (c === a) return this.set(a, this.$y + t);
55863            if (c === i) return d(1);
55864            if (c === s) return d(7);
55865            var $ = (h = {}, h[n] = 6e4, h[r] = 36e5, h[e] = 1e3, h)[c] || 1,
55866                l = this.$d.getTime() + t * $;
55867            return D.w(l, this);
55868          }, d.subtract = function (t, e) {
55869            return this.add(-1 * t, e);
55870          }, d.format = function (t) {
55871            var e = this;
55872            if (!this.isValid()) return "Invalid Date";
55873
55874            var n = t || "YYYY-MM-DDTHH:mm:ssZ",
55875                r = D.z(this),
55876                i = this.$locale(),
55877                s = this.$H,
55878                u = this.$m,
55879                o = this.$M,
55880                a = i.weekdays,
55881                h = i.months,
55882                c = function c(t, r, i, s) {
55883              return t && (t[r] || t(e, n)) || i[r].substr(0, s);
55884            },
55885                d = function d(t) {
55886              return D.s(s % 12 || 12, t, "0");
55887            },
55888                $ = i.meridiem || function (t, e, n) {
55889              var r = t < 12 ? "AM" : "PM";
55890              return n ? r.toLowerCase() : r;
55891            },
55892                l = {
55893              YY: String(this.$y).slice(-2),
55894              YYYY: this.$y,
55895              M: o + 1,
55896              MM: D.s(o + 1, 2, "0"),
55897              MMM: c(i.monthsShort, o, h, 3),
55898              MMMM: c(h, o),
55899              D: this.$D,
55900              DD: D.s(this.$D, 2, "0"),
55901              d: String(this.$W),
55902              dd: c(i.weekdaysMin, this.$W, a, 2),
55903              ddd: c(i.weekdaysShort, this.$W, a, 3),
55904              dddd: a[this.$W],
55905              H: String(s),
55906              HH: D.s(s, 2, "0"),
55907              h: d(1),
55908              hh: d(2),
55909              a: $(s, u, !0),
55910              A: $(s, u, !1),
55911              m: String(u),
55912              mm: D.s(u, 2, "0"),
55913              s: String(this.$s),
55914              ss: D.s(this.$s, 2, "0"),
55915              SSS: D.s(this.$ms, 3, "0"),
55916              Z: r
55917            };
55918
55919            return n.replace(f, function (t, e) {
55920              return e || l[t] || r.replace(":", "");
55921            });
55922          }, d.utcOffset = function () {
55923            return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
55924          }, d.diff = function (t, h, f) {
55925            var c,
55926                d = D.p(h),
55927                $ = g(t),
55928                l = 6e4 * ($.utcOffset() - this.utcOffset()),
55929                m = this - $,
55930                y = D.m(this, $);
55931            return y = (c = {}, c[a] = y / 12, c[u] = y, c[o] = y / 3, c[s] = (m - l) / 6048e5, c[i] = (m - l) / 864e5, c[r] = m / 36e5, c[n] = m / 6e4, c[e] = m / 1e3, c)[d] || m, f ? y : D.a(y);
55932          }, d.daysInMonth = function () {
55933            return this.endOf(u).$D;
55934          }, d.$locale = function () {
55935            return m[this.$L];
55936          }, d.locale = function (t, e) {
55937            if (!t) return this.$L;
55938            var n = this.clone(),
55939                r = M(t, e, !0);
55940            return r && (n.$L = r), n;
55941          }, d.clone = function () {
55942            return D.w(this.$d, this);
55943          }, d.toDate = function () {
55944            return new Date(this.valueOf());
55945          }, d.toJSON = function () {
55946            return this.isValid() ? this.toISOString() : null;
55947          }, d.toISOString = function () {
55948            return this.$d.toISOString();
55949          }, d.toString = function () {
55950            return this.$d.toUTCString();
55951          }, c;
55952        }();
55953
55954        return g.prototype = v.prototype, g.extend = function (t, e) {
55955          return t(e, v, g), g;
55956        }, g.locale = M, g.isDayjs = y, g.unix = function (t) {
55957          return g(1e3 * t);
55958        }, g.en = m[l], g.Ls = m, g;
55959      });
55960    }, {}],
55961    314: [function (require, module, exports) {
55962      !function (t, e) {
55963        "object" == _typeof2(exports) && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : t.dayjs_plugin_customParseFormat = e();
55964      }(this, function () {
55965        "use strict";
55966
55967        var t,
55968            e = /(\[[^[]*\])|([-:/.()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,
55969            n = /\d\d/,
55970            r = /\d\d?/,
55971            o = /\d*[^\s\d-:/()]+/;
55972
55973        var i = function i(t) {
55974          return function (e) {
55975            this[t] = +e;
55976          };
55977        },
55978            s = [/[+-]\d\d:?\d\d/, function (t) {
55979          var e, n;
55980          (this.zone || (this.zone = {})).offset = (e = t.match(/([+-]|\d\d)/g), 0 === (n = 60 * e[1] + +e[2]) ? 0 : "+" === e[0] ? -n : n);
55981        }],
55982            a = function a(e) {
55983          var n = t[e];
55984          return n && (n.indexOf ? n : n.s.concat(n.f));
55985        },
55986            h = {
55987          A: [/[AP]M/, function (t) {
55988            this.afternoon = "PM" === t;
55989          }],
55990          a: [/[ap]m/, function (t) {
55991            this.afternoon = "pm" === t;
55992          }],
55993          S: [/\d/, function (t) {
55994            this.milliseconds = 100 * +t;
55995          }],
55996          SS: [n, function (t) {
55997            this.milliseconds = 10 * +t;
55998          }],
55999          SSS: [/\d{3}/, function (t) {
56000            this.milliseconds = +t;
56001          }],
56002          s: [r, i("seconds")],
56003          ss: [r, i("seconds")],
56004          m: [r, i("minutes")],
56005          mm: [r, i("minutes")],
56006          H: [r, i("hours")],
56007          h: [r, i("hours")],
56008          HH: [r, i("hours")],
56009          hh: [r, i("hours")],
56010          D: [r, i("day")],
56011          DD: [n, i("day")],
56012          Do: [o, function (e) {
56013            var n = t.ordinal,
56014                r = e.match(/\d+/);
56015            if (this.day = r[0], n) for (var o = 1; o <= 31; o += 1) {
56016              n(o).replace(/\[|\]/g, "") === e && (this.day = o);
56017            }
56018          }],
56019          M: [r, i("month")],
56020          MM: [n, i("month")],
56021          MMM: [o, function (t) {
56022            var e = a("months"),
56023                n = (a("monthsShort") || e.map(function (t) {
56024              return t.substr(0, 3);
56025            })).indexOf(t) + 1;
56026            if (n < 1) throw new Error();
56027            this.month = n % 12 || n;
56028          }],
56029          MMMM: [o, function (t) {
56030            var e = a("months").indexOf(t) + 1;
56031            if (e < 1) throw new Error();
56032            this.month = e % 12 || e;
56033          }],
56034          Y: [/[+-]?\d+/, i("year")],
56035          YY: [n, function (t) {
56036            t = +t, this.year = t + (t > 68 ? 1900 : 2e3);
56037          }],
56038          YYYY: [/\d{4}/, i("year")],
56039          Z: s,
56040          ZZ: s
56041        };
56042
56043        var f = function f(t, n, r) {
56044          try {
56045            var o = function (t) {
56046              for (var n = t.match(e), r = n.length, o = 0; o < r; o += 1) {
56047                var i = n[o],
56048                    s = h[i],
56049                    a = s && s[0],
56050                    f = s && s[1];
56051                n[o] = f ? {
56052                  regex: a,
56053                  parser: f
56054                } : i.replace(/^\[|\]$/g, "");
56055              }
56056
56057              return function (t) {
56058                for (var e = {}, o = 0, i = 0; o < r; o += 1) {
56059                  var s = n[o];
56060                  if ("string" == typeof s) i += s.length;else {
56061                    var a = s.regex,
56062                        h = s.parser,
56063                        f = t.substr(i),
56064                        u = a.exec(f)[0];
56065                    h.call(e, u), t = t.replace(u, "");
56066                  }
56067                }
56068
56069                return function (t) {
56070                  var e = t.afternoon;
56071
56072                  if (void 0 !== e) {
56073                    var n = t.hours;
56074                    e ? n < 12 && (t.hours += 12) : 12 === n && (t.hours = 0), delete t.afternoon;
56075                  }
56076                }(e), e;
56077              };
56078            }(n)(t),
56079                i = o.year,
56080                s = o.month,
56081                a = o.day,
56082                f = o.hours,
56083                u = o.minutes,
56084                d = o.seconds,
56085                c = o.milliseconds,
56086                l = o.zone,
56087                m = new Date(),
56088                v = a || (i || s ? 1 : m.getDate()),
56089                p = i || m.getFullYear(),
56090                y = 0;
56091
56092            i && !s || (y = s > 0 ? s - 1 : m.getMonth());
56093            var D = f || 0,
56094                M = u || 0,
56095                g = d || 0,
56096                Y = c || 0;
56097            return l ? new Date(Date.UTC(p, y, v, D, M, g, Y + 60 * l.offset * 1e3)) : r ? new Date(Date.UTC(p, y, v, D, M, g, Y)) : new Date(p, y, v, D, M, g, Y);
56098          } catch (t) {
56099            return new Date("");
56100          }
56101        };
56102
56103        return function (e, n, r) {
56104          var o = n.prototype,
56105              i = o.parse;
56106
56107          o.parse = function (e) {
56108            var n = e.date,
56109                o = e.utc,
56110                s = e.args;
56111            this.$u = o;
56112            var a = s[1];
56113
56114            if ("string" == typeof a) {
56115              var h = !0 === s[2],
56116                  u = !0 === s[3],
56117                  d = h || u,
56118                  c = s[2];
56119              u && (c = s[2]), h || (t = c ? r.Ls[c] : this.$locale()), this.$d = f(n, a, o), this.init(), c && !0 !== c && (this.$L = this.locale(c).$L), d && n !== this.format(a) && (this.$d = new Date(""));
56120            } else if (a instanceof Array) for (var l = a.length, m = 1; m <= l; m += 1) {
56121              s[1] = a[m - 1];
56122              var v = r.apply(this, s);
56123
56124              if (v.isValid()) {
56125                this.$d = v.$d, this.$L = v.$L, this.init();
56126                break;
56127              }
56128
56129              m === l && (this.$d = new Date(""));
56130            } else i.call(this, e);
56131          };
56132        };
56133      });
56134    }, {}],
56135    315: [function (require, module, exports) {
56136      !function (t, i) {
56137        "object" == _typeof2(exports) && "undefined" != typeof module ? module.exports = i() : "function" == typeof define && define.amd ? define(i) : t.dayjs_plugin_utc = i();
56138      }(this, function () {
56139        "use strict";
56140
56141        return function (t, i, e) {
56142          var s = new Date().getTimezoneOffset(),
56143              n = i.prototype;
56144          e.utc = function (t) {
56145            return new i({
56146              date: t,
56147              utc: !0,
56148              args: arguments
56149            });
56150          }, n.utc = function () {
56151            return e(this.toDate(), {
56152              locale: this.$L,
56153              utc: !0
56154            });
56155          }, n.local = function () {
56156            return e(this.toDate(), {
56157              locale: this.$L,
56158              utc: !1
56159            });
56160          };
56161          var u = n.parse;
56162
56163          n.parse = function (t) {
56164            t.utc && (this.$u = !0), this.$utils().u(t.$offset) || (this.$offset = t.$offset), u.call(this, t);
56165          };
56166
56167          var o = n.init;
56168
56169          n.init = function () {
56170            if (this.$u) {
56171              var t = this.$d;
56172              this.$y = t.getUTCFullYear(), this.$M = t.getUTCMonth(), this.$D = t.getUTCDate(), this.$W = t.getUTCDay(), this.$H = t.getUTCHours(), this.$m = t.getUTCMinutes(), this.$s = t.getUTCSeconds(), this.$ms = t.getUTCMilliseconds();
56173            } else o.call(this);
56174          };
56175
56176          var f = n.utcOffset;
56177
56178          n.utcOffset = function (t) {
56179            var i = this.$utils().u;
56180            if (i(t)) return this.$u ? 0 : i(this.$offset) ? f.call(this) : this.$offset;
56181            var e,
56182                n = Math.abs(t) <= 16 ? 60 * t : t;
56183            return 0 !== t ? (e = this.local().add(n + s, "minute")).$offset = n : e = this.utc(), e;
56184          };
56185
56186          var r = n.format;
56187          n.format = function (t) {
56188            var i = t || (this.$u ? "YYYY-MM-DDTHH:mm:ss[Z]" : "");
56189            return r.call(this, i);
56190          }, n.valueOf = function () {
56191            var t = this.$utils().u(this.$offset) ? 0 : this.$offset + s;
56192            return this.$d.valueOf() - 6e4 * t;
56193          }, n.isUTC = function () {
56194            return !!this.$u;
56195          }, n.toISOString = function () {
56196            return this.toDate().toISOString();
56197          }, n.toString = function () {
56198            return this.toDate().toUTCString();
56199          };
56200          var a = n.toDate;
56201
56202          n.toDate = function (t) {
56203            return "s" === t && this.$offset ? e(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate() : a.call(this);
56204          };
56205        };
56206      });
56207    }, {}],
56208    316: [function (require, module, exports) {
56209      'use strict';
56210
56211      exports.utils = require('./des/utils');
56212      exports.Cipher = require('./des/cipher');
56213      exports.DES = require('./des/des');
56214      exports.CBC = require('./des/cbc');
56215      exports.EDE = require('./des/ede');
56216    }, {
56217      "./des/cbc": 317,
56218      "./des/cipher": 318,
56219      "./des/des": 319,
56220      "./des/ede": 320,
56221      "./des/utils": 321
56222    }],
56223    317: [function (require, module, exports) {
56224      'use strict';
56225
56226      var assert = require('minimalistic-assert');
56227
56228      var inherits = require('inherits');
56229
56230      var proto = {};
56231
56232      function CBCState(iv) {
56233        assert.equal(iv.length, 8, 'Invalid IV length');
56234        this.iv = new Array(8);
56235
56236        for (var i = 0; i < this.iv.length; i++) {
56237          this.iv[i] = iv[i];
56238        }
56239      }
56240
56241      function instantiate(Base) {
56242        function CBC(options) {
56243          Base.call(this, options);
56244
56245          this._cbcInit();
56246        }
56247
56248        inherits(CBC, Base);
56249        var keys = Object.keys(proto);
56250
56251        for (var i = 0; i < keys.length; i++) {
56252          var key = keys[i];
56253          CBC.prototype[key] = proto[key];
56254        }
56255
56256        CBC.create = function create(options) {
56257          return new CBC(options);
56258        };
56259
56260        return CBC;
56261      }
56262
56263      exports.instantiate = instantiate;
56264
56265      proto._cbcInit = function _cbcInit() {
56266        var state = new CBCState(this.options.iv);
56267        this._cbcState = state;
56268      };
56269
56270      proto._update = function _update(inp, inOff, out, outOff) {
56271        var state = this._cbcState;
56272        var superProto = this.constructor.super_.prototype;
56273        var iv = state.iv;
56274
56275        if (this.type === 'encrypt') {
56276          for (var i = 0; i < this.blockSize; i++) {
56277            iv[i] ^= inp[inOff + i];
56278          }
56279
56280          superProto._update.call(this, iv, 0, out, outOff);
56281
56282          for (var i = 0; i < this.blockSize; i++) {
56283            iv[i] = out[outOff + i];
56284          }
56285        } else {
56286          superProto._update.call(this, inp, inOff, out, outOff);
56287
56288          for (var i = 0; i < this.blockSize; i++) {
56289            out[outOff + i] ^= iv[i];
56290          }
56291
56292          for (var i = 0; i < this.blockSize; i++) {
56293            iv[i] = inp[inOff + i];
56294          }
56295        }
56296      };
56297    }, {
56298      "inherits": 364,
56299      "minimalistic-assert": 414
56300    }],
56301    318: [function (require, module, exports) {
56302      'use strict';
56303
56304      var assert = require('minimalistic-assert');
56305
56306      function Cipher(options) {
56307        this.options = options;
56308        this.type = this.options.type;
56309        this.blockSize = 8;
56310
56311        this._init();
56312
56313        this.buffer = new Array(this.blockSize);
56314        this.bufferOff = 0;
56315      }
56316
56317      module.exports = Cipher;
56318
56319      Cipher.prototype._init = function _init() {// Might be overrided
56320      };
56321
56322      Cipher.prototype.update = function update(data) {
56323        if (data.length === 0) return [];
56324        if (this.type === 'decrypt') return this._updateDecrypt(data);else return this._updateEncrypt(data);
56325      };
56326
56327      Cipher.prototype._buffer = function _buffer(data, off) {
56328        // Append data to buffer
56329        var min = Math.min(this.buffer.length - this.bufferOff, data.length - off);
56330
56331        for (var i = 0; i < min; i++) {
56332          this.buffer[this.bufferOff + i] = data[off + i];
56333        }
56334
56335        this.bufferOff += min; // Shift next
56336
56337        return min;
56338      };
56339
56340      Cipher.prototype._flushBuffer = function _flushBuffer(out, off) {
56341        this._update(this.buffer, 0, out, off);
56342
56343        this.bufferOff = 0;
56344        return this.blockSize;
56345      };
56346
56347      Cipher.prototype._updateEncrypt = function _updateEncrypt(data) {
56348        var inputOff = 0;
56349        var outputOff = 0;
56350        var count = (this.bufferOff + data.length) / this.blockSize | 0;
56351        var out = new Array(count * this.blockSize);
56352
56353        if (this.bufferOff !== 0) {
56354          inputOff += this._buffer(data, inputOff);
56355          if (this.bufferOff === this.buffer.length) outputOff += this._flushBuffer(out, outputOff);
56356        } // Write blocks
56357
56358
56359        var max = data.length - (data.length - inputOff) % this.blockSize;
56360
56361        for (; inputOff < max; inputOff += this.blockSize) {
56362          this._update(data, inputOff, out, outputOff);
56363
56364          outputOff += this.blockSize;
56365        } // Queue rest
56366
56367
56368        for (; inputOff < data.length; inputOff++, this.bufferOff++) {
56369          this.buffer[this.bufferOff] = data[inputOff];
56370        }
56371
56372        return out;
56373      };
56374
56375      Cipher.prototype._updateDecrypt = function _updateDecrypt(data) {
56376        var inputOff = 0;
56377        var outputOff = 0;
56378        var count = Math.ceil((this.bufferOff + data.length) / this.blockSize) - 1;
56379        var out = new Array(count * this.blockSize); // TODO(indutny): optimize it, this is far from optimal
56380
56381        for (; count > 0; count--) {
56382          inputOff += this._buffer(data, inputOff);
56383          outputOff += this._flushBuffer(out, outputOff);
56384        } // Buffer rest of the input
56385
56386
56387        inputOff += this._buffer(data, inputOff);
56388        return out;
56389      };
56390
56391      Cipher.prototype.final = function final(buffer) {
56392        var first;
56393        if (buffer) first = this.update(buffer);
56394        var last;
56395        if (this.type === 'encrypt') last = this._finalEncrypt();else last = this._finalDecrypt();
56396        if (first) return first.concat(last);else return last;
56397      };
56398
56399      Cipher.prototype._pad = function _pad(buffer, off) {
56400        if (off === 0) return false;
56401
56402        while (off < buffer.length) {
56403          buffer[off++] = 0;
56404        }
56405
56406        return true;
56407      };
56408
56409      Cipher.prototype._finalEncrypt = function _finalEncrypt() {
56410        if (!this._pad(this.buffer, this.bufferOff)) return [];
56411        var out = new Array(this.blockSize);
56412
56413        this._update(this.buffer, 0, out, 0);
56414
56415        return out;
56416      };
56417
56418      Cipher.prototype._unpad = function _unpad(buffer) {
56419        return buffer;
56420      };
56421
56422      Cipher.prototype._finalDecrypt = function _finalDecrypt() {
56423        assert.equal(this.bufferOff, this.blockSize, 'Not enough data to decrypt');
56424        var out = new Array(this.blockSize);
56425
56426        this._flushBuffer(out, 0);
56427
56428        return this._unpad(out);
56429      };
56430    }, {
vendor: 2,508 bytes, lines 56431-56516
56431      "minimalistic-assert": 414
56432    }],
56433    319: [function (require, module, exports) {
56434      'use strict';
56435
56436      var assert = require('minimalistic-assert');
56437
56438      var inherits = require('inherits');
56439
56440      var utils = require('./utils');
56441
56442      var Cipher = require('./cipher');
56443
56444      function DESState() {
56445        this.tmp = new Array(2);
56446        this.keys = null;
56447      }
56448
56449      function DES(options) {
56450        Cipher.call(this, options);
56451        var state = new DESState();
56452        this._desState = state;
56453        this.deriveKeys(state, options.key);
56454      }
56455
56456      inherits(DES, Cipher);
56457      module.exports = DES;
56458
56459      DES.create = function create(options) {
56460        return new DES(options);
56461      };
56462
56463      var shiftTable = [1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1];
56464
56465      DES.prototype.deriveKeys = function deriveKeys(state, key) {
56466        state.keys = new Array(16 * 2);
56467        assert.equal(key.length, this.blockSize, 'Invalid key length');
56468        var kL = utils.readUInt32BE(key, 0);
56469        var kR = utils.readUInt32BE(key, 4);
56470        utils.pc1(kL, kR, state.tmp, 0);
56471        kL = state.tmp[0];
56472        kR = state.tmp[1];
56473
56474        for (var i = 0; i < state.keys.length; i += 2) {
56475          var shift = shiftTable[i >>> 1];
56476          kL = utils.r28shl(kL, shift);
56477          kR = utils.r28shl(kR, shift);
56478          utils.pc2(kL, kR, state.keys, i);
56479        }
56480      };
56481
56482      DES.prototype._update = function _update(inp, inOff, out, outOff) {
56483        var state = this._desState;
56484        var l = utils.readUInt32BE(inp, inOff);
56485        var r = utils.readUInt32BE(inp, inOff + 4); // Initial Permutation
56486
56487        utils.ip(l, r, state.tmp, 0);
56488        l = state.tmp[0];
56489        r = state.tmp[1];
56490        if (this.type === 'encrypt') this._encrypt(state, l, r, state.tmp, 0);else this._decrypt(state, l, r, state.tmp, 0);
56491        l = state.tmp[0];
56492        r = state.tmp[1];
56493        utils.writeUInt32BE(out, l, outOff);
56494        utils.writeUInt32BE(out, r, outOff + 4);
56495      };
56496
56497      DES.prototype._pad = function _pad(buffer, off) {
56498        var value = buffer.length - off;
56499
56500        for (var i = off; i < buffer.length; i++) {
56501          buffer[i] = value;
56502        }
56503
56504        return true;
56505      };
56506
56507      DES.prototype._unpad = function _unpad(buffer) {
56508        var pad = buffer[buffer.length - 1];
56509
56510        for (var i = buffer.length - pad; i < buffer.length; i++) {
56511          assert.equal(buffer[i], pad);
56512        }
56513
56514        return buffer.slice(0, buffer.length - pad);
56515      };
56516
vendor: 10,758 bytes, lines 56517-56858
56517      DES.prototype._encrypt = function _encrypt(state, lStart, rStart, out, off) {
56518        var l = lStart;
56519        var r = rStart; // Apply f() x16 times
56520
56521        for (var i = 0; i < state.keys.length; i += 2) {
56522          var keyL = state.keys[i];
56523          var keyR = state.keys[i + 1]; // f(r, k)
56524
56525          utils.expand(r, state.tmp, 0);
56526          keyL ^= state.tmp[0];
56527          keyR ^= state.tmp[1];
56528          var s = utils.substitute(keyL, keyR);
56529          var f = utils.permute(s);
56530          var t = r;
56531          r = (l ^ f) >>> 0;
56532          l = t;
56533        } // Reverse Initial Permutation
56534
56535
56536        utils.rip(r, l, out, off);
56537      };
56538
56539      DES.prototype._decrypt = function _decrypt(state, lStart, rStart, out, off) {
56540        var l = rStart;
56541        var r = lStart; // Apply f() x16 times
56542
56543        for (var i = state.keys.length - 2; i >= 0; i -= 2) {
56544          var keyL = state.keys[i];
56545          var keyR = state.keys[i + 1]; // f(r, k)
56546
56547          utils.expand(l, state.tmp, 0);
56548          keyL ^= state.tmp[0];
56549          keyR ^= state.tmp[1];
56550          var s = utils.substitute(keyL, keyR);
56551          var f = utils.permute(s);
56552          var t = l;
56553          l = (r ^ f) >>> 0;
56554          r = t;
56555        } // Reverse Initial Permutation
56556
56557
56558        utils.rip(l, r, out, off);
56559      };
56560    }, {
56561      "./cipher": 318,
56562      "./utils": 321,
56563      "inherits": 364,
56564      "minimalistic-assert": 414
56565    }],
56566    320: [function (require, module, exports) {
56567      'use strict';
56568
56569      var assert = require('minimalistic-assert');
56570
56571      var inherits = require('inherits');
56572
56573      var Cipher = require('./cipher');
56574
56575      var DES = require('./des');
56576
56577      function EDEState(type, key) {
56578        assert.equal(key.length, 24, 'Invalid key length');
56579        var k1 = key.slice(0, 8);
56580        var k2 = key.slice(8, 16);
56581        var k3 = key.slice(16, 24);
56582
56583        if (type === 'encrypt') {
56584          this.ciphers = [DES.create({
56585            type: 'encrypt',
56586            key: k1
56587          }), DES.create({
56588            type: 'decrypt',
56589            key: k2
56590          }), DES.create({
56591            type: 'encrypt',
56592            key: k3
56593          })];
56594        } else {
56595          this.ciphers = [DES.create({
56596            type: 'decrypt',
56597            key: k3
56598          }), DES.create({
56599            type: 'encrypt',
56600            key: k2
56601          }), DES.create({
56602            type: 'decrypt',
56603            key: k1
56604          })];
56605        }
56606      }
56607
56608      function EDE(options) {
56609        Cipher.call(this, options);
56610        var state = new EDEState(this.type, this.options.key);
56611        this._edeState = state;
56612      }
56613
56614      inherits(EDE, Cipher);
56615      module.exports = EDE;
56616
56617      EDE.create = function create(options) {
56618        return new EDE(options);
56619      };
56620
56621      EDE.prototype._update = function _update(inp, inOff, out, outOff) {
56622        var state = this._edeState;
56623
56624        state.ciphers[0]._update(inp, inOff, out, outOff);
56625
56626        state.ciphers[1]._update(out, outOff, out, outOff);
56627
56628        state.ciphers[2]._update(out, outOff, out, outOff);
56629      };
56630
56631      EDE.prototype._pad = DES.prototype._pad;
56632      EDE.prototype._unpad = DES.prototype._unpad;
56633    }, {
56634      "./cipher": 318,
56635      "./des": 319,
56636      "inherits": 364,
56637      "minimalistic-assert": 414
56638    }],
56639    321: [function (require, module, exports) {
56640      'use strict';
56641
56642      exports.readUInt32BE = function readUInt32BE(bytes, off) {
56643        var res = bytes[0 + off] << 24 | bytes[1 + off] << 16 | bytes[2 + off] << 8 | bytes[3 + off];
56644        return res >>> 0;
56645      };
56646
56647      exports.writeUInt32BE = function writeUInt32BE(bytes, value, off) {
56648        bytes[0 + off] = value >>> 24;
56649        bytes[1 + off] = value >>> 16 & 0xff;
56650        bytes[2 + off] = value >>> 8 & 0xff;
56651        bytes[3 + off] = value & 0xff;
56652      };
56653
56654      exports.ip = function ip(inL, inR, out, off) {
56655        var outL = 0;
56656        var outR = 0;
56657
56658        for (var i = 6; i >= 0; i -= 2) {
56659          for (var j = 0; j <= 24; j += 8) {
56660            outL <<= 1;
56661            outL |= inR >>> j + i & 1;
56662          }
56663
56664          for (var j = 0; j <= 24; j += 8) {
56665            outL <<= 1;
56666            outL |= inL >>> j + i & 1;
56667          }
56668        }
56669
56670        for (var i = 6; i >= 0; i -= 2) {
56671          for (var j = 1; j <= 25; j += 8) {
56672            outR <<= 1;
56673            outR |= inR >>> j + i & 1;
56674          }
56675
56676          for (var j = 1; j <= 25; j += 8) {
56677            outR <<= 1;
56678            outR |= inL >>> j + i & 1;
56679          }
56680        }
56681
56682        out[off + 0] = outL >>> 0;
56683        out[off + 1] = outR >>> 0;
56684      };
56685
56686      exports.rip = function rip(inL, inR, out, off) {
56687        var outL = 0;
56688        var outR = 0;
56689
56690        for (var i = 0; i < 4; i++) {
56691          for (var j = 24; j >= 0; j -= 8) {
56692            outL <<= 1;
56693            outL |= inR >>> j + i & 1;
56694            outL <<= 1;
56695            outL |= inL >>> j + i & 1;
56696          }
56697        }
56698
56699        for (var i = 4; i < 8; i++) {
56700          for (var j = 24; j >= 0; j -= 8) {
56701            outR <<= 1;
56702            outR |= inR >>> j + i & 1;
56703            outR <<= 1;
56704            outR |= inL >>> j + i & 1;
56705          }
56706        }
56707
56708        out[off + 0] = outL >>> 0;
56709        out[off + 1] = outR >>> 0;
56710      };
56711
56712      exports.pc1 = function pc1(inL, inR, out, off) {
56713        var outL = 0;
56714        var outR = 0; // 7, 15, 23, 31, 39, 47, 55, 63
56715        // 6, 14, 22, 30, 39, 47, 55, 63
56716        // 5, 13, 21, 29, 39, 47, 55, 63
56717        // 4, 12, 20, 28
56718
56719        for (var i = 7; i >= 5; i--) {
56720          for (var j = 0; j <= 24; j += 8) {
56721            outL <<= 1;
56722            outL |= inR >> j + i & 1;
56723          }
56724
56725          for (var j = 0; j <= 24; j += 8) {
56726            outL <<= 1;
56727            outL |= inL >> j + i & 1;
56728          }
56729        }
56730
56731        for (var j = 0; j <= 24; j += 8) {
56732          outL <<= 1;
56733          outL |= inR >> j + i & 1;
56734        } // 1, 9, 17, 25, 33, 41, 49, 57
56735        // 2, 10, 18, 26, 34, 42, 50, 58
56736        // 3, 11, 19, 27, 35, 43, 51, 59
56737        // 36, 44, 52, 60
56738
56739
56740        for (var i = 1; i <= 3; i++) {
56741          for (var j = 0; j <= 24; j += 8) {
56742            outR <<= 1;
56743            outR |= inR >> j + i & 1;
56744          }
56745
56746          for (var j = 0; j <= 24; j += 8) {
56747            outR <<= 1;
56748            outR |= inL >> j + i & 1;
56749          }
56750        }
56751
56752        for (var j = 0; j <= 24; j += 8) {
56753          outR <<= 1;
56754          outR |= inL >> j + i & 1;
56755        }
56756
56757        out[off + 0] = outL >>> 0;
56758        out[off + 1] = outR >>> 0;
56759      };
56760
56761      exports.r28shl = function r28shl(num, shift) {
56762        return num << shift & 0xfffffff | num >>> 28 - shift;
56763      };
56764
56765      var pc2table = [// inL => outL
56766      14, 11, 17, 4, 27, 23, 25, 0, 13, 22, 7, 18, 5, 9, 16, 24, 2, 20, 12, 21, 1, 8, 15, 26, // inR => outR
56767      15, 4, 25, 19, 9, 1, 26, 16, 5, 11, 23, 8, 12, 7, 17, 0, 22, 3, 10, 14, 6, 20, 27, 24];
56768
56769      exports.pc2 = function pc2(inL, inR, out, off) {
56770        var outL = 0;
56771        var outR = 0;
56772        var len = pc2table.length >>> 1;
56773
56774        for (var i = 0; i < len; i++) {
56775          outL <<= 1;
56776          outL |= inL >>> pc2table[i] & 0x1;
56777        }
56778
56779        for (var i = len; i < pc2table.length; i++) {
56780          outR <<= 1;
56781          outR |= inR >>> pc2table[i] & 0x1;
56782        }
56783
56784        out[off + 0] = outL >>> 0;
56785        out[off + 1] = outR >>> 0;
56786      };
56787
56788      exports.expand = function expand(r, out, off) {
56789        var outL = 0;
56790        var outR = 0;
56791        outL = (r & 1) << 5 | r >>> 27;
56792
56793        for (var i = 23; i >= 15; i -= 4) {
56794          outL <<= 6;
56795          outL |= r >>> i & 0x3f;
56796        }
56797
56798        for (var i = 11; i >= 3; i -= 4) {
56799          outR |= r >>> i & 0x3f;
56800          outR <<= 6;
56801        }
56802
56803        outR |= (r & 0x1f) << 1 | r >>> 31;
56804        out[off + 0] = outL >>> 0;
56805        out[off + 1] = outR >>> 0;
56806      };
56807
56808      var sTable = [14, 0, 4, 15, 13, 7, 1, 4, 2, 14, 15, 2, 11, 13, 8, 1, 3, 10, 10, 6, 6, 12, 12, 11, 5, 9, 9, 5, 0, 3, 7, 8, 4, 15, 1, 12, 14, 8, 8, 2, 13, 4, 6, 9, 2, 1, 11, 7, 15, 5, 12, 11, 9, 3, 7, 14, 3, 10, 10, 0, 5, 6, 0, 13, 15, 3, 1, 13, 8, 4, 14, 7, 6, 15, 11, 2, 3, 8, 4, 14, 9, 12, 7, 0, 2, 1, 13, 10, 12, 6, 0, 9, 5, 11, 10, 5, 0, 13, 14, 8, 7, 10, 11, 1, 10, 3, 4, 15, 13, 4, 1, 2, 5, 11, 8, 6, 12, 7, 6, 12, 9, 0, 3, 5, 2, 14, 15, 9, 10, 13, 0, 7, 9, 0, 14, 9, 6, 3, 3, 4, 15, 6, 5, 10, 1, 2, 13, 8, 12, 5, 7, 14, 11, 12, 4, 11, 2, 15, 8, 1, 13, 1, 6, 10, 4, 13, 9, 0, 8, 6, 15, 9, 3, 8, 0, 7, 11, 4, 1, 15, 2, 14, 12, 3, 5, 11, 10, 5, 14, 2, 7, 12, 7, 13, 13, 8, 14, 11, 3, 5, 0, 6, 6, 15, 9, 0, 10, 3, 1, 4, 2, 7, 8, 2, 5, 12, 11, 1, 12, 10, 4, 14, 15, 9, 10, 3, 6, 15, 9, 0, 0, 6, 12, 10, 11, 1, 7, 13, 13, 8, 15, 9, 1, 4, 3, 5, 14, 11, 5, 12, 2, 7, 8, 2, 4, 14, 2, 14, 12, 11, 4, 2, 1, 12, 7, 4, 10, 7, 11, 13, 6, 1, 8, 5, 5, 0, 3, 15, 15, 10, 13, 3, 0, 9, 14, 8, 9, 6, 4, 11, 2, 8, 1, 12, 11, 7, 10, 1, 13, 14, 7, 2, 8, 13, 15, 6, 9, 15, 12, 0, 5, 9, 6, 10, 3, 4, 0, 5, 14, 3, 12, 10, 1, 15, 10, 4, 15, 2, 9, 7, 2, 12, 6, 9, 8, 5, 0, 6, 13, 1, 3, 13, 4, 14, 14, 0, 7, 11, 5, 3, 11, 8, 9, 4, 14, 3, 15, 2, 5, 12, 2, 9, 8, 5, 12, 15, 3, 10, 7, 11, 0, 14, 4, 1, 10, 7, 1, 6, 13, 0, 11, 8, 6, 13, 4, 13, 11, 0, 2, 11, 14, 7, 15, 4, 0, 9, 8, 1, 13, 10, 3, 14, 12, 3, 9, 5, 7, 12, 5, 2, 10, 15, 6, 8, 1, 6, 1, 6, 4, 11, 11, 13, 13, 8, 12, 1, 3, 4, 7, 10, 14, 7, 10, 9, 15, 5, 6, 0, 8, 15, 0, 14, 5, 2, 9, 3, 2, 12, 13, 1, 2, 15, 8, 13, 4, 8, 6, 10, 15, 3, 11, 7, 1, 4, 10, 12, 9, 5, 3, 6, 14, 11, 5, 0, 0, 14, 12, 9, 7, 2, 7, 2, 11, 1, 4, 14, 1, 7, 9, 4, 12, 10, 14, 8, 2, 13, 0, 15, 6, 12, 10, 9, 13, 0, 15, 3, 3, 5, 5, 6, 8, 11];
56809
56810      exports.substitute = function substitute(inL, inR) {
56811        var out = 0;
56812
56813        for (var i = 0; i < 4; i++) {
56814          var b = inL >>> 18 - i * 6 & 0x3f;
56815          var sb = sTable[i * 0x40 + b];
56816          out <<= 4;
56817          out |= sb;
56818        }
56819
56820        for (var i = 0; i < 4; i++) {
56821          var b = inR >>> 18 - i * 6 & 0x3f;
56822          var sb = sTable[4 * 0x40 + i * 0x40 + b];
56823          out <<= 4;
56824          out |= sb;
56825        }
56826
56827        return out >>> 0;
56828      };
56829
56830      var permuteTable = [16, 25, 12, 11, 3, 20, 4, 15, 31, 17, 9, 6, 27, 14, 1, 22, 30, 24, 8, 18, 0, 5, 29, 23, 13, 19, 2, 26, 10, 21, 28, 7];
56831
56832      exports.permute = function permute(num) {
56833        var out = 0;
56834
56835        for (var i = 0; i < permuteTable.length; i++) {
56836          out <<= 1;
56837          out |= num >>> permuteTable[i] & 0x1;
56838        }
56839
56840        return out >>> 0;
56841      };
56842
56843      exports.padSplit = function padSplit(num, size, group) {
56844        var str = num.toString(2);
56845
56846        while (str.length < size) {
56847          str = '0' + str;
56848        }
56849
56850        var out = [];
56851
56852        for (var i = 0; i < size; i += group) {
56853          out.push(str.slice(i, i + group));
56854        }
56855
56856        return out.join(' ');
56857      };
56858    }, {}],
vendor: 6,887 bytes, lines 56859-57108
56859    322: [function (require, module, exports) {
56860      (function (Buffer) {
56861        var generatePrime = require('./lib/generatePrime');
56862
56863        var primes = require('./lib/primes.json');
56864
56865        var DH = require('./lib/dh');
56866
56867        function getDiffieHellman(mod) {
56868          var prime = new Buffer(primes[mod].prime, 'hex');
56869          var gen = new Buffer(primes[mod].gen, 'hex');
56870          return new DH(prime, gen);
56871        }
56872
56873        var ENCODINGS = {
56874          'binary': true,
56875          'hex': true,
56876          'base64': true
56877        };
56878
56879        function createDiffieHellman(prime, enc, generator, genc) {
56880          if (Buffer.isBuffer(enc) || ENCODINGS[enc] === undefined) {
56881            return createDiffieHellman(prime, 'binary', enc, generator);
56882          }
56883
56884          enc = enc || 'binary';
56885          genc = genc || 'binary';
56886          generator = generator || new Buffer([2]);
56887
56888          if (!Buffer.isBuffer(generator)) {
56889            generator = new Buffer(generator, genc);
56890          }
56891
56892          if (typeof prime === 'number') {
56893            return new DH(generatePrime(prime, generator), generator, true);
56894          }
56895
56896          if (!Buffer.isBuffer(prime)) {
56897            prime = new Buffer(prime, enc);
56898          }
56899
56900          return new DH(prime, generator, true);
56901        }
56902
56903        exports.DiffieHellmanGroup = exports.createDiffieHellmanGroup = exports.getDiffieHellman = getDiffieHellman;
56904        exports.createDiffieHellman = exports.DiffieHellman = createDiffieHellman;
56905      }).call(this, require("buffer").Buffer);
56906    }, {
56907      "./lib/dh": 323,
56908      "./lib/generatePrime": 324,
56909      "./lib/primes.json": 325,
56910      "buffer": 214
56911    }],
56912    323: [function (require, module, exports) {
56913      (function (Buffer) {
56914        var BN = require('bn.js');
56915
56916        var MillerRabin = require('miller-rabin');
56917
56918        var millerRabin = new MillerRabin();
56919        var TWENTYFOUR = new BN(24);
56920        var ELEVEN = new BN(11);
56921        var TEN = new BN(10);
56922        var THREE = new BN(3);
56923        var SEVEN = new BN(7);
56924
56925        var primes = require('./generatePrime');
56926
56927        var randomBytes = require('randombytes');
56928
56929        module.exports = DH;
56930
56931        function setPublicKey(pub, enc) {
56932          enc = enc || 'utf8';
56933
56934          if (!Buffer.isBuffer(pub)) {
56935            pub = new Buffer(pub, enc);
56936          }
56937
56938          this._pub = new BN(pub);
56939          return this;
56940        }
56941
56942        function setPrivateKey(priv, enc) {
56943          enc = enc || 'utf8';
56944
56945          if (!Buffer.isBuffer(priv)) {
56946            priv = new Buffer(priv, enc);
56947          }
56948
56949          this._priv = new BN(priv);
56950          return this;
56951        }
56952
56953        var primeCache = {};
56954
56955        function checkPrime(prime, generator) {
56956          var gen = generator.toString('hex');
56957          var hex = [gen, prime.toString(16)].join('_');
56958
56959          if (hex in primeCache) {
56960            return primeCache[hex];
56961          }
56962
56963          var error = 0;
56964
56965          if (prime.isEven() || !primes.simpleSieve || !primes.fermatTest(prime) || !millerRabin.test(prime)) {
56966            //not a prime so +1
56967            error += 1;
56968
56969            if (gen === '02' || gen === '05') {
56970              // we'd be able to check the generator
56971              // it would fail so +8
56972              error += 8;
56973            } else {
56974              //we wouldn't be able to test the generator
56975              // so +4
56976              error += 4;
56977            }
56978
56979            primeCache[hex] = error;
56980            return error;
56981          }
56982
56983          if (!millerRabin.test(prime.shrn(1))) {
56984            //not a safe prime
56985            error += 2;
56986          }
56987
56988          var rem;
56989
56990          switch (gen) {
56991            case '02':
56992              if (prime.mod(TWENTYFOUR).cmp(ELEVEN)) {
56993                // unsuidable generator
56994                error += 8;
56995              }
56996
56997              break;
56998
56999            case '05':
57000              rem = prime.mod(TEN);
57001
57002              if (rem.cmp(THREE) && rem.cmp(SEVEN)) {
57003                // prime mod 10 needs to equal 3 or 7
57004                error += 8;
57005              }
57006
57007              break;
57008
57009            default:
57010              error += 4;
57011          }
57012
57013          primeCache[hex] = error;
57014          return error;
57015        }
57016
57017        function DH(prime, generator, malleable) {
57018          this.setGenerator(generator);
57019          this.__prime = new BN(prime);
57020          this._prime = BN.mont(this.__prime);
57021          this._primeLen = prime.length;
57022          this._pub = undefined;
57023          this._priv = undefined;
57024          this._primeCode = undefined;
57025
57026          if (malleable) {
57027            this.setPublicKey = setPublicKey;
57028            this.setPrivateKey = setPrivateKey;
57029          } else {
57030            this._primeCode = 8;
57031          }
57032        }
57033
57034        Object.defineProperty(DH.prototype, 'verifyError', {
57035          enumerable: true,
57036          get: function get() {
57037            if (typeof this._primeCode !== 'number') {
57038              this._primeCode = checkPrime(this.__prime, this.__gen);
57039            }
57040
57041            return this._primeCode;
57042          }
57043        });
57044
57045        DH.prototype.generateKeys = function () {
57046          if (!this._priv) {
57047            this._priv = new BN(randomBytes(this._primeLen));
57048          }
57049
57050          this._pub = this._gen.toRed(this._prime).redPow(this._priv).fromRed();
57051          return this.getPublicKey();
57052        };
57053
57054        DH.prototype.computeSecret = function (other) {
57055          other = new BN(other);
57056          other = other.toRed(this._prime);
57057          var secret = other.redPow(this._priv).fromRed();
57058          var out = new Buffer(secret.toArray());
57059          var prime = this.getPrime();
57060
57061          if (out.length < prime.length) {
57062            var front = new Buffer(prime.length - out.length);
57063            front.fill(0);
57064            out = Buffer.concat([front, out]);
57065          }
57066
57067          return out;
57068        };
57069
57070        DH.prototype.getPublicKey = function getPublicKey(enc) {
57071          return formatReturnValue(this._pub, enc);
57072        };
57073
57074        DH.prototype.getPrivateKey = function getPrivateKey(enc) {
57075          return formatReturnValue(this._priv, enc);
57076        };
57077
57078        DH.prototype.getPrime = function (enc) {
57079          return formatReturnValue(this.__prime, enc);
57080        };
57081
57082        DH.prototype.getGenerator = function (enc) {
57083          return formatReturnValue(this._gen, enc);
57084        };
57085
57086        DH.prototype.setGenerator = function (gen, enc) {
57087          enc = enc || 'utf8';
57088
57089          if (!Buffer.isBuffer(gen)) {
57090            gen = new Buffer(gen, enc);
57091          }
57092
57093          this.__gen = gen;
57094          this._gen = new BN(gen);
57095          return this;
57096        };
57097
57098        function formatReturnValue(bn, enc) {
57099          var buf = new Buffer(bn.toArray());
57100
57101          if (!enc) {
57102            return buf;
57103          } else {
57104            return buf.toString(enc);
57105          }
57106        }
57107      }).call(this, require("buffer").Buffer);
57108    }, {
vendor: 8,097 bytes, lines 57109-57262
57109      "./generatePrime": 324,
57110      "bn.js": 326,
57111      "buffer": 214,
57112      "miller-rabin": 412,
57113      "randombytes": 451
57114    }],
57115    324: [function (require, module, exports) {
57116      var randomBytes = require('randombytes');
57117
57118      module.exports = findPrime;
57119      findPrime.simpleSieve = simpleSieve;
57120      findPrime.fermatTest = fermatTest;
57121
57122      var BN = require('bn.js');
57123
57124      var TWENTYFOUR = new BN(24);
57125
57126      var MillerRabin = require('miller-rabin');
57127
57128      var millerRabin = new MillerRabin();
57129      var ONE = new BN(1);
57130      var TWO = new BN(2);
57131      var FIVE = new BN(5);
57132      var SIXTEEN = new BN(16);
57133      var EIGHT = new BN(8);
57134      var TEN = new BN(10);
57135      var THREE = new BN(3);
57136      var SEVEN = new BN(7);
57137      var ELEVEN = new BN(11);
57138      var FOUR = new BN(4);
57139      var TWELVE = new BN(12);
57140      var primes = null;
57141
57142      function _getPrimes() {
57143        if (primes !== null) return primes;
57144        var limit = 0x100000;
57145        var res = [];
57146        res[0] = 2;
57147
57148        for (var i = 1, k = 3; k < limit; k += 2) {
57149          var sqrt = Math.ceil(Math.sqrt(k));
57150
57151          for (var j = 0; j < i && res[j] <= sqrt; j++) {
57152            if (k % res[j] === 0) break;
57153          }
57154
57155          if (i !== j && res[j] <= sqrt) continue;
57156          res[i++] = k;
57157        }
57158
57159        primes = res;
57160        return res;
57161      }
57162
57163      function simpleSieve(p) {
57164        var primes = _getPrimes();
57165
57166        for (var i = 0; i < primes.length; i++) {
57167          if (p.modn(primes[i]) === 0) {
57168            if (p.cmpn(primes[i]) === 0) {
57169              return true;
57170            } else {
57171              return false;
57172            }
57173          }
57174        }
57175
57176        return true;
57177      }
57178
57179      function fermatTest(p) {
57180        var red = BN.mont(p);
57181        return TWO.toRed(red).redPow(p.subn(1)).fromRed().cmpn(1) === 0;
57182      }
57183
57184      function findPrime(bits, gen) {
57185        if (bits < 16) {
57186          // this is what openssl does
57187          if (gen === 2 || gen === 5) {
57188            return new BN([0x8c, 0x7b]);
57189          } else {
57190            return new BN([0x8c, 0x27]);
57191          }
57192        }
57193
57194        gen = new BN(gen);
57195        var num, n2;
57196
57197        while (true) {
57198          num = new BN(randomBytes(Math.ceil(bits / 8)));
57199
57200          while (num.bitLength() > bits) {
57201            num.ishrn(1);
57202          }
57203
57204          if (num.isEven()) {
57205            num.iadd(ONE);
57206          }
57207
57208          if (!num.testn(1)) {
57209            num.iadd(TWO);
57210          }
57211
57212          if (!gen.cmp(TWO)) {
57213            while (num.mod(TWENTYFOUR).cmp(ELEVEN)) {
57214              num.iadd(FOUR);
57215            }
57216          } else if (!gen.cmp(FIVE)) {
57217            while (num.mod(TEN).cmp(THREE)) {
57218              num.iadd(FOUR);
57219            }
57220          }
57221
57222          n2 = num.shrn(1);
57223
57224          if (simpleSieve(n2) && simpleSieve(num) && fermatTest(n2) && fermatTest(num) && millerRabin.test(n2) && millerRabin.test(num)) {
57225            return num;
57226          }
57227        }
57228      }
57229    }, {
57230      "bn.js": 326,
57231      "miller-rabin": 412,
57232      "randombytes": 451
57233    }],
57234    325: [function (require, module, exports) {
57235      module.exports = {
57236        "modp1": {
57237          "gen": "02",
57238          "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"
57239        },
57240        "modp2": {
57241          "gen": "02",
57242          "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"
57243        },
57244        "modp5": {
57245          "gen": "02",
57246          "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"
57247        },
57248        "modp14": {
57249          "gen": "02",
57250          "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"
57251        },
57252        "modp15": {
57253          "gen": "02",
57254          "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"
57255        },
57256        "modp16": {
57257          "gen": "02",
57258          "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"
57259        },
57260        "modp17": {
57261          "gen": "02",
57262          "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd4
5726207b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"
57263        },
57264        "modp18": {
57265          "gen": "02",
57266          "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"
57267        }
57268      };
57269    }, {}],
57270    326: [function (require, module, exports) {
57271      arguments[4][179][0].apply(exports, arguments);
57272    }, {
vendor: 5,610 bytes, lines 57273-57459
57273      "buffer": 183,
57274      "dup": 179
57275    }],
57276    327: [function (require, module, exports) {
57277      'use strict';
57278
57279      var elliptic = exports;
57280      elliptic.version = require('../package.json').version;
57281      elliptic.utils = require('./elliptic/utils');
57282      elliptic.rand = require('brorand');
57283      elliptic.curve = require('./elliptic/curve');
57284      elliptic.curves = require('./elliptic/curves'); // Protocols
57285
57286      elliptic.ec = require('./elliptic/ec');
57287      elliptic.eddsa = require('./elliptic/eddsa');
57288    }, {
57289      "../package.json": 343,
57290      "./elliptic/curve": 330,
57291      "./elliptic/curves": 333,
57292      "./elliptic/ec": 334,
57293      "./elliptic/eddsa": 337,
57294      "./elliptic/utils": 341,
57295      "brorand": 182
57296    }],
57297    328: [function (require, module, exports) {
57298      'use strict';
57299
57300      var BN = require('bn.js');
57301
57302      var utils = require('../utils');
57303
57304      var getNAF = utils.getNAF;
57305      var getJSF = utils.getJSF;
57306      var assert = utils.assert;
57307
57308      function BaseCurve(type, conf) {
57309        this.type = type;
57310        this.p = new BN(conf.p, 16); // Use Montgomery, when there is no fast reduction for the prime
57311
57312        this.red = conf.prime ? BN.red(conf.prime) : BN.mont(this.p); // Useful for many curves
57313
57314        this.zero = new BN(0).toRed(this.red);
57315        this.one = new BN(1).toRed(this.red);
57316        this.two = new BN(2).toRed(this.red); // Curve configuration, optional
57317
57318        this.n = conf.n && new BN(conf.n, 16);
57319        this.g = conf.g && this.pointFromJSON(conf.g, conf.gRed); // Temporary arrays
57320
57321        this._wnafT1 = new Array(4);
57322        this._wnafT2 = new Array(4);
57323        this._wnafT3 = new Array(4);
57324        this._wnafT4 = new Array(4);
57325        this._bitLength = this.n ? this.n.bitLength() : 0; // Generalized Greg Maxwell's trick
57326
57327        var adjustCount = this.n && this.p.div(this.n);
57328
57329        if (!adjustCount || adjustCount.cmpn(100) > 0) {
57330          this.redN = null;
57331        } else {
57332          this._maxwellTrick = true;
57333          this.redN = this.n.toRed(this.red);
57334        }
57335      }
57336
57337      module.exports = BaseCurve;
57338
57339      BaseCurve.prototype.point = function point() {
57340        throw new Error('Not implemented');
57341      };
57342
57343      BaseCurve.prototype.validate = function validate() {
57344        throw new Error('Not implemented');
57345      };
57346
57347      BaseCurve.prototype._fixedNafMul = function _fixedNafMul(p, k) {
57348        assert(p.precomputed);
57349
57350        var doubles = p._getDoubles();
57351
57352        var naf = getNAF(k, 1, this._bitLength);
57353        var I = (1 << doubles.step + 1) - (doubles.step % 2 === 0 ? 2 : 1);
57354        I /= 3; // Translate into more windowed form
57355
57356        var repr = [];
57357
57358        for (var j = 0; j < naf.length; j += doubles.step) {
57359          var nafW = 0;
57360
57361          for (var k = j + doubles.step - 1; k >= j; k--) {
57362            nafW = (nafW << 1) + naf[k];
57363          }
57364
57365          repr.push(nafW);
57366        }
57367
57368        var a = this.jpoint(null, null, null);
57369        var b = this.jpoint(null, null, null);
57370
57371        for (var i = I; i > 0; i--) {
57372          for (var j = 0; j < repr.length; j++) {
57373            var nafW = repr[j];
57374            if (nafW === i) b = b.mixedAdd(doubles.points[j]);else if (nafW === -i) b = b.mixedAdd(doubles.points[j].neg());
57375          }
57376
57377          a = a.add(b);
57378        }
57379
57380        return a.toP();
57381      };
57382
57383      BaseCurve.prototype._wnafMul = function _wnafMul(p, k) {
57384        var w = 4; // Precompute window
57385
57386        var nafPoints = p._getNAFPoints(w);
57387
57388        w = nafPoints.wnd;
57389        var wnd = nafPoints.points; // Get NAF form
57390
57391        var naf = getNAF(k, w, this._bitLength); // Add `this`*(N+1) for every w-NAF index
57392
57393        var acc = this.jpoint(null, null, null);
57394
57395        for (var i = naf.length - 1; i >= 0; i--) {
57396          // Count zeroes
57397          for (var k = 0; i >= 0 && naf[i] === 0; i--) {
57398            k++;
57399          }
57400
57401          if (i >= 0) k++;
57402          acc = acc.dblp(k);
57403          if (i < 0) break;
57404          var z = naf[i];
57405          assert(z !== 0);
57406
57407          if (p.type === 'affine') {
57408            // J +- P
57409            if (z > 0) acc = acc.mixedAdd(wnd[z - 1 >> 1]);else acc = acc.mixedAdd(wnd[-z - 1 >> 1].neg());
57410          } else {
57411            // J +- J
57412            if (z > 0) acc = acc.add(wnd[z - 1 >> 1]);else acc = acc.add(wnd[-z - 1 >> 1].neg());
57413          }
57414        }
57415
57416        return p.type === 'affine' ? acc.toP() : acc;
57417      };
57418
57419      BaseCurve.prototype._wnafMulAdd = function _wnafMulAdd(defW, points, coeffs, len, jacobianResult) {
57420        var wndWidth = this._wnafT1;
57421        var wnd = this._wnafT2;
57422        var naf = this._wnafT3; // Fill all arrays
57423
57424        var max = 0;
57425
57426        for (var i = 0; i < len; i++) {
57427          var p = points[i];
57428
57429          var nafPoints = p._getNAFPoints(defW);
57430
57431          wndWidth[i] = nafPoints.wnd;
57432          wnd[i] = nafPoints.points;
57433        } // Comb small window NAFs
57434
57435
57436        for (var i = len - 1; i >= 1; i -= 2) {
57437          var a = i - 1;
57438          var b = i;
57439
57440          if (wndWidth[a] !== 1 || wndWidth[b] !== 1) {
57441            naf[a] = getNAF(coeffs[a], wndWidth[a], this._bitLength);
57442            naf[b] = getNAF(coeffs[b], wndWidth[b], this._bitLength);
57443            max = Math.max(naf[a].length, max);
57444            max = Math.max(naf[b].length, max);
57445            continue;
57446          }
57447
57448          var comb = [points[a],
57449          /* 1 */
57450          null,
57451          /* 3 */
57452          null,
57453          /* 5 */
57454          points[b]
57455          /* 7 */
57456          ]; // Try to avoid Projective points, if possible
57457
57458          if (points[a].y.cmp(points[b].y) === 0) {
57459            comb[1] = points[a].add(points[b]);
vendor: 4,294 bytes, lines 57460-57598
57460            comb[2] = points[a].toJ().mixedAdd(points[b].neg());
57461          } else if (points[a].y.cmp(points[b].y.redNeg()) === 0) {
57462            comb[1] = points[a].toJ().mixedAdd(points[b]);
57463            comb[2] = points[a].add(points[b].neg());
57464          } else {
57465            comb[1] = points[a].toJ().mixedAdd(points[b]);
57466            comb[2] = points[a].toJ().mixedAdd(points[b].neg());
57467          }
57468
57469          var index = [-3,
57470          /* -1 -1 */
57471          -1,
57472          /* -1 0 */
57473          -5,
57474          /* -1 1 */
57475          -7,
57476          /* 0 -1 */
57477          0,
57478          /* 0 0 */
57479          7,
57480          /* 0 1 */
57481          5,
57482          /* 1 -1 */
57483          1,
57484          /* 1 0 */
57485          3
57486          /* 1 1 */
57487          ];
57488          var jsf = getJSF(coeffs[a], coeffs[b]);
57489          max = Math.max(jsf[0].length, max);
57490          naf[a] = new Array(max);
57491          naf[b] = new Array(max);
57492
57493          for (var j = 0; j < max; j++) {
57494            var ja = jsf[0][j] | 0;
57495            var jb = jsf[1][j] | 0;
57496            naf[a][j] = index[(ja + 1) * 3 + (jb + 1)];
57497            naf[b][j] = 0;
57498            wnd[a] = comb;
57499          }
57500        }
57501
57502        var acc = this.jpoint(null, null, null);
57503        var tmp = this._wnafT4;
57504
57505        for (var i = max; i >= 0; i--) {
57506          var k = 0;
57507
57508          while (i >= 0) {
57509            var zero = true;
57510
57511            for (var j = 0; j < len; j++) {
57512              tmp[j] = naf[j][i] | 0;
57513              if (tmp[j] !== 0) zero = false;
57514            }
57515
57516            if (!zero) break;
57517            k++;
57518            i--;
57519          }
57520
57521          if (i >= 0) k++;
57522          acc = acc.dblp(k);
57523          if (i < 0) break;
57524
57525          for (var j = 0; j < len; j++) {
57526            var z = tmp[j];
57527            var p;
57528            if (z === 0) continue;else if (z > 0) p = wnd[j][z - 1 >> 1];else if (z < 0) p = wnd[j][-z - 1 >> 1].neg();
57529            if (p.type === 'affine') acc = acc.mixedAdd(p);else acc = acc.add(p);
57530          }
57531        } // Zeroify references
57532
57533
57534        for (var i = 0; i < len; i++) {
57535          wnd[i] = null;
57536        }
57537
57538        if (jacobianResult) return acc;else return acc.toP();
57539      };
57540
57541      function BasePoint(curve, type) {
57542        this.curve = curve;
57543        this.type = type;
57544        this.precomputed = null;
57545      }
57546
57547      BaseCurve.BasePoint = BasePoint;
57548
57549      BasePoint.prototype.eq = function eq()
57550      /*other*/
57551      {
57552        throw new Error('Not implemented');
57553      };
57554
57555      BasePoint.prototype.validate = function validate() {
57556        return this.curve.validate(this);
57557      };
57558
57559      BaseCurve.prototype.decodePoint = function decodePoint(bytes, enc) {
57560        bytes = utils.toArray(bytes, enc);
57561        var len = this.p.byteLength(); // uncompressed, hybrid-odd, hybrid-even
57562
57563        if ((bytes[0] === 0x04 || bytes[0] === 0x06 || bytes[0] === 0x07) && bytes.length - 1 === 2 * len) {
57564          if (bytes[0] === 0x06) assert(bytes[bytes.length - 1] % 2 === 0);else if (bytes[0] === 0x07) assert(bytes[bytes.length - 1] % 2 === 1);
57565          var res = this.point(bytes.slice(1, 1 + len), bytes.slice(1 + len, 1 + 2 * len));
57566          return res;
57567        } else if ((bytes[0] === 0x02 || bytes[0] === 0x03) && bytes.length - 1 === len) {
57568          return this.pointFromX(bytes.slice(1, 1 + len), bytes[0] === 0x03);
57569        }
57570
57571        throw new Error('Unknown point format');
57572      };
57573
57574      BasePoint.prototype.encodeCompressed = function encodeCompressed(enc) {
57575        return this.encode(enc, true);
57576      };
57577
57578      BasePoint.prototype._encode = function _encode(compact) {
57579        var len = this.curve.p.byteLength();
57580        var x = this.getX().toArray('be', len);
57581        if (compact) return [this.getY().isEven() ? 0x02 : 0x03].concat(x);
57582        return [0x04].concat(x, this.getY().toArray('be', len));
57583      };
57584
57585      BasePoint.prototype.encode = function encode(enc, compact) {
57586        return utils.encode(this._encode(compact), enc);
57587      };
57588
57589      BasePoint.prototype.precompute = function precompute(power) {
57590        if (this.precomputed) return this;
57591        var precomputed = {
57592          doubles: null,
57593          naf: null,
57594          beta: null
57595        };
57596        precomputed.naf = this._getNAFPoints(8);
57597        precomputed.doubles = this._getDoubles(4, power);
57598        precomputed.beta = this._getBeta();
vendor: 6,858 bytes, lines 57599-57803
57599        this.precomputed = precomputed;
57600        return this;
57601      };
57602
57603      BasePoint.prototype._hasDoubles = function _hasDoubles(k) {
57604        if (!this.precomputed) return false;
57605        var doubles = this.precomputed.doubles;
57606        if (!doubles) return false;
57607        return doubles.points.length >= Math.ceil((k.bitLength() + 1) / doubles.step);
57608      };
57609
57610      BasePoint.prototype._getDoubles = function _getDoubles(step, power) {
57611        if (this.precomputed && this.precomputed.doubles) return this.precomputed.doubles;
57612        var doubles = [this];
57613        var acc = this;
57614
57615        for (var i = 0; i < power; i += step) {
57616          for (var j = 0; j < step; j++) {
57617            acc = acc.dbl();
57618          }
57619
57620          doubles.push(acc);
57621        }
57622
57623        return {
57624          step: step,
57625          points: doubles
57626        };
57627      };
57628
57629      BasePoint.prototype._getNAFPoints = function _getNAFPoints(wnd) {
57630        if (this.precomputed && this.precomputed.naf) return this.precomputed.naf;
57631        var res = [this];
57632        var max = (1 << wnd) - 1;
57633        var dbl = max === 1 ? null : this.dbl();
57634
57635        for (var i = 1; i < max; i++) {
57636          res[i] = res[i - 1].add(dbl);
57637        }
57638
57639        return {
57640          wnd: wnd,
57641          points: res
57642        };
57643      };
57644
57645      BasePoint.prototype._getBeta = function _getBeta() {
57646        return null;
57647      };
57648
57649      BasePoint.prototype.dblp = function dblp(k) {
57650        var r = this;
57651
57652        for (var i = 0; i < k; i++) {
57653          r = r.dbl();
57654        }
57655
57656        return r;
57657      };
57658    }, {
57659      "../utils": 341,
57660      "bn.js": 342
57661    }],
57662    329: [function (require, module, exports) {
57663      'use strict';
57664
57665      var utils = require('../utils');
57666
57667      var BN = require('bn.js');
57668
57669      var inherits = require('inherits');
57670
57671      var Base = require('./base');
57672
57673      var assert = utils.assert;
57674
57675      function EdwardsCurve(conf) {
57676        // NOTE: Important as we are creating point in Base.call()
57677        this.twisted = (conf.a | 0) !== 1;
57678        this.mOneA = this.twisted && (conf.a | 0) === -1;
57679        this.extended = this.mOneA;
57680        Base.call(this, 'edwards', conf);
57681        this.a = new BN(conf.a, 16).umod(this.red.m);
57682        this.a = this.a.toRed(this.red);
57683        this.c = new BN(conf.c, 16).toRed(this.red);
57684        this.c2 = this.c.redSqr();
57685        this.d = new BN(conf.d, 16).toRed(this.red);
57686        this.dd = this.d.redAdd(this.d);
57687        assert(!this.twisted || this.c.fromRed().cmpn(1) === 0);
57688        this.oneC = (conf.c | 0) === 1;
57689      }
57690
57691      inherits(EdwardsCurve, Base);
57692      module.exports = EdwardsCurve;
57693
57694      EdwardsCurve.prototype._mulA = function _mulA(num) {
57695        if (this.mOneA) return num.redNeg();else return this.a.redMul(num);
57696      };
57697
57698      EdwardsCurve.prototype._mulC = function _mulC(num) {
57699        if (this.oneC) return num;else return this.c.redMul(num);
57700      }; // Just for compatibility with Short curve
57701
57702
57703      EdwardsCurve.prototype.jpoint = function jpoint(x, y, z, t) {
57704        return this.point(x, y, z, t);
57705      };
57706
57707      EdwardsCurve.prototype.pointFromX = function pointFromX(x, odd) {
57708        x = new BN(x, 16);
57709        if (!x.red) x = x.toRed(this.red);
57710        var x2 = x.redSqr();
57711        var rhs = this.c2.redSub(this.a.redMul(x2));
57712        var lhs = this.one.redSub(this.c2.redMul(this.d).redMul(x2));
57713        var y2 = rhs.redMul(lhs.redInvm());
57714        var y = y2.redSqrt();
57715        if (y.redSqr().redSub(y2).cmp(this.zero) !== 0) throw new Error('invalid point');
57716        var isOdd = y.fromRed().isOdd();
57717        if (odd && !isOdd || !odd && isOdd) y = y.redNeg();
57718        return this.point(x, y);
57719      };
57720
57721      EdwardsCurve.prototype.pointFromY = function pointFromY(y, odd) {
57722        y = new BN(y, 16);
57723        if (!y.red) y = y.toRed(this.red); // x^2 = (y^2 - c^2) / (c^2 d y^2 - a)
57724
57725        var y2 = y.redSqr();
57726        var lhs = y2.redSub(this.c2);
57727        var rhs = y2.redMul(this.d).redMul(this.c2).redSub(this.a);
57728        var x2 = lhs.redMul(rhs.redInvm());
57729
57730        if (x2.cmp(this.zero) === 0) {
57731          if (odd) throw new Error('invalid point');else return this.point(this.zero, y);
57732        }
57733
57734        var x = x2.redSqrt();
57735        if (x.redSqr().redSub(x2).cmp(this.zero) !== 0) throw new Error('invalid point');
57736        if (x.fromRed().isOdd() !== odd) x = x.redNeg();
57737        return this.point(x, y);
57738      };
57739
57740      EdwardsCurve.prototype.validate = function validate(point) {
57741        if (point.isInfinity()) return true; // Curve: A * X^2 + Y^2 = C^2 * (1 + D * X^2 * Y^2)
57742
57743        point.normalize();
57744        var x2 = point.x.redSqr();
57745        var y2 = point.y.redSqr();
57746        var lhs = x2.redMul(this.a).redAdd(y2);
57747        var rhs = this.c2.redMul(this.one.redAdd(this.d.redMul(x2).redMul(y2)));
57748        return lhs.cmp(rhs) === 0;
57749      };
57750
57751      function Point(curve, x, y, z, t) {
57752        Base.BasePoint.call(this, curve, 'projective');
57753
57754        if (x === null && y === null && z === null) {
57755          this.x = this.curve.zero;
57756          this.y = this.curve.one;
57757          this.z = this.curve.one;
57758          this.t = this.curve.zero;
57759          this.zOne = true;
57760        } else {
57761          this.x = new BN(x, 16);
57762          this.y = new BN(y, 16);
57763          this.z = z ? new BN(z, 16) : this.curve.one;
57764          this.t = t && new BN(t, 16);
57765          if (!this.x.red) this.x = this.x.toRed(this.curve.red);
57766          if (!this.y.red) this.y = this.y.toRed(this.curve.red);
57767          if (!this.z.red) this.z = this.z.toRed(this.curve.red);
57768          if (this.t && !this.t.red) this.t = this.t.toRed(this.curve.red);
57769          this.zOne = this.z === this.curve.one; // Use extended coordinates
57770
57771          if (this.curve.extended && !this.t) {
57772            this.t = this.x.redMul(this.y);
57773            if (!this.zOne) this.t = this.t.redMul(this.z.redInvm());
57774          }
57775        }
57776      }
57777
57778      inherits(Point, Base.BasePoint);
57779
57780      EdwardsCurve.prototype.pointFromJSON = function pointFromJSON(obj) {
57781        return Point.fromJSON(this, obj);
57782      };
57783
57784      EdwardsCurve.prototype.point = function point(x, y, z, t) {
57785        return new Point(this, x, y, z, t);
57786      };
57787
57788      Point.fromJSON = function fromJSON(curve, obj) {
57789        return new Point(curve, obj[0], obj[1], obj[2]);
57790      };
57791
57792      Point.prototype.inspect = function inspect() {
57793        if (this.isInfinity()) return '<EC Point Infinity>';
57794        return '<EC Point x: ' + this.x.fromRed().toString(16, 2) + ' y: ' + this.y.fromRed().toString(16, 2) + ' z: ' + this.z.fromRed().toString(16, 2) + '>';
57795      };
57796
57797      Point.prototype.isInfinity = function isInfinity() {
57798        // XXX This code assumes that zero is always zero in red
57799        return this.x.cmpn(0) === 0 && (this.y.cmp(this.z) === 0 || this.zOne && this.y.cmp(this.curve.c) === 0);
57800      };
57801
57802      Point.prototype._extDbl = function _extDbl() {
57803        
57803// hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html
57804        //     #doubling-dbl-2008-hwcd
57805        // 4M + 4S
57806        // A = X1^2
57807        var a = this.x.redSqr(); // B = Y1^2
57808
57809        var b = this.y.redSqr(); // C = 2 * Z1^2
57810
57811        var c = this.z.redSqr();
57812        c = c.redIAdd(c); // D = a * A
57813
57814        var d = this.curve._mulA(a); // E = (X1 + Y1)^2 - A - B
57815
57816
57817        var e = this.x.redAdd(this.y).redSqr().redISub(a).redISub(b); // G = D + B
57818
57819        var g = d.redAdd(b); // F = G - C
57820
57821        var f = g.redSub(c); // H = D - B
57822
57823        var h = d.redSub(b); // X3 = E * F
57824
57825        var nx = e.redMul(f); // Y3 = G * H
57826
57827        var ny = g.redMul(h); // T3 = E * H
57828
57829        var nt = e.redMul(h); // Z3 = F * G
57830
57831        var nz = f.redMul(g);
57832        return this.curve.point(nx, ny, nz, nt);
57833      };
57834
57835      Point.prototype._projDbl = function _projDbl() {
57836        
vendor: 1,915 bytes, lines 57836-57903
57836// hyperelliptic.org/EFD/g1p/auto-twisted-projective.html
57837        //     #doubling-dbl-2008-bbjlp
57838        //     #doubling-dbl-2007-bl
57839        // and others
57840        // Generally 3M + 4S or 2M + 4S
57841        // B = (X1 + Y1)^2
57842        var b = this.x.redAdd(this.y).redSqr(); // C = X1^2
57843
57844        var c = this.x.redSqr(); // D = Y1^2
57845
57846        var d = this.y.redSqr();
57847        var nx;
57848        var ny;
57849        var nz;
57850
57851        if (this.curve.twisted) {
57852          // E = a * C
57853          var e = this.curve._mulA(c); // F = E + D
57854
57855
57856          var f = e.redAdd(d);
57857
57858          if (this.zOne) {
57859            // X3 = (B - C - D) * (F - 2)
57860            nx = b.redSub(c).redSub(d).redMul(f.redSub(this.curve.two)); // Y3 = F * (E - D)
57861
57862            ny = f.redMul(e.redSub(d)); // Z3 = F^2 - 2 * F
57863
57864            nz = f.redSqr().redSub(f).redSub(f);
57865          } else {
57866            // H = Z1^2
57867            var h = this.z.redSqr(); // J = F - 2 * H
57868
57869            var j = f.redSub(h).redISub(h); // X3 = (B-C-D)*J
57870
57871            nx = b.redSub(c).redISub(d).redMul(j); // Y3 = F * (E - D)
57872
57873            ny = f.redMul(e.redSub(d)); // Z3 = F * J
57874
57875            nz = f.redMul(j);
57876          }
57877        } else {
57878          // E = C + D
57879          var e = c.redAdd(d); // H = (c * Z1)^2
57880
57881          var h = this.curve._mulC(this.z).redSqr(); // J = E - 2 * H
57882
57883
57884          var j = e.redSub(h).redSub(h); // X3 = c * (B - E) * J
57885
57886          nx = this.curve._mulC(b.redISub(e)).redMul(j); // Y3 = c * E * (C - D)
57887
57888          ny = this.curve._mulC(e).redMul(c.redISub(d)); // Z3 = E * J
57889
57890          nz = e.redMul(j);
57891        }
57892
57893        return this.curve.point(nx, ny, nz);
57894      };
57895
57896      Point.prototype.dbl = function dbl() {
57897        if (this.isInfinity()) return this; // Double in extended coordinates
57898
57899        if (this.curve.extended) return this._extDbl();else return this._projDbl();
57900      };
57901
57902      Point.prototype._extAdd = function _extAdd(p) {
57903        
57903// hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html
57904        //     #addition-add-2008-hwcd-3
57905        // 8M
57906        // A = (Y1 - X1) * (Y2 - X2)
57907        var a = this.y.redSub(this.x).redMul(p.y.redSub(p.x)); // B = (Y1 + X1) * (Y2 + X2)
57908
57909        var b = this.y.redAdd(this.x).redMul(p.y.redAdd(p.x)); // C = T1 * k * T2
57910
57911        var c = this.t.redMul(this.curve.dd).redMul(p.t); // D = Z1 * 2 * Z2
57912
57913        var d = this.z.redMul(p.z.redAdd(p.z)); // E = B - A
57914
57915        var e = b.redSub(a); // F = D - C
57916
57917        var f = d.redSub(c); // G = D + C
57918
57919        var g = d.redAdd(c); // H = B + A
57920
57921        var h = b.redAdd(a); // X3 = E * F
57922
57923        var nx = e.redMul(f); // Y3 = G * H
57924
57925        var ny = g.redMul(h); // T3 = E * H
57926
57927        var nt = e.redMul(h); // Z3 = F * G
57928
57929        var nz = f.redMul(g);
57930        return this.curve.point(nx, ny, nz, nt);
57931      };
57932
57933      Point.prototype._projAdd = function _projAdd(p) {
57934        
vendor: 16,943 bytes, lines 57934-58512
57934// hyperelliptic.org/EFD/g1p/auto-twisted-projective.html
57935        //     #addition-add-2008-bbjlp
57936        //     #addition-add-2007-bl
57937        // 10M + 1S
57938        // A = Z1 * Z2
57939        var a = this.z.redMul(p.z); // B = A^2
57940
57941        var b = a.redSqr(); // C = X1 * X2
57942
57943        var c = this.x.redMul(p.x); // D = Y1 * Y2
57944
57945        var d = this.y.redMul(p.y); // E = d * C * D
57946
57947        var e = this.curve.d.redMul(c).redMul(d); // F = B - E
57948
57949        var f = b.redSub(e); // G = B + E
57950
57951        var g = b.redAdd(e); // X3 = A * F * ((X1 + Y1) * (X2 + Y2) - C - D)
57952
57953        var tmp = this.x.redAdd(this.y).redMul(p.x.redAdd(p.y)).redISub(c).redISub(d);
57954        var nx = a.redMul(f).redMul(tmp);
57955        var ny;
57956        var nz;
57957
57958        if (this.curve.twisted) {
57959          // Y3 = A * G * (D - a * C)
57960          ny = a.redMul(g).redMul(d.redSub(this.curve._mulA(c))); // Z3 = F * G
57961
57962          nz = f.redMul(g);
57963        } else {
57964          // Y3 = A * G * (D - C)
57965          ny = a.redMul(g).redMul(d.redSub(c)); // Z3 = c * F * G
57966
57967          nz = this.curve._mulC(f).redMul(g);
57968        }
57969
57970        return this.curve.point(nx, ny, nz);
57971      };
57972
57973      Point.prototype.add = function add(p) {
57974        if (this.isInfinity()) return p;
57975        if (p.isInfinity()) return this;
57976        if (this.curve.extended) return this._extAdd(p);else return this._projAdd(p);
57977      };
57978
57979      Point.prototype.mul = function mul(k) {
57980        if (this._hasDoubles(k)) return this.curve._fixedNafMul(this, k);else return this.curve._wnafMul(this, k);
57981      };
57982
57983      Point.prototype.mulAdd = function mulAdd(k1, p, k2) {
57984        return this.curve._wnafMulAdd(1, [this, p], [k1, k2], 2, false);
57985      };
57986
57987      Point.prototype.jmulAdd = function jmulAdd(k1, p, k2) {
57988        return this.curve._wnafMulAdd(1, [this, p], [k1, k2], 2, true);
57989      };
57990
57991      Point.prototype.normalize = function normalize() {
57992        if (this.zOne) return this; // Normalize coordinates
57993
57994        var zi = this.z.redInvm();
57995        this.x = this.x.redMul(zi);
57996        this.y = this.y.redMul(zi);
57997        if (this.t) this.t = this.t.redMul(zi);
57998        this.z = this.curve.one;
57999        this.zOne = true;
58000        return this;
58001      };
58002
58003      Point.prototype.neg = function neg() {
58004        return this.curve.point(this.x.redNeg(), this.y, this.z, this.t && this.t.redNeg());
58005      };
58006
58007      Point.prototype.getX = function getX() {
58008        this.normalize();
58009        return this.x.fromRed();
58010      };
58011
58012      Point.prototype.getY = function getY() {
58013        this.normalize();
58014        return this.y.fromRed();
58015      };
58016
58017      Point.prototype.eq = function eq(other) {
58018        return this === other || this.getX().cmp(other.getX()) === 0 && this.getY().cmp(other.getY()) === 0;
58019      };
58020
58021      Point.prototype.eqXToP = function eqXToP(x) {
58022        var rx = x.toRed(this.curve.red).redMul(this.z);
58023        if (this.x.cmp(rx) === 0) return true;
58024        var xc = x.clone();
58025        var t = this.curve.redN.redMul(this.z);
58026
58027        for (;;) {
58028          xc.iadd(this.curve.n);
58029          if (xc.cmp(this.curve.p) >= 0) return false;
58030          rx.redIAdd(t);
58031          if (this.x.cmp(rx) === 0) return true;
58032        }
58033      }; // Compatibility with BaseCurve
58034
58035
58036      Point.prototype.toP = Point.prototype.normalize;
58037      Point.prototype.mixedAdd = Point.prototype.add;
58038    }, {
58039      "../utils": 341,
58040      "./base": 328,
58041      "bn.js": 342,
58042      "inherits": 364
58043    }],
58044    330: [function (require, module, exports) {
58045      'use strict';
58046
58047      var curve = exports;
58048      curve.base = require('./base');
58049      curve.short = require('./short');
58050      curve.mont = require('./mont');
58051      curve.edwards = require('./edwards');
58052    }, {
58053      "./base": 328,
58054      "./edwards": 329,
58055      "./mont": 331,
58056      "./short": 332
58057    }],
58058    331: [function (require, module, exports) {
58059      'use strict';
58060
58061      var BN = require('bn.js');
58062
58063      var inherits = require('inherits');
58064
58065      var Base = require('./base');
58066
58067      var utils = require('../utils');
58068
58069      function MontCurve(conf) {
58070        Base.call(this, 'mont', conf);
58071        this.a = new BN(conf.a, 16).toRed(this.red);
58072        this.b = new BN(conf.b, 16).toRed(this.red);
58073        this.i4 = new BN(4).toRed(this.red).redInvm();
58074        this.two = new BN(2).toRed(this.red);
58075        this.a24 = this.i4.redMul(this.a.redAdd(this.two));
58076      }
58077
58078      inherits(MontCurve, Base);
58079      module.exports = MontCurve;
58080
58081      MontCurve.prototype.validate = function validate(point) {
58082        var x = point.normalize().x;
58083        var x2 = x.redSqr();
58084        var rhs = x2.redMul(x).redAdd(x2.redMul(this.a)).redAdd(x);
58085        var y = rhs.redSqrt();
58086        return y.redSqr().cmp(rhs) === 0;
58087      };
58088
58089      function Point(curve, x, z) {
58090        Base.BasePoint.call(this, curve, 'projective');
58091
58092        if (x === null && z === null) {
58093          this.x = this.curve.one;
58094          this.z = this.curve.zero;
58095        } else {
58096          this.x = new BN(x, 16);
58097          this.z = new BN(z, 16);
58098          if (!this.x.red) this.x = this.x.toRed(this.curve.red);
58099          if (!this.z.red) this.z = this.z.toRed(this.curve.red);
58100        }
58101      }
58102
58103      inherits(Point, Base.BasePoint);
58104
58105      MontCurve.prototype.decodePoint = function decodePoint(bytes, enc) {
58106        return this.point(utils.toArray(bytes, enc), 1);
58107      };
58108
58109      MontCurve.prototype.point = function point(x, z) {
58110        return new Point(this, x, z);
58111      };
58112
58113      MontCurve.prototype.pointFromJSON = function pointFromJSON(obj) {
58114        return Point.fromJSON(this, obj);
58115      };
58116
58117      Point.prototype.precompute = function precompute() {// No-op
58118      };
58119
58120      Point.prototype._encode = function _encode() {
58121        return this.getX().toArray('be', this.curve.p.byteLength());
58122      };
58123
58124      Point.fromJSON = function fromJSON(curve, obj) {
58125        return new Point(curve, obj[0], obj[1] || curve.one);
58126      };
58127
58128      Point.prototype.inspect = function inspect() {
58129        if (this.isInfinity()) return '<EC Point Infinity>';
58130        return '<EC Point x: ' + this.x.fromRed().toString(16, 2) + ' z: ' + this.z.fromRed().toString(16, 2) + '>';
58131      };
58132
58133      Point.prototype.isInfinity = function isInfinity() {
58134        // XXX This code assumes that zero is always zero in red
58135        return this.z.cmpn(0) === 0;
58136      };
58137
58138      Point.prototype.dbl = function dbl() {
58139        // http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#doubling-dbl-1987-m-3
58140        // 2M + 2S + 4A
58141        // A = X1 + Z1
58142        var a = this.x.redAdd(this.z); // AA = A^2
58143
58144        var aa = a.redSqr(); // B = X1 - Z1
58145
58146        var b = this.x.redSub(this.z); // BB = B^2
58147
58148        var bb = b.redSqr(); // C = AA - BB
58149
58150        var c = aa.redSub(bb); // X3 = AA * BB
58151
58152        var nx = aa.redMul(bb); // Z3 = C * (BB + A24 * C)
58153
58154        var nz = c.redMul(bb.redAdd(this.curve.a24.redMul(c)));
58155        return this.curve.point(nx, nz);
58156      };
58157
58158      Point.prototype.add = function add() {
58159        throw new Error('Not supported on Montgomery curve');
58160      };
58161
58162      Point.prototype.diffAdd = function diffAdd(p, diff) {
58163        // http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#diffadd-dadd-1987-m-3
58164        // 4M + 2S + 6A
58165        // A = X2 + Z2
58166        var a = this.x.redAdd(this.z); // B = X2 - Z2
58167
58168        var b = this.x.redSub(this.z); // C = X3 + Z3
58169
58170        var c = p.x.redAdd(p.z); // D = X3 - Z3
58171
58172        var d = p.x.redSub(p.z); // DA = D * A
58173
58174        var da = d.redMul(a); // CB = C * B
58175
58176        var cb = c.redMul(b); // X5 = Z1 * (DA + CB)^2
58177
58178        var nx = diff.z.redMul(da.redAdd(cb).redSqr()); // Z5 = X1 * (DA - CB)^2
58179
58180        var nz = diff.x.redMul(da.redISub(cb).redSqr());
58181        return this.curve.point(nx, nz);
58182      };
58183
58184      Point.prototype.mul = function mul(k) {
58185        var t = k.clone();
58186        var a = this; // (N / 2) * Q + Q
58187
58188        var b = this.curve.point(null, null); // (N / 2) * Q
58189
58190        var c = this; // Q
58191
58192        for (var bits = []; t.cmpn(0) !== 0; t.iushrn(1)) {
58193          bits.push(t.andln(1));
58194        }
58195
58196        for (var i = bits.length - 1; i >= 0; i--) {
58197          if (bits[i] === 0) {
58198            // N * Q + Q = ((N / 2) * Q + Q)) + (N / 2) * Q
58199            a = a.diffAdd(b, c); // N * Q = 2 * ((N / 2) * Q + Q))
58200
58201            b = b.dbl();
58202          } else {
58203            // N * Q = ((N / 2) * Q + Q) + ((N / 2) * Q)
58204            b = a.diffAdd(b, c); // N * Q + Q = 2 * ((N / 2) * Q + Q)
58205
58206            a = a.dbl();
58207          }
58208        }
58209
58210        return b;
58211      };
58212
58213      Point.prototype.mulAdd = function mulAdd() {
58214        throw new Error('Not supported on Montgomery curve');
58215      };
58216
58217      Point.prototype.jumlAdd = function jumlAdd() {
58218        throw new Error('Not supported on Montgomery curve');
58219      };
58220
58221      Point.prototype.eq = function eq(other) {
58222        return this.getX().cmp(other.getX()) === 0;
58223      };
58224
58225      Point.prototype.normalize = function normalize() {
58226        this.x = this.x.redMul(this.z.redInvm());
58227        this.z = this.curve.one;
58228        return this;
58229      };
58230
58231      Point.prototype.getX = function getX() {
58232        // Normalize coordinates
58233        this.normalize();
58234        return this.x.fromRed();
58235      };
58236    }, {
58237      "../utils": 341,
58238      "./base": 328,
58239      "bn.js": 342,
58240      "inherits": 364
58241    }],
58242    332: [function (require, module, exports) {
58243      'use strict';
58244
58245      var utils = require('../utils');
58246
58247      var BN = require('bn.js');
58248
58249      var inherits = require('inherits');
58250
58251      var Base = require('./base');
58252
58253      var assert = utils.assert;
58254
58255      function ShortCurve(conf) {
58256        Base.call(this, 'short', conf);
58257        this.a = new BN(conf.a, 16).toRed(this.red);
58258        this.b = new BN(conf.b, 16).toRed(this.red);
58259        this.tinv = this.two.redInvm();
58260        this.zeroA = this.a.fromRed().cmpn(0) === 0;
58261        this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0; // If the curve is endomorphic, precalculate beta and lambda
58262
58263        this.endo = this._getEndomorphism(conf);
58264        this._endoWnafT1 = new Array(4);
58265        this._endoWnafT2 = new Array(4);
58266      }
58267
58268      inherits(ShortCurve, Base);
58269      module.exports = ShortCurve;
58270
58271      ShortCurve.prototype._getEndomorphism = function _getEndomorphism(conf) {
58272        // No efficient endomorphism
58273        if (!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1) return; // Compute beta and lambda, that lambda * P = (beta * Px; Py)
58274
58275        var beta;
58276        var lambda;
58277
58278        if (conf.beta) {
58279          beta = new BN(conf.beta, 16).toRed(this.red);
58280        } else {
58281          var betas = this._getEndoRoots(this.p); // Choose the smallest beta
58282
58283
58284          beta = betas[0].cmp(betas[1]) < 0 ? betas[0] : betas[1];
58285          beta = beta.toRed(this.red);
58286        }
58287
58288        if (conf.lambda) {
58289          lambda = new BN(conf.lambda, 16);
58290        } else {
58291          // Choose the lambda that is matching selected beta
58292          var lambdas = this._getEndoRoots(this.n);
58293
58294          if (this.g.mul(lambdas[0]).x.cmp(this.g.x.redMul(beta)) === 0) {
58295            lambda = lambdas[0];
58296          } else {
58297            lambda = lambdas[1];
58298            assert(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta)) === 0);
58299          }
58300        } // Get basis vectors, used for balanced length-two representation
58301
58302
58303        var basis;
58304
58305        if (conf.basis) {
58306          basis = conf.basis.map(function (vec) {
58307            return {
58308              a: new BN(vec.a, 16),
58309              b: new BN(vec.b, 16)
58310            };
58311          });
58312        } else {
58313          basis = this._getEndoBasis(lambda);
58314        }
58315
58316        return {
58317          beta: beta,
58318          lambda: lambda,
58319          basis: basis
58320        };
58321      };
58322
58323      ShortCurve.prototype._getEndoRoots = function _getEndoRoots(num) {
58324        // Find roots of for x^2 + x + 1 in F
58325        // Root = (-1 +- Sqrt(-3)) / 2
58326        //
58327        var red = num === this.p ? this.red : BN.mont(num);
58328        var tinv = new BN(2).toRed(red).redInvm();
58329        var ntinv = tinv.redNeg();
58330        var s = new BN(3).toRed(red).redNeg().redSqrt().redMul(tinv);
58331        var l1 = ntinv.redAdd(s).fromRed();
58332        var l2 = ntinv.redSub(s).fromRed();
58333        return [l1, l2];
58334      };
58335
58336      ShortCurve.prototype._getEndoBasis = function _getEndoBasis(lambda) {
58337        // aprxSqrt >= sqrt(this.n)
58338        var aprxSqrt = this.n.ushrn(Math.floor(this.n.bitLength() / 2)); // 3.74
58339        // Run EGCD, until r(L + 1) < aprxSqrt
58340
58341        var u = lambda;
58342        var v = this.n.clone();
58343        var x1 = new BN(1);
58344        var y1 = new BN(0);
58345        var x2 = new BN(0);
58346        var y2 = new BN(1); // NOTE: all vectors are roots of: a + b * lambda = 0 (mod n)
58347
58348        var a0;
58349        var b0; // First vector
58350
58351        var a1;
58352        var b1; // Second vector
58353
58354        var a2;
58355        var b2;
58356        var prevR;
58357        var i = 0;
58358        var r;
58359        var x;
58360
58361        while (u.cmpn(0) !== 0) {
58362          var q = v.div(u);
58363          r = v.sub(q.mul(u));
58364          x = x2.sub(q.mul(x1));
58365          var y = y2.sub(q.mul(y1));
58366
58367          if (!a1 && r.cmp(aprxSqrt) < 0) {
58368            a0 = prevR.neg();
58369            b0 = x1;
58370            a1 = r.neg();
58371            b1 = x;
58372          } else if (a1 && ++i === 2) {
58373            break;
58374          }
58375
58376          prevR = r;
58377          v = u;
58378          u = r;
58379          x2 = x1;
58380          x1 = x;
58381          y2 = y1;
58382          y1 = y;
58383        }
58384
58385        a2 = r.neg();
58386        b2 = x;
58387        var len1 = a1.sqr().add(b1.sqr());
58388        var len2 = a2.sqr().add(b2.sqr());
58389
58390        if (len2.cmp(len1) >= 0) {
58391          a2 = a0;
58392          b2 = b0;
58393        } // Normalize signs
58394
58395
58396        if (a1.negative) {
58397          a1 = a1.neg();
58398          b1 = b1.neg();
58399        }
58400
58401        if (a2.negative) {
58402          a2 = a2.neg();
58403          b2 = b2.neg();
58404        }
58405
58406        return [{
58407          a: a1,
58408          b: b1
58409        }, {
58410          a: a2,
58411          b: b2
58412        }];
58413      };
58414
58415      ShortCurve.prototype._endoSplit = function _endoSplit(k) {
58416        var basis = this.endo.basis;
58417        var v1 = basis[0];
58418        var v2 = basis[1];
58419        var c1 = v2.b.mul(k).divRound(this.n);
58420        var c2 = v1.b.neg().mul(k).divRound(this.n);
58421        var p1 = c1.mul(v1.a);
58422        var p2 = c2.mul(v2.a);
58423        var q1 = c1.mul(v1.b);
58424        var q2 = c2.mul(v2.b); // Calculate answer
58425
58426        var k1 = k.sub(p1).sub(p2);
58427        var k2 = q1.add(q2).neg();
58428        return {
58429          k1: k1,
58430          k2: k2
58431        };
58432      };
58433
58434      ShortCurve.prototype.pointFromX = function pointFromX(x, odd) {
58435        x = new BN(x, 16);
58436        if (!x.red) x = x.toRed(this.red);
58437        var y2 = x.redSqr().redMul(x).redIAdd(x.redMul(this.a)).redIAdd(this.b);
58438        var y = y2.redSqrt();
58439        if (y.redSqr().redSub(y2).cmp(this.zero) !== 0) throw new Error('invalid point'); // XXX Is there any way to tell if the number is odd without converting it
58440        // to non-red form?
58441
58442        var isOdd = y.fromRed().isOdd();
58443        if (odd && !isOdd || !odd && isOdd) y = y.redNeg();
58444        return this.point(x, y);
58445      };
58446
58447      ShortCurve.prototype.validate = function validate(point) {
58448        if (point.inf) return true;
58449        var x = point.x;
58450        var y = point.y;
58451        var ax = this.a.redMul(x);
58452        var rhs = x.redSqr().redMul(x).redIAdd(ax).redIAdd(this.b);
58453        return y.redSqr().redISub(rhs).cmpn(0) === 0;
58454      };
58455
58456      ShortCurve.prototype._endoWnafMulAdd = function _endoWnafMulAdd(points, coeffs, jacobianResult) {
58457        var npoints = this._endoWnafT1;
58458        var ncoeffs = this._endoWnafT2;
58459
58460        for (var i = 0; i < points.length; i++) {
58461          var split = this._endoSplit(coeffs[i]);
58462
58463          var p = points[i];
58464
58465          var beta = p._getBeta();
58466
58467          if (split.k1.negative) {
58468            split.k1.ineg();
58469            p = p.neg(true);
58470          }
58471
58472          if (split.k2.negative) {
58473            split.k2.ineg();
58474            beta = beta.neg(true);
58475          }
58476
58477          npoints[i * 2] = p;
58478          npoints[i * 2 + 1] = beta;
58479          ncoeffs[i * 2] = split.k1;
58480          ncoeffs[i * 2 + 1] = split.k2;
58481        }
58482
58483        var res = this._wnafMulAdd(1, npoints, ncoeffs, i * 2, jacobianResult); // Clean-up references to points and coefficients
58484
58485
58486        for (var j = 0; j < i * 2; j++) {
58487          npoints[j] = null;
58488          ncoeffs[j] = null;
58489        }
58490
58491        return res;
58492      };
58493
58494      function Point(curve, x, y, isRed) {
58495        Base.BasePoint.call(this, curve, 'affine');
58496
58497        if (x === null && y === null) {
58498          this.x = null;
58499          this.y = null;
58500          this.inf = true;
58501        } else {
58502          this.x = new BN(x, 16);
58503          this.y = new BN(y, 16); // Force redgomery representation when loading from JSON
58504
58505          if (isRed) {
58506            this.x.forceRed(this.curve.red);
58507            this.y.forceRed(this.curve.red);
58508          }
58509
58510          if (!this.x.red) this.x = this.x.toRed(this.curve.red);
58511          if (!this.y.red) this.y = this.y.toRed(this.curve.red);
58512          this.inf = false;
vendor: 5,271 bytes, lines 58513-58667
58513        }
58514      }
58515
58516      inherits(Point, Base.BasePoint);
58517
58518      ShortCurve.prototype.point = function point(x, y, isRed) {
58519        return new Point(this, x, y, isRed);
58520      };
58521
58522      ShortCurve.prototype.pointFromJSON = function pointFromJSON(obj, red) {
58523        return Point.fromJSON(this, obj, red);
58524      };
58525
58526      Point.prototype._getBeta = function _getBeta() {
58527        if (!this.curve.endo) return;
58528        var pre = this.precomputed;
58529        if (pre && pre.beta) return pre.beta;
58530        var beta = this.curve.point(this.x.redMul(this.curve.endo.beta), this.y);
58531
58532        if (pre) {
58533          var curve = this.curve;
58534
58535          var endoMul = function endoMul(p) {
58536            return curve.point(p.x.redMul(curve.endo.beta), p.y);
58537          };
58538
58539          pre.beta = beta;
58540          beta.precomputed = {
58541            beta: null,
58542            naf: pre.naf && {
58543              wnd: pre.naf.wnd,
58544              points: pre.naf.points.map(endoMul)
58545            },
58546            doubles: pre.doubles && {
58547              step: pre.doubles.step,
58548              points: pre.doubles.points.map(endoMul)
58549            }
58550          };
58551        }
58552
58553        return beta;
58554      };
58555
58556      Point.prototype.toJSON = function toJSON() {
58557        if (!this.precomputed) return [this.x, this.y];
58558        return [this.x, this.y, this.precomputed && {
58559          doubles: this.precomputed.doubles && {
58560            step: this.precomputed.doubles.step,
58561            points: this.precomputed.doubles.points.slice(1)
58562          },
58563          naf: this.precomputed.naf && {
58564            wnd: this.precomputed.naf.wnd,
58565            points: this.precomputed.naf.points.slice(1)
58566          }
58567        }];
58568      };
58569
58570      Point.fromJSON = function fromJSON(curve, obj, red) {
58571        if (typeof obj === 'string') obj = JSON.parse(obj);
58572        var res = curve.point(obj[0], obj[1], red);
58573        if (!obj[2]) return res;
58574
58575        function obj2point(obj) {
58576          return curve.point(obj[0], obj[1], red);
58577        }
58578
58579        var pre = obj[2];
58580        res.precomputed = {
58581          beta: null,
58582          doubles: pre.doubles && {
58583            step: pre.doubles.step,
58584            points: [res].concat(pre.doubles.points.map(obj2point))
58585          },
58586          naf: pre.naf && {
58587            wnd: pre.naf.wnd,
58588            points: [res].concat(pre.naf.points.map(obj2point))
58589          }
58590        };
58591        return res;
58592      };
58593
58594      Point.prototype.inspect = function inspect() {
58595        if (this.isInfinity()) return '<EC Point Infinity>';
58596        return '<EC Point x: ' + this.x.fromRed().toString(16, 2) + ' y: ' + this.y.fromRed().toString(16, 2) + '>';
58597      };
58598
58599      Point.prototype.isInfinity = function isInfinity() {
58600        return this.inf;
58601      };
58602
58603      Point.prototype.add = function add(p) {
58604        // O + P = P
58605        if (this.inf) return p; // P + O = P
58606
58607        if (p.inf) return this; // P + P = 2P
58608
58609        if (this.eq(p)) return this.dbl(); // P + (-P) = O
58610
58611        if (this.neg().eq(p)) return this.curve.point(null, null); // P + Q = O
58612
58613        if (this.x.cmp(p.x) === 0) return this.curve.point(null, null);
58614        var c = this.y.redSub(p.y);
58615        if (c.cmpn(0) !== 0) c = c.redMul(this.x.redSub(p.x).redInvm());
58616        var nx = c.redSqr().redISub(this.x).redISub(p.x);
58617        var ny = c.redMul(this.x.redSub(nx)).redISub(this.y);
58618        return this.curve.point(nx, ny);
58619      };
58620
58621      Point.prototype.dbl = function dbl() {
58622        if (this.inf) return this; // 2P = O
58623
58624        var ys1 = this.y.redAdd(this.y);
58625        if (ys1.cmpn(0) === 0) return this.curve.point(null, null);
58626        var a = this.curve.a;
58627        var x2 = this.x.redSqr();
58628        var dyinv = ys1.redInvm();
58629        var c = x2.redAdd(x2).redIAdd(x2).redIAdd(a).redMul(dyinv);
58630        var nx = c.redSqr().redISub(this.x.redAdd(this.x));
58631        var ny = c.redMul(this.x.redSub(nx)).redISub(this.y);
58632        return this.curve.point(nx, ny);
58633      };
58634
58635      Point.prototype.getX = function getX() {
58636        return this.x.fromRed();
58637      };
58638
58639      Point.prototype.getY = function getY() {
58640        return this.y.fromRed();
58641      };
58642
58643      Point.prototype.mul = function mul(k) {
58644        k = new BN(k, 16);
58645        if (this.isInfinity()) return this;else if (this._hasDoubles(k)) return this.curve._fixedNafMul(this, k);else if (this.curve.endo) return this.curve._endoWnafMulAdd([this], [k]);else return this.curve._wnafMul(this, k);
58646      };
58647
58648      Point.prototype.mulAdd = function mulAdd(k1, p2, k2) {
58649        var points = [this, p2];
58650        var coeffs = [k1, k2];
58651        if (this.curve.endo) return this.curve._endoWnafMulAdd(points, coeffs);else return this.curve._wnafMulAdd(1, points, coeffs, 2);
58652      };
58653
58654      Point.prototype.jmulAdd = function jmulAdd(k1, p2, k2) {
58655        var points = [this, p2];
58656        var coeffs = [k1, k2];
58657        if (this.curve.endo) return this.curve._endoWnafMulAdd(points, coeffs, true);else return this.curve._wnafMulAdd(1, points, coeffs, 2, true);
58658      };
58659
58660      Point.prototype.eq = function eq(p) {
58661        return this === p || this.inf === p.inf && (this.inf || this.x.cmp(p.x) === 0 && this.y.cmp(p.y) === 0);
58662      };
58663
58664      Point.prototype.neg = function neg(_precompute) {
58665        if (this.inf) return this;
58666        var res = this.curve.point(this.x, this.y.redNeg());
58667
vendor: 5,473 bytes, lines 58668-58846
58668        if (_precompute && this.precomputed) {
58669          var pre = this.precomputed;
58670
58671          var negate = function negate(p) {
58672            return p.neg();
58673          };
58674
58675          res.precomputed = {
58676            naf: pre.naf && {
58677              wnd: pre.naf.wnd,
58678              points: pre.naf.points.map(negate)
58679            },
58680            doubles: pre.doubles && {
58681              step: pre.doubles.step,
58682              points: pre.doubles.points.map(negate)
58683            }
58684          };
58685        }
58686
58687        return res;
58688      };
58689
58690      Point.prototype.toJ = function toJ() {
58691        if (this.inf) return this.curve.jpoint(null, null, null);
58692        var res = this.curve.jpoint(this.x, this.y, this.curve.one);
58693        return res;
58694      };
58695
58696      function JPoint(curve, x, y, z) {
58697        Base.BasePoint.call(this, curve, 'jacobian');
58698
58699        if (x === null && y === null && z === null) {
58700          this.x = this.curve.one;
58701          this.y = this.curve.one;
58702          this.z = new BN(0);
58703        } else {
58704          this.x = new BN(x, 16);
58705          this.y = new BN(y, 16);
58706          this.z = new BN(z, 16);
58707        }
58708
58709        if (!this.x.red) this.x = this.x.toRed(this.curve.red);
58710        if (!this.y.red) this.y = this.y.toRed(this.curve.red);
58711        if (!this.z.red) this.z = this.z.toRed(this.curve.red);
58712        this.zOne = this.z === this.curve.one;
58713      }
58714
58715      inherits(JPoint, Base.BasePoint);
58716
58717      ShortCurve.prototype.jpoint = function jpoint(x, y, z) {
58718        return new JPoint(this, x, y, z);
58719      };
58720
58721      JPoint.prototype.toP = function toP() {
58722        if (this.isInfinity()) return this.curve.point(null, null);
58723        var zinv = this.z.redInvm();
58724        var zinv2 = zinv.redSqr();
58725        var ax = this.x.redMul(zinv2);
58726        var ay = this.y.redMul(zinv2).redMul(zinv);
58727        return this.curve.point(ax, ay);
58728      };
58729
58730      JPoint.prototype.neg = function neg() {
58731        return this.curve.jpoint(this.x, this.y.redNeg(), this.z);
58732      };
58733
58734      JPoint.prototype.add = function add(p) {
58735        // O + P = P
58736        if (this.isInfinity()) return p; // P + O = P
58737
58738        if (p.isInfinity()) return this; // 12M + 4S + 7A
58739
58740        var pz2 = p.z.redSqr();
58741        var z2 = this.z.redSqr();
58742        var u1 = this.x.redMul(pz2);
58743        var u2 = p.x.redMul(z2);
58744        var s1 = this.y.redMul(pz2.redMul(p.z));
58745        var s2 = p.y.redMul(z2.redMul(this.z));
58746        var h = u1.redSub(u2);
58747        var r = s1.redSub(s2);
58748
58749        if (h.cmpn(0) === 0) {
58750          if (r.cmpn(0) !== 0) return this.curve.jpoint(null, null, null);else return this.dbl();
58751        }
58752
58753        var h2 = h.redSqr();
58754        var h3 = h2.redMul(h);
58755        var v = u1.redMul(h2);
58756        var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v);
58757        var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3));
58758        var nz = this.z.redMul(p.z).redMul(h);
58759        return this.curve.jpoint(nx, ny, nz);
58760      };
58761
58762      JPoint.prototype.mixedAdd = function mixedAdd(p) {
58763        // O + P = P
58764        if (this.isInfinity()) return p.toJ(); // P + O = P
58765
58766        if (p.isInfinity()) return this; // 8M + 3S + 7A
58767
58768        var z2 = this.z.redSqr();
58769        var u1 = this.x;
58770        var u2 = p.x.redMul(z2);
58771        var s1 = this.y;
58772        var s2 = p.y.redMul(z2).redMul(this.z);
58773        var h = u1.redSub(u2);
58774        var r = s1.redSub(s2);
58775
58776        if (h.cmpn(0) === 0) {
58777          if (r.cmpn(0) !== 0) return this.curve.jpoint(null, null, null);else return this.dbl();
58778        }
58779
58780        var h2 = h.redSqr();
58781        var h3 = h2.redMul(h);
58782        var v = u1.redMul(h2);
58783        var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v);
58784        var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3));
58785        var nz = this.z.redMul(h);
58786        return this.curve.jpoint(nx, ny, nz);
58787      };
58788
58789      JPoint.prototype.dblp = function dblp(pow) {
58790        if (pow === 0) return this;
58791        if (this.isInfinity()) return this;
58792        if (!pow) return this.dbl();
58793
58794        if (this.curve.zeroA || this.curve.threeA) {
58795          var r = this;
58796
58797          for (var i = 0; i < pow; i++) {
58798            r = r.dbl();
58799          }
58800
58801          return r;
58802        } // 1M + 2S + 1A + N * (4S + 5M + 8A)
58803        // N = 1 => 6M + 6S + 9A
58804
58805
58806        var a = this.curve.a;
58807        var tinv = this.curve.tinv;
58808        var jx = this.x;
58809        var jy = this.y;
58810        var jz = this.z;
58811        var jz4 = jz.redSqr().redSqr(); // Reuse results
58812
58813        var jyd = jy.redAdd(jy);
58814
58815        for (var i = 0; i < pow; i++) {
58816          var jx2 = jx.redSqr();
58817          var jyd2 = jyd.redSqr();
58818          var jyd4 = jyd2.redSqr();
58819          var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4));
58820          var t1 = jx.redMul(jyd2);
58821          var nx = c.redSqr().redISub(t1.redAdd(t1));
58822          var t2 = t1.redISub(nx);
58823          var dny = c.redMul(t2);
58824          dny = dny.redIAdd(dny).redISub(jyd4);
58825          var nz = jyd.redMul(jz);
58826          if (i + 1 < pow) jz4 = jz4.redMul(jyd4);
58827          jx = nx;
58828          jz = nz;
58829          jyd = dny;
58830        }
58831
58832        return this.curve.jpoint(jx, jyd.redMul(tinv), jz);
58833      };
58834
58835      JPoint.prototype.dbl = function dbl() {
58836        if (this.isInfinity()) return this;
58837        if (this.curve.zeroA) return this._zeroDbl();else if (this.curve.threeA) return this._threeDbl();else return this._dbl();
58838      };
58839
58840      JPoint.prototype._zeroDbl = function _zeroDbl() {
58841        var nx;
58842        var ny;
58843        var nz; // Z = 1
58844
58845        if (this.zOne) {
58846          
58846// hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html
58847          //     #doubling-mdbl-2007-bl
58848          // 1M + 5S + 14A
58849          // XX = X1^2
58850          var xx = this.x.redSqr(); // YY = Y1^2
58851
58852          var yy = this.y.redSqr(); // YYYY = YY^2
58853
58854          var yyyy = yy.redSqr(); // S = 2 * ((X1 + YY)^2 - XX - YYYY)
58855
58856          var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);
58857          s = s.redIAdd(s); // M = 3 * XX + a; a = 0
58858
58859          var m = xx.redAdd(xx).redIAdd(xx); // T = M ^ 2 - 2*S
58860
58861          var t = m.redSqr().redISub(s).redISub(s); // 8 * YYYY
58862
58863          var yyyy8 = yyyy.redIAdd(yyyy);
58864          yyyy8 = yyyy8.redIAdd(yyyy8);
58865          yyyy8 = yyyy8.redIAdd(yyyy8); // X3 = T
58866
58867          nx = t; // Y3 = M * (S - T) - 8 * YYYY
58868
58869          ny = m.redMul(s.redISub(t)).redISub(yyyy8); // Z3 = 2*Y1
58870
58871          nz = this.y.redAdd(this.y);
58872        } else {
58873          
58873// hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html
58874          //     #doubling-dbl-2009-l
58875          // 2M + 5S + 13A
58876          // A = X1^2
58877          var a = this.x.redSqr(); // B = Y1^2
58878
58879          var b = this.y.redSqr(); // C = B^2
58880
58881          var c = b.redSqr(); // D = 2 * ((X1 + B)^2 - A - C)
58882
58883          var d = this.x.redAdd(b).redSqr().redISub(a).redISub(c);
58884          d = d.redIAdd(d); // E = 3 * A
58885
58886          var e = a.redAdd(a).redIAdd(a); // F = E^2
58887
58888          var f = e.redSqr(); // 8 * C
58889
58890          var c8 = c.redIAdd(c);
58891          c8 = c8.redIAdd(c8);
58892          c8 = c8.redIAdd(c8); // X3 = F - 2 * D
58893
58894          nx = f.redISub(d).redISub(d); // Y3 = E * (D - X3) - 8 * C
58895
58896          ny = e.redMul(d.redISub(nx)).redISub(c8); // Z3 = 2 * Y1 * Z1
58897
58898          nz = this.y.redMul(this.z);
58899          nz = nz.redIAdd(nz);
58900        }
58901
58902        return this.curve.jpoint(nx, ny, nz);
58903      };
58904
58905      JPoint.prototype._threeDbl = function _threeDbl() {
58906        var nx;
58907        var ny;
58908        var nz; // Z = 1
58909
58910        if (this.zOne) {
58911          
vendor: 5,455 bytes, lines 58911-59064
58911// hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html
58912          //     #doubling-mdbl-2007-bl
58913          // 1M + 5S + 15A
58914          // XX = X1^2
58915          var xx = this.x.redSqr(); // YY = Y1^2
58916
58917          var yy = this.y.redSqr(); // YYYY = YY^2
58918
58919          var yyyy = yy.redSqr(); // S = 2 * ((X1 + YY)^2 - XX - YYYY)
58920
58921          var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);
58922          s = s.redIAdd(s); // M = 3 * XX + a
58923
58924          var m = xx.redAdd(xx).redIAdd(xx).redIAdd(this.curve.a); // T = M^2 - 2 * S
58925
58926          var t = m.redSqr().redISub(s).redISub(s); // X3 = T
58927
58928          nx = t; // Y3 = M * (S - T) - 8 * YYYY
58929
58930          var yyyy8 = yyyy.redIAdd(yyyy);
58931          yyyy8 = yyyy8.redIAdd(yyyy8);
58932          yyyy8 = yyyy8.redIAdd(yyyy8);
58933          ny = m.redMul(s.redISub(t)).redISub(yyyy8); // Z3 = 2 * Y1
58934
58935          nz = this.y.redAdd(this.y);
58936        } else {
58937          // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2001-b
58938          // 3M + 5S
58939          // delta = Z1^2
58940          var delta = this.z.redSqr(); // gamma = Y1^2
58941
58942          var gamma = this.y.redSqr(); // beta = X1 * gamma
58943
58944          var beta = this.x.redMul(gamma); // alpha = 3 * (X1 - delta) * (X1 + delta)
58945
58946          var alpha = this.x.redSub(delta).redMul(this.x.redAdd(delta));
58947          alpha = alpha.redAdd(alpha).redIAdd(alpha); // X3 = alpha^2 - 8 * beta
58948
58949          var beta4 = beta.redIAdd(beta);
58950          beta4 = beta4.redIAdd(beta4);
58951          var beta8 = beta4.redAdd(beta4);
58952          nx = alpha.redSqr().redISub(beta8); // Z3 = (Y1 + Z1)^2 - gamma - delta
58953
58954          nz = this.y.redAdd(this.z).redSqr().redISub(gamma).redISub(delta); // Y3 = alpha * (4 * beta - X3) - 8 * gamma^2
58955
58956          var ggamma8 = gamma.redSqr();
58957          ggamma8 = ggamma8.redIAdd(ggamma8);
58958          ggamma8 = ggamma8.redIAdd(ggamma8);
58959          ggamma8 = ggamma8.redIAdd(ggamma8);
58960          ny = alpha.redMul(beta4.redISub(nx)).redISub(ggamma8);
58961        }
58962
58963        return this.curve.jpoint(nx, ny, nz);
58964      };
58965
58966      JPoint.prototype._dbl = function _dbl() {
58967        var a = this.curve.a; // 4M + 6S + 10A
58968
58969        var jx = this.x;
58970        var jy = this.y;
58971        var jz = this.z;
58972        var jz4 = jz.redSqr().redSqr();
58973        var jx2 = jx.redSqr();
58974        var jy2 = jy.redSqr();
58975        var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4));
58976        var jxd4 = jx.redAdd(jx);
58977        jxd4 = jxd4.redIAdd(jxd4);
58978        var t1 = jxd4.redMul(jy2);
58979        var nx = c.redSqr().redISub(t1.redAdd(t1));
58980        var t2 = t1.redISub(nx);
58981        var jyd8 = jy2.redSqr();
58982        jyd8 = jyd8.redIAdd(jyd8);
58983        jyd8 = jyd8.redIAdd(jyd8);
58984        jyd8 = jyd8.redIAdd(jyd8);
58985        var ny = c.redMul(t2).redISub(jyd8);
58986        var nz = jy.redAdd(jy).redMul(jz);
58987        return this.curve.jpoint(nx, ny, nz);
58988      };
58989
58990      JPoint.prototype.trpl = function trpl() {
58991        if (!this.curve.zeroA) return this.dbl().add(this); // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#tripling-tpl-2007-bl
58992        // 5M + 10S + ...
58993        // XX = X1^2
58994
58995        var xx = this.x.redSqr(); // YY = Y1^2
58996
58997        var yy = this.y.redSqr(); // ZZ = Z1^2
58998
58999        var zz = this.z.redSqr(); // YYYY = YY^2
59000
59001        var yyyy = yy.redSqr(); // M = 3 * XX + a * ZZ2; a = 0
59002
59003        var m = xx.redAdd(xx).redIAdd(xx); // MM = M^2
59004
59005        var mm = m.redSqr(); // E = 6 * ((X1 + YY)^2 - XX - YYYY) - MM
59006
59007        var e = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);
59008        e = e.redIAdd(e);
59009        e = e.redAdd(e).redIAdd(e);
59010        e = e.redISub(mm); // EE = E^2
59011
59012        var ee = e.redSqr(); // T = 16*YYYY
59013
59014        var t = yyyy.redIAdd(yyyy);
59015        t = t.redIAdd(t);
59016        t = t.redIAdd(t);
59017        t = t.redIAdd(t); // U = (M + E)^2 - MM - EE - T
59018
59019        var u = m.redIAdd(e).redSqr().redISub(mm).redISub(ee).redISub(t); // X3 = 4 * (X1 * EE - 4 * YY * U)
59020
59021        var yyu4 = yy.redMul(u);
59022        yyu4 = yyu4.redIAdd(yyu4);
59023        yyu4 = yyu4.redIAdd(yyu4);
59024        var nx = this.x.redMul(ee).redISub(yyu4);
59025        nx = nx.redIAdd(nx);
59026        nx = nx.redIAdd(nx); // Y3 = 8 * Y1 * (U * (T - U) - E * EE)
59027
59028        var ny = this.y.redMul(u.redMul(t.redISub(u)).redISub(e.redMul(ee)));
59029        ny = ny.redIAdd(ny);
59030        ny = ny.redIAdd(ny);
59031        ny = ny.redIAdd(ny); // Z3 = (Z1 + E)^2 - ZZ - EE
59032
59033        var nz = this.z.redAdd(e).redSqr().redISub(zz).redISub(ee);
59034        return this.curve.jpoint(nx, ny, nz);
59035      };
59036
59037      JPoint.prototype.mul = function mul(k, kbase) {
59038        k = new BN(k, kbase);
59039        return this.curve._wnafMul(this, k);
59040      };
59041
59042      JPoint.prototype.eq = function eq(p) {
59043        if (p.type === 'affine') return this.eq(p.toJ());
59044        if (this === p) return true; // x1 * z2^2 == x2 * z1^2
59045
59046        var z2 = this.z.redSqr();
59047        var pz2 = p.z.redSqr();
59048        if (this.x.redMul(pz2).redISub(p.x.redMul(z2)).cmpn(0) !== 0) return false; // y1 * z2^3 == y2 * z1^3
59049
59050        var z3 = z2.redMul(this.z);
59051        var pz3 = pz2.redMul(p.z);
59052        return this.y.redMul(pz3).redISub(p.y.redMul(z3)).cmpn(0) === 0;
59053      };
59054
59055      JPoint.prototype.eqXToP = function eqXToP(x) {
59056        var zs = this.z.redSqr();
59057        var rx = x.toRed(this.curve.red).redMul(zs);
59058        if (this.x.cmp(rx) === 0) return true;
59059        var xc = x.clone();
59060        var t = this.curve.redN.redMul(zs);
59061
59062        for (;;) {
59063          xc.iadd(this.curve.n);
59064          if (xc.cmp(this.curve.p) >= 0) return false;
vendor: 2,203 bytes, lines 59065-59132
59065          rx.redIAdd(t);
59066          if (this.x.cmp(rx) === 0) return true;
59067        }
59068      };
59069
59070      JPoint.prototype.inspect = function inspect() {
59071        if (this.isInfinity()) return '<EC JPoint Infinity>';
59072        return '<EC JPoint x: ' + this.x.toString(16, 2) + ' y: ' + this.y.toString(16, 2) + ' z: ' + this.z.toString(16, 2) + '>';
59073      };
59074
59075      JPoint.prototype.isInfinity = function isInfinity() {
59076        // XXX This code assumes that zero is always zero in red
59077        return this.z.cmpn(0) === 0;
59078      };
59079    }, {
59080      "../utils": 341,
59081      "./base": 328,
59082      "bn.js": 342,
59083      "inherits": 364
59084    }],
59085    333: [function (require, module, exports) {
59086      'use strict';
59087
59088      var curves = exports;
59089
59090      var hash = require('hash.js');
59091
59092      var curve = require('./curve');
59093
59094      var utils = require('./utils');
59095
59096      var assert = utils.assert;
59097
59098      function PresetCurve(options) {
59099        if (options.type === 'short') this.curve = new curve.short(options);else if (options.type === 'edwards') this.curve = new curve.edwards(options);else this.curve = new curve.mont(options);
59100        this.g = this.curve.g;
59101        this.n = this.curve.n;
59102        this.hash = options.hash;
59103        assert(this.g.validate(), 'Invalid curve');
59104        assert(this.g.mul(this.n).isInfinity(), 'Invalid curve, G*N != O');
59105      }
59106
59107      curves.PresetCurve = PresetCurve;
59108
59109      function defineCurve(name, options) {
59110        Object.defineProperty(curves, name, {
59111          configurable: true,
59112          enumerable: true,
59113          get: function get() {
59114            var curve = new PresetCurve(options);
59115            Object.defineProperty(curves, name, {
59116              configurable: true,
59117              enumerable: true,
59118              value: curve
59119            });
59120            return curve;
59121          }
59122        });
59123      }
59124
59125      defineCurve('p192', {
59126        type: 'short',
59127        prime: 'p192',
59128        p: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff',
59129        a: 'ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc',
59130        b: '64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1',
59131        n: 'ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831',
59132        hash: hash.sha256,
59133        gRed: false,
59134        g: ['188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012', '07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811']
59135      });
59136      defineCurve('p224', {
59137        type: 'short',
59138        prime: 'p224',
59139        p: 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001',
59140        a: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe',
59141        b: 'b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4',
59142        n: 'ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d',
59143        hash: hash.sha256,
59144        gRed: false,
59145        g: ['b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21', 'bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34']
59146      });
59147      defineCurve('p256', {
59148        type: 'short',
59149        prime: null,
59150        p: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff',
59151        a: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc',
59152        b: '5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b',
59153        n: 'ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551',
59154        hash: hash.sha256,
59155        gRed: false,
59156        g: ['6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296', '4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5']
59157      });
59158      defineCurve('p384', {
59159        type: 'short',
59160        prime: null,
59161        p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' + 'fffffffe ffffffff 00000000 00000000 ffffffff',
59162        a: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' + 'fffffffe ffffffff 00000000 00000000 fffffffc',
59163        b: 'b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f ' + '5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef',
59164        n: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 ' + 'f4372ddf 581a0db2 48b0a77a ecec196a ccc52973',
59165        hash: hash.sha384,
59166        gRed: false,
59167        g: ['aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 ' + '5502f25d bf55296c 3a545e38 72760ab7', '3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 ' + '0a60b1ce 1d7e819d 7a431d7c 90ea0e5f']
59168      });
59169      defineCurve('p521', {
59170        type: 'short',
59171        prime: null,
59172        p: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' + 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' + 'ffffffff ffffffff ffffffff ffffffff ffffffff',
59173        a: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' + 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' + 'ffffffff ffffffff ffffffff ffffffff fffffffc',
59174        b: '00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b ' + '99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd ' + '3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00',
59175        n: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' + 'ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 ' + 'f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409',
59176        hash: hash.sha512,
59177        gRed: false,
59178        g: ['000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 ' + '053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 ' + 'a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66', '00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 ' + '579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 ' + '3fad0761 353c7086 a272c240 88be9476 9fd16650']
59179      });
59180      defineCurve('curve25519', {
59181        type: 'mont',
59182        prime: 'p25519',
59183        p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',
59184        a: '76d06',
59185        b: '1',
59186        n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',
59187        hash: hash.sha256,
59188        gRed: false,
59189        g: ['9']
59190      });
59191      defineCurve('ed25519', {
59192        type: 'edwards',
59193        prime: 'p25519',
59194        p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',
59195        a: '-1',
59196        c: '1',
59197        // -121665 * (121666^(-1)) (mod P)
59198        d: '52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3',
59199        n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',
59200        hash: hash.sha256,
59201        gRed: false,
59202        g: ['216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a', // 4/5
59203        '6666666666666666666666666666666666666666666666666666666666666658']
59204      });
59205      var pre;
59206
59207      try {
59208        pre = require('./precomputed/secp256k1');
59209      } catch (e) {
59210        pre = undefined;
59211      }
59212
59213      defineCurve('secp256k1', {
59214        type: 'short',
59215        prime: 'k256',
59216        p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f',
59217        a: '0',
59218        b: '7',
59219        n: 'ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141',
59220        h: '1',
59221        hash: hash.sha256,
59222        // Precomputed endomorphism
59223        beta: '7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee',
59224        lambda: '5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72',
59225        basis: [{
59226          a: '3086d221a7d46bcde86c90e49284eb15',
59227          b: '-e4437ed6010e88286f547fa90abfe4c3'
59228        }, {
59229          a: '114ca50f7a8e2f3f657c1108d9d44cfd8',
59230          b: '3086d221a7d46bcde86c90e49284eb15'
59231        }],
vendor: 18,905 bytes, lines 59232-59849
59232        gRed: false,
59233        g: ['79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798', '483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8', pre]
59234      });
59235    }, {
59236      "./curve": 330,
59237      "./precomputed/secp256k1": 340,
59238      "./utils": 341,
59239      "hash.js": 349
59240    }],
59241    334: [function (require, module, exports) {
59242      'use strict';
59243
59244      var BN = require('bn.js');
59245
59246      var HmacDRBG = require('hmac-drbg');
59247
59248      var utils = require('../utils');
59249
59250      var curves = require('../curves');
59251
59252      var rand = require('brorand');
59253
59254      var assert = utils.assert;
59255
59256      var KeyPair = require('./key');
59257
59258      var Signature = require('./signature');
59259
59260      function EC(options) {
59261        if (!(this instanceof EC)) return new EC(options); // Shortcut `elliptic.ec(curve-name)`
59262
59263        if (typeof options === 'string') {
59264          assert(curves.hasOwnProperty(options), 'Unknown curve ' + options);
59265          options = curves[options];
59266        } // Shortcut for `elliptic.ec(elliptic.curves.curveName)`
59267
59268
59269        if (options instanceof curves.PresetCurve) options = {
59270          curve: options
59271        };
59272        this.curve = options.curve.curve;
59273        this.n = this.curve.n;
59274        this.nh = this.n.ushrn(1);
59275        this.g = this.curve.g; // Point on curve
59276
59277        this.g = options.curve.g;
59278        this.g.precompute(options.curve.n.bitLength() + 1); // Hash for function for DRBG
59279
59280        this.hash = options.hash || options.curve.hash;
59281      }
59282
59283      module.exports = EC;
59284
59285      EC.prototype.keyPair = function keyPair(options) {
59286        return new KeyPair(this, options);
59287      };
59288
59289      EC.prototype.keyFromPrivate = function keyFromPrivate(priv, enc) {
59290        return KeyPair.fromPrivate(this, priv, enc);
59291      };
59292
59293      EC.prototype.keyFromPublic = function keyFromPublic(pub, enc) {
59294        return KeyPair.fromPublic(this, pub, enc);
59295      };
59296
59297      EC.prototype.genKeyPair = function genKeyPair(options) {
59298        if (!options) options = {}; // Instantiate Hmac_DRBG
59299
59300        var drbg = new HmacDRBG({
59301          hash: this.hash,
59302          pers: options.pers,
59303          persEnc: options.persEnc || 'utf8',
59304          entropy: options.entropy || rand(this.hash.hmacStrength),
59305          entropyEnc: options.entropy && options.entropyEnc || 'utf8',
59306          nonce: this.n.toArray()
59307        });
59308        var bytes = this.n.byteLength();
59309        var ns2 = this.n.sub(new BN(2));
59310
59311        do {
59312          var priv = new BN(drbg.generate(bytes));
59313          if (priv.cmp(ns2) > 0) continue;
59314          priv.iaddn(1);
59315          return this.keyFromPrivate(priv);
59316        } while (true);
59317      };
59318
59319      EC.prototype._truncateToN = function truncateToN(msg, truncOnly) {
59320        var delta = msg.byteLength() * 8 - this.n.bitLength();
59321        if (delta > 0) msg = msg.ushrn(delta);
59322        if (!truncOnly && msg.cmp(this.n) >= 0) return msg.sub(this.n);else return msg;
59323      };
59324
59325      EC.prototype.sign = function sign(msg, key, enc, options) {
59326        if (_typeof2(enc) === 'object') {
59327          options = enc;
59328          enc = null;
59329        }
59330
59331        if (!options) options = {};
59332        key = this.keyFromPrivate(key, enc);
59333        msg = this._truncateToN(new BN(msg, 16)); // Zero-extend key to provide enough entropy
59334
59335        var bytes = this.n.byteLength();
59336        var bkey = key.getPrivate().toArray('be', bytes); // Zero-extend nonce to have the same byte size as N
59337
59338        var nonce = msg.toArray('be', bytes); // Instantiate Hmac_DRBG
59339
59340        var drbg = new HmacDRBG({
59341          hash: this.hash,
59342          entropy: bkey,
59343          nonce: nonce,
59344          pers: options.pers,
59345          persEnc: options.persEnc || 'utf8'
59346        }); // Number of bytes to generate
59347
59348        var ns1 = this.n.sub(new BN(1));
59349
59350        for (var iter = 0; true; iter++) {
59351          var k = options.k ? options.k(iter) : new BN(drbg.generate(this.n.byteLength()));
59352          k = this._truncateToN(k, true);
59353          if (k.cmpn(1) <= 0 || k.cmp(ns1) >= 0) continue;
59354          var kp = this.g.mul(k);
59355          if (kp.isInfinity()) continue;
59356          var kpX = kp.getX();
59357          var r = kpX.umod(this.n);
59358          if (r.cmpn(0) === 0) continue;
59359          var s = k.invm(this.n).mul(r.mul(key.getPrivate()).iadd(msg));
59360          s = s.umod(this.n);
59361          if (s.cmpn(0) === 0) continue;
59362          var recoveryParam = (kp.getY().isOdd() ? 1 : 0) | (kpX.cmp(r) !== 0 ? 2 : 0); // Use complement of `s`, if it is > `n / 2`
59363
59364          if (options.canonical && s.cmp(this.nh) > 0) {
59365            s = this.n.sub(s);
59366            recoveryParam ^= 1;
59367          }
59368
59369          return new Signature({
59370            r: r,
59371            s: s,
59372            recoveryParam: recoveryParam
59373          });
59374        }
59375      };
59376
59377      EC.prototype.verify = function verify(msg, signature, key, enc) {
59378        msg = this._truncateToN(new BN(msg, 16));
59379        key = this.keyFromPublic(key, enc);
59380        signature = new Signature(signature, 'hex'); // Perform primitive values validation
59381
59382        var r = signature.r;
59383        var s = signature.s;
59384        if (r.cmpn(1) < 0 || r.cmp(this.n) >= 0) return false;
59385        if (s.cmpn(1) < 0 || s.cmp(this.n) >= 0) return false; // Validate signature
59386
59387        var sinv = s.invm(this.n);
59388        var u1 = sinv.mul(msg).umod(this.n);
59389        var u2 = sinv.mul(r).umod(this.n);
59390
59391        if (!this.curve._maxwellTrick) {
59392          var p = this.g.mulAdd(u1, key.getPublic(), u2);
59393          if (p.isInfinity()) return false;
59394          return p.getX().umod(this.n).cmp(r) === 0;
59395        } // NOTE: Greg Maxwell's trick, inspired by:
59396        // https://git.io/vad3K
59397
59398
59399        var p = this.g.jmulAdd(u1, key.getPublic(), u2);
59400        if (p.isInfinity()) return false; // Compare `p.x` of Jacobian point with `r`,
59401        // this will do `p.x == r * p.z^2` instead of multiplying `p.x` by the
59402        // inverse of `p.z^2`
59403
59404        return p.eqXToP(r);
59405      };
59406
59407      EC.prototype.recoverPubKey = function (msg, signature, j, enc) {
59408        assert((3 & j) === j, 'The recovery param is more than two bits');
59409        signature = new Signature(signature, enc);
59410        var n = this.n;
59411        var e = new BN(msg);
59412        var r = signature.r;
59413        var s = signature.s; // A set LSB signifies that the y-coordinate is odd
59414
59415        var isYOdd = j & 1;
59416        var isSecondKey = j >> 1;
59417        if (r.cmp(this.curve.p.umod(this.curve.n)) >= 0 && isSecondKey) throw new Error('Unable to find sencond key candinate'); // 1.1. Let x = r + jn.
59418
59419        if (isSecondKey) r = this.curve.pointFromX(r.add(this.curve.n), isYOdd);else r = this.curve.pointFromX(r, isYOdd);
59420        var rInv = signature.r.invm(n);
59421        var s1 = n.sub(e).mul(rInv).umod(n);
59422        var s2 = s.mul(rInv).umod(n); // 1.6.1 Compute Q = r^-1 (sR -  eG)
59423        //               Q = r^-1 (sR + -eG)
59424
59425        return this.g.mulAdd(s1, r, s2);
59426      };
59427
59428      EC.prototype.getKeyRecoveryParam = function (e, signature, Q, enc) {
59429        signature = new Signature(signature, enc);
59430        if (signature.recoveryParam !== null) return signature.recoveryParam;
59431
59432        for (var i = 0; i < 4; i++) {
59433          var Qprime;
59434
59435          try {
59436            Qprime = this.recoverPubKey(e, signature, i);
59437          } catch (e) {
59438            continue;
59439          }
59440
59441          if (Qprime.eq(Q)) return i;
59442        }
59443
59444        throw new Error('Unable to find valid recovery factor');
59445      };
59446    }, {
59447      "../curves": 333,
59448      "../utils": 341,
59449      "./key": 335,
59450      "./signature": 336,
59451      "bn.js": 342,
59452      "brorand": 182,
59453      "hmac-drbg": 361
59454    }],
59455    335: [function (require, module, exports) {
59456      'use strict';
59457
59458      var BN = require('bn.js');
59459
59460      var utils = require('../utils');
59461
59462      var assert = utils.assert;
59463
59464      function KeyPair(ec, options) {
59465        this.ec = ec;
59466        this.priv = null;
59467        this.pub = null; // KeyPair(ec, { priv: ..., pub: ... })
59468
59469        if (options.priv) this._importPrivate(options.priv, options.privEnc);
59470        if (options.pub) this._importPublic(options.pub, options.pubEnc);
59471      }
59472
59473      module.exports = KeyPair;
59474
59475      KeyPair.fromPublic = function fromPublic(ec, pub, enc) {
59476        if (pub instanceof KeyPair) return pub;
59477        return new KeyPair(ec, {
59478          pub: pub,
59479          pubEnc: enc
59480        });
59481      };
59482
59483      KeyPair.fromPrivate = function fromPrivate(ec, priv, enc) {
59484        if (priv instanceof KeyPair) return priv;
59485        return new KeyPair(ec, {
59486          priv: priv,
59487          privEnc: enc
59488        });
59489      };
59490
59491      KeyPair.prototype.validate = function validate() {
59492        var pub = this.getPublic();
59493        if (pub.isInfinity()) return {
59494          result: false,
59495          reason: 'Invalid public key'
59496        };
59497        if (!pub.validate()) return {
59498          result: false,
59499          reason: 'Public key is not a point'
59500        };
59501        if (!pub.mul(this.ec.curve.n).isInfinity()) return {
59502          result: false,
59503          reason: 'Public key * N != O'
59504        };
59505        return {
59506          result: true,
59507          reason: null
59508        };
59509      };
59510
59511      KeyPair.prototype.getPublic = function getPublic(compact, enc) {
59512        // compact is optional argument
59513        if (typeof compact === 'string') {
59514          enc = compact;
59515          compact = null;
59516        }
59517
59518        if (!this.pub) this.pub = this.ec.g.mul(this.priv);
59519        if (!enc) return this.pub;
59520        return this.pub.encode(enc, compact);
59521      };
59522
59523      KeyPair.prototype.getPrivate = function getPrivate(enc) {
59524        if (enc === 'hex') return this.priv.toString(16, 2);else return this.priv;
59525      };
59526
59527      KeyPair.prototype._importPrivate = function _importPrivate(key, enc) {
59528        this.priv = new BN(key, enc || 16); // Ensure that the priv won't be bigger than n, otherwise we may fail
59529        // in fixed multiplication method
59530
59531        this.priv = this.priv.umod(this.ec.curve.n);
59532      };
59533
59534      KeyPair.prototype._importPublic = function _importPublic(key, enc) {
59535        if (key.x || key.y) {
59536          // Montgomery points only have an `x` coordinate.
59537          // Weierstrass/Edwards points on the other hand have both `x` and
59538          // `y` coordinates.
59539          if (this.ec.curve.type === 'mont') {
59540            assert(key.x, 'Need x coordinate');
59541          } else if (this.ec.curve.type === 'short' || this.ec.curve.type === 'edwards') {
59542            assert(key.x && key.y, 'Need both x and y coordinate');
59543          }
59544
59545          this.pub = this.ec.curve.point(key.x, key.y);
59546          return;
59547        }
59548
59549        this.pub = this.ec.curve.decodePoint(key, enc);
59550      }; // ECDH
59551
59552
59553      KeyPair.prototype.derive = function derive(pub) {
59554        return pub.mul(this.priv).getX();
59555      }; // ECDSA
59556
59557
59558      KeyPair.prototype.sign = function sign(msg, enc, options) {
59559        return this.ec.sign(msg, this, enc, options);
59560      };
59561
59562      KeyPair.prototype.verify = function verify(msg, signature) {
59563        return this.ec.verify(msg, signature, this);
59564      };
59565
59566      KeyPair.prototype.inspect = function inspect() {
59567        return '<Key priv: ' + (this.priv && this.priv.toString(16, 2)) + ' pub: ' + (this.pub && this.pub.inspect()) + ' >';
59568      };
59569    }, {
59570      "../utils": 341,
59571      "bn.js": 342
59572    }],
59573    336: [function (require, module, exports) {
59574      'use strict';
59575
59576      var BN = require('bn.js');
59577
59578      var utils = require('../utils');
59579
59580      var assert = utils.assert;
59581
59582      function Signature(options, enc) {
59583        if (options instanceof Signature) return options;
59584        if (this._importDER(options, enc)) return;
59585        assert(options.r && options.s, 'Signature without r or s');
59586        this.r = new BN(options.r, 16);
59587        this.s = new BN(options.s, 16);
59588        if (options.recoveryParam === undefined) this.recoveryParam = null;else this.recoveryParam = options.recoveryParam;
59589      }
59590
59591      module.exports = Signature;
59592
59593      function Position() {
59594        this.place = 0;
59595      }
59596
59597      function getLength(buf, p) {
59598        var initial = buf[p.place++];
59599
59600        if (!(initial & 0x80)) {
59601          return initial;
59602        }
59603
59604        var octetLen = initial & 0xf;
59605        var val = 0;
59606
59607        for (var i = 0, off = p.place; i < octetLen; i++, off++) {
59608          val <<= 8;
59609          val |= buf[off];
59610        }
59611
59612        p.place = off;
59613        return val;
59614      }
59615
59616      function rmPadding(buf) {
59617        var i = 0;
59618        var len = buf.length - 1;
59619
59620        while (!buf[i] && !(buf[i + 1] & 0x80) && i < len) {
59621          i++;
59622        }
59623
59624        if (i === 0) {
59625          return buf;
59626        }
59627
59628        return buf.slice(i);
59629      }
59630
59631      Signature.prototype._importDER = function _importDER(data, enc) {
59632        data = utils.toArray(data, enc);
59633        var p = new Position();
59634
59635        if (data[p.place++] !== 0x30) {
59636          return false;
59637        }
59638
59639        var len = getLength(data, p);
59640
59641        if (len + p.place !== data.length) {
59642          return false;
59643        }
59644
59645        if (data[p.place++] !== 0x02) {
59646          return false;
59647        }
59648
59649        var rlen = getLength(data, p);
59650        var r = data.slice(p.place, rlen + p.place);
59651        p.place += rlen;
59652
59653        if (data[p.place++] !== 0x02) {
59654          return false;
59655        }
59656
59657        var slen = getLength(data, p);
59658
59659        if (data.length !== slen + p.place) {
59660          return false;
59661        }
59662
59663        var s = data.slice(p.place, slen + p.place);
59664
59665        if (r[0] === 0 && r[1] & 0x80) {
59666          r = r.slice(1);
59667        }
59668
59669        if (s[0] === 0 && s[1] & 0x80) {
59670          s = s.slice(1);
59671        }
59672
59673        this.r = new BN(r);
59674        this.s = new BN(s);
59675        this.recoveryParam = null;
59676        return true;
59677      };
59678
59679      function constructLength(arr, len) {
59680        if (len < 0x80) {
59681          arr.push(len);
59682          return;
59683        }
59684
59685        var octets = 1 + (Math.log(len) / Math.LN2 >>> 3);
59686        arr.push(octets | 0x80);
59687
59688        while (--octets) {
59689          arr.push(len >>> (octets << 3) & 0xff);
59690        }
59691
59692        arr.push(len);
59693      }
59694
59695      Signature.prototype.toDER = function toDER(enc) {
59696        var r = this.r.toArray();
59697        var s = this.s.toArray(); // Pad values
59698
59699        if (r[0] & 0x80) r = [0].concat(r); // Pad values
59700
59701        if (s[0] & 0x80) s = [0].concat(s);
59702        r = rmPadding(r);
59703        s = rmPadding(s);
59704
59705        while (!s[0] && !(s[1] & 0x80)) {
59706          s = s.slice(1);
59707        }
59708
59709        var arr = [0x02];
59710        constructLength(arr, r.length);
59711        arr = arr.concat(r);
59712        arr.push(0x02);
59713        constructLength(arr, s.length);
59714        var backHalf = arr.concat(s);
59715        var res = [0x30];
59716        constructLength(res, backHalf.length);
59717        res = res.concat(backHalf);
59718        return utils.encode(res, enc);
59719      };
59720    }, {
59721      "../utils": 341,
59722      "bn.js": 342
59723    }],
59724    337: [function (require, module, exports) {
59725      'use strict';
59726
59727      var hash = require('hash.js');
59728
59729      var curves = require('../curves');
59730
59731      var utils = require('../utils');
59732
59733      var assert = utils.assert;
59734      var parseBytes = utils.parseBytes;
59735
59736      var KeyPair = require('./key');
59737
59738      var Signature = require('./signature');
59739
59740      function EDDSA(curve) {
59741        assert(curve === 'ed25519', 'only tested with ed25519 so far');
59742        if (!(this instanceof EDDSA)) return new EDDSA(curve);
59743        var curve = curves[curve].curve;
59744        this.curve = curve;
59745        this.g = curve.g;
59746        this.g.precompute(curve.n.bitLength() + 1);
59747        this.pointClass = curve.point().constructor;
59748        this.encodingLength = Math.ceil(curve.n.bitLength() / 8);
59749        this.hash = hash.sha512;
59750      }
59751
59752      module.exports = EDDSA;
59753      /**
59754      * @param {Array|String} message - message bytes
59755      * @param {Array|String|KeyPair} secret - secret bytes or a keypair
59756      * @returns {Signature} - signature
59757      */
59758
59759      EDDSA.prototype.sign = function sign(message, secret) {
59760        message = parseBytes(message);
59761        var key = this.keyFromSecret(secret);
59762        var r = this.hashInt(key.messagePrefix(), message);
59763        var R = this.g.mul(r);
59764        var Rencoded = this.encodePoint(R);
59765        var s_ = this.hashInt(Rencoded, key.pubBytes(), message).mul(key.priv());
59766        var S = r.add(s_).umod(this.curve.n);
59767        return this.makeSignature({
59768          R: R,
59769          S: S,
59770          Rencoded: Rencoded
59771        });
59772      };
59773      /**
59774      * @param {Array} message - message bytes
59775      * @param {Array|String|Signature} sig - sig bytes
59776      * @param {Array|String|Point|KeyPair} pub - public key
59777      * @returns {Boolean} - true if public key matches sig of message
59778      */
59779
59780
59781      EDDSA.prototype.verify = function verify(message, sig, pub) {
59782        message = parseBytes(message);
59783        sig = this.makeSignature(sig);
59784        var key = this.keyFromPublic(pub);
59785        var h = this.hashInt(sig.Rencoded(), key.pubBytes(), message);
59786        var SG = this.g.mul(sig.S());
59787        var RplusAh = sig.R().add(key.pub().mul(h));
59788        return RplusAh.eq(SG);
59789      };
59790
59791      EDDSA.prototype.hashInt = function hashInt() {
59792        var hash = this.hash();
59793
59794        for (var i = 0; i < arguments.length; i++) {
59795          hash.update(arguments[i]);
59796        }
59797
59798        return utils.intFromLE(hash.digest()).umod(this.curve.n);
59799      };
59800
59801      EDDSA.prototype.keyFromPublic = function keyFromPublic(pub) {
59802        return KeyPair.fromPublic(this, pub);
59803      };
59804
59805      EDDSA.prototype.keyFromSecret = function keyFromSecret(secret) {
59806        return KeyPair.fromSecret(this, secret);
59807      };
59808
59809      EDDSA.prototype.makeSignature = function makeSignature(sig) {
59810        if (sig instanceof Signature) return sig;
59811        return new Signature(this, sig);
59812      };
59813      /**
59814      * * https://tools.ietf.org/html/draft-josefsson-eddsa-ed25519-03#section-5.2
59815      *
59816      * EDDSA defines methods for encoding and decoding points and integers. These are
59817      * helper convenience methods, that pass along to utility functions implied
59818      * parameters.
59819      *
59820      */
59821
59822
59823      EDDSA.prototype.encodePoint = function encodePoint(point) {
59824        var enc = point.getY().toArray('le', this.encodingLength);
59825        enc[this.encodingLength - 1] |= point.getX().isOdd() ? 0x80 : 0;
59826        return enc;
59827      };
59828
59829      EDDSA.prototype.decodePoint = function decodePoint(bytes) {
59830        bytes = utils.parseBytes(bytes);
59831        var lastIx = bytes.length - 1;
59832        var normed = bytes.slice(0, lastIx).concat(bytes[lastIx] & ~0x80);
59833        var xIsOdd = (bytes[lastIx] & 0x80) !== 0;
59834        var y = utils.intFromLE(normed);
59835        return this.curve.pointFromY(y, xIsOdd);
59836      };
59837
59838      EDDSA.prototype.encodeInt = function encodeInt(num) {
59839        return num.toArray('le', this.encodingLength);
59840      };
59841
59842      EDDSA.prototype.decodeInt = function decodeInt(bytes) {
59843        return utils.intFromLE(bytes);
59844      };
59845
59846      EDDSA.prototype.isPoint = function isPoint(val) {
59847        return val instanceof this.pointClass;
59848      };
59849    }, {
59850      "../curves": 333,
59851      "../utils": 341,
59852      "./key": 338,
59853      "./signature": 339,
59854      "hash.js": 349
59855    }],
59856    338: [function (require, module, exports) {
59857      'use strict';
59858
59859      var utils = require('../utils');
59860
59861      var assert = utils.assert;
59862      var parseBytes = utils.parseBytes;
59863      var cachedProperty = utils.cachedProperty;
59864      /**
59865      * @param {EDDSA} eddsa - instance
59866      * @param {Object} params - public/private key parameters
59867      *
59868      * @param {Array<Byte>} [params.secret] - secret seed bytes
59869      * @param {Point} [params.pub] - public key point (aka `A` in eddsa terms)
59870      * @param {Array<Byte>} [params.pub] - public key point encoded as bytes
59871      *
59872      */
59873
59874      function KeyPair(eddsa, params) {
59875        this.eddsa = eddsa;
59876        this._secret = parseBytes(params.secret);
59877        if (eddsa.isPoint(params.pub)) this._pub = params.pub;else this._pubBytes = parseBytes(params.pub);
59878      }
59879
59880      KeyPair.fromPublic = function fromPublic(eddsa, pub) {
59881        if (pub instanceof KeyPair) return pub;
59882        return new KeyPair(eddsa, {
59883          pub: pub
59884        });
59885      };
59886
59887      KeyPair.fromSecret = function fromSecret(eddsa, secret) {
59888        if (secret instanceof KeyPair) return secret;
vendor: 3,373 bytes, lines 59889-59989
59889        return new KeyPair(eddsa, {
59890          secret: secret
59891        });
59892      };
59893
59894      KeyPair.prototype.secret = function secret() {
59895        return this._secret;
59896      };
59897
59898      cachedProperty(KeyPair, 'pubBytes', function pubBytes() {
59899        return this.eddsa.encodePoint(this.pub());
59900      });
59901      cachedProperty(KeyPair, 'pub', function pub() {
59902        if (this._pubBytes) return this.eddsa.decodePoint(this._pubBytes);
59903        return this.eddsa.g.mul(this.priv());
59904      });
59905      cachedProperty(KeyPair, 'privBytes', function privBytes() {
59906        var eddsa = this.eddsa;
59907        var hash = this.hash();
59908        var lastIx = eddsa.encodingLength - 1;
59909        var a = hash.slice(0, eddsa.encodingLength);
59910        a[0] &= 248;
59911        a[lastIx] &= 127;
59912        a[lastIx] |= 64;
59913        return a;
59914      });
59915      cachedProperty(KeyPair, 'priv', function priv() {
59916        return this.eddsa.decodeInt(this.privBytes());
59917      });
59918      cachedProperty(KeyPair, 'hash', function hash() {
59919        return this.eddsa.hash().update(this.secret()).digest();
59920      });
59921      cachedProperty(KeyPair, 'messagePrefix', function messagePrefix() {
59922        return this.hash().slice(this.eddsa.encodingLength);
59923      });
59924
59925      KeyPair.prototype.sign = function sign(message) {
59926        assert(this._secret, 'KeyPair can only verify');
59927        return this.eddsa.sign(message, this);
59928      };
59929
59930      KeyPair.prototype.verify = function verify(message, sig) {
59931        return this.eddsa.verify(message, sig, this);
59932      };
59933
59934      KeyPair.prototype.getSecret = function getSecret(enc) {
59935        assert(this._secret, 'KeyPair is public only');
59936        return utils.encode(this.secret(), enc);
59937      };
59938
59939      KeyPair.prototype.getPublic = function getPublic(enc) {
59940        return utils.encode(this.pubBytes(), enc);
59941      };
59942
59943      module.exports = KeyPair;
59944    }, {
59945      "../utils": 341
59946    }],
59947    339: [function (require, module, exports) {
59948      'use strict';
59949
59950      var BN = require('bn.js');
59951
59952      var utils = require('../utils');
59953
59954      var assert = utils.assert;
59955      var cachedProperty = utils.cachedProperty;
59956      var parseBytes = utils.parseBytes;
59957      /**
59958      * @param {EDDSA} eddsa - eddsa instance
59959      * @param {Array<Bytes>|Object} sig -
59960      * @param {Array<Bytes>|Point} [sig.R] - R point as Point or bytes
59961      * @param {Array<Bytes>|bn} [sig.S] - S scalar as bn or bytes
59962      * @param {Array<Bytes>} [sig.Rencoded] - R point encoded
59963      * @param {Array<Bytes>} [sig.Sencoded] - S scalar encoded
59964      */
59965
59966      function Signature(eddsa, sig) {
59967        this.eddsa = eddsa;
59968        if (_typeof2(sig) !== 'object') sig = parseBytes(sig);
59969
59970        if (Array.isArray(sig)) {
59971          sig = {
59972            R: sig.slice(0, eddsa.encodingLength),
59973            S: sig.slice(eddsa.encodingLength)
59974          };
59975        }
59976
59977        assert(sig.R && sig.S, 'Signature without R or S');
59978        if (eddsa.isPoint(sig.R)) this._R = sig.R;
59979        if (sig.S instanceof BN) this._S = sig.S;
59980        this._Rencoded = Array.isArray(sig.R) ? sig.R : sig.Rencoded;
59981        this._Sencoded = Array.isArray(sig.S) ? sig.S : sig.Sencoded;
59982      }
59983
59984      cachedProperty(Signature, 'S', function S() {
59985        return this.eddsa.decodeInt(this.Sencoded());
59986      });
59987      cachedProperty(Signature, 'R', function R() {
59988        return this.eddsa.decodePoint(this.Rencoded());
59989      });
vendor: 711 bytes, lines 59990-60014
59990      cachedProperty(Signature, 'Rencoded', function Rencoded() {
59991        return this.eddsa.encodePoint(this.R());
59992      });
59993      cachedProperty(Signature, 'Sencoded', function Sencoded() {
59994        return this.eddsa.encodeInt(this.S());
59995      });
59996
59997      Signature.prototype.toBytes = function toBytes() {
59998        return this.Rencoded().concat(this.Sencoded());
59999      };
60000
60001      Signature.prototype.toHex = function toHex() {
60002        return utils.encode(this.toBytes(), 'hex').toUpperCase();
60003      };
60004
60005      module.exports = Signature;
60006    }, {
60007      "../utils": 341,
60008      "bn.js": 342
60009    }],
60010    340: [function (require, module, exports) {
60011      module.exports = {
60012        doubles: {
60013          step: 4,
60014      
vendor: 8,975 bytes, lines 60014-60015
60014    points: [['e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a', 'f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821'], ['8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508', '11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf'], ['175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739', 'd3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695'], ['363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640', '4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9'], ['8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c', '4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36'], ['723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda', '96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f'], ['eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa', '5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999'], ['100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0', 'cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09'], ['e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d', '9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d'], ['feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d', 'e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088'], ['da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1', '9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d'], ['53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0', '5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8'], ['8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047', '10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a'], ['385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862', '283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453'], ['6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7', '7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160'], ['3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd', '56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0'], ['85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83', '7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6'], ['948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a', '53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589'], ['6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8', 'bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17'], ['e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d', '4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda'], ['e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725', '7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd'], ['213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754', '4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2'], ['4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c', '17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6'], ['fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6', '6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f'], ['76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39', 'c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01'], ['c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891', '893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3'], ['d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b', 'febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f'], ['b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03', '2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7'], ['e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d', 'eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78'], ['a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070', '7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1'], ['90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4', 'e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150'], ['8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da', '662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82'], ['e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11', '1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc'], ['8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e', 'efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b'], ['e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41', '2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51'], ['b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef', '67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45'], ['d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8', 'db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120'], ['324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d', '648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84'], ['4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96', '35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d'], ['9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd', 'ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d'], ['6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5', '9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8'], ['a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266', '40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8'], ['7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71', '34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac'], ['928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac', 'c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f'], ['85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751', '1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962'], ['ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e', '493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907'], ['827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241', 'c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec'], ['eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3', 'be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d'], ['e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f', '4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414'], ['1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19', 'aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd'], ['146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be', 'b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0'], ['fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9', '6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811'], ['da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2', '8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1'], ['a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13', '7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c'], ['174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c', 'ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73'], ['959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba', '2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd'], ['d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151', 'e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405'], ['64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073', 'd99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589'], ['8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458', '38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e'], ['13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b', '69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27'], ['bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366', 'd3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1'], ['8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa', '40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482'], ['8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0', '620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945'], ['dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787', '7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573'], ['f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e', 'ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82']]
60015  
60015      },
60016        naf: {
60017          wnd: 7,
60018      
vendor: 17,517 bytes, lines 60018-60019
60018    points: [['f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9', '388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672'], ['2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4', 'd8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6'], ['5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc', '6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da'], ['acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe', 'cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37'], ['774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb', 'd984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b'], ['f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8', 'ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81'], ['d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e', '581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58'], ['defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34', '4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77'], ['2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c', '85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a'], ['352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5', '321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c'], ['2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f', '2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67'], ['9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714', '73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402'], ['daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729', 'a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55'], ['c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db', '2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482'], ['6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4', 'e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82'], ['1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5', 'b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396'], ['605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479', '2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49'], ['62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d', '80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf'], ['80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f', '1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a'], ['7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb', 'd0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7'], ['d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9', 'eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933'], ['49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963', '758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a'], ['77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74', '958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6'], ['f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530', 'e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37'], ['463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b', '5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e'], ['f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247', 'cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6'], ['caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1', 'cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476'], ['2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120', '4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40'], ['7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435', '91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61'], ['754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18', '673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683'], ['e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8', '59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5'], ['186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb', '3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b'], ['df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f', '55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417'], ['5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143', 'efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868'], ['290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba', 'e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a'], ['af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45', 'f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6'], ['766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a', '744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996'], ['59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e', 'c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e'], ['f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8', 'e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d'], ['7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c', '30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2'], ['948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519', 'e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e'], ['7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab', '100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437'], ['3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca', 'ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311'], ['d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf', '8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4'], ['1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610', '68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575'], ['733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4', 'f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d'], ['15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c', 'd56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d'], ['a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940', 'edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629'], ['e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980', 'a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06'], ['311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3', '66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374'], ['34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf', '9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee'], ['f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63', '4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1'], ['d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448', 'fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b'], ['32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf', '5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661'], ['7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5', '8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6'], ['ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6', '8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e'], ['16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5', '5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d'], ['eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99', 'f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc'], ['78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51', 'f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4'], ['494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5', '42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c'], ['a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5', '204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b'], ['c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997', '4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913'], ['841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881', '73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154'], ['5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5', '39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865'], ['36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66', 'd2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc'], ['336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726', 'ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224'], ['8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede', '6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e'], ['1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94', '60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6'], ['85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31', '3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511'], ['29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51', 'b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b'], ['a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252', 'ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2'], ['4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5', 'cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c'], ['d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b', '6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3'], ['ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4', '322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d'], ['af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f', '6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700'], ['e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889', '2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4'], ['591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246', 'b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196'], ['11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984', '998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4'], ['3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a', 'b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257'], ['cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030', 'bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13'], ['c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197', '6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096'], ['c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593', 'c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38'], ['a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef', '21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f'], ['347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38', '60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448'], ['da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a', '49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a'], ['c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111', '5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4'], ['4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502', '7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437'], ['3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea', 'be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7'], ['cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26', '8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d'], ['b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986', '39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a'], ['d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e', '62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54'], ['48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4', '25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77'], ['dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda', 'ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517'], ['6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859', 'cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10'], ['e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f', 'f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125'], ['eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c', '6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e'], ['13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942', 'fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1'], ['ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a', '1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2'], ['b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80', '5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423'], ['ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d', '438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8'], ['8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1', 'cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758'], ['52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63', 'c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375'], ['e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352', '6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d'], ['7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193', 'ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec'], ['5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00', '9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0'], ['32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58', 'ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c'], ['e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7', 'd3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4'], ['8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8', 'c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f'], ['4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e', '67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649'], ['3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d', 'cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826'], ['674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b', '299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5'], ['d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f', 'f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87'], ['30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6', '462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b'], ['be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297', '62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc'], ['93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a', '7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c'], ['b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c', 'ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f'], ['d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52', '4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a'], ['d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb', 'bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46'], ['463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065', 'bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f'], ['7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917', '603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03'], ['74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9', 'cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08'], ['30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3', '553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8'], ['9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57', '712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373'], ['176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66', 'ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3'], ['75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8', '9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8'], ['809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721', '9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1'], ['1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180', '4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9']]
60019  
vendor: 3,024 bytes, lines 60019-60138
60019      }
60020      };
60021    }, {}],
60022    341: [function (require, module, exports) {
60023      'use strict';
60024
60025      var utils = exports;
60026
60027      var BN = require('bn.js');
60028
60029      var minAssert = require('minimalistic-assert');
60030
60031      var minUtils = require('minimalistic-crypto-utils');
60032
60033      utils.assert = minAssert;
60034      utils.toArray = minUtils.toArray;
60035      utils.zero2 = minUtils.zero2;
60036      utils.toHex = minUtils.toHex;
60037      utils.encode = minUtils.encode; // Represent num in a w-NAF form
60038
60039      function getNAF(num, w, bits) {
60040        var naf = new Array(Math.max(num.bitLength(), bits) + 1);
60041        naf.fill(0);
60042        var ws = 1 << w + 1;
60043        var k = num.clone();
60044
60045        for (var i = 0; i < naf.length; i++) {
60046          var z;
60047          var mod = k.andln(ws - 1);
60048
60049          if (k.isOdd()) {
60050            if (mod > (ws >> 1) - 1) z = (ws >> 1) - mod;else z = mod;
60051            k.isubn(z);
60052          } else {
60053            z = 0;
60054          }
60055
60056          naf[i] = z;
60057          k.iushrn(1);
60058        }
60059
60060        return naf;
60061      }
60062
60063      utils.getNAF = getNAF; // Represent k1, k2 in a Joint Sparse Form
60064
60065      function getJSF(k1, k2) {
60066        var jsf = [[], []];
60067        k1 = k1.clone();
60068        k2 = k2.clone();
60069        var d1 = 0;
60070        var d2 = 0;
60071
60072        while (k1.cmpn(-d1) > 0 || k2.cmpn(-d2) > 0) {
60073          // First phase
60074          var m14 = k1.andln(3) + d1 & 3;
60075          var m24 = k2.andln(3) + d2 & 3;
60076          if (m14 === 3) m14 = -1;
60077          if (m24 === 3) m24 = -1;
60078          var u1;
60079
60080          if ((m14 & 1) === 0) {
60081            u1 = 0;
60082          } else {
60083            var m8 = k1.andln(7) + d1 & 7;
60084            if ((m8 === 3 || m8 === 5) && m24 === 2) u1 = -m14;else u1 = m14;
60085          }
60086
60087          jsf[0].push(u1);
60088          var u2;
60089
60090          if ((m24 & 1) === 0) {
60091            u2 = 0;
60092          } else {
60093            var m8 = k2.andln(7) + d2 & 7;
60094            if ((m8 === 3 || m8 === 5) && m14 === 2) u2 = -m24;else u2 = m24;
60095          }
60096
60097          jsf[1].push(u2); // Second phase
60098
60099          if (2 * d1 === u1 + 1) d1 = 1 - d1;
60100          if (2 * d2 === u2 + 1) d2 = 1 - d2;
60101          k1.iushrn(1);
60102          k2.iushrn(1);
60103        }
60104
60105        return jsf;
60106      }
60107
60108      utils.getJSF = getJSF;
60109
60110      function cachedProperty(obj, name, computer) {
60111        var key = '_' + name;
60112
60113        obj.prototype[name] = function cachedProperty() {
60114          return this[key] !== undefined ? this[key] : this[key] = computer.call(this);
60115        };
60116      }
60117
60118      utils.cachedProperty = cachedProperty;
60119
60120      function parseBytes(bytes) {
60121        return typeof bytes === 'string' ? utils.toArray(bytes, 'hex') : bytes;
60122      }
60123
60124      utils.parseBytes = parseBytes;
60125
60126      function intFromLE(bytes) {
60127        return new BN(bytes, 'hex', 'le');
60128      }
60129
60130      utils.intFromLE = intFromLE;
60131    }, {
60132      "bn.js": 342,
60133      "minimalistic-assert": 414,
60134      "minimalistic-crypto-utils": 415
60135    }],
60136    342: [function (require, module, exports) {
60137      arguments[4][179][0].apply(exports, arguments);
60138    }, {
60139      "buffer": 183,
60140      "dup": 179
60141    }],
60142    343: [function (require, module, exports) {
60143      module.exports = {
60144        "_from": "elliptic@^6.5.2",
60145        "_id": "[email protected]",
60146        "_inBundle": false,
60147        "_integrity": "sha512-f4x70okzZbIQl/NSRLkI/+tteV/9WqL98zx+SQ69KbXxmVrmjwsNUPn/gYJJ0sHvEak24cZgHIPegRePAtA/xw==",
60148        "_location": "/elliptic",
60149        "_phantomChildren": {},
60150        "_requested": {
60151          "type": "range",
60152          "registry": true,
60153          "raw": "elliptic@^6.5.2",
60154          "name": "elliptic",
60155          "escapedName": "elliptic",
60156          "rawSpec": "^6.5.2",
60157          "saveSpec": null,
60158          "fetchSpec": "^6.5.2"
60159        },
60160        "_requiredBy": ["/browserify-sign", "/create-ecdh"],
60161        "_resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.2.tgz",
60162        "_shasum": "05c5678d7173c049d8ca433552224a495d0e3762",
60163        "_spec": "elliptic@^6.5.2",
60164        "_where": "/mnt/d/dev/git/exceljs/node_modules/browserify-sign",
60165        "author": {
60166          "name": "Fedor Indutny",
60167          "email": "[email protected]"
60168        },
60169        "bugs": {
60170          "url": "https://github.com/indutny/elliptic/issues"
60171        },
60172        "bundleDependencies": false,
60173        "dependencies": {
60174          "bn.js": "^4.4.0",
60175          "brorand": "^1.0.1",
60176          "hash.js": "^1.0.0",
60177          "hmac-drbg": "^1.0.0",
60178          "inherits": "^2.0.1",
60179          "minimalistic-assert": "^1.0.0",
60180          "minimalistic-crypto-utils": "^1.0.0"
60181        },
60182        "deprecated": false,
60183        "description": "EC cryptography",
60184        "devDependencies": {
60185          "brfs": "^1.4.3",
60186          "coveralls": "^3.0.8",
60187          "grunt": "^1.0.4",
60188          "grunt-browserify": "^5.0.0",
60189          "grunt-cli": "^1.2.0",
60190          "grunt-contrib-connect": "^1.0.0",
60191          "grunt-contrib-copy": "^1.0.0",
60192          "grunt-contrib-uglify": "^1.0.1",
60193          "grunt-mocha-istanbul": "^3.0.1",
60194          "grunt-saucelabs": "^9.0.1",
60195          "istanbul": "^0.4.2",
60196          "jscs": "^3.0.7",
60197          "jshint": "^2.10.3",
60198          "mocha": "^6.2.2"
60199        },
60200        "files": ["lib"],
60201        "homepage": "https://github.com/indutny/elliptic",
60202        "keywords": ["EC", "Elliptic", "curve", "Cryptography"],
60203        "license": "MIT",
60204        "main": "lib/elliptic.js",
60205        "name": "elliptic",
60206        "repository": {
60207          "type": "git",
60208          "url": "git+ssh://[email protected]/indutny/elliptic.git"
60209        },
60210        "scripts": {
60211          "jscs": "jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",
60212          "jshint": "jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",
60213          "lint": "npm run jscs && npm run jshint",
60214          "test": "npm run lint && npm run unit",
60215          "unit": "istanbul test _mocha --reporter=spec test/index.js",
60216          "version": "grunt dist && git add dist/"
60217        },
60218        "version": "6.5.2"
60219      };
60220    }, {}],
60221    344: [function (require, module, exports) {
60222      // Copyright Joyent, Inc. and other Node contributors.
60223      //
60224      // Permission is hereby granted, free of charge, to any person obtaining a
60225      // copy of this software and associated documentation files (the
60226      // "Software"), to deal in the Software without restriction, including
60227      // without limitation the rights to use, copy, modify, merge, publish,
60228      // distribute, sublicense, and/or sell copies of the Software, and to permit
60229      // persons to whom the Software is furnished to do so, subject to the
60230      // following conditions:
60231      //
60232      // The above copyright notice and this permission notice shall be included
60233      // in all copies or substantial portions of the Software.
60234      //
60235      // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
60236      // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
60237      // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
60238      // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
60239      // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
60240      // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
60241      // USE OR OTHER DEALINGS IN THE SOFTWARE.
60242      var objectCreate = Object.create || objectCreatePolyfill;
60243      var objectKeys = Object.keys || objectKeysPolyfill;
60244      var bind = Function.prototype.bind || functionBindPolyfill;
60245
60246      function EventEmitter() {
60247        if (!this._events || !Object.prototype.hasOwnProperty.call(this, '_events')) {
60248          this._events = objectCreate(null);
60249          this._eventsCount = 0;
60250        }
60251
60252        this._maxListeners = this._maxListeners || undefined;
60253      }
60254
60255      module.exports = EventEmitter; // Backwards-compat with node 0.10.x
60256
60257      EventEmitter.EventEmitter = EventEmitter;
60258      EventEmitter.prototype._events = undefined;
60259      EventEmitter.prototype._maxListeners = undefined; // By default EventEmitters will print a warning if more than 10 listeners are
60260      // added to it. This is a useful default which helps finding memory leaks.
60261
60262      var defaultMaxListeners = 10;
60263      var hasDefineProperty;
60264
60265      try {
60266        var o = {};
60267        if (Object.defineProperty) Object.defineProperty(o, 'x', {
60268          value: 0
60269        });
60270        hasDefineProperty = o.x === 0;
60271      } catch (err) {
60272        hasDefineProperty = false;
60273      }
60274
60275      if (hasDefineProperty) {
60276        Object.defineProperty(EventEmitter, 'defaultMaxListeners', {
60277          enumerable: true,
60278          get: function get() {
60279            return defaultMaxListeners;
60280          },
60281          set: function set(arg) {
60282            // check whether the input is a positive number (whose value is zero or
60283            // greater and not a NaN).
60284            if (typeof arg !== 'number' || arg < 0 || arg !== arg) throw new TypeError('"defaultMaxListeners" must be a positive number');
60285            defaultMaxListeners = arg;
60286          }
60287        });
60288      } else {
60289        EventEmitter.defaultMaxListeners = defaultMaxListeners;
60290      } // Obviously not all Emitters should be limited to 10. This function allows
60291      // that to be increased. Set to zero for unlimited.
60292
60293
60294      EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
60295        if (typeof n !== 'number' || n < 0 || isNaN(n)) throw new TypeError('"n" argument must be a positive number');
60296        this._maxListeners = n;
60297        return this;
60298      };
60299
60300      function $getMaxListeners(that) {
60301        if (that._maxListeners === undefined) return EventEmitter.defaultMaxListeners;
60302        return that._maxListeners;
60303      }
60304
60305      EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
60306        return $getMaxListeners(this);
60307      }; // These standalone emit* functions are used to optimize calling of event
60308      // handlers for fast cases because emit() itself often has a variable number of
60309      // arguments and can be deoptimized because of that. These functions always have
60310      // the same number of arguments and thus do not get deoptimized, so the code
60311      // inside them can execute faster.
60312
60313
60314      function emitNone(handler, isFn, self) {
60315        if (isFn) handler.call(self);else {
60316          var len = handler.length;
60317          var listeners = arrayClone(handler, len);
60318
60319          for (var i = 0; i < len; ++i) {
60320            listeners[i].call(self);
60321          }
60322        }
60323      }
60324
60325      function emitOne(handler, isFn, self, arg1) {
60326        if (isFn) handler.call(self, arg1);else {
60327          var len = handler.length;
60328          var listeners = arrayClone(handler, len);
60329
60330          for (var i = 0; i < len; ++i) {
60331            listeners[i].call(self, arg1);
60332          }
60333        }
60334      }
60335
60336      function emitTwo(handler, isFn, self, arg1, arg2) {
60337        if (isFn) handler.call(self, arg1, arg2);else {
60338          var len = handler.length;
60339          var listeners = arrayClone(handler, len);
60340
60341          for (var i = 0; i < len; ++i) {
60342            listeners[i].call(self, arg1, arg2);
60343          }
60344        }
60345      }
60346
60347      function emitThree(handler, isFn, self, arg1, arg2, arg3) {
60348        if (isFn) handler.call(self, arg1, arg2, arg3);else {
60349          var len = handler.length;
60350          var listeners = arrayClone(handler, len);
60351
60352          for (var i = 0; i < len; ++i) {
60353            listeners[i].call(self, arg1, arg2, arg3);
60354          }
60355        }
60356      }
60357
60358      function emitMany(handler, isFn, self, args) {
60359        if (isFn) handler.apply(self, args);else {
60360          var len = handler.length;
60361          var listeners = arrayClone(handler, len);
60362
60363          for (var i = 0; i < len; ++i) {
60364            listeners[i].apply(self, args);
60365          }
60366        }
60367      }
60368
60369      EventEmitter.prototype.emit = function emit(type) {
60370        var er, handler, len, args, i, events;
60371        var doError = type === 'error';
60372        events = this._events;
60373        if (events) doError = doError && events.error == null;else if (!doError) return false; // If there is no 'error' event listener then throw.
60374
60375        if (doError) {
60376          if (arguments.length > 1) er = arguments[1];
60377
60378          if (er instanceof Error) {
60379            throw er; // Unhandled 'error' event
60380          } else {
60381            // At least give some kind of context to the user
60382            var err = new Error('Unhandled "error" event. (' + er + ')');
60383            err.context = er;
60384            throw err;
60385          }
60386
60387          return false;
vendor: 12,420 bytes, lines 60388-60789
60388        }
60389
60390        handler = events[type];
60391        if (!handler) return false;
60392        var isFn = typeof handler === 'function';
60393        len = arguments.length;
60394
60395        switch (len) {
60396          // fast cases
60397          case 1:
60398            emitNone(handler, isFn, this);
60399            break;
60400
60401          case 2:
60402            emitOne(handler, isFn, this, arguments[1]);
60403            break;
60404
60405          case 3:
60406            emitTwo(handler, isFn, this, arguments[1], arguments[2]);
60407            break;
60408
60409          case 4:
60410            emitThree(handler, isFn, this, arguments[1], arguments[2], arguments[3]);
60411            break;
60412          // slower
60413
60414          default:
60415            args = new Array(len - 1);
60416
60417            for (i = 1; i < len; i++) {
60418              args[i - 1] = arguments[i];
60419            }
60420
60421            emitMany(handler, isFn, this, args);
60422        }
60423
60424        return true;
60425      };
60426
60427      function _addListener(target, type, listener, prepend) {
60428        var m;
60429        var events;
60430        var existing;
60431        if (typeof listener !== 'function') throw new TypeError('"listener" argument must be a function');
60432        events = target._events;
60433
60434        if (!events) {
60435          events = target._events = objectCreate(null);
60436          target._eventsCount = 0;
60437        } else {
60438          // To avoid recursion in the case that type === "newListener"! Before
60439          // adding it to the listeners, first emit "newListener".
60440          if (events.newListener) {
60441            target.emit('newListener', type, listener.listener ? listener.listener : listener); // Re-assign `events` because a newListener handler could have caused the
60442            // this._events to be assigned to a new object
60443
60444            events = target._events;
60445          }
60446
60447          existing = events[type];
60448        }
60449
60450        if (!existing) {
60451          // Optimize the case of one listener. Don't need the extra array object.
60452          existing = events[type] = listener;
60453          ++target._eventsCount;
60454        } else {
60455          if (typeof existing === 'function') {
60456            // Adding the second element, need to change to array.
60457            existing = events[type] = prepend ? [listener, existing] : [existing, listener];
60458          } else {
60459            // If we've already got an array, just append.
60460            if (prepend) {
60461              existing.unshift(listener);
60462            } else {
60463              existing.push(listener);
60464            }
60465          } // Check for listener leak
60466
60467
60468          if (!existing.warned) {
60469            m = $getMaxListeners(target);
60470
60471            if (m && m > 0 && existing.length > m) {
60472              existing.warned = true;
60473              var w = new Error('Possible EventEmitter memory leak detected. ' + existing.length + ' "' + String(type) + '" listeners ' + 'added. Use emitter.setMaxListeners() to ' + 'increase limit.');
60474              w.name = 'MaxListenersExceededWarning';
60475              w.emitter = target;
60476              w.type = type;
60477              w.count = existing.length;
60478
60479              if ((typeof console === "undefined" ? "undefined" : _typeof2(console)) === 'object' && console.warn) {
60480                console.warn('%s: %s', w.name, w.message);
60481              }
60482            }
60483          }
60484        }
60485
60486        return target;
60487      }
60488
60489      EventEmitter.prototype.addListener = function addListener(type, listener) {
60490        return _addListener(this, type, listener, false);
60491      };
60492
60493      EventEmitter.prototype.on = EventEmitter.prototype.addListener;
60494
60495      EventEmitter.prototype.prependListener = function prependListener(type, listener) {
60496        return _addListener(this, type, listener, true);
60497      };
60498
60499      function onceWrapper() {
60500        if (!this.fired) {
60501          this.target.removeListener(this.type, this.wrapFn);
60502          this.fired = true;
60503
60504          switch (arguments.length) {
60505            case 0:
60506              return this.listener.call(this.target);
60507
60508            case 1:
60509              return this.listener.call(this.target, arguments[0]);
60510
60511            case 2:
60512              return this.listener.call(this.target, arguments[0], arguments[1]);
60513
60514            case 3:
60515              return this.listener.call(this.target, arguments[0], arguments[1], arguments[2]);
60516
60517            default:
60518              var args = new Array(arguments.length);
60519
60520              for (var i = 0; i < args.length; ++i) {
60521                args[i] = arguments[i];
60522              }
60523
60524              this.listener.apply(this.target, args);
60525          }
60526        }
60527      }
60528
60529      function _onceWrap(target, type, listener) {
60530        var state = {
60531          fired: false,
60532          wrapFn: undefined,
60533          target: target,
60534          type: type,
60535          listener: listener
60536        };
60537        var wrapped = bind.call(onceWrapper, state);
60538        wrapped.listener = listener;
60539        state.wrapFn = wrapped;
60540        return wrapped;
60541      }
60542
60543      EventEmitter.prototype.once = function once(type, listener) {
60544        if (typeof listener !== 'function') throw new TypeError('"listener" argument must be a function');
60545        this.on(type, _onceWrap(this, type, listener));
60546        return this;
60547      };
60548
60549      EventEmitter.prototype.prependOnceListener = function prependOnceListener(type, listener) {
60550        if (typeof listener !== 'function') throw new TypeError('"listener" argument must be a function');
60551        this.prependListener(type, _onceWrap(this, type, listener));
60552        return this;
60553      }; // Emits a 'removeListener' event if and only if the listener was removed.
60554
60555
60556      EventEmitter.prototype.removeListener = function removeListener(type, listener) {
60557        var list, events, position, i, originalListener;
60558        if (typeof listener !== 'function') throw new TypeError('"listener" argument must be a function');
60559        events = this._events;
60560        if (!events) return this;
60561        list = events[type];
60562        if (!list) return this;
60563
60564        if (list === listener || list.listener === listener) {
60565          if (--this._eventsCount === 0) this._events = objectCreate(null);else {
60566            delete events[type];
60567            if (events.removeListener) this.emit('removeListener', type, list.listener || listener);
60568          }
60569        } else if (typeof list !== 'function') {
60570          position = -1;
60571
60572          for (i = list.length - 1; i >= 0; i--) {
60573            if (list[i] === listener || list[i].listener === listener) {
60574              originalListener = list[i].listener;
60575              position = i;
60576              break;
60577            }
60578          }
60579
60580          if (position < 0) return this;
60581          if (position === 0) list.shift();else spliceOne(list, position);
60582          if (list.length === 1) events[type] = list[0];
60583          if (events.removeListener) this.emit('removeListener', type, originalListener || listener);
60584        }
60585
60586        return this;
60587      };
60588
60589      EventEmitter.prototype.removeAllListeners = function removeAllListeners(type) {
60590        var listeners, events, i;
60591        events = this._events;
60592        if (!events) return this; // not listening for removeListener, no need to emit
60593
60594        if (!events.removeListener) {
60595          if (arguments.length === 0) {
60596            this._events = objectCreate(null);
60597            this._eventsCount = 0;
60598          } else if (events[type]) {
60599            if (--this._eventsCount === 0) this._events = objectCreate(null);else delete events[type];
60600          }
60601
60602          return this;
60603        } // emit removeListener for all listeners on all events
60604
60605
60606        if (arguments.length === 0) {
60607          var keys = objectKeys(events);
60608          var key;
60609
60610          for (i = 0; i < keys.length; ++i) {
60611            key = keys[i];
60612            if (key === 'removeListener') continue;
60613            this.removeAllListeners(key);
60614          }
60615
60616          this.removeAllListeners('removeListener');
60617          this._events = objectCreate(null);
60618          this._eventsCount = 0;
60619          return this;
60620        }
60621
60622        listeners = events[type];
60623
60624        if (typeof listeners === 'function') {
60625          this.removeListener(type, listeners);
60626        } else if (listeners) {
60627          // LIFO order
60628          for (i = listeners.length - 1; i >= 0; i--) {
60629            this.removeListener(type, listeners[i]);
60630          }
60631        }
60632
60633        return this;
60634      };
60635
60636      function _listeners(target, type, unwrap) {
60637        var events = target._events;
60638        if (!events) return [];
60639        var evlistener = events[type];
60640        if (!evlistener) return [];
60641        if (typeof evlistener === 'function') return unwrap ? [evlistener.listener || evlistener] : [evlistener];
60642        return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
60643      }
60644
60645      EventEmitter.prototype.listeners = function listeners(type) {
60646        return _listeners(this, type, true);
60647      };
60648
60649      EventEmitter.prototype.rawListeners = function rawListeners(type) {
60650        return _listeners(this, type, false);
60651      };
60652
60653      EventEmitter.listenerCount = function (emitter, type) {
60654        if (typeof emitter.listenerCount === 'function') {
60655          return emitter.listenerCount(type);
60656        } else {
60657          return listenerCount.call(emitter, type);
60658        }
60659      };
60660
60661      EventEmitter.prototype.listenerCount = listenerCount;
60662
60663      function listenerCount(type) {
60664        var events = this._events;
60665
60666        if (events) {
60667          var evlistener = events[type];
60668
60669          if (typeof evlistener === 'function') {
60670            return 1;
60671          } else if (evlistener) {
60672            return evlistener.length;
60673          }
60674        }
60675
60676        return 0;
60677      }
60678
60679      EventEmitter.prototype.eventNames = function eventNames() {
60680        return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : [];
60681      }; // About 1.5x faster than the two-arg version of Array#splice().
60682
60683
60684      function spliceOne(list, index) {
60685        for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {
60686          list[i] = list[k];
60687        }
60688
60689        list.pop();
60690      }
60691
60692      function arrayClone(arr, n) {
60693        var copy = new Array(n);
60694
60695        for (var i = 0; i < n; ++i) {
60696          copy[i] = arr[i];
60697        }
60698
60699        return copy;
60700      }
60701
60702      function unwrapListeners(arr) {
60703        var ret = new Array(arr.length);
60704
60705        for (var i = 0; i < ret.length; ++i) {
60706          ret[i] = arr[i].listener || arr[i];
60707        }
60708
60709        return ret;
60710      }
60711
60712      function objectCreatePolyfill(proto) {
60713        var F = function F() {};
60714
60715        F.prototype = proto;
60716        return new F();
60717      }
60718
60719      function objectKeysPolyfill(obj) {
60720        var keys = [];
60721
60722        for (var k in obj) {
60723          if (Object.prototype.hasOwnProperty.call(obj, k)) {
60724            keys.push(k);
60725          }
60726        }
60727
60728        return k;
60729      }
60730
60731      function functionBindPolyfill(context) {
60732        var fn = this;
60733        return function () {
60734          return fn.apply(context, arguments);
60735        };
60736      }
60737    }, {}],
60738    345: [function (require, module, exports) {
60739      var Buffer = require('safe-buffer').Buffer;
60740
60741      var MD5 = require('md5.js');
60742      /* eslint-disable camelcase */
60743
60744
60745      function EVP_BytesToKey(password, salt, keyBits, ivLen) {
60746        if (!Buffer.isBuffer(password)) password = Buffer.from(password, 'binary');
60747
60748        if (salt) {
60749          if (!Buffer.isBuffer(salt)) salt = Buffer.from(salt, 'binary');
60750          if (salt.length !== 8) throw new RangeError('salt should be Buffer with 8 byte length');
60751        }
60752
60753        var keyLen = keyBits / 8;
60754        var key = Buffer.alloc(keyLen);
60755        var iv = Buffer.alloc(ivLen || 0);
60756        var tmp = Buffer.alloc(0);
60757
60758        while (keyLen > 0 || ivLen > 0) {
60759          var hash = new MD5();
60760          hash.update(tmp);
60761          hash.update(password);
60762          if (salt) hash.update(salt);
60763          tmp = hash.digest();
60764          var used = 0;
60765
60766          if (keyLen > 0) {
60767            var keyStart = key.length - keyLen;
60768            used = Math.min(keyLen, tmp.length);
60769            tmp.copy(key, keyStart, 0, used);
60770            keyLen -= used;
60771          }
60772
60773          if (used < tmp.length && ivLen > 0) {
60774            var ivStart = iv.length - ivLen;
60775            var length = Math.min(ivLen, tmp.length - used);
60776            tmp.copy(iv, ivStart, used, used + length);
60777            ivLen -= length;
60778          }
60779        }
60780
60781        tmp.fill(0);
60782        return {
60783          key: key,
60784          iv: iv
60785        };
60786      }
60787
60788      module.exports = EVP_BytesToKey;
60789    }, {
60790      "md5.js": 411,
60791      "safe-buffer": 470
60792    }],
60793    346: [function (require, module, exports) {
60794      "use strict";
60795
60796      Object.defineProperty(exports, "__esModule", {
60797        value: true
60798      });
60799
60800      var format_1 = require("@fast-csv/format");
60801
60802      Object.defineProperty(exports, "format", {
60803        enumerable: true,
60804        get: function get() {
60805          return format_1.format;
60806        }
60807      });
60808      Object.defineProperty(exports, "write", {
60809        enumerable: true,
60810        get: function get() {
60811          return format_1.write;
60812        }
60813      });
60814      Object.defineProperty(exports, "writeToStream", {
60815        enumerable: true,
60816        get: function get() {
60817          return format_1.writeToStream;
60818        }
60819      });
60820      Object.defineProperty(exports, "writeToBuffer", {
60821        enumerable: true,
60822        get: function get() {
60823          return format_1.writeToBuffer;
60824        }
60825      });
60826      Object.defineProperty(exports, "writeToString", {
60827        enumerable: true,
60828        get: function get() {
60829          return format_1.writeToString;
60830        }
60831      });
60832      Object.defineProperty(exports, "writeToPath", {
60833        enumerable: true,
60834        get: function get() {
60835          return format_1.writeToPath;
60836        }
60837      });
60838      Object.defineProperty(exports, "CsvFormatterStream", {
60839        enumerable: true,
60840        get: function get() {
60841          return format_1.CsvFormatterStream;
60842        }
60843      });
60844      Object.defineProperty(exports, "FormatterOptions", {
60845        enumerable: true,
60846        get: function get() {
60847          return format_1.FormatterOptions;
60848        }
60849      });
60850
60851      var parse_1 = require("@fast-csv/parse");
60852
60853      Object.defineProperty(exports, "parse", {
60854        enumerable: true,
60855        get: function get() {
60856          return parse_1.parse;
60857        }
60858      });
60859      Object.defineProperty(exports, "parseString", {
60860        enumerable: true,
60861        get: function get() {
60862          return parse_1.parseString;
60863        }
60864      });
60865      Object.defineProperty(exports, "parseStream", {
60866        enumerable: true,
60867        get: function get() {
60868          return parse_1.parseStream;
60869        }
60870      });
60871      Object.defineProperty(exports, "parseFile", {
60872        enumerable: true,
60873        get: function get() {
60874          return parse_1.parseFile;
60875        }
60876      });
60877      Object.defineProperty(exports, "ParserOptions", {
60878        enumerable: true,
60879        get: function get() {
60880          return parse_1.ParserOptions;
60881        }
60882      });
60883      Object.defineProperty(exports, "CsvParserStream", {
60884        enumerable: true,
60885        get: function get() {
60886          return parse_1.CsvParserStream;
60887        }
60888      });
60889    }, {
60890      "@fast-csv/format": 146,
60891      "@fast-csv/parse": 150
60892    }],
60893    347: [function (require, module, exports) {
60894      'use strict';
60895
60896      var Buffer = require('safe-buffer').Buffer;
60897
60898      var Transform = require('readable-stream').Transform;
60899
60900      var inherits = require('inherits');
60901
60902      function throwIfNotStringOrBuffer(val, prefix) {
60903        if (!Buffer.isBuffer(val) && typeof val !== 'string') {
60904          throw new TypeError(prefix + ' must be a string or a buffer');
60905        }
60906      }
60907
60908      function HashBase(blockSize) {
60909        Transform.call(this);
60910        this._block = Buffer.allocUnsafe(blockSize);
60911        this._blockSize = blockSize;
60912        this._blockOffset = 0;
60913        this._length = [0, 0, 0, 0];
60914        this._finalized = false;
60915      }
60916
60917      inherits(HashBase, Transform);
60918
60919      HashBase.prototype._transform = function (chunk, encoding, callback) {
60920        var error = null;
60921
60922        try {
60923          this.update(chunk, encoding);
60924        } catch (err) {
60925          error = err;
60926        }
60927
60928        callback(error);
60929      };
60930
60931      HashBase.prototype._flush = function (callback) {
60932        var error = null;
60933
60934        try {
60935          this.push(this.digest());
60936        } catch (err) {
60937          error = err;
60938        }
60939
60940        callback(error);
60941      };
60942
60943      HashBase.prototype.update = function (data, encoding) {
60944        throwIfNotStringOrBuffer(data, 'Data');
60945        if (this._finalized) throw new Error('Digest already called');
60946        if (!Buffer.isBuffer(data)) data = Buffer.from(data, encoding); // consume data
60947
60948        var block = this._block;
60949        var offset = 0;
60950
60951        while (this._blockOffset + data.length - offset >= this._blockSize) {
60952          for (var i = this._blockOffset; i < this._blockSize;) {
60953            block[i++] = data[offset++];
60954          }
60955
60956          this._update();
60957
60958          this._blockOffset = 0;
60959        }
60960
60961        while (offset < data.length) {
60962          block[this._blockOffset++] = data[offset++];
60963        } // update length
60964
60965
60966        for (var j = 0, carry = data.length * 8; carry > 0; ++j) {
60967          this._length[j] += carry;
60968          carry = this._length[j] / 0x0100000000 | 0;
60969          if (carry > 0) this._length[j] -= 0x0100000000 * carry;
60970        }
60971
60972        return this;
60973      };
60974
60975      HashBase.prototype._update = function () {
60976        throw new Error('_update is not implemented');
60977      };
60978
60979      HashBase.prototype.digest = function (encoding) {
60980        if (this._finalized) throw new Error('Digest already called');
60981        this._finalized = true;
60982
60983        var digest = this._digest();
60984
60985        if (encoding !== undefined) digest = digest.toString(encoding); // reset state
60986
60987        this._block.fill(0);
60988
60989        this._blockOffset = 0;
60990
60991        for (var i = 0; i < 4; ++i) {
60992          this._length[i] = 0;
60993        }
60994
60995        return digest;
60996      };
60997
60998      HashBase.prototype._digest = function () {
60999        throw new Error('_digest is not implemented');
61000      };
61001
61002      module.exports = HashBase;
61003    }, {
61004      "inherits": 364,
61005      "readable-stream": 467,
61006      "safe-buffer": 348
61007    }],
61008    348: [function (require, module, exports) {
61009      arguments[4][212][0].apply(exports, arguments);
61010    }, {
61011      "buffer": 214,
61012      "dup": 212
61013    }],
61014    349: [function (require, module, exports) {
61015      var hash = exports;
61016      hash.utils = require('./hash/utils');
61017      hash.common = require('./hash/common');
61018      hash.sha = require('./hash/sha');
61019      hash.ripemd = require('./hash/ripemd');
61020      hash.hmac = require('./hash/hmac'); // Proxy hash functions to the main object
61021
61022      hash.sha1 = hash.sha.sha1;
61023      hash.sha256 = hash.sha.sha256;
61024      hash.sha224 = hash.sha.sha224;
61025      hash.sha384 = hash.sha.sha384;
61026      hash.sha512 = hash.sha.sha512;
61027      hash.ripemd160 = hash.ripemd.ripemd160;
61028    }, {
61029      "./hash/common": 350,
61030      "./hash/hmac": 351,
61031      "./hash/ripemd": 352,
61032      "./hash/sha": 353,
61033      "./hash/utils": 360
61034    }],
61035    350: [function (require, module, exports) {
61036      'use strict';
61037
61038      var utils = require('./utils');
61039
61040      var assert = require('minimalistic-assert');
61041
61042      function BlockHash() {
61043        this.pending = null;
61044        this.pendingTotal = 0;
61045        this.blockSize = this.constructor.blockSize;
61046        this.outSize = this.constructor.outSize;
61047        this.hmacStrength = this.constructor.hmacStrength;
61048        this.padLength = this.constructor.padLength / 8;
61049        this.endian = 'big';
61050        this._delta8 = this.blockSize / 8;
61051        this._delta32 = this.blockSize / 32;
61052      }
61053
61054      exports.BlockHash = BlockHash;
61055
61056      BlockHash.prototype.update = function update(msg, enc) {
61057        // Convert message to array, pad it, and join into 32bit blocks
61058        msg = utils.toArray(msg, enc);
61059        if (!this.pending) this.pending = msg;else this.pending = this.pending.concat(msg);
61060        this.pendingTotal += msg.length; // Enough data, try updating
61061
61062        if (this.pending.length >= this._delta8) {
61063          msg = this.pending; // Process pending data in blocks
61064
61065          var r = msg.length % this._delta8;
61066          this.pending = msg.slice(msg.length - r, msg.length);
61067          if (this.pending.length === 0) this.pending = null;
61068          msg = utils.join32(msg, 0, msg.length - r, this.endian);
61069
61070          for (var i = 0; i < msg.length; i += this._delta32) {
61071            this._update(msg, i, i + this._delta32);
61072          }
61073        }
61074
61075        return this;
61076      };
61077
61078      BlockHash.prototype.digest = function digest(enc) {
61079        this.update(this._pad());
61080        assert(this.pending === null);
61081        return this._digest(enc);
61082      };
61083
61084      BlockHash.prototype._pad = function pad() {
61085        var len = this.pendingTotal;
61086        var bytes = this._delta8;
61087        var k = bytes - (len + this.padLength) % bytes;
61088        var res = new Array(k + this.padLength);
61089        res[0] = 0x80;
61090
61091        for (var i = 1; i < k; i++) {
61092          res[i] = 0;
61093        } // Append length
61094
61095
61096        len <<= 3;
61097
61098        if (this.endian === 'big') {
61099          for (var t = 8; t < this.padLength; t++) {
61100            res[i++] = 0;
61101          }
61102
61103          res[i++] = 0;
61104          res[i++] = 0;
61105          res[i++] = 0;
61106          res[i++] = 0;
61107          res[i++] = len >>> 24 & 0xff;
61108          res[i++] = len >>> 16 & 0xff;
61109          res[i++] = len >>> 8 & 0xff;
61110          res[i++] = len & 0xff;
61111        } else {
61112          res[i++] = len & 0xff;
61113          res[i++] = len >>> 8 & 0xff;
61114          res[i++] = len >>> 16 & 0xff;
61115          res[i++] = len >>> 24 & 0xff;
61116          res[i++] = 0;
61117          res[i++] = 0;
61118          res[i++] = 0;
61119          res[i++] = 0;
61120
61121          for (t = 8; t < this.padLength; t++) {
61122            res[i++] = 0;
61123          }
61124        }
61125
61126        return res;
61127      };
61128    }, {
61129      "./utils": 360,
61130      "minimalistic-assert": 414
61131    }],
61132    351: [function (require, module, exports) {
61133      'use strict';
61134
61135      var utils = require('./utils');
61136
61137      var assert = require('minimalistic-assert');
61138
61139      function Hmac(hash, key, enc) {
61140        if (!(this instanceof Hmac)) return new Hmac(hash, key, enc);
61141        this.Hash = hash;
61142        this.blockSize = hash.blockSize / 8;
61143        this.outSize = hash.outSize / 8;
61144        this.inner = null;
61145        this.outer = null;
61146
61147        this._init(utils.toArray(key, enc));
61148      }
61149
61150      module.exports = Hmac;
61151
61152      Hmac.prototype._init = function init(key) {
61153        // Shorten key, if needed
61154        if (key.length > this.blockSize) key = new this.Hash().update(key).digest();
61155        assert(key.length <= this.blockSize); // Add padding to key
61156
61157        for (var i = key.length; i < this.blockSize; i++) {
61158          key.push(0);
61159        }
61160
61161        for (i = 0; i < key.length; i++) {
61162          key[i] ^= 0x36;
61163        }
61164
61165        this.inner = new this.Hash().update(key); // 0x36 ^ 0x5c = 0x6a
61166
61167        for (i = 0; i < key.length; i++) {
61168          key[i] ^= 0x6a;
61169        }
61170
61171        this.outer = new this.Hash().update(key);
61172      };
61173
61174      Hmac.prototype.update = function update(msg, enc) {
61175        this.inner.update(msg, enc);
61176        return this;
61177      };
61178
61179      Hmac.prototype.digest = function digest(enc) {
61180        this.outer.update(this.inner.digest());
61181        return this.outer.digest(enc);
61182      };
61183    }, {
vendor: 3,840 bytes, lines 61184-61269
61184      "./utils": 360,
61185      "minimalistic-assert": 414
61186    }],
61187    352: [function (require, module, exports) {
61188      'use strict';
61189
61190      var utils = require('./utils');
61191
61192      var common = require('./common');
61193
61194      var rotl32 = utils.rotl32;
61195      var sum32 = utils.sum32;
61196      var sum32_3 = utils.sum32_3;
61197      var sum32_4 = utils.sum32_4;
61198      var BlockHash = common.BlockHash;
61199
61200      function RIPEMD160() {
61201        if (!(this instanceof RIPEMD160)) return new RIPEMD160();
61202        BlockHash.call(this);
61203        this.h = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0];
61204        this.endian = 'little';
61205      }
61206
61207      utils.inherits(RIPEMD160, BlockHash);
61208      exports.ripemd160 = RIPEMD160;
61209      RIPEMD160.blockSize = 512;
61210      RIPEMD160.outSize = 160;
61211      RIPEMD160.hmacStrength = 192;
61212      RIPEMD160.padLength = 64;
61213
61214      RIPEMD160.prototype._update = function update(msg, start) {
61215        var A = this.h[0];
61216        var B = this.h[1];
61217        var C = this.h[2];
61218        var D = this.h[3];
61219        var E = this.h[4];
61220        var Ah = A;
61221        var Bh = B;
61222        var Ch = C;
61223        var Dh = D;
61224        var Eh = E;
61225
61226        for (var j = 0; j < 80; j++) {
61227          var T = sum32(rotl32(sum32_4(A, f(j, B, C, D), msg[r[j] + start], K(j)), s[j]), E);
61228          A = E;
61229          E = D;
61230          D = rotl32(C, 10);
61231          C = B;
61232          B = T;
61233          T = sum32(rotl32(sum32_4(Ah, f(79 - j, Bh, Ch, Dh), msg[rh[j] + start], Kh(j)), sh[j]), Eh);
61234          Ah = Eh;
61235          Eh = Dh;
61236          Dh = rotl32(Ch, 10);
61237          Ch = Bh;
61238          Bh = T;
61239        }
61240
61241        T = sum32_3(this.h[1], C, Dh);
61242        this.h[1] = sum32_3(this.h[2], D, Eh);
61243        this.h[2] = sum32_3(this.h[3], E, Ah);
61244        this.h[3] = sum32_3(this.h[4], A, Bh);
61245        this.h[4] = sum32_3(this.h[0], B, Ch);
61246        this.h[0] = T;
61247      };
61248
61249      RIPEMD160.prototype._digest = function digest(enc) {
61250        if (enc === 'hex') return utils.toHex32(this.h, 'little');else return utils.split32(this.h, 'little');
61251      };
61252
61253      function f(j, x, y, z) {
61254        if (j <= 15) return x ^ y ^ z;else if (j <= 31) return x & y | ~x & z;else if (j <= 47) return (x | ~y) ^ z;else if (j <= 63) return x & z | y & ~z;else return x ^ (y | ~z);
61255      }
61256
61257      function K(j) {
61258        if (j <= 15) return 0x00000000;else if (j <= 31) return 0x5a827999;else if (j <= 47) return 0x6ed9eba1;else if (j <= 63) return 0x8f1bbcdc;else return 0xa953fd4e;
61259      }
61260
61261      function Kh(j) {
61262        if (j <= 15) return 0x50a28be6;else if (j <= 31) return 0x5c4dd124;else if (j <= 47) return 0x6d703ef3;else if (j <= 63) return 0x7a6d76e9;else return 0x00000000;
61263      }
61264
61265      var r = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13];
61266      var rh = [5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11];
61267      var s = [11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6];
61268      var sh = [8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11];
61269    }, {
vendor: 8,900 bytes, lines 61270-61527
61270      "./common": 350,
61271      "./utils": 360
61272    }],
61273    353: [function (require, module, exports) {
61274      'use strict';
61275
61276      exports.sha1 = require('./sha/1');
61277      exports.sha224 = require('./sha/224');
61278      exports.sha256 = require('./sha/256');
61279      exports.sha384 = require('./sha/384');
61280      exports.sha512 = require('./sha/512');
61281    }, {
61282      "./sha/1": 354,
61283      "./sha/224": 355,
61284      "./sha/256": 356,
61285      "./sha/384": 357,
61286      "./sha/512": 358
61287    }],
61288    354: [function (require, module, exports) {
61289      'use strict';
61290
61291      var utils = require('../utils');
61292
61293      var common = require('../common');
61294
61295      var shaCommon = require('./common');
61296
61297      var rotl32 = utils.rotl32;
61298      var sum32 = utils.sum32;
61299      var sum32_5 = utils.sum32_5;
61300      var ft_1 = shaCommon.ft_1;
61301      var BlockHash = common.BlockHash;
61302      var sha1_K = [0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xCA62C1D6];
61303
61304      function SHA1() {
61305        if (!(this instanceof SHA1)) return new SHA1();
61306        BlockHash.call(this);
61307        this.h = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0];
61308        this.W = new Array(80);
61309      }
61310
61311      utils.inherits(SHA1, BlockHash);
61312      module.exports = SHA1;
61313      SHA1.blockSize = 512;
61314      SHA1.outSize = 160;
61315      SHA1.hmacStrength = 80;
61316      SHA1.padLength = 64;
61317
61318      SHA1.prototype._update = function _update(msg, start) {
61319        var W = this.W;
61320
61321        for (var i = 0; i < 16; i++) {
61322          W[i] = msg[start + i];
61323        }
61324
61325        for (; i < W.length; i++) {
61326          W[i] = rotl32(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16], 1);
61327        }
61328
61329        var a = this.h[0];
61330        var b = this.h[1];
61331        var c = this.h[2];
61332        var d = this.h[3];
61333        var e = this.h[4];
61334
61335        for (i = 0; i < W.length; i++) {
61336          var s = ~~(i / 20);
61337          var t = sum32_5(rotl32(a, 5), ft_1(s, b, c, d), e, W[i], sha1_K[s]);
61338          e = d;
61339          d = c;
61340          c = rotl32(b, 30);
61341          b = a;
61342          a = t;
61343        }
61344
61345        this.h[0] = sum32(this.h[0], a);
61346        this.h[1] = sum32(this.h[1], b);
61347        this.h[2] = sum32(this.h[2], c);
61348        this.h[3] = sum32(this.h[3], d);
61349        this.h[4] = sum32(this.h[4], e);
61350      };
61351
61352      SHA1.prototype._digest = function digest(enc) {
61353        if (enc === 'hex') return utils.toHex32(this.h, 'big');else return utils.split32(this.h, 'big');
61354      };
61355    }, {
61356      "../common": 350,
61357      "../utils": 360,
61358      "./common": 359
61359    }],
61360    355: [function (require, module, exports) {
61361      'use strict';
61362
61363      var utils = require('../utils');
61364
61365      var SHA256 = require('./256');
61366
61367      function SHA224() {
61368        if (!(this instanceof SHA224)) return new SHA224();
61369        SHA256.call(this);
61370        this.h = [0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4];
61371      }
61372
61373      utils.inherits(SHA224, SHA256);
61374      module.exports = SHA224;
61375      SHA224.blockSize = 512;
61376      SHA224.outSize = 224;
61377      SHA224.hmacStrength = 192;
61378      SHA224.padLength = 64;
61379
61380      SHA224.prototype._digest = function digest(enc) {
61381        // Just truncate output
61382        if (enc === 'hex') return utils.toHex32(this.h.slice(0, 7), 'big');else return utils.split32(this.h.slice(0, 7), 'big');
61383      };
61384    }, {
61385      "../utils": 360,
61386      "./256": 356
61387    }],
61388    356: [function (require, module, exports) {
61389      'use strict';
61390
61391      var utils = require('../utils');
61392
61393      var common = require('../common');
61394
61395      var shaCommon = require('./common');
61396
61397      var assert = require('minimalistic-assert');
61398
61399      var sum32 = utils.sum32;
61400      var sum32_4 = utils.sum32_4;
61401      var sum32_5 = utils.sum32_5;
61402      var ch32 = shaCommon.ch32;
61403      var maj32 = shaCommon.maj32;
61404      var s0_256 = shaCommon.s0_256;
61405      var s1_256 = shaCommon.s1_256;
61406      var g0_256 = shaCommon.g0_256;
61407      var g1_256 = shaCommon.g1_256;
61408      var BlockHash = common.BlockHash;
61409      var sha256_K = [0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2];
61410
61411      function SHA256() {
61412        if (!(this instanceof SHA256)) return new SHA256();
61413        BlockHash.call(this);
61414        this.h = [0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19];
61415        this.k = sha256_K;
61416        this.W = new Array(64);
61417      }
61418
61419      utils.inherits(SHA256, BlockHash);
61420      module.exports = SHA256;
61421      SHA256.blockSize = 512;
61422      SHA256.outSize = 256;
61423      SHA256.hmacStrength = 192;
61424      SHA256.padLength = 64;
61425
61426      SHA256.prototype._update = function _update(msg, start) {
61427        var W = this.W;
61428
61429        for (var i = 0; i < 16; i++) {
61430          W[i] = msg[start + i];
61431        }
61432
61433        for (; i < W.length; i++) {
61434          W[i] = sum32_4(g1_256(W[i - 2]), W[i - 7], g0_256(W[i - 15]), W[i - 16]);
61435        }
61436
61437        var a = this.h[0];
61438        var b = this.h[1];
61439        var c = this.h[2];
61440        var d = this.h[3];
61441        var e = this.h[4];
61442        var f = this.h[5];
61443        var g = this.h[6];
61444        var h = this.h[7];
61445        assert(this.k.length === W.length);
61446
61447        for (i = 0; i < W.length; i++) {
61448          var T1 = sum32_5(h, s1_256(e), ch32(e, f, g), this.k[i], W[i]);
61449          var T2 = sum32(s0_256(a), maj32(a, b, c));
61450          h = g;
61451          g = f;
61452          f = e;
61453          e = sum32(d, T1);
61454          d = c;
61455          c = b;
61456          b = a;
61457          a = sum32(T1, T2);
61458        }
61459
61460        this.h[0] = sum32(this.h[0], a);
61461        this.h[1] = sum32(this.h[1], b);
61462        this.h[2] = sum32(this.h[2], c);
61463        this.h[3] = sum32(this.h[3], d);
61464        this.h[4] = sum32(this.h[4], e);
61465        this.h[5] = sum32(this.h[5], f);
61466        this.h[6] = sum32(this.h[6], g);
61467        this.h[7] = sum32(this.h[7], h);
61468      };
61469
61470      SHA256.prototype._digest = function digest(enc) {
61471        if (enc === 'hex') return utils.toHex32(this.h, 'big');else return utils.split32(this.h, 'big');
61472      };
61473    }, {
61474      "../common": 350,
61475      "../utils": 360,
61476      "./common": 359,
61477      "minimalistic-assert": 414
61478    }],
61479    357: [function (require, module, exports) {
61480      'use strict';
61481
61482      var utils = require('../utils');
61483
61484      var SHA512 = require('./512');
61485
61486      function SHA384() {
61487        if (!(this instanceof SHA384)) return new SHA384();
61488        SHA512.call(this);
61489        this.h = [0xcbbb9d5d, 0xc1059ed8, 0x629a292a, 0x367cd507, 0x9159015a, 0x3070dd17, 0x152fecd8, 0xf70e5939, 0x67332667, 0xffc00b31, 0x8eb44a87, 0x68581511, 0xdb0c2e0d, 0x64f98fa7, 0x47b5481d, 0xbefa4fa4];
61490      }
61491
61492      utils.inherits(SHA384, SHA512);
61493      module.exports = SHA384;
61494      SHA384.blockSize = 1024;
61495      SHA384.outSize = 384;
61496      SHA384.hmacStrength = 192;
61497      SHA384.padLength = 128;
61498
61499      SHA384.prototype._digest = function digest(enc) {
61500        if (enc === 'hex') return utils.toHex32(this.h.slice(0, 12), 'big');else return utils.split32(this.h.slice(0, 12), 'big');
61501      };
61502    }, {
61503      "../utils": 360,
61504      "./512": 358
61505    }],
61506    358: [function (require, module, exports) {
61507      'use strict';
61508
61509      var utils = require('../utils');
61510
61511      var common = require('../common');
61512
61513      var assert = require('minimalistic-assert');
61514
61515      var rotr64_hi = utils.rotr64_hi;
61516      var rotr64_lo = utils.rotr64_lo;
61517      var shr64_hi = utils.shr64_hi;
61518      var shr64_lo = utils.shr64_lo;
61519      var sum64 = utils.sum64;
61520      var sum64_hi = utils.sum64_hi;
61521      var sum64_lo = utils.sum64_lo;
61522      var sum64_4_hi = utils.sum64_4_hi;
61523      var sum64_4_lo = utils.sum64_4_lo;
61524      var sum64_5_hi = utils.sum64_5_hi;
61525      var sum64_5_lo = utils.sum64_5_lo;
61526      var BlockHash = common.BlockHash;
61527      var sha512_K = [0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd, 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc, 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019, 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118, 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe, 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2, 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1, 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694, 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3, 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65, 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483, 0x5cb0
vendor: 23,180 bytes, lines 61527-62306
61527a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5, 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210, 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4, 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725, 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70, 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926, 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df, 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8, 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b, 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001, 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30, 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910, 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8, 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53, 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8, 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb, 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3, 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60, 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec, 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9, 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b, 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207, 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178, 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6, 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b, 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493, 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c, 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a, 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817];
61528
61529      function SHA512() {
61530        if (!(this instanceof SHA512)) return new SHA512();
61531        BlockHash.call(this);
61532        this.h = [0x6a09e667, 0xf3bcc908, 0xbb67ae85, 0x84caa73b, 0x3c6ef372, 0xfe94f82b, 0xa54ff53a, 0x5f1d36f1, 0x510e527f, 0xade682d1, 0x9b05688c, 0x2b3e6c1f, 0x1f83d9ab, 0xfb41bd6b, 0x5be0cd19, 0x137e2179];
61533        this.k = sha512_K;
61534        this.W = new Array(160);
61535      }
61536
61537      utils.inherits(SHA512, BlockHash);
61538      module.exports = SHA512;
61539      SHA512.blockSize = 1024;
61540      SHA512.outSize = 512;
61541      SHA512.hmacStrength = 192;
61542      SHA512.padLength = 128;
61543
61544      SHA512.prototype._prepareBlock = function _prepareBlock(msg, start) {
61545        var W = this.W; // 32 x 32bit words
61546
61547        for (var i = 0; i < 32; i++) {
61548          W[i] = msg[start + i];
61549        }
61550
61551        for (; i < W.length; i += 2) {
61552          var c0_hi = g1_512_hi(W[i - 4], W[i - 3]); // i - 2
61553
61554          var c0_lo = g1_512_lo(W[i - 4], W[i - 3]);
61555          var c1_hi = W[i - 14]; // i - 7
61556
61557          var c1_lo = W[i - 13];
61558          var c2_hi = g0_512_hi(W[i - 30], W[i - 29]); // i - 15
61559
61560          var c2_lo = g0_512_lo(W[i - 30], W[i - 29]);
61561          var c3_hi = W[i - 32]; // i - 16
61562
61563          var c3_lo = W[i - 31];
61564          W[i] = sum64_4_hi(c0_hi, c0_lo, c1_hi, c1_lo, c2_hi, c2_lo, c3_hi, c3_lo);
61565          W[i + 1] = sum64_4_lo(c0_hi, c0_lo, c1_hi, c1_lo, c2_hi, c2_lo, c3_hi, c3_lo);
61566        }
61567      };
61568
61569      SHA512.prototype._update = function _update(msg, start) {
61570        this._prepareBlock(msg, start);
61571
61572        var W = this.W;
61573        var ah = this.h[0];
61574        var al = this.h[1];
61575        var bh = this.h[2];
61576        var bl = this.h[3];
61577        var ch = this.h[4];
61578        var cl = this.h[5];
61579        var dh = this.h[6];
61580        var dl = this.h[7];
61581        var eh = this.h[8];
61582        var el = this.h[9];
61583        var fh = this.h[10];
61584        var fl = this.h[11];
61585        var gh = this.h[12];
61586        var gl = this.h[13];
61587        var hh = this.h[14];
61588        var hl = this.h[15];
61589        assert(this.k.length === W.length);
61590
61591        for (var i = 0; i < W.length; i += 2) {
61592          var c0_hi = hh;
61593          var c0_lo = hl;
61594          var c1_hi = s1_512_hi(eh, el);
61595          var c1_lo = s1_512_lo(eh, el);
61596          var c2_hi = ch64_hi(eh, el, fh, fl, gh, gl);
61597          var c2_lo = ch64_lo(eh, el, fh, fl, gh, gl);
61598          var c3_hi = this.k[i];
61599          var c3_lo = this.k[i + 1];
61600          var c4_hi = W[i];
61601          var c4_lo = W[i + 1];
61602          var T1_hi = sum64_5_hi(c0_hi, c0_lo, c1_hi, c1_lo, c2_hi, c2_lo, c3_hi, c3_lo, c4_hi, c4_lo);
61603          var T1_lo = sum64_5_lo(c0_hi, c0_lo, c1_hi, c1_lo, c2_hi, c2_lo, c3_hi, c3_lo, c4_hi, c4_lo);
61604          c0_hi = s0_512_hi(ah, al);
61605          c0_lo = s0_512_lo(ah, al);
61606          c1_hi = maj64_hi(ah, al, bh, bl, ch, cl);
61607          c1_lo = maj64_lo(ah, al, bh, bl, ch, cl);
61608          var T2_hi = sum64_hi(c0_hi, c0_lo, c1_hi, c1_lo);
61609          var T2_lo = sum64_lo(c0_hi, c0_lo, c1_hi, c1_lo);
61610          hh = gh;
61611          hl = gl;
61612          gh = fh;
61613          gl = fl;
61614          fh = eh;
61615          fl = el;
61616          eh = sum64_hi(dh, dl, T1_hi, T1_lo);
61617          el = sum64_lo(dl, dl, T1_hi, T1_lo);
61618          dh = ch;
61619          dl = cl;
61620          ch = bh;
61621          cl = bl;
61622          bh = ah;
61623          bl = al;
61624          ah = sum64_hi(T1_hi, T1_lo, T2_hi, T2_lo);
61625          al = sum64_lo(T1_hi, T1_lo, T2_hi, T2_lo);
61626        }
61627
61628        sum64(this.h, 0, ah, al);
61629        sum64(this.h, 2, bh, bl);
61630        sum64(this.h, 4, ch, cl);
61631        sum64(this.h, 6, dh, dl);
61632        sum64(this.h, 8, eh, el);
61633        sum64(this.h, 10, fh, fl);
61634        sum64(this.h, 12, gh, gl);
61635        sum64(this.h, 14, hh, hl);
61636      };
61637
61638      SHA512.prototype._digest = function digest(enc) {
61639        if (enc === 'hex') return utils.toHex32(this.h, 'big');else return utils.split32(this.h, 'big');
61640      };
61641
61642      function ch64_hi(xh, xl, yh, yl, zh) {
61643        var r = xh & yh ^ ~xh & zh;
61644        if (r < 0) r += 0x100000000;
61645        return r;
61646      }
61647
61648      function ch64_lo(xh, xl, yh, yl, zh, zl) {
61649        var r = xl & yl ^ ~xl & zl;
61650        if (r < 0) r += 0x100000000;
61651        return r;
61652      }
61653
61654      function maj64_hi(xh, xl, yh, yl, zh) {
61655        var r = xh & yh ^ xh & zh ^ yh & zh;
61656        if (r < 0) r += 0x100000000;
61657        return r;
61658      }
61659
61660      function maj64_lo(xh, xl, yh, yl, zh, zl) {
61661        var r = xl & yl ^ xl & zl ^ yl & zl;
61662        if (r < 0) r += 0x100000000;
61663        return r;
61664      }
61665
61666      function s0_512_hi(xh, xl) {
61667        var c0_hi = rotr64_hi(xh, xl, 28);
61668        var c1_hi = rotr64_hi(xl, xh, 2); // 34
61669
61670        var c2_hi = rotr64_hi(xl, xh, 7); // 39
61671
61672        var r = c0_hi ^ c1_hi ^ c2_hi;
61673        if (r < 0) r += 0x100000000;
61674        return r;
61675      }
61676
61677      function s0_512_lo(xh, xl) {
61678        var c0_lo = rotr64_lo(xh, xl, 28);
61679        var c1_lo = rotr64_lo(xl, xh, 2); // 34
61680
61681        var c2_lo = rotr64_lo(xl, xh, 7); // 39
61682
61683        var r = c0_lo ^ c1_lo ^ c2_lo;
61684        if (r < 0) r += 0x100000000;
61685        return r;
61686      }
61687
61688      function s1_512_hi(xh, xl) {
61689        var c0_hi = rotr64_hi(xh, xl, 14);
61690        var c1_hi = rotr64_hi(xh, xl, 18);
61691        var c2_hi = rotr64_hi(xl, xh, 9); // 41
61692
61693        var r = c0_hi ^ c1_hi ^ c2_hi;
61694        if (r < 0) r += 0x100000000;
61695        return r;
61696      }
61697
61698      function s1_512_lo(xh, xl) {
61699        var c0_lo = rotr64_lo(xh, xl, 14);
61700        var c1_lo = rotr64_lo(xh, xl, 18);
61701        var c2_lo = rotr64_lo(xl, xh, 9); // 41
61702
61703        var r = c0_lo ^ c1_lo ^ c2_lo;
61704        if (r < 0) r += 0x100000000;
61705        return r;
61706      }
61707
61708      function g0_512_hi(xh, xl) {
61709        var c0_hi = rotr64_hi(xh, xl, 1);
61710        var c1_hi = rotr64_hi(xh, xl, 8);
61711        var c2_hi = shr64_hi(xh, xl, 7);
61712        var r = c0_hi ^ c1_hi ^ c2_hi;
61713        if (r < 0) r += 0x100000000;
61714        return r;
61715      }
61716
61717      function g0_512_lo(xh, xl) {
61718        var c0_lo = rotr64_lo(xh, xl, 1);
61719        var c1_lo = rotr64_lo(xh, xl, 8);
61720        var c2_lo = shr64_lo(xh, xl, 7);
61721        var r = c0_lo ^ c1_lo ^ c2_lo;
61722        if (r < 0) r += 0x100000000;
61723        return r;
61724      }
61725
61726      function g1_512_hi(xh, xl) {
61727        var c0_hi = rotr64_hi(xh, xl, 19);
61728        var c1_hi = rotr64_hi(xl, xh, 29); // 61
61729
61730        var c2_hi = shr64_hi(xh, xl, 6);
61731        var r = c0_hi ^ c1_hi ^ c2_hi;
61732        if (r < 0) r += 0x100000000;
61733        return r;
61734      }
61735
61736      function g1_512_lo(xh, xl) {
61737        var c0_lo = rotr64_lo(xh, xl, 19);
61738        var c1_lo = rotr64_lo(xl, xh, 29); // 61
61739
61740        var c2_lo = shr64_lo(xh, xl, 6);
61741        var r = c0_lo ^ c1_lo ^ c2_lo;
61742        if (r < 0) r += 0x100000000;
61743        return r;
61744      }
61745    }, {
61746      "../common": 350,
61747      "../utils": 360,
61748      "minimalistic-assert": 414
61749    }],
61750    359: [function (require, module, exports) {
61751      'use strict';
61752
61753      var utils = require('../utils');
61754
61755      var rotr32 = utils.rotr32;
61756
61757      function ft_1(s, x, y, z) {
61758        if (s === 0) return ch32(x, y, z);
61759        if (s === 1 || s === 3) return p32(x, y, z);
61760        if (s === 2) return maj32(x, y, z);
61761      }
61762
61763      exports.ft_1 = ft_1;
61764
61765      function ch32(x, y, z) {
61766        return x & y ^ ~x & z;
61767      }
61768
61769      exports.ch32 = ch32;
61770
61771      function maj32(x, y, z) {
61772        return x & y ^ x & z ^ y & z;
61773      }
61774
61775      exports.maj32 = maj32;
61776
61777      function p32(x, y, z) {
61778        return x ^ y ^ z;
61779      }
61780
61781      exports.p32 = p32;
61782
61783      function s0_256(x) {
61784        return rotr32(x, 2) ^ rotr32(x, 13) ^ rotr32(x, 22);
61785      }
61786
61787      exports.s0_256 = s0_256;
61788
61789      function s1_256(x) {
61790        return rotr32(x, 6) ^ rotr32(x, 11) ^ rotr32(x, 25);
61791      }
61792
61793      exports.s1_256 = s1_256;
61794
61795      function g0_256(x) {
61796        return rotr32(x, 7) ^ rotr32(x, 18) ^ x >>> 3;
61797      }
61798
61799      exports.g0_256 = g0_256;
61800
61801      function g1_256(x) {
61802        return rotr32(x, 17) ^ rotr32(x, 19) ^ x >>> 10;
61803      }
61804
61805      exports.g1_256 = g1_256;
61806    }, {
61807      "../utils": 360
61808    }],
61809    360: [function (require, module, exports) {
61810      'use strict';
61811
61812      var assert = require('minimalistic-assert');
61813
61814      var inherits = require('inherits');
61815
61816      exports.inherits = inherits;
61817
61818      function isSurrogatePair(msg, i) {
61819        if ((msg.charCodeAt(i) & 0xFC00) !== 0xD800) {
61820          return false;
61821        }
61822
61823        if (i < 0 || i + 1 >= msg.length) {
61824          return false;
61825        }
61826
61827        return (msg.charCodeAt(i + 1) & 0xFC00) === 0xDC00;
61828      }
61829
61830      function toArray(msg, enc) {
61831        if (Array.isArray(msg)) return msg.slice();
61832        if (!msg) return [];
61833        var res = [];
61834
61835        if (typeof msg === 'string') {
61836          if (!enc) {
61837            // Inspired by stringToUtf8ByteArray() in closure-library by Google
61838            // https://github.com/google/closure-library/blob/8598d87242af59aac233270742c8984e2b2bdbe0/closure/goog/crypt/crypt.js#L117-L143
61839            // Apache License 2.0
61840            // https://github.com/google/closure-library/blob/master/LICENSE
61841            var p = 0;
61842
61843            for (var i = 0; i < msg.length; i++) {
61844              var c = msg.charCodeAt(i);
61845
61846              if (c < 128) {
61847                res[p++] = c;
61848              } else if (c < 2048) {
61849                res[p++] = c >> 6 | 192;
61850                res[p++] = c & 63 | 128;
61851              } else if (isSurrogatePair(msg, i)) {
61852                c = 0x10000 + ((c & 0x03FF) << 10) + (msg.charCodeAt(++i) & 0x03FF);
61853                res[p++] = c >> 18 | 240;
61854                res[p++] = c >> 12 & 63 | 128;
61855                res[p++] = c >> 6 & 63 | 128;
61856                res[p++] = c & 63 | 128;
61857              } else {
61858                res[p++] = c >> 12 | 224;
61859                res[p++] = c >> 6 & 63 | 128;
61860                res[p++] = c & 63 | 128;
61861              }
61862            }
61863          } else if (enc === 'hex') {
61864            msg = msg.replace(/[^a-z0-9]+/ig, '');
61865            if (msg.length % 2 !== 0) msg = '0' + msg;
61866
61867            for (i = 0; i < msg.length; i += 2) {
61868              res.push(parseInt(msg[i] + msg[i + 1], 16));
61869            }
61870          }
61871        } else {
61872          for (i = 0; i < msg.length; i++) {
61873            res[i] = msg[i] | 0;
61874          }
61875        }
61876
61877        return res;
61878      }
61879
61880      exports.toArray = toArray;
61881
61882      function toHex(msg) {
61883        var res = '';
61884
61885        for (var i = 0; i < msg.length; i++) {
61886          res += zero2(msg[i].toString(16));
61887        }
61888
61889        return res;
61890      }
61891
61892      exports.toHex = toHex;
61893
61894      function htonl(w) {
61895        var res = w >>> 24 | w >>> 8 & 0xff00 | w << 8 & 0xff0000 | (w & 0xff) << 24;
61896        return res >>> 0;
61897      }
61898
61899      exports.htonl = htonl;
61900
61901      function toHex32(msg, endian) {
61902        var res = '';
61903
61904        for (var i = 0; i < msg.length; i++) {
61905          var w = msg[i];
61906          if (endian === 'little') w = htonl(w);
61907          res += zero8(w.toString(16));
61908        }
61909
61910        return res;
61911      }
61912
61913      exports.toHex32 = toHex32;
61914
61915      function zero2(word) {
61916        if (word.length === 1) return '0' + word;else return word;
61917      }
61918
61919      exports.zero2 = zero2;
61920
61921      function zero8(word) {
61922        if (word.length === 7) return '0' + word;else if (word.length === 6) return '00' + word;else if (word.length === 5) return '000' + word;else if (word.length === 4) return '0000' + word;else if (word.length === 3) return '00000' + word;else if (word.length === 2) return '000000' + word;else if (word.length === 1) return '0000000' + word;else return word;
61923      }
61924
61925      exports.zero8 = zero8;
61926
61927      function join32(msg, start, end, endian) {
61928        var len = end - start;
61929        assert(len % 4 === 0);
61930        var res = new Array(len / 4);
61931
61932        for (var i = 0, k = start; i < res.length; i++, k += 4) {
61933          var w;
61934          if (endian === 'big') w = msg[k] << 24 | msg[k + 1] << 16 | msg[k + 2] << 8 | msg[k + 3];else w = msg[k + 3] << 24 | msg[k + 2] << 16 | msg[k + 1] << 8 | msg[k];
61935          res[i] = w >>> 0;
61936        }
61937
61938        return res;
61939      }
61940
61941      exports.join32 = join32;
61942
61943      function split32(msg, endian) {
61944        var res = new Array(msg.length * 4);
61945
61946        for (var i = 0, k = 0; i < msg.length; i++, k += 4) {
61947          var m = msg[i];
61948
61949          if (endian === 'big') {
61950            res[k] = m >>> 24;
61951            res[k + 1] = m >>> 16 & 0xff;
61952            res[k + 2] = m >>> 8 & 0xff;
61953            res[k + 3] = m & 0xff;
61954          } else {
61955            res[k + 3] = m >>> 24;
61956            res[k + 2] = m >>> 16 & 0xff;
61957            res[k + 1] = m >>> 8 & 0xff;
61958            res[k] = m & 0xff;
61959          }
61960        }
61961
61962        return res;
61963      }
61964
61965      exports.split32 = split32;
61966
61967      function rotr32(w, b) {
61968        return w >>> b | w << 32 - b;
61969      }
61970
61971      exports.rotr32 = rotr32;
61972
61973      function rotl32(w, b) {
61974        return w << b | w >>> 32 - b;
61975      }
61976
61977      exports.rotl32 = rotl32;
61978
61979      function sum32(a, b) {
61980        return a + b >>> 0;
61981      }
61982
61983      exports.sum32 = sum32;
61984
61985      function sum32_3(a, b, c) {
61986        return a + b + c >>> 0;
61987      }
61988
61989      exports.sum32_3 = sum32_3;
61990
61991      function sum32_4(a, b, c, d) {
61992        return a + b + c + d >>> 0;
61993      }
61994
61995      exports.sum32_4 = sum32_4;
61996
61997      function sum32_5(a, b, c, d, e) {
61998        return a + b + c + d + e >>> 0;
61999      }
62000
62001      exports.sum32_5 = sum32_5;
62002
62003      function sum64(buf, pos, ah, al) {
62004        var bh = buf[pos];
62005        var bl = buf[pos + 1];
62006        var lo = al + bl >>> 0;
62007        var hi = (lo < al ? 1 : 0) + ah + bh;
62008        buf[pos] = hi >>> 0;
62009        buf[pos + 1] = lo;
62010      }
62011
62012      exports.sum64 = sum64;
62013
62014      function sum64_hi(ah, al, bh, bl) {
62015        var lo = al + bl >>> 0;
62016        var hi = (lo < al ? 1 : 0) + ah + bh;
62017        return hi >>> 0;
62018      }
62019
62020      exports.sum64_hi = sum64_hi;
62021
62022      function sum64_lo(ah, al, bh, bl) {
62023        var lo = al + bl;
62024        return lo >>> 0;
62025      }
62026
62027      exports.sum64_lo = sum64_lo;
62028
62029      function sum64_4_hi(ah, al, bh, bl, ch, cl, dh, dl) {
62030        var carry = 0;
62031        var lo = al;
62032        lo = lo + bl >>> 0;
62033        carry += lo < al ? 1 : 0;
62034        lo = lo + cl >>> 0;
62035        carry += lo < cl ? 1 : 0;
62036        lo = lo + dl >>> 0;
62037        carry += lo < dl ? 1 : 0;
62038        var hi = ah + bh + ch + dh + carry;
62039        return hi >>> 0;
62040      }
62041
62042      exports.sum64_4_hi = sum64_4_hi;
62043
62044      function sum64_4_lo(ah, al, bh, bl, ch, cl, dh, dl) {
62045        var lo = al + bl + cl + dl;
62046        return lo >>> 0;
62047      }
62048
62049      exports.sum64_4_lo = sum64_4_lo;
62050
62051      function sum64_5_hi(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {
62052        var carry = 0;
62053        var lo = al;
62054        lo = lo + bl >>> 0;
62055        carry += lo < al ? 1 : 0;
62056        lo = lo + cl >>> 0;
62057        carry += lo < cl ? 1 : 0;
62058        lo = lo + dl >>> 0;
62059        carry += lo < dl ? 1 : 0;
62060        lo = lo + el >>> 0;
62061        carry += lo < el ? 1 : 0;
62062        var hi = ah + bh + ch + dh + eh + carry;
62063        return hi >>> 0;
62064      }
62065
62066      exports.sum64_5_hi = sum64_5_hi;
62067
62068      function sum64_5_lo(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {
62069        var lo = al + bl + cl + dl + el;
62070        return lo >>> 0;
62071      }
62072
62073      exports.sum64_5_lo = sum64_5_lo;
62074
62075      function rotr64_hi(ah, al, num) {
62076        var r = al << 32 - num | ah >>> num;
62077        return r >>> 0;
62078      }
62079
62080      exports.rotr64_hi = rotr64_hi;
62081
62082      function rotr64_lo(ah, al, num) {
62083        var r = ah << 32 - num | al >>> num;
62084        return r >>> 0;
62085      }
62086
62087      exports.rotr64_lo = rotr64_lo;
62088
62089      function shr64_hi(ah, al, num) {
62090        return ah >>> num;
62091      }
62092
62093      exports.shr64_hi = shr64_hi;
62094
62095      function shr64_lo(ah, al, num) {
62096        var r = ah << 32 - num | al >>> num;
62097        return r >>> 0;
62098      }
62099
62100      exports.shr64_lo = shr64_lo;
62101    }, {
62102      "inherits": 364,
62103      "minimalistic-assert": 414
62104    }],
62105    361: [function (require, module, exports) {
62106      'use strict';
62107
62108      var hash = require('hash.js');
62109
62110      var utils = require('minimalistic-crypto-utils');
62111
62112      var assert = require('minimalistic-assert');
62113
62114      function HmacDRBG(options) {
62115        if (!(this instanceof HmacDRBG)) return new HmacDRBG(options);
62116        this.hash = options.hash;
62117        this.predResist = !!options.predResist;
62118        this.outLen = this.hash.outSize;
62119        this.minEntropy = options.minEntropy || this.hash.hmacStrength;
62120        this._reseed = null;
62121        this.reseedInterval = null;
62122        this.K = null;
62123        this.V = null;
62124        var entropy = utils.toArray(options.entropy, options.entropyEnc || 'hex');
62125        var nonce = utils.toArray(options.nonce, options.nonceEnc || 'hex');
62126        var pers = utils.toArray(options.pers, options.persEnc || 'hex');
62127        assert(entropy.length >= this.minEntropy / 8, 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits');
62128
62129        this._init(entropy, nonce, pers);
62130      }
62131
62132      module.exports = HmacDRBG;
62133
62134      HmacDRBG.prototype._init = function init(entropy, nonce, pers) {
62135        var seed = entropy.concat(nonce).concat(pers);
62136        this.K = new Array(this.outLen / 8);
62137        this.V = new Array(this.outLen / 8);
62138
62139        for (var i = 0; i < this.V.length; i++) {
62140          this.K[i] = 0x00;
62141          this.V[i] = 0x01;
62142        }
62143
62144        this._update(seed);
62145
62146        this._reseed = 1;
62147        this.reseedInterval = 0x1000000000000; // 2^48
62148      };
62149
62150      HmacDRBG.prototype._hmac = function hmac() {
62151        return new hash.hmac(this.hash, this.K);
62152      };
62153
62154      HmacDRBG.prototype._update = function update(seed) {
62155        var kmac = this._hmac().update(this.V).update([0x00]);
62156
62157        if (seed) kmac = kmac.update(seed);
62158        this.K = kmac.digest();
62159        this.V = this._hmac().update(this.V).digest();
62160        if (!seed) return;
62161        this.K = this._hmac().update(this.V).update([0x01]).update(seed).digest();
62162        this.V = this._hmac().update(this.V).digest();
62163      };
62164
62165      HmacDRBG.prototype.reseed = function reseed(entropy, entropyEnc, add, addEnc) {
62166        // Optional entropy enc
62167        if (typeof entropyEnc !== 'string') {
62168          addEnc = add;
62169          add = entropyEnc;
62170          entropyEnc = null;
62171        }
62172
62173        entropy = utils.toArray(entropy, entropyEnc);
62174        add = utils.toArray(add, addEnc);
62175        assert(entropy.length >= this.minEntropy / 8, 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits');
62176
62177        this._update(entropy.concat(add || []));
62178
62179        this._reseed = 1;
62180      };
62181
62182      HmacDRBG.prototype.generate = function generate(len, enc, add, addEnc) {
62183        if (this._reseed > this.reseedInterval) throw new Error('Reseed is required'); // Optional encoding
62184
62185        if (typeof enc !== 'string') {
62186          addEnc = add;
62187          add = enc;
62188          enc = null;
62189        } // Optional additional data
62190
62191
62192        if (add) {
62193          add = utils.toArray(add, addEnc || 'hex');
62194
62195          this._update(add);
62196        }
62197
62198        var temp = [];
62199
62200        while (temp.length < len) {
62201          this.V = this._hmac().update(this.V).digest();
62202          temp = temp.concat(this.V);
62203        }
62204
62205        var res = temp.slice(0, len);
62206
62207        this._update(add);
62208
62209        this._reseed++;
62210        return utils.encode(res, enc);
62211      };
62212    }, {
62213      "hash.js": 349,
62214      "minimalistic-assert": 414,
62215      "minimalistic-crypto-utils": 415
62216    }],
62217    362: [function (require, module, exports) {
62218      exports.read = function (buffer, offset, isLE, mLen, nBytes) {
62219        var e, m;
62220        var eLen = nBytes * 8 - mLen - 1;
62221        var eMax = (1 << eLen) - 1;
62222        var eBias = eMax >> 1;
62223        var nBits = -7;
62224        var i = isLE ? nBytes - 1 : 0;
62225        var d = isLE ? -1 : 1;
62226        var s = buffer[offset + i];
62227        i += d;
62228        e = s & (1 << -nBits) - 1;
62229        s >>= -nBits;
62230        nBits += eLen;
62231
62232        for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
62233
62234        m = e & (1 << -nBits) - 1;
62235        e >>= -nBits;
62236        nBits += mLen;
62237
62238        for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
62239
62240        if (e === 0) {
62241          e = 1 - eBias;
62242        } else if (e === eMax) {
62243          return m ? NaN : (s ? -1 : 1) * Infinity;
62244        } else {
62245          m = m + Math.pow(2, mLen);
62246          e = e - eBias;
62247        }
62248
62249        return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
62250      };
62251
62252      exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
62253        var e, m, c;
62254        var eLen = nBytes * 8 - mLen - 1;
62255        var eMax = (1 << eLen) - 1;
62256        var eBias = eMax >> 1;
62257        var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
62258        var i = isLE ? 0 : nBytes - 1;
62259        var d = isLE ? 1 : -1;
62260        var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
62261        value = Math.abs(value);
62262
62263        if (isNaN(value) || value === Infinity) {
62264          m = isNaN(value) ? 1 : 0;
62265          e = eMax;
62266        } else {
62267          e = Math.floor(Math.log(value) / Math.LN2);
62268
62269          if (value * (c = Math.pow(2, -e)) < 1) {
62270            e--;
62271            c *= 2;
62272          }
62273
62274          if (e + eBias >= 1) {
62275            value += rt / c;
62276          } else {
62277            value += rt * Math.pow(2, 1 - eBias);
62278          }
62279
62280          if (value * c >= 2) {
62281            e++;
62282            c /= 2;
62283          }
62284
62285          if (e + eBias >= eMax) {
62286            m = 0;
62287            e = eMax;
62288          } else if (e + eBias >= 1) {
62289            m = (value * c - 1) * Math.pow(2, mLen);
62290            e = e + eBias;
62291          } else {
62292            m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
62293            e = 0;
62294          }
62295        }
62296
62297        for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
62298
62299        e = e << mLen | m;
62300        eLen += mLen;
62301
62302        for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
62303
62304        buffer[offset + i - d] |= s * 128;
62305      };
62306    }, {}],
62307    363: [function (require, module, exports) {
62308      (function (global) {
62309        'use strict';
62310
62311        var Mutation = global.MutationObserver || global.WebKitMutationObserver;
62312        var scheduleDrain;
62313        {
62314          if (Mutation) {
62315            var called = 0;
62316            var observer = new Mutation(nextTick);
62317            var element = global.document.createTextNode('');
62318            observer.observe(element, {
62319              characterData: true
62320            });
62321
62322            scheduleDrain = function scheduleDrain() {
62323              element.data = called = ++called % 2;
62324            };
62325          } else if (!global.setImmediate && typeof global.MessageChannel !== 'undefined') {
62326            var channel = new global.MessageChannel();
62327            channel.port1.onmessage = nextTick;
62328
62329            scheduleDrain = function scheduleDrain() {
62330              channel.port2.postMessage(0);
62331            };
62332          } else if ('document' in global && 'onreadystatechange' in global.document.createElement('script')) {
62333            scheduleDrain = function scheduleDrain() {
62334              // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
62335              // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
62336              var scriptEl = global.document.createElement('script');
62337
62338              scriptEl.onreadystatechange = function () {
62339                nextTick();
62340                scriptEl.onreadystatechange = null;
62341                scriptEl.parentNode.removeChild(scriptEl);
62342                scriptEl = null;
62343              };
62344
62345              global.document.documentElement.appendChild(scriptEl);
62346            };
62347          } else {
62348            scheduleDrain = function scheduleDrain() {
62349              setTimeout(nextTick, 0);
62350            };
62351          }
62352        }
62353        var draining;
62354        var queue = []; //named nextTick for less confusing stack traces
62355
62356        function nextTick() {
62357          draining = true;
62358          var i, oldQueue;
62359          var len = queue.length;
62360
62361          while (len) {
62362            oldQueue = queue;
62363            queue = [];
62364            i = -1;
62365
62366            while (++i < len) {
62367              oldQueue[i]();
62368            }
62369
62370            len = queue.length;
62371          }
62372
62373          draining = false;
62374        }
62375
62376        module.exports = immediate;
62377
62378        function immediate(task) {
62379          if (queue.push(task) === 1 && !draining) {
62380            scheduleDrain();
62381          }
62382        }
62383      }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
62384    }, {}],
62385    364: [function (require, module, exports) {
62386      if (typeof Object.create === 'function') {
62387        // implementation from standard node.js 'util' module
62388        module.exports = function inherits(ctor, superCtor) {
62389          if (superCtor) {
62390            ctor.super_ = superCtor;
62391            ctor.prototype = Object.create(superCtor.prototype, {
62392              constructor: {
62393                value: ctor,
62394                enumerable: false,
62395                writable: true,
62396                configurable: true
62397              }
62398            });
62399          }
62400        };
62401      } else {
62402        // old school shim for old browsers
62403        module.exports = function inherits(ctor, superCtor) {
62404          if (superCtor) {
62405            ctor.super_ = superCtor;
62406
62407            var TempCtor = function TempCtor() {};
62408
62409            TempCtor.prototype = superCtor.prototype;
62410            ctor.prototype = new TempCtor();
62411            ctor.prototype.constructor = ctor;
62412          }
62413        };
62414      }
62415    }, {}],
62416    365: [function (require, module, exports) {
62417      /*!
62418       * Determine if an object is a Buffer
62419       *
62420       * @author   Feross Aboukhadijeh <https://feross.org>
62421       * @license  MIT
62422       */
62423      // The _isBuffer check is for Safari 5-7 support, because it's missing
62424      // Object.prototype.constructor. Remove this eventually
62425      module.exports = function (obj) {
62426        return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer);
62427      };
62428
62429      function isBuffer(obj) {
62430        return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj);
62431      } // For Node v0.10 support. Remove this eventually.
62432
62433
62434      function isSlowBuffer(obj) {
62435        return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0));
62436      }
62437    }, {}],
62438    366: [function (require, module, exports) {
62439      var toString = {}.toString;
62440
62441      module.exports = Array.isArray || function (arr) {
62442        return toString.call(arr) == '[object Array]';
62443      };
62444    }, {}],
62445    367: [function (require, module, exports) {
62446      'use strict';
62447
62448      var utils = require('./utils');
62449
62450      var support = require('./support'); // private property
62451
62452
62453      var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; // public method for encoding
62454
62455      exports.encode = function (input) {
62456        var output = [];
62457        var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
62458        var i = 0,
62459            len = input.length,
62460            remainingBytes = len;
62461        var isArray = utils.getTypeOf(input) !== "string";
62462
62463        while (i < input.length) {
62464          remainingBytes = len - i;
62465
62466          if (!isArray) {
62467            chr1 = input.charCodeAt(i++);
62468            chr2 = i < len ? input.charCodeAt(i++) : 0;
62469            chr3 = i < len ? input.charCodeAt(i++) : 0;
62470          } else {
62471            chr1 = input[i++];
62472            chr2 = i < len ? input[i++] : 0;
62473            chr3 = i < len ? input[i++] : 0;
62474          }
62475
62476          enc1 = chr1 >> 2;
62477          enc2 = (chr1 & 3) << 4 | chr2 >> 4;
62478          enc3 = remainingBytes > 1 ? (chr2 & 15) << 2 | chr3 >> 6 : 64;
62479          enc4 = remainingBytes > 2 ? chr3 & 63 : 64;
62480          output.push(_keyStr.charAt(enc1) + _keyStr.charAt(enc2) + _keyStr.charAt(enc3) + _keyStr.charAt(enc4));
62481        }
62482
62483        return output.join("");
62484      }; // public method for decoding
62485
62486
62487      exports.decode = function (input) {
62488        var chr1, chr2, chr3;
62489        var enc1, enc2, enc3, enc4;
62490        var i = 0,
62491            resultIndex = 0;
62492        var dataUrlPrefix = "data:";
62493
62494        if (input.substr(0, dataUrlPrefix.length) === dataUrlPrefix) {
62495          // This is a common error: people give a data url
62496          // (data:image/png;base64,iVBOR...) with a {base64: true} and
62497          // wonders why things don't work.
62498          // We can detect that the string input looks like a data url but we
62499          // *can't* be sure it is one: removing everything up to the comma would
62500          // be too dangerous.
62501          throw new Error("Invalid base64 input, it looks like a data url.");
62502        }
62503
62504        input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
62505        var totalLength = input.length * 3 / 4;
62506
62507        if (input.charAt(input.length - 1) === _keyStr.charAt(64)) {
62508          totalLength--;
62509        }
62510
62511        if (input.charAt(input.length - 2) === _keyStr.charAt(64)) {
62512          totalLength--;
62513        }
62514
62515        if (totalLength % 1 !== 0) {
62516          // totalLength is not an integer, the length does not match a valid
62517          // base64 content. That can happen if:
62518          // - the input is not a base64 content
62519          // - the input is *almost* a base64 content, with a extra chars at the
62520          //   beginning or at the end
62521          // - the input uses a base64 variant (base64url for example)
62522          throw new Error("Invalid base64 input, bad content length.");
62523        }
62524
62525        var output;
62526
62527        if (support.uint8array) {
62528          output = new Uint8Array(totalLength | 0);
62529        } else {
62530          output = new Array(totalLength | 0);
62531        }
62532
62533        while (i < input.length) {
62534          enc1 = _keyStr.indexOf(input.charAt(i++));
62535          enc2 = _keyStr.indexOf(input.charAt(i++));
62536          enc3 = _keyStr.indexOf(input.charAt(i++));
62537          enc4 = _keyStr.indexOf(input.charAt(i++));
62538          chr1 = enc1 << 2 | enc2 >> 4;
62539          chr2 = (enc2 & 15) << 4 | enc3 >> 2;
62540          chr3 = (enc3 & 3) << 6 | enc4;
62541          output[resultIndex++] = chr1;
62542
62543          if (enc3 !== 64) {
62544            output[resultIndex++] = chr2;
62545          }
62546
62547          if (enc4 !== 64) {
62548            output[resultIndex++] = chr3;
62549          }
62550        }
62551
62552        return output;
62553      };
62554    }, {
62555      "./support": 396,
62556      "./utils": 398
62557    }],
62558    368: [function (require, module, exports) {
62559      'use strict';
62560
62561      var external = require("./external");
62562
62563      var DataWorker = require('./stream/DataWorker');
62564
62565      var DataLengthProbe = require('./stream/DataLengthProbe');
62566
62567      var Crc32Probe = require('./stream/Crc32Probe');
62568
62569      var DataLengthProbe = require('./stream/DataLengthProbe');
62570      /**
62571       * Represent a compressed object, with everything needed to decompress it.
62572       * @constructor
62573       * @param {number} compressedSize the size of the data compressed.
62574       * @param {number} uncompressedSize the size of the data after decompression.
62575       * @param {number} crc32 the crc32 of the decompressed file.
62576       * @param {object} compression the type of compression, see lib/compressions.js.
62577       * @param {String|ArrayBuffer|Uint8Array|Buffer} data the compressed data.
62578       */
62579
62580
62581      function CompressedObject(compressedSize, uncompressedSize, crc32, compression, data) {
62582        this.compressedSize = compressedSize;
62583        this.uncompressedSize = uncompressedSize;
62584        this.crc32 = crc32;
62585        this.compression = compression;
62586        this.compressedContent = data;
62587      }
62588
62589      CompressedObject.prototype = {
62590        /**
62591         * Create a worker to get the uncompressed content.
62592         * @return {GenericWorker} the worker.
62593         */
62594        getContentWorker: function getContentWorker() {
62595          var worker = new DataWorker(external.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new DataLengthProbe("data_length"));
62596          var that = this;
62597          worker.on("end", function () {
62598            if (this.streamInfo['data_length'] !== that.uncompressedSize) {
62599              throw new Error("Bug : uncompressed data size mismatch");
62600            }
62601          });
62602          return worker;
62603        },
62604
62605        /**
62606         * Create a worker to get the compressed content.
62607         * @return {GenericWorker} the worker.
62608         */
62609        getCompressedWorker: function getCompressedWorker() {
62610          return new DataWorker(external.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize", this.compressedSize).withStreamInfo("uncompressedSize", this.uncompressedSize).withStreamInfo("crc32", this.crc32).withStreamInfo("compression", this.compression);
62611        }
62612      };
62613      /**
62614       * Chain the given worker with other workers to compress the content with the
62615       * given compression.
62616       * @param {GenericWorker} uncompressedWorker the worker to pipe.
62617       * @param {Object} compression the compression object.
62618       * @param {Object} compressionOptions the options to use when compressing.
62619       * @return {GenericWorker} the new worker compressing the content.
62620       */
62621
62622      CompressedObject.createWorkerFrom = function (uncompressedWorker, compression, compressionOptions) {
62623        return uncompressedWorker.pipe(new Crc32Probe()).pipe(new DataLengthProbe("uncompressedSize")).pipe(compression.compressWorker(compressionOptions)).pipe(new DataLengthProbe("compressedSize")).withStreamInfo("compression", compression);
62624      };
62625
62626      module.exports = CompressedObject;
62627    }, {
62628      "./external": 372,
62629      "./stream/Crc32Probe": 391,
62630      "./stream/DataLengthProbe": 392,
62631      "./stream/DataWorker": 393
62632    }],
62633    369: [function (require, module, exports) {
62634      'use strict';
62635
62636      var GenericWorker = require("./stream/GenericWorker");
62637
62638      exports.STORE = {
62639        magic: "\x00\x00",
62640        compressWorker: function compressWorker(compressionOptions) {
62641          return new GenericWorker("STORE compression");
62642        },
62643        uncompressWorker: function uncompressWorker() {
62644          return new GenericWorker("STORE decompression");
62645        }
62646      };
62647      exports.DEFLATE = require('./flate');
62648    }, {
62649      "./flate": 373,
62650      "./stream/GenericWorker": 394
62651    }],
62652    370: [function (require, module, exports) {
62653      'use strict';
62654
62655      var utils = require('./utils');
62656      /**
62657       * The following functions come from pako, from pako/lib/zlib/crc32.js
62658       * released under the MIT license, see pako https://github.com/nodeca/pako/
62659       */
62660      // Use ordinary array, since untyped makes no boost here
62661
62662
62663      function makeTable() {
62664        var c,
62665            table = [];
62666
62667        for (var n = 0; n < 256; n++) {
62668          c = n;
62669
62670          for (var k = 0; k < 8; k++) {
62671            c = c & 1 ? 0xEDB88320 ^ c >>> 1 : c >>> 1;
62672          }
62673
62674          table[n] = c;
62675        }
62676
62677        return table;
62678      } // Create table on load. Just 255 signed longs. Not a problem.
62679
62680
62681      var crcTable = makeTable();
62682
62683      function crc32(crc, buf, len, pos) {
62684        var t = crcTable,
62685            end = pos + len;
62686        crc = crc ^ -1;
62687
62688        for (var i = pos; i < end; i++) {
62689          crc = crc >>> 8 ^ t[(crc ^ buf[i]) & 0xFF];
62690        }
62691
62692        return crc ^ -1; // >>> 0;
62693      } // That's all for the pako functions.
62694
62695      /**
62696       * Compute the crc32 of a string.
62697       * This is almost the same as the function crc32, but for strings. Using the
62698       * same function for the two use cases leads to horrible performances.
62699       * @param {Number} crc the starting value of the crc.
62700       * @param {String} str the string to use.
62701       * @param {Number} len the length of the string.
62702       * @param {Number} pos the starting position for the crc32 computation.
62703       * @return {Number} the computed crc32.
62704       */
62705
62706
62707      function crc32str(crc, str, len, pos) {
62708        var t = crcTable,
62709            end = pos + len;
62710        crc = crc ^ -1;
62711
62712        for (var i = pos; i < end; i++) {
62713          crc = crc >>> 8 ^ t[(crc ^ str.charCodeAt(i)) & 0xFF];
62714        }
62715
62716        return crc ^ -1; // >>> 0;
62717      }
62718
62719      module.exports = function crc32wrapper(input, crc) {
62720        if (typeof input === "undefined" || !input.length) {
62721          return 0;
62722        }
62723
62724        var isArray = utils.getTypeOf(input) !== "string";
62725
62726        if (isArray) {
62727          return crc32(crc | 0, input, input.length, 0);
62728        } else {
62729          return crc32str(crc | 0, input, input.length, 0);
62730        }
62731      };
62732    }, {
62733      "./utils": 398
62734    }],
62735    371: [function (require, module, exports) {
62736      'use strict';
62737
62738      exports.base64 = false;
62739      exports.binary = false;
62740      exports.dir = false;
62741      exports.createFolders = true;
62742      exports.date = null;
62743      exports.compression = null;
62744      exports.compressionOptions = null;
62745      exports.comment = null;
62746      exports.unixPermissions = null;
62747      exports.dosPermissions = null;
62748    }, {}],
62749    372: [function (require, module, exports) {
62750      /* global Promise */
62751      'use strict'; // load the global object first:
62752      // - it should be better integrated in the system (unhandledRejection in node)
62753      // - the environment may have a custom Promise implementation (see zone.js)
62754
62755      var ES6Promise = null;
62756
62757      if (typeof Promise !== "undefined") {
62758        ES6Promise = Promise;
62759      } else {
62760        ES6Promise = require("lie");
62761      }
62762      /**
62763       * Let the user use/change some implementations.
62764       */
62765
62766
62767      module.exports = {
62768        Promise: ES6Promise
62769      };
62770    }, {
62771      "lie": 402
62772    }],
62773    373: [function (require, module, exports) {
62774      'use strict';
62775
62776      var USE_TYPEDARRAY = typeof Uint8Array !== 'undefined' && typeof Uint16Array !== 'undefined' && typeof Uint32Array !== 'undefined';
62777
62778      var pako = require("pako");
62779
62780      var utils = require("./utils");
62781
62782      var GenericWorker = require("./stream/GenericWorker");
62783
62784      var ARRAY_TYPE = USE_TYPEDARRAY ? "uint8array" : "array";
62785      exports.magic = "\x08\x00";
62786      /**
62787       * Create a worker that uses pako to inflate/deflate.
62788       * @constructor
62789       * @param {String} action the name of the pako function to call : either "Deflate" or "Inflate".
62790       * @param {Object} options the options to use when (de)compressing.
62791       */
62792
62793      function FlateWorker(action, options) {
62794        GenericWorker.call(this, "FlateWorker/" + action);
62795        this._pako = null;
62796        this._pakoAction = action;
62797        this._pakoOptions = options; // the `meta` object from the last chunk received
62798        // this allow this worker to pass around metadata
62799
62800        this.meta = {};
62801      }
62802
62803      utils.inherits(FlateWorker, GenericWorker);
62804      /**
62805       * @see GenericWorker.processChunk
62806       */
62807
62808      FlateWorker.prototype.processChunk = function (chunk) {
62809        this.meta = chunk.meta;
62810
62811        if (this._pako === null) {
62812          this._createPako();
62813        }
62814
62815        this._pako.push(utils.transformTo(ARRAY_TYPE, chunk.data), false);
62816      };
62817      /**
62818       * @see GenericWorker.flush
62819       */
62820
62821
62822      FlateWorker.prototype.flush = function () {
62823        GenericWorker.prototype.flush.call(this);
62824
62825        if (this._pako === null) {
62826          this._createPako();
62827        }
62828
62829        this._pako.push([], true);
62830      };
62831      /**
62832       * @see GenericWorker.cleanUp
62833       */
62834
62835
62836      FlateWorker.prototype.cleanUp = function () {
vendor: 19,471 bytes, lines 62837-63357
62837        GenericWorker.prototype.cleanUp.call(this);
62838        this._pako = null;
62839      };
62840      /**
62841       * Create the _pako object.
62842       * TODO: lazy-loading this object isn't the best solution but it's the
62843       * quickest. The best solution is to lazy-load the worker list. See also the
62844       * issue #446.
62845       */
62846
62847
62848      FlateWorker.prototype._createPako = function () {
62849        this._pako = new pako[this._pakoAction]({
62850          raw: true,
62851          level: this._pakoOptions.level || -1 // default compression
62852
62853        });
62854        var self = this;
62855
62856        this._pako.onData = function (data) {
62857          self.push({
62858            data: data,
62859            meta: self.meta
62860          });
62861        };
62862      };
62863
62864      exports.compressWorker = function (compressionOptions) {
62865        return new FlateWorker("Deflate", compressionOptions);
62866      };
62867
62868      exports.uncompressWorker = function () {
62869        return new FlateWorker("Inflate", {});
62870      };
62871    }, {
62872      "./stream/GenericWorker": 394,
62873      "./utils": 398,
62874      "pako": 416
62875    }],
62876    374: [function (require, module, exports) {
62877      'use strict';
62878
62879      var utils = require('../utils');
62880
62881      var GenericWorker = require('../stream/GenericWorker');
62882
62883      var utf8 = require('../utf8');
62884
62885      var crc32 = require('../crc32');
62886
62887      var signature = require('../signature');
62888      /**
62889       * Transform an integer into a string in hexadecimal.
62890       * @private
62891       * @param {number} dec the number to convert.
62892       * @param {number} bytes the number of bytes to generate.
62893       * @returns {string} the result.
62894       */
62895
62896
62897      var decToHex = function decToHex(dec, bytes) {
62898        var hex = "",
62899            i;
62900
62901        for (i = 0; i < bytes; i++) {
62902          hex += String.fromCharCode(dec & 0xff);
62903          dec = dec >>> 8;
62904        }
62905
62906        return hex;
62907      };
62908      /**
62909       * Generate the UNIX part of the external file attributes.
62910       * @param {Object} unixPermissions the unix permissions or null.
62911       * @param {Boolean} isDir true if the entry is a directory, false otherwise.
62912       * @return {Number} a 32 bit integer.
62913       *
62914       * adapted from http://unix.stackexchange.com/questions/14705/the-zip-formats-external-file-attribute :
62915       *
62916       * TTTTsstrwxrwxrwx0000000000ADVSHR
62917       * ^^^^____________________________ file type, see zipinfo.c (UNX_*)
62918       *     ^^^_________________________ setuid, setgid, sticky
62919       *        ^^^^^^^^^________________ permissions
62920       *                 ^^^^^^^^^^______ not used ?
62921       *                           ^^^^^^ DOS attribute bits : Archive, Directory, Volume label, System file, Hidden, Read only
62922       */
62923
62924
62925      var generateUnixExternalFileAttr = function generateUnixExternalFileAttr(unixPermissions, isDir) {
62926        var result = unixPermissions;
62927
62928        if (!unixPermissions) {
62929          // I can't use octal values in strict mode, hence the hexa.
62930          //  040775 => 0x41fd
62931          // 0100664 => 0x81b4
62932          result = isDir ? 0x41fd : 0x81b4;
62933        }
62934
62935        return (result & 0xFFFF) << 16;
62936      };
62937      /**
62938       * Generate the DOS part of the external file attributes.
62939       * @param {Object} dosPermissions the dos permissions or null.
62940       * @param {Boolean} isDir true if the entry is a directory, false otherwise.
62941       * @return {Number} a 32 bit integer.
62942       *
62943       * Bit 0     Read-Only
62944       * Bit 1     Hidden
62945       * Bit 2     System
62946       * Bit 3     Volume Label
62947       * Bit 4     Directory
62948       * Bit 5     Archive
62949       */
62950
62951
62952      var generateDosExternalFileAttr = function generateDosExternalFileAttr(dosPermissions, isDir) {
62953        // the dir flag is already set for compatibility
62954        return (dosPermissions || 0) & 0x3F;
62955      };
62956      /**
62957       * Generate the various parts used in the construction of the final zip file.
62958       * @param {Object} streamInfo the hash with information about the compressed file.
62959       * @param {Boolean} streamedContent is the content streamed ?
62960       * @param {Boolean} streamingEnded is the stream finished ?
62961       * @param {number} offset the current offset from the start of the zip file.
62962       * @param {String} platform let's pretend we are this platform (change platform dependents fields)
62963       * @param {Function} encodeFileName the function to encode the file name / comment.
62964       * @return {Object} the zip parts.
62965       */
62966
62967
62968      var generateZipParts = function generateZipParts(streamInfo, streamedContent, streamingEnded, offset, platform, encodeFileName) {
62969        var file = streamInfo['file'],
62970            compression = streamInfo['compression'],
62971            useCustomEncoding = encodeFileName !== utf8.utf8encode,
62972            encodedFileName = utils.transformTo("string", encodeFileName(file.name)),
62973            utfEncodedFileName = utils.transformTo("string", utf8.utf8encode(file.name)),
62974            comment = file.comment,
62975            encodedComment = utils.transformTo("string", encodeFileName(comment)),
62976            utfEncodedComment = utils.transformTo("string", utf8.utf8encode(comment)),
62977            useUTF8ForFileName = utfEncodedFileName.length !== file.name.length,
62978            useUTF8ForComment = utfEncodedComment.length !== comment.length,
62979            dosTime,
62980            dosDate,
62981            extraFields = "",
62982            unicodePathExtraField = "",
62983            unicodeCommentExtraField = "",
62984            dir = file.dir,
62985            date = file.date;
62986        var dataInfo = {
62987          crc32: 0,
62988          compressedSize: 0,
62989          uncompressedSize: 0
62990        }; // if the content is streamed, the sizes/crc32 are only available AFTER
62991        // the end of the stream.
62992
62993        if (!streamedContent || streamingEnded) {
62994          dataInfo.crc32 = streamInfo['crc32'];
62995          dataInfo.compressedSize = streamInfo['compressedSize'];
62996          dataInfo.uncompressedSize = streamInfo['uncompressedSize'];
62997        }
62998
62999        var bitflag = 0;
63000
63001        if (streamedContent) {
63002          // Bit 3: the sizes/crc32 are set to zero in the local header.
63003          // The correct values are put in the data descriptor immediately
63004          // following the compressed data.
63005          bitflag |= 0x0008;
63006        }
63007
63008        if (!useCustomEncoding && (useUTF8ForFileName || useUTF8ForComment)) {
63009          // Bit 11: Language encoding flag (EFS).
63010          bitflag |= 0x0800;
63011        }
63012
63013        var extFileAttr = 0;
63014        var versionMadeBy = 0;
63015
63016        if (dir) {
63017          // dos or unix, we set the dos dir flag
63018          extFileAttr |= 0x00010;
63019        }
63020
63021        if (platform === "UNIX") {
63022          versionMadeBy = 0x031E; // UNIX, version 3.0
63023
63024          extFileAttr |= generateUnixExternalFileAttr(file.unixPermissions, dir);
63025        } else {
63026          // DOS or other, fallback to DOS
63027          versionMadeBy = 0x0014; // DOS, version 2.0
63028
63029          extFileAttr |= generateDosExternalFileAttr(file.dosPermissions, dir);
63030        } // date
63031        // @see http://www.delorie.com/djgpp/doc/rbinter/it/52/13.html
63032        // @see http://www.delorie.com/djgpp/doc/rbinter/it/65/16.html
63033        // @see http://www.delorie.com/djgpp/doc/rbinter/it/66/16.html
63034
63035
63036        dosTime = date.getUTCHours();
63037        dosTime = dosTime << 6;
63038        dosTime = dosTime | date.getUTCMinutes();
63039        dosTime = dosTime << 5;
63040        dosTime = dosTime | date.getUTCSeconds() / 2;
63041        dosDate = date.getUTCFullYear() - 1980;
63042        dosDate = dosDate << 4;
63043        dosDate = dosDate | date.getUTCMonth() + 1;
63044        dosDate = dosDate << 5;
63045        dosDate = dosDate | date.getUTCDate();
63046
63047        if (useUTF8ForFileName) {
63048          // set the unicode path extra field. unzip needs at least one extra
63049          // field to correctly handle unicode path, so using the path is as good
63050          // as any other information. This could improve the situation with
63051          // other archive managers too.
63052          // This field is usually used without the utf8 flag, with a non
63053          // unicode path in the header (winrar, winzip). This helps (a bit)
63054          // with the messy Windows' default compressed folders feature but
63055          // breaks on p7zip which doesn't seek the unicode path extra field.
63056          // So for now, UTF-8 everywhere !
63057          unicodePathExtraField = // Version
63058          decToHex(1, 1) + // NameCRC32
63059          decToHex(crc32(encodedFileName), 4) + // UnicodeName
63060          utfEncodedFileName;
63061          extraFields += // Info-ZIP Unicode Path Extra Field
63062          "\x75\x70" + // size
63063          decToHex(unicodePathExtraField.length, 2) + // content
63064          unicodePathExtraField;
63065        }
63066
63067        if (useUTF8ForComment) {
63068          unicodeCommentExtraField = // Version
63069          decToHex(1, 1) + // CommentCRC32
63070          decToHex(crc32(encodedComment), 4) + // UnicodeName
63071          utfEncodedComment;
63072          extraFields += // Info-ZIP Unicode Path Extra Field
63073          "\x75\x63" + // size
63074          decToHex(unicodeCommentExtraField.length, 2) + // content
63075          unicodeCommentExtraField;
63076        }
63077
63078        var header = ""; // version needed to extract
63079
63080        header += "\x0A\x00"; // general purpose bit flag
63081
63082        header += decToHex(bitflag, 2); // compression method
63083
63084        header += compression.magic; // last mod file time
63085
63086        header += decToHex(dosTime, 2); // last mod file date
63087
63088        header += decToHex(dosDate, 2); // crc-32
63089
63090        header += decToHex(dataInfo.crc32, 4); // compressed size
63091
63092        header += decToHex(dataInfo.compressedSize, 4); // uncompressed size
63093
63094        header += decToHex(dataInfo.uncompressedSize, 4); // file name length
63095
63096        header += decToHex(encodedFileName.length, 2); // extra field length
63097
63098        header += decToHex(extraFields.length, 2);
63099        var fileRecord = signature.LOCAL_FILE_HEADER + header + encodedFileName + extraFields;
63100        var dirRecord = signature.CENTRAL_FILE_HEADER + // version made by (00: DOS)
63101        decToHex(versionMadeBy, 2) + // file header (common to file and central directory)
63102        header + // file comment length
63103        decToHex(encodedComment.length, 2) + // disk number start
63104        "\x00\x00" + // internal file attributes TODO
63105        "\x00\x00" + // external file attributes
63106        decToHex(extFileAttr, 4) + // relative offset of local header
63107        decToHex(offset, 4) + // file name
63108        encodedFileName + // extra field
63109        extraFields + // file comment
63110        encodedComment;
63111        return {
63112          fileRecord: fileRecord,
63113          dirRecord: dirRecord
63114        };
63115      };
63116      /**
63117       * Generate the EOCD record.
63118       * @param {Number} entriesCount the number of entries in the zip file.
63119       * @param {Number} centralDirLength the length (in bytes) of the central dir.
63120       * @param {Number} localDirLength the length (in bytes) of the local dir.
63121       * @param {String} comment the zip file comment as a binary string.
63122       * @param {Function} encodeFileName the function to encode the comment.
63123       * @return {String} the EOCD record.
63124       */
63125
63126
63127      var generateCentralDirectoryEnd = function generateCentralDirectoryEnd(entriesCount, centralDirLength, localDirLength, comment, encodeFileName) {
63128        var dirEnd = "";
63129        var encodedComment = utils.transformTo("string", encodeFileName(comment)); // end of central dir signature
63130
63131        dirEnd = signature.CENTRAL_DIRECTORY_END + // number of this disk
63132        "\x00\x00" + // number of the disk with the start of the central directory
63133        "\x00\x00" + // total number of entries in the central directory on this disk
63134        decToHex(entriesCount, 2) + // total number of entries in the central directory
63135        decToHex(entriesCount, 2) + // size of the central directory   4 bytes
63136        decToHex(centralDirLength, 4) + // offset of start of central directory with respect to the starting disk number
63137        decToHex(localDirLength, 4) + // .ZIP file comment length
63138        decToHex(encodedComment.length, 2) + // .ZIP file comment
63139        encodedComment;
63140        return dirEnd;
63141      };
63142      /**
63143       * Generate data descriptors for a file entry.
63144       * @param {Object} streamInfo the hash generated by a worker, containing information
63145       * on the file entry.
63146       * @return {String} the data descriptors.
63147       */
63148
63149
63150      var generateDataDescriptors = function generateDataDescriptors(streamInfo) {
63151        var descriptor = "";
63152        descriptor = signature.DATA_DESCRIPTOR + // crc-32                          4 bytes
63153        decToHex(streamInfo['crc32'], 4) + // compressed size                 4 bytes
63154        decToHex(streamInfo['compressedSize'], 4) + // uncompressed size               4 bytes
63155        decToHex(streamInfo['uncompressedSize'], 4);
63156        return descriptor;
63157      };
63158      /**
63159       * A worker to concatenate other workers to create a zip file.
63160       * @param {Boolean} streamFiles `true` to stream the content of the files,
63161       * `false` to accumulate it.
63162       * @param {String} comment the comment to use.
63163       * @param {String} platform the platform to use, "UNIX" or "DOS".
63164       * @param {Function} encodeFileName the function to encode file names and comments.
63165       */
63166
63167
63168      function ZipFileWorker(streamFiles, comment, platform, encodeFileName) {
63169        GenericWorker.call(this, "ZipFileWorker"); // The number of bytes written so far. This doesn't count accumulated chunks.
63170
63171        this.bytesWritten = 0; // The comment of the zip file
63172
63173        this.zipComment = comment; // The platform "generating" the zip file.
63174
63175        this.zipPlatform = platform; // the function to encode file names and comments.
63176
63177        this.encodeFileName = encodeFileName; // Should we stream the content of the files ?
63178
63179        this.streamFiles = streamFiles; // If `streamFiles` is false, we will need to accumulate the content of the
63180        // files to calculate sizes / crc32 (and write them *before* the content).
63181        // This boolean indicates if we are accumulating chunks (it will change a lot
63182        // during the lifetime of this worker).
63183
63184        this.accumulate = false; // The buffer receiving chunks when accumulating content.
63185
63186        this.contentBuffer = []; // The list of generated directory records.
63187
63188        this.dirRecords = []; // The offset (in bytes) from the beginning of the zip file for the current source.
63189
63190        this.currentSourceOffset = 0; // The total number of entries in this zip file.
63191
63192        this.entriesCount = 0; // the name of the file currently being added, null when handling the end of the zip file.
63193        // Used for the emitted metadata.
63194
63195        this.currentFile = null;
63196        this._sources = [];
63197      }
63198
63199      utils.inherits(ZipFileWorker, GenericWorker);
63200      /**
63201       * @see GenericWorker.push
63202       */
63203
63204      ZipFileWorker.prototype.push = function (chunk) {
63205        var currentFilePercent = chunk.meta.percent || 0;
63206        var entriesCount = this.entriesCount;
63207        var remainingFiles = this._sources.length;
63208
63209        if (this.accumulate) {
63210          this.contentBuffer.push(chunk);
63211        } else {
63212          this.bytesWritten += chunk.data.length;
63213          GenericWorker.prototype.push.call(this, {
63214            data: chunk.data,
63215            meta: {
63216              currentFile: this.currentFile,
63217              percent: entriesCount ? (currentFilePercent + 100 * (entriesCount - remainingFiles - 1)) / entriesCount : 100
63218            }
63219          });
63220        }
63221      };
63222      /**
63223       * The worker started a new source (an other worker).
63224       * @param {Object} streamInfo the streamInfo object from the new source.
63225       */
63226
63227
63228      ZipFileWorker.prototype.openedSource = function (streamInfo) {
63229        this.currentSourceOffset = this.bytesWritten;
63230        this.currentFile = streamInfo['file'].name;
63231        var streamedContent = this.streamFiles && !streamInfo['file'].dir; // don't stream folders (because they don't have any content)
63232
63233        if (streamedContent) {
63234          var record = generateZipParts(streamInfo, streamedContent, false, this.currentSourceOffset, this.zipPlatform, this.encodeFileName);
63235          this.push({
63236            data: record.fileRecord,
63237            meta: {
63238              percent: 0
63239            }
63240          });
63241        } else {
63242          // we need to wait for the whole file before pushing anything
63243          this.accumulate = true;
63244        }
63245      };
63246      /**
63247       * The worker finished a source (an other worker).
63248       * @param {Object} streamInfo the streamInfo object from the finished source.
63249       */
63250
63251
63252      ZipFileWorker.prototype.closedSource = function (streamInfo) {
63253        this.accumulate = false;
63254        var streamedContent = this.streamFiles && !streamInfo['file'].dir;
63255        var record = generateZipParts(streamInfo, streamedContent, true, this.currentSourceOffset, this.zipPlatform, this.encodeFileName);
63256        this.dirRecords.push(record.dirRecord);
63257
63258        if (streamedContent) {
63259          // after the streamed file, we put data descriptors
63260          this.push({
63261            data: generateDataDescriptors(streamInfo),
63262            meta: {
63263              percent: 100
63264            }
63265          });
63266        } else {
63267          // the content wasn't streamed, we need to push everything now
63268          // first the file record, then the content
63269          this.push({
63270            data: record.fileRecord,
63271            meta: {
63272              percent: 0
63273            }
63274          });
63275
63276          while (this.contentBuffer.length) {
63277            this.push(this.contentBuffer.shift());
63278          }
63279        }
63280
63281        this.currentFile = null;
63282      };
63283      /**
63284       * @see GenericWorker.flush
63285       */
63286
63287
63288      ZipFileWorker.prototype.flush = function () {
63289        var localDirLength = this.bytesWritten;
63290
63291        for (var i = 0; i < this.dirRecords.length; i++) {
63292          this.push({
63293            data: this.dirRecords[i],
63294            meta: {
63295              percent: 100
63296            }
63297          });
63298        }
63299
63300        var centralDirLength = this.bytesWritten - localDirLength;
63301        var dirEnd = generateCentralDirectoryEnd(this.dirRecords.length, centralDirLength, localDirLength, this.zipComment, this.encodeFileName);
63302        this.push({
63303          data: dirEnd,
63304          meta: {
63305            percent: 100
63306          }
63307        });
63308      };
63309      /**
63310       * Prepare the next source to be read.
63311       */
63312
63313
63314      ZipFileWorker.prototype.prepareNextSource = function () {
63315        this.previous = this._sources.shift();
63316        this.openedSource(this.previous.streamInfo);
63317
63318        if (this.isPaused) {
63319          this.previous.pause();
63320        } else {
63321          this.previous.resume();
63322        }
63323      };
63324      /**
63325       * @see GenericWorker.registerPrevious
63326       */
63327
63328
63329      ZipFileWorker.prototype.registerPrevious = function (previous) {
63330        this._sources.push(previous);
63331
63332        var self = this;
63333        previous.on('data', function (chunk) {
63334          self.processChunk(chunk);
63335        });
63336        previous.on('end', function () {
63337          self.closedSource(self.previous.streamInfo);
63338
63339          if (self._sources.length) {
63340            self.prepareNextSource();
63341          } else {
63342            self.end();
63343          }
63344        });
63345        previous.on('error', function (e) {
63346          self.error(e);
63347        });
63348        return this;
63349      };
63350      /**
63351       * @see GenericWorker.resume
63352       */
63353
63354
63355      ZipFileWorker.prototype.resume = function () {
63356        if (!GenericWorker.prototype.resume.call(this)) {
63357          return false;
vendor: 10,111 bytes, lines 63358-63694
63358        }
63359
63360        if (!this.previous && this._sources.length) {
63361          this.prepareNextSource();
63362          return true;
63363        }
63364
63365        if (!this.previous && !this._sources.length && !this.generatedError) {
63366          this.end();
63367          return true;
63368        }
63369      };
63370      /**
63371       * @see GenericWorker.error
63372       */
63373
63374
63375      ZipFileWorker.prototype.error = function (e) {
63376        var sources = this._sources;
63377
63378        if (!GenericWorker.prototype.error.call(this, e)) {
63379          return false;
63380        }
63381
63382        for (var i = 0; i < sources.length; i++) {
63383          try {
63384            sources[i].error(e);
63385          } catch (e) {// the `error` exploded, nothing to do
63386          }
63387        }
63388
63389        return true;
63390      };
63391      /**
63392       * @see GenericWorker.lock
63393       */
63394
63395
63396      ZipFileWorker.prototype.lock = function () {
63397        GenericWorker.prototype.lock.call(this);
63398        var sources = this._sources;
63399
63400        for (var i = 0; i < sources.length; i++) {
63401          sources[i].lock();
63402        }
63403      };
63404
63405      module.exports = ZipFileWorker;
63406    }, {
63407      "../crc32": 370,
63408      "../signature": 389,
63409      "../stream/GenericWorker": 394,
63410      "../utf8": 397,
63411      "../utils": 398
63412    }],
63413    375: [function (require, module, exports) {
63414      'use strict';
63415
63416      var compressions = require('../compressions');
63417
63418      var ZipFileWorker = require('./ZipFileWorker');
63419      /**
63420       * Find the compression to use.
63421       * @param {String} fileCompression the compression defined at the file level, if any.
63422       * @param {String} zipCompression the compression defined at the load() level.
63423       * @return {Object} the compression object to use.
63424       */
63425
63426
63427      var getCompression = function getCompression(fileCompression, zipCompression) {
63428        var compressionName = fileCompression || zipCompression;
63429        var compression = compressions[compressionName];
63430
63431        if (!compression) {
63432          throw new Error(compressionName + " is not a valid compression method !");
63433        }
63434
63435        return compression;
63436      };
63437      /**
63438       * Create a worker to generate a zip file.
63439       * @param {JSZip} zip the JSZip instance at the right root level.
63440       * @param {Object} options to generate the zip file.
63441       * @param {String} comment the comment to use.
63442       */
63443
63444
63445      exports.generateWorker = function (zip, options, comment) {
63446        var zipFileWorker = new ZipFileWorker(options.streamFiles, comment, options.platform, options.encodeFileName);
63447        var entriesCount = 0;
63448
63449        try {
63450          zip.forEach(function (relativePath, file) {
63451            entriesCount++;
63452            var compression = getCompression(file.options.compression, options.compression);
63453            var compressionOptions = file.options.compressionOptions || options.compressionOptions || {};
63454            var dir = file.dir,
63455                date = file.date;
63456
63457            file._compressWorker(compression, compressionOptions).withStreamInfo("file", {
63458              name: relativePath,
63459              dir: dir,
63460              date: date,
63461              comment: file.comment || "",
63462              unixPermissions: file.unixPermissions,
63463              dosPermissions: file.dosPermissions
63464            }).pipe(zipFileWorker);
63465          });
63466          zipFileWorker.entriesCount = entriesCount;
63467        } catch (e) {
63468          zipFileWorker.error(e);
63469        }
63470
63471        return zipFileWorker;
63472      };
63473    }, {
63474      "../compressions": 369,
63475      "./ZipFileWorker": 374
63476    }],
63477    376: [function (require, module, exports) {
63478      'use strict';
63479      /**
63480       * Representation a of zip file in js
63481       * @constructor
63482       */
63483
63484      function JSZip() {
63485        // if this constructor is used without `new`, it adds `new` before itself:
63486        if (!(this instanceof JSZip)) {
63487          return new JSZip();
63488        }
63489
63490        if (arguments.length) {
63491          throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");
63492        } // object containing the files :
63493        // {
63494        //   "folder/" : {...},
63495        //   "folder/data.txt" : {...}
63496        // }
63497
63498
63499        this.files = {};
63500        this.comment = null; // Where we are in the hierarchy
63501
63502        this.root = "";
63503
63504        this.clone = function () {
63505          var newObj = new JSZip();
63506
63507          for (var i in this) {
63508            if (typeof this[i] !== "function") {
63509              newObj[i] = this[i];
63510            }
63511          }
63512
63513          return newObj;
63514        };
63515      }
63516
63517      JSZip.prototype = require('./object');
63518      JSZip.prototype.loadAsync = require('./load');
63519      JSZip.support = require('./support');
63520      JSZip.defaults = require('./defaults'); // TODO find a better way to handle this version,
63521      // a require('package.json').version doesn't work with webpack, see #327
63522
63523      JSZip.version = "3.4.0";
63524
63525      JSZip.loadAsync = function (content, options) {
63526        return new JSZip().loadAsync(content, options);
63527      };
63528
63529      JSZip.external = require("./external");
63530      module.exports = JSZip;
63531    }, {
63532      "./defaults": 371,
63533      "./external": 372,
63534      "./load": 377,
63535      "./object": 381,
63536      "./support": 396
63537    }],
63538    377: [function (require, module, exports) {
63539      'use strict';
63540
63541      var utils = require('./utils');
63542
63543      var external = require("./external");
63544
63545      var utf8 = require('./utf8');
63546
63547      var utils = require('./utils');
63548
63549      var ZipEntries = require('./zipEntries');
63550
63551      var Crc32Probe = require('./stream/Crc32Probe');
63552
63553      var nodejsUtils = require("./nodejsUtils");
63554      /**
63555       * Check the CRC32 of an entry.
63556       * @param {ZipEntry} zipEntry the zip entry to check.
63557       * @return {Promise} the result.
63558       */
63559
63560
63561      function checkEntryCRC32(zipEntry) {
63562        return new external.Promise(function (resolve, reject) {
63563          var worker = zipEntry.decompressed.getContentWorker().pipe(new Crc32Probe());
63564          worker.on("error", function (e) {
63565            reject(e);
63566          }).on("end", function () {
63567            if (worker.streamInfo.crc32 !== zipEntry.decompressed.crc32) {
63568              reject(new Error("Corrupted zip : CRC32 mismatch"));
63569            } else {
63570              resolve();
63571            }
63572          }).resume();
63573        });
63574      }
63575
63576      module.exports = function (data, options) {
63577        var zip = this;
63578        options = utils.extend(options || {}, {
63579          base64: false,
63580          checkCRC32: false,
63581          optimizedBinaryString: false,
63582          createFolders: false,
63583          decodeFileName: utf8.utf8decode
63584        });
63585
63586        if (nodejsUtils.isNode && nodejsUtils.isStream(data)) {
63587          return external.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file."));
63588        }
63589
63590        return utils.prepareContent("the loaded zip file", data, true, options.optimizedBinaryString, options.base64).then(function (data) {
63591          var zipEntries = new ZipEntries(options);
63592          zipEntries.load(data);
63593          return zipEntries;
63594        }).then(function checkCRC32(zipEntries) {
63595          var promises = [external.Promise.resolve(zipEntries)];
63596          var files = zipEntries.files;
63597
63598          if (options.checkCRC32) {
63599            for (var i = 0; i < files.length; i++) {
63600              promises.push(checkEntryCRC32(files[i]));
63601            }
63602          }
63603
63604          return external.Promise.all(promises);
63605        }).then(function addFiles(results) {
63606          var zipEntries = results.shift();
63607          var files = zipEntries.files;
63608
63609          for (var i = 0; i < files.length; i++) {
63610            var input = files[i];
63611            zip.file(input.fileNameStr, input.decompressed, {
63612              binary: true,
63613              optimizedBinaryString: true,
63614              date: input.date,
63615              dir: input.dir,
63616              comment: input.fileCommentStr.length ? input.fileCommentStr : null,
63617              unixPermissions: input.unixPermissions,
63618              dosPermissions: input.dosPermissions,
63619              createFolders: options.createFolders
63620            });
63621          }
63622
63623          if (zipEntries.zipComment.length) {
63624            zip.comment = zipEntries.zipComment;
63625          }
63626
63627          return zip;
63628        });
63629      };
63630    }, {
63631      "./external": 372,
63632      "./nodejsUtils": 380,
63633      "./stream/Crc32Probe": 391,
63634      "./utf8": 397,
63635      "./utils": 398,
63636      "./zipEntries": 399
63637    }],
63638    378: [function (require, module, exports) {
63639      "use strict";
63640
63641      var utils = require('../utils');
63642
63643      var GenericWorker = require('../stream/GenericWorker');
63644      /**
63645       * A worker that use a nodejs stream as source.
63646       * @constructor
63647       * @param {String} filename the name of the file entry for this stream.
63648       * @param {Readable} stream the nodejs stream.
63649       */
63650
63651
63652      function NodejsStreamInputAdapter(filename, stream) {
63653        GenericWorker.call(this, "Nodejs stream input adapter for " + filename);
63654        this._upstreamEnded = false;
63655
63656        this._bindStream(stream);
63657      }
63658
63659      utils.inherits(NodejsStreamInputAdapter, GenericWorker);
63660      /**
63661       * Prepare the stream and bind the callbacks on it.
63662       * Do this ASAP on node 0.10 ! A lazy binding doesn't always work.
63663       * @param {Stream} stream the nodejs stream to use.
63664       */
63665
63666      NodejsStreamInputAdapter.prototype._bindStream = function (stream) {
63667        var self = this;
63668        this._stream = stream;
63669        stream.pause();
63670        stream.on("data", function (chunk) {
63671          self.push({
63672            data: chunk,
63673            meta: {
63674              percent: 0
63675            }
63676          });
63677        }).on("error", function (e) {
63678          if (self.isPaused) {
63679            this.generatedError = e;
63680          } else {
63681            self.error(e);
63682          }
63683        }).on("end", function () {
63684          if (self.isPaused) {
63685            self._upstreamEnded = true;
63686          } else {
63687            self.end();
63688          }
63689        });
63690      };
63691
63692      NodejsStreamInputAdapter.prototype.pause = function () {
63693        if (!GenericWorker.prototype.pause.call(this)) {
63694          return false;
63695        }
63696
63697        this._stream.pause();
63698
63699        return true;
63700      };
63701
63702      NodejsStreamInputAdapter.prototype.resume = function () {
63703        if (!GenericWorker.prototype.resume.call(this)) {
63704          return false;
63705        }
63706
63707        if (this._upstreamEnded) {
63708          this.end();
63709        } else {
63710          this._stream.resume();
63711        }
63712
63713        return true;
63714      };
63715
63716      module.exports = NodejsStreamInputAdapter;
63717    }, {
63718      "../stream/GenericWorker": 394,
63719      "../utils": 398
63720    }],
63721    379: [function (require, module, exports) {
63722      'use strict';
63723
63724      var Readable = require('readable-stream').Readable;
63725
63726      var utils = require('../utils');
63727
63728      utils.inherits(NodejsStreamOutputAdapter, Readable);
63729      /**
63730      * A nodejs stream using a worker as source.
63731      * @see the SourceWrapper in http://nodejs.org/api/stream.html
63732      * @constructor
63733      * @param {StreamHelper} helper the helper wrapping the worker
63734      * @param {Object} options the nodejs stream options
63735      * @param {Function} updateCb the update callback.
63736      */
63737
63738      function NodejsStreamOutputAdapter(helper, options, updateCb) {
63739        Readable.call(this, options);
63740        this._helper = helper;
63741        var self = this;
63742        helper.on("data", function (data, meta) {
63743          if (!self.push(data)) {
63744            self._helper.pause();
63745          }
63746
63747          if (updateCb) {
63748            updateCb(meta);
63749          }
63750        }).on("error", function (e) {
63751          self.emit('error', e);
63752        }).on("end", function () {
63753          self.push(null);
63754        });
63755      }
63756
63757      NodejsStreamOutputAdapter.prototype._read = function () {
63758        this._helper.resume();
63759      };
63760
63761      module.exports = NodejsStreamOutputAdapter;
63762    }, {
63763      "../utils": 398,
63764      "readable-stream": 382
63765    }],
63766    380: [function (require, module, exports) {
63767      (function (Buffer) {
63768        'use strict';
63769
63770        module.exports = {
63771          /**
63772           * True if this is running in Nodejs, will be undefined in a browser.
63773           * In a browser, browserify won't include this file and the whole module
63774           * will be resolved an empty object.
63775           */
63776          isNode: typeof Buffer !== "undefined",
63777
63778          /**
63779           * Create a new nodejs Buffer from an existing content.
63780           * @param {Object} data the data to pass to the constructor.
63781           * @param {String} encoding the encoding to use.
63782           * @return {Buffer} a new Buffer.
63783           */
63784          newBufferFrom: function newBufferFrom(data, encoding) {
63785            if (Buffer.from && Buffer.from !== Uint8Array.from) {
63786              return Buffer.from(data, encoding);
63787            } else {
63788              if (typeof data === "number") {
63789                // Safeguard for old Node.js versions. On newer versions,
63790                // Buffer.from(number) / Buffer(number, encoding) already throw.
63791                throw new Error("The \"data\" argument must not be a number");
63792              }
63793
63794              return new Buffer(data, encoding);
63795            }
63796          },
63797
63798          /**
63799           * Create a new nodejs Buffer with the specified size.
63800           * @param {Integer} size the size of the buffer.
63801           * @return {Buffer} a new Buffer.
63802           */
63803          allocBuffer: function allocBuffer(size) {
63804            if (Buffer.alloc) {
63805              return Buffer.alloc(size);
63806            } else {
63807              var buf = new Buffer(size);
63808              buf.fill(0);
63809              return buf;
63810            }
63811          },
63812
63813          /**
63814           * Find out if an object is a Buffer.
63815           * @param {Object} b the object to test.
63816           * @return {Boolean} true if the object is a Buffer, false otherwise.
63817           */
63818          isBuffer: function isBuffer(b) {
63819            return Buffer.isBuffer(b);
63820          },
63821          isStream: function isStream(obj) {
63822            return obj && typeof obj.on === "function" && typeof obj.pause === "function" && typeof obj.resume === "function";
63823          }
63824        };
63825      }).call(this, require("buffer").Buffer);
63826    }, {
63827      "buffer": 214
63828    }],
63829    381: [function (require, module, exports) {
63830      'use strict';
63831
63832      var utf8 = require('./utf8');
63833
63834      var utils = require('./utils');
63835
63836      var GenericWorker = require('./stream/GenericWorker');
63837
63838      var StreamHelper = require('./stream/StreamHelper');
63839
63840      var defaults = require('./defaults');
63841
63842      var CompressedObject = require('./compressedObject');
63843
63844      var ZipObject = require('./zipObject');
63845
63846      var generate = require("./generate");
63847
63848      var nodejsUtils = require("./nodejsUtils");
63849
63850      var NodejsStreamInputAdapter = require("./nodejs/NodejsStreamInputAdapter");
63851      /**
63852       * Add a file in the current folder.
63853       * @private
63854       * @param {string} name the name of the file
63855       * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data of the file
63856       * @param {Object} originalOptions the options of the file
63857       * @return {Object} the new file.
63858       */
63859
63860
63861      var fileAdd = function fileAdd(name, data, originalOptions) {
63862        // be sure sub folders exist
63863        var dataType = utils.getTypeOf(data),
63864            parent;
63865        /*
63866         * Correct options.
63867         */
63868
63869        var o = utils.extend(originalOptions || {}, defaults);
63870        o.date = o.date || new Date();
63871
63872        if (o.compression !== null) {
63873          o.compression = o.compression.toUpperCase();
63874        }
63875
63876        if (typeof o.unixPermissions === "string") {
63877          o.unixPermissions = parseInt(o.unixPermissions, 8);
63878        } // UNX_IFDIR  0040000 see zipinfo.c
63879
63880
63881        if (o.unixPermissions && o.unixPermissions & 0x4000) {
63882          o.dir = true;
63883        } // Bit 4    Directory
63884
63885
63886        if (o.dosPermissions && o.dosPermissions & 0x0010) {
63887          o.dir = true;
63888        }
63889
63890        if (o.dir) {
63891          name = forceTrailingSlash(name);
63892        }
63893
63894        if (o.createFolders && (parent = parentFolder(name))) {
63895          folderAdd.call(this, parent, true);
63896        }
63897
63898        var isUnicodeString = dataType === "string" && o.binary === false && o.base64 === false;
63899
63900        if (!originalOptions || typeof originalOptions.binary === "undefined") {
63901          o.binary = !isUnicodeString;
63902        }
63903
63904        var isCompressedEmpty = data instanceof CompressedObject && data.uncompressedSize === 0;
63905
63906        if (isCompressedEmpty || o.dir || !data || data.length === 0) {
63907          o.base64 = false;
63908          o.binary = true;
63909          data = "";
63910          o.compression = "STORE";
63911          dataType = "string";
63912        }
63913        /*
63914         * Convert content to fit.
63915         */
63916
63917
63918        var zipObjectContent = null;
63919
63920        if (data instanceof CompressedObject || data instanceof GenericWorker) {
63921          zipObjectContent = data;
63922        } else if (nodejsUtils.isNode && nodejsUtils.isStream(data)) {
63923          zipObjectContent = new NodejsStreamInputAdapter(name, data);
63924        } else {
63925          zipObjectContent = utils.prepareContent(name, data, o.binary, o.optimizedBinaryString, o.base64);
63926        }
63927
63928        var object = new ZipObject(name, zipObjectContent, o);
63929        this.files[name] = object;
63930        /*
63931        TODO: we can't throw an exception because we have async promises
63932        (we can have a promise of a Date() for example) but returning a
63933        promise is useless because file(name, data) returns the JSZip
63934        object for chaining. Should we break that to allow the user
63935        to catch the error ?
63936         return external.Promise.resolve(zipObjectContent)
63937        .then(function () {
63938            return object;
63939        });
63940        */
63941      };
63942      /**
63943       * Find the parent folder of the path.
63944       * @private
63945       * @param {string} path the path to use
63946       * @return {string} the parent folder, or ""
63947       */
63948
63949
63950      var parentFolder = function parentFolder(path) {
63951        if (path.slice(-1) === '/') {
63952          path = path.substring(0, path.length - 1);
63953        }
63954
63955        var lastSlash = path.lastIndexOf('/');
63956        return lastSlash > 0 ? path.substring(0, lastSlash) : "";
63957      };
63958      /**
63959       * Returns the path with a slash at the end.
63960       * @private
63961       * @param {String} path the path to check.
63962       * @return {String} the path with a trailing slash.
63963       */
63964
63965
63966      var forceTrailingSlash = function forceTrailingSlash(path) {
63967        // Check the name ends with a /
63968        if (path.slice(-1) !== "/") {
63969          path += "/"; // IE doesn't like substr(-1)
63970        }
63971
63972        return path;
63973      };
63974      /**
63975       * Add a (sub) folder in the current folder.
63976       * @private
63977       * @param {string} name the folder's name
63978       * @param {boolean=} [createFolders] If true, automatically create sub
63979       *  folders. Defaults to false.
63980       * @return {Object} the new folder.
63981       */
63982
63983
63984      var folderAdd = function folderAdd(name, createFolders) {
63985        createFolders = typeof createFolders !== 'undefined' ? createFolders : defaults.createFolders;
63986        name = forceTrailingSlash(name); // Does this folder already exist?
63987
63988        if (!this.files[name]) {
63989          fileAdd.call(this, name, null, {
63990            dir: true,
63991            createFolders: createFolders
63992          });
63993        }
63994
63995        return this.files[name];
63996      };
63997      /**
63998      * Cross-window, cross-Node-context regular expression detection
63999      * @param  {Object}  object Anything
64000      * @return {Boolean}        true if the object is a regular expression,
64001      * false otherwise
64002      */
64003
64004
64005      function isRegExp(object) {
64006        return Object.prototype.toString.call(object) === "[object RegExp]";
64007      } // return the actual prototype of JSZip
64008
64009
64010      var out = {
64011        /**
64012         * @see loadAsync
64013         */
64014        load: function load() {
64015          throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.");
64016        },
64017
64018        /**
64019         * Call a callback function for each entry at this folder level.
64020         * @param {Function} cb the callback function:
64021         * function (relativePath, file) {...}
64022         * It takes 2 arguments : the relative path and the file.
64023         */
vendor: 5,370 bytes, lines 64024-64172
64024        forEach: function forEach(cb) {
64025          var filename, relativePath, file;
64026
64027          for (filename in this.files) {
64028            if (!this.files.hasOwnProperty(filename)) {
64029              continue;
64030            }
64031
64032            file = this.files[filename];
64033            relativePath = filename.slice(this.root.length, filename.length);
64034
64035            if (relativePath && filename.slice(0, this.root.length) === this.root) {
64036              // the file is in the current root
64037              cb(relativePath, file); // TODO reverse the parameters ? need to be clean AND consistent with the filter search fn...
64038            }
64039          }
64040        },
64041
64042        /**
64043         * Filter nested files/folders with the specified function.
64044         * @param {Function} search the predicate to use :
64045         * function (relativePath, file) {...}
64046         * It takes 2 arguments : the relative path and the file.
64047         * @return {Array} An array of matching elements.
64048         */
64049        filter: function filter(search) {
64050          var result = [];
64051          this.forEach(function (relativePath, entry) {
64052            if (search(relativePath, entry)) {
64053              // the file matches the function
64054              result.push(entry);
64055            }
64056          });
64057          return result;
64058        },
64059
64060        /**
64061         * Add a file to the zip file, or search a file.
64062         * @param   {string|RegExp} name The name of the file to add (if data is defined),
64063         * the name of the file to find (if no data) or a regex to match files.
64064         * @param   {String|ArrayBuffer|Uint8Array|Buffer} data  The file data, either raw or base64 encoded
64065         * @param   {Object} o     File options
64066         * @return  {JSZip|Object|Array} this JSZip object (when adding a file),
64067         * a file (when searching by string) or an array of files (when searching by regex).
64068         */
64069        file: function file(name, data, o) {
64070          if (arguments.length === 1) {
64071            if (isRegExp(name)) {
64072              var regexp = name;
64073              return this.filter(function (relativePath, file) {
64074                return !file.dir && regexp.test(relativePath);
64075              });
64076            } else {
64077              // text
64078              var obj = this.files[this.root + name];
64079
64080              if (obj && !obj.dir) {
64081                return obj;
64082              } else {
64083                return null;
64084              }
64085            }
64086          } else {
64087            // more than one argument : we have data !
64088            name = this.root + name;
64089            fileAdd.call(this, name, data, o);
64090          }
64091
64092          return this;
64093        },
64094
64095        /**
64096         * Add a directory to the zip file, or search.
64097         * @param   {String|RegExp} arg The name of the directory to add, or a regex to search folders.
64098         * @return  {JSZip} an object with the new directory as the root, or an array containing matching folders.
64099         */
64100        folder: function folder(arg) {
64101          if (!arg) {
64102            return this;
64103          }
64104
64105          if (isRegExp(arg)) {
64106            return this.filter(function (relativePath, file) {
64107              return file.dir && arg.test(relativePath);
64108            });
64109          } // else, name is a new folder
64110
64111
64112          var name = this.root + arg;
64113          var newFolder = folderAdd.call(this, name); // Allow chaining by returning a new object with this folder as the root
64114
64115          var ret = this.clone();
64116          ret.root = newFolder.name;
64117          return ret;
64118        },
64119
64120        /**
64121         * Delete a file, or a directory and all sub-files, from the zip
64122         * @param {string} name the name of the file to delete
64123         * @return {JSZip} this JSZip object
64124         */
64125        remove: function remove(name) {
64126          name = this.root + name;
64127          var file = this.files[name];
64128
64129          if (!file) {
64130            // Look for any folders
64131            if (name.slice(-1) !== "/") {
64132              name += "/";
64133            }
64134
64135            file = this.files[name];
64136          }
64137
64138          if (file && !file.dir) {
64139            // file
64140            delete this.files[name];
64141          } else {
64142            // maybe a folder, delete recursively
64143            var kids = this.filter(function (relativePath, file) {
64144              return file.name.slice(0, name.length) === name;
64145            });
64146
64147            for (var i = 0; i < kids.length; i++) {
64148              delete this.files[kids[i].name];
64149            }
64150          }
64151
64152          return this;
64153        },
64154
64155        /**
64156         * Generate the complete zip file
64157         * @param {Object} options the options to generate the zip file :
64158         * - compression, "STORE" by default.
64159         * - type, "base64" by default. Values are : string, base64, uint8array, arraybuffer, blob.
64160         * @return {String|Uint8Array|ArrayBuffer|Buffer|Blob} the zip file
64161         */
64162        generate: function generate(options) {
64163          throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.");
64164        },
64165
64166        /**
64167         * Generate the complete zip file as an internal stream.
64168         * @param {Object} options the options to generate the zip file :
64169         * - compression, "STORE" by default.
64170         * - type, "base64" by default. Values are : string, base64, uint8array, arraybuffer, blob.
64171         * @return {StreamHelper} the streamed zip file.
64172         */
vendor: 5,100 bytes, lines 64173-64340
64173        generateInternalStream: function generateInternalStream(options) {
64174          var worker,
64175              opts = {};
64176
64177          try {
64178            opts = utils.extend(options || {}, {
64179              streamFiles: false,
64180              compression: "STORE",
64181              compressionOptions: null,
64182              type: "",
64183              platform: "DOS",
64184              comment: null,
64185              mimeType: 'application/zip',
64186              encodeFileName: utf8.utf8encode
64187            });
64188            opts.type = opts.type.toLowerCase();
64189            opts.compression = opts.compression.toUpperCase(); // "binarystring" is preferred but the internals use "string".
64190
64191            if (opts.type === "binarystring") {
64192              opts.type = "string";
64193            }
64194
64195            if (!opts.type) {
64196              throw new Error("No output type specified.");
64197            }
64198
64199            utils.checkSupport(opts.type); // accept nodejs `process.platform`
64200
64201            if (opts.platform === 'darwin' || opts.platform === 'freebsd' || opts.platform === 'linux' || opts.platform === 'sunos') {
64202              opts.platform = "UNIX";
64203            }
64204
64205            if (opts.platform === 'win32') {
64206              opts.platform = "DOS";
64207            }
64208
64209            var comment = opts.comment || this.comment || "";
64210            worker = generate.generateWorker(this, opts, comment);
64211          } catch (e) {
64212            worker = new GenericWorker("error");
64213            worker.error(e);
64214          }
64215
64216          return new StreamHelper(worker, opts.type || "string", opts.mimeType);
64217        },
64218
64219        /**
64220         * Generate the complete zip file asynchronously.
64221         * @see generateInternalStream
64222         */
64223        generateAsync: function generateAsync(options, onUpdate) {
64224          return this.generateInternalStream(options).accumulate(onUpdate);
64225        },
64226
64227        /**
64228         * Generate the complete zip file asynchronously.
64229         * @see generateInternalStream
64230         */
64231        generateNodeStream: function generateNodeStream(options, onUpdate) {
64232          options = options || {};
64233
64234          if (!options.type) {
64235            options.type = "nodebuffer";
64236          }
64237
64238          return this.generateInternalStream(options).toNodejsStream(onUpdate);
64239        }
64240      };
64241      module.exports = out;
64242    }, {
64243      "./compressedObject": 368,
64244      "./defaults": 371,
64245      "./generate": 375,
64246      "./nodejs/NodejsStreamInputAdapter": 378,
64247      "./nodejsUtils": 380,
64248      "./stream/GenericWorker": 394,
64249      "./stream/StreamHelper": 395,
64250      "./utf8": 397,
64251      "./utils": 398,
64252      "./zipObject": 401
64253    }],
64254    382: [function (require, module, exports) {
64255      /*
64256       * This file is used by module bundlers (browserify/webpack/etc) when
64257       * including a stream implementation. We use "readable-stream" to get a
64258       * consistent behavior between nodejs versions but bundlers often have a shim
64259       * for "stream". Using this shim greatly improve the compatibility and greatly
64260       * reduce the final size of the bundle (only one stream implementation, not
64261       * two).
64262       */
64263      module.exports = require("stream");
64264    }, {
64265      "stream": 481
64266    }],
64267    383: [function (require, module, exports) {
64268      'use strict';
64269
64270      var DataReader = require('./DataReader');
64271
64272      var utils = require('../utils');
64273
64274      function ArrayReader(data) {
64275        DataReader.call(this, data);
64276
64277        for (var i = 0; i < this.data.length; i++) {
64278          data[i] = data[i] & 0xFF;
64279        }
64280      }
64281
64282      utils.inherits(ArrayReader, DataReader);
64283      /**
64284       * @see DataReader.byteAt
64285       */
64286
64287      ArrayReader.prototype.byteAt = function (i) {
64288        return this.data[this.zero + i];
64289      };
64290      /**
64291       * @see DataReader.lastIndexOfSignature
64292       */
64293
64294
64295      ArrayReader.prototype.lastIndexOfSignature = function (sig) {
64296        var sig0 = sig.charCodeAt(0),
64297            sig1 = sig.charCodeAt(1),
64298            sig2 = sig.charCodeAt(2),
64299            sig3 = sig.charCodeAt(3);
64300
64301        for (var i = this.length - 4; i >= 0; --i) {
64302          if (this.data[i] === sig0 && this.data[i + 1] === sig1 && this.data[i + 2] === sig2 && this.data[i + 3] === sig3) {
64303            return i - this.zero;
64304          }
64305        }
64306
64307        return -1;
64308      };
64309      /**
64310       * @see DataReader.readAndCheckSignature
64311       */
64312
64313
64314      ArrayReader.prototype.readAndCheckSignature = function (sig) {
64315        var sig0 = sig.charCodeAt(0),
64316            sig1 = sig.charCodeAt(1),
64317            sig2 = sig.charCodeAt(2),
64318            sig3 = sig.charCodeAt(3),
64319            data = this.readData(4);
64320        return sig0 === data[0] && sig1 === data[1] && sig2 === data[2] && sig3 === data[3];
64321      };
64322      /**
64323       * @see DataReader.readData
64324       */
64325
64326
64327      ArrayReader.prototype.readData = function (size) {
64328        this.checkOffset(size);
64329
64330        if (size === 0) {
64331          return [];
64332        }
64333
64334        var result = this.data.slice(this.zero + this.index, this.zero + this.index + size);
64335        this.index += size;
64336        return result;
64337      };
64338
64339      module.exports = ArrayReader;
64340    }, {
64341      "../utils": 398,
64342      "./DataReader": 384
64343    }],
64344    384: [function (require, module, exports) {
64345      'use strict';
64346
64347      var utils = require('../utils');
64348
64349      function DataReader(data) {
64350        this.data = data; // type : see implementation
64351
64352        this.length = data.length;
64353        this.index = 0;
64354        this.zero = 0;
64355      }
64356
64357      DataReader.prototype = {
64358        /**
64359         * Check that the offset will not go too far.
64360         * @param {string} offset the additional offset to check.
64361         * @throws {Error} an Error if the offset is out of bounds.
64362         */
64363        checkOffset: function checkOffset(offset) {
64364          this.checkIndex(this.index + offset);
64365        },
64366
64367        /**
64368         * Check that the specified index will not be too far.
64369         * @param {string} newIndex the index to check.
64370         * @throws {Error} an Error if the index is out of bounds.
64371         */
64372        checkIndex: function checkIndex(newIndex) {
64373          if (this.length < this.zero + newIndex || newIndex < 0) {
64374            throw new Error("End of data reached (data length = " + this.length + ", asked index = " + newIndex + "). Corrupted zip ?");
64375          }
64376        },
64377
64378        /**
64379         * Change the index.
64380         * @param {number} newIndex The new index.
64381         * @throws {Error} if the new index is out of the data.
64382         */
64383        setIndex: function setIndex(newIndex) {
64384          this.checkIndex(newIndex);
64385          this.index = newIndex;
64386        },
64387
64388        /**
64389         * Skip the next n bytes.
64390         * @param {number} n the number of bytes to skip.
64391         * @throws {Error} if the new index is out of the data.
64392         */
64393        skip: function skip(n) {
64394          this.setIndex(this.index + n);
64395        },
64396
64397        /**
64398         * Get the byte at the specified index.
64399         * @param {number} i the index to use.
64400         * @return {number} a byte.
64401         */
64402        byteAt: function byteAt(i) {// see implementations
64403        },
64404
64405        /**
64406         * Get the next number with a given byte size.
64407         * @param {number} size the number of bytes to read.
64408         * @return {number} the corresponding number.
64409         */
64410        readInt: function readInt(size) {
64411          var result = 0,
64412              i;
64413          this.checkOffset(size);
64414
64415          for (i = this.index + size - 1; i >= this.index; i--) {
64416            result = (result << 8) + this.byteAt(i);
64417          }
64418
64419          this.index += size;
64420          return result;
64421        },
64422
64423        /**
64424         * Get the next string with a given byte size.
64425         * @param {number} size the number of bytes to read.
64426         * @return {string} the corresponding string.
64427         */
64428        readString: function readString(size) {
64429          return utils.transformTo("string", this.readData(size));
64430        },
64431
64432        /**
64433         * Get raw data without conversion, <size> bytes.
64434         * @param {number} size the number of bytes to read.
64435         * @return {Object} the raw data, implementation specific.
64436         */
64437        readData: function readData(size) {// see implementations
64438        },
64439
64440        /**
64441         * Find the last occurrence of a zip signature (4 bytes).
64442         * @param {string} sig the signature to find.
64443         * @return {number} the index of the last occurrence, -1 if not found.
64444         */
64445        lastIndexOfSignature: function lastIndexOfSignature(sig) {// see implementations
64446        },
64447
64448        /**
64449         * Read the signature (4 bytes) at the current position and compare it with sig.
64450         * @param {string} sig the expected signature
64451         * @return {boolean} true if the signature matches, false otherwise.
64452         */
64453        readAndCheckSignature: function readAndCheckSignature(sig) {// see implementations
64454        },
64455
64456        /**
64457         * Get the next date.
64458         * @return {Date} the date.
64459         */
64460        readDate: function readDate() {
64461          var dostime = this.readInt(4);
64462          return new Date(Date.UTC((dostime >> 25 & 0x7f) + 1980, // year
64463          (dostime >> 21 & 0x0f) - 1, // month
64464          dostime >> 16 & 0x1f, // day
64465          dostime >> 11 & 0x1f, // hour
64466          dostime >> 5 & 0x3f, // minute
64467          (dostime & 0x1f) << 1)); // second
64468        }
64469      };
64470      module.exports = DataReader;
64471    }, {
vendor: 11,727 bytes, lines 64472-64906
64472      "../utils": 398
64473    }],
64474    385: [function (require, module, exports) {
64475      'use strict';
64476
64477      var Uint8ArrayReader = require('./Uint8ArrayReader');
64478
64479      var utils = require('../utils');
64480
64481      function NodeBufferReader(data) {
64482        Uint8ArrayReader.call(this, data);
64483      }
64484
64485      utils.inherits(NodeBufferReader, Uint8ArrayReader);
64486      /**
64487       * @see DataReader.readData
64488       */
64489
64490      NodeBufferReader.prototype.readData = function (size) {
64491        this.checkOffset(size);
64492        var result = this.data.slice(this.zero + this.index, this.zero + this.index + size);
64493        this.index += size;
64494        return result;
64495      };
64496
64497      module.exports = NodeBufferReader;
64498    }, {
64499      "../utils": 398,
64500      "./Uint8ArrayReader": 387
64501    }],
64502    386: [function (require, module, exports) {
64503      'use strict';
64504
64505      var DataReader = require('./DataReader');
64506
64507      var utils = require('../utils');
64508
64509      function StringReader(data) {
64510        DataReader.call(this, data);
64511      }
64512
64513      utils.inherits(StringReader, DataReader);
64514      /**
64515       * @see DataReader.byteAt
64516       */
64517
64518      StringReader.prototype.byteAt = function (i) {
64519        return this.data.charCodeAt(this.zero + i);
64520      };
64521      /**
64522       * @see DataReader.lastIndexOfSignature
64523       */
64524
64525
64526      StringReader.prototype.lastIndexOfSignature = function (sig) {
64527        return this.data.lastIndexOf(sig) - this.zero;
64528      };
64529      /**
64530       * @see DataReader.readAndCheckSignature
64531       */
64532
64533
64534      StringReader.prototype.readAndCheckSignature = function (sig) {
64535        var data = this.readData(4);
64536        return sig === data;
64537      };
64538      /**
64539       * @see DataReader.readData
64540       */
64541
64542
64543      StringReader.prototype.readData = function (size) {
64544        this.checkOffset(size); // this will work because the constructor applied the "& 0xff" mask.
64545
64546        var result = this.data.slice(this.zero + this.index, this.zero + this.index + size);
64547        this.index += size;
64548        return result;
64549      };
64550
64551      module.exports = StringReader;
64552    }, {
64553      "../utils": 398,
64554      "./DataReader": 384
64555    }],
64556    387: [function (require, module, exports) {
64557      'use strict';
64558
64559      var ArrayReader = require('./ArrayReader');
64560
64561      var utils = require('../utils');
64562
64563      function Uint8ArrayReader(data) {
64564        ArrayReader.call(this, data);
64565      }
64566
64567      utils.inherits(Uint8ArrayReader, ArrayReader);
64568      /**
64569       * @see DataReader.readData
64570       */
64571
64572      Uint8ArrayReader.prototype.readData = function (size) {
64573        this.checkOffset(size);
64574
64575        if (size === 0) {
64576          // in IE10, when using subarray(idx, idx), we get the array [0x00] instead of [].
64577          return new Uint8Array(0);
64578        }
64579
64580        var result = this.data.subarray(this.zero + this.index, this.zero + this.index + size);
64581        this.index += size;
64582        return result;
64583      };
64584
64585      module.exports = Uint8ArrayReader;
64586    }, {
64587      "../utils": 398,
64588      "./ArrayReader": 383
64589    }],
64590    388: [function (require, module, exports) {
64591      'use strict';
64592
64593      var utils = require('../utils');
64594
64595      var support = require('../support');
64596
64597      var ArrayReader = require('./ArrayReader');
64598
64599      var StringReader = require('./StringReader');
64600
64601      var NodeBufferReader = require('./NodeBufferReader');
64602
64603      var Uint8ArrayReader = require('./Uint8ArrayReader');
64604      /**
64605       * Create a reader adapted to the data.
64606       * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data to read.
64607       * @return {DataReader} the data reader.
64608       */
64609
64610
64611      module.exports = function (data) {
64612        var type = utils.getTypeOf(data);
64613        utils.checkSupport(type);
64614
64615        if (type === "string" && !support.uint8array) {
64616          return new StringReader(data);
64617        }
64618
64619        if (type === "nodebuffer") {
64620          return new NodeBufferReader(data);
64621        }
64622
64623        if (support.uint8array) {
64624          return new Uint8ArrayReader(utils.transformTo("uint8array", data));
64625        }
64626
64627        return new ArrayReader(utils.transformTo("array", data));
64628      };
64629    }, {
64630      "../support": 396,
64631      "../utils": 398,
64632      "./ArrayReader": 383,
64633      "./NodeBufferReader": 385,
64634      "./StringReader": 386,
64635      "./Uint8ArrayReader": 387
64636    }],
64637    389: [function (require, module, exports) {
64638      'use strict';
64639
64640      exports.LOCAL_FILE_HEADER = "PK\x03\x04";
64641      exports.CENTRAL_FILE_HEADER = "PK\x01\x02";
64642      exports.CENTRAL_DIRECTORY_END = "PK\x05\x06";
64643      exports.ZIP64_CENTRAL_DIRECTORY_LOCATOR = "PK\x06\x07";
64644      exports.ZIP64_CENTRAL_DIRECTORY_END = "PK\x06\x06";
64645      exports.DATA_DESCRIPTOR = "PK\x07\x08";
64646    }, {}],
64647    390: [function (require, module, exports) {
64648      'use strict';
64649
64650      var GenericWorker = require('./GenericWorker');
64651
64652      var utils = require('../utils');
64653      /**
64654       * A worker which convert chunks to a specified type.
64655       * @constructor
64656       * @param {String} destType the destination type.
64657       */
64658
64659
64660      function ConvertWorker(destType) {
64661        GenericWorker.call(this, "ConvertWorker to " + destType);
64662        this.destType = destType;
64663      }
64664
64665      utils.inherits(ConvertWorker, GenericWorker);
64666      /**
64667       * @see GenericWorker.processChunk
64668       */
64669
64670      ConvertWorker.prototype.processChunk = function (chunk) {
64671        this.push({
64672          data: utils.transformTo(this.destType, chunk.data),
64673          meta: chunk.meta
64674        });
64675      };
64676
64677      module.exports = ConvertWorker;
64678    }, {
64679      "../utils": 398,
64680      "./GenericWorker": 394
64681    }],
64682    391: [function (require, module, exports) {
64683      'use strict';
64684
64685      var GenericWorker = require('./GenericWorker');
64686
64687      var crc32 = require('../crc32');
64688
64689      var utils = require('../utils');
64690      /**
64691       * A worker which calculate the crc32 of the data flowing through.
64692       * @constructor
64693       */
64694
64695
64696      function Crc32Probe() {
64697        GenericWorker.call(this, "Crc32Probe");
64698        this.withStreamInfo("crc32", 0);
64699      }
64700
64701      utils.inherits(Crc32Probe, GenericWorker);
64702      /**
64703       * @see GenericWorker.processChunk
64704       */
64705
64706      Crc32Probe.prototype.processChunk = function (chunk) {
64707        this.streamInfo.crc32 = crc32(chunk.data, this.streamInfo.crc32 || 0);
64708        this.push(chunk);
64709      };
64710
64711      module.exports = Crc32Probe;
64712    }, {
64713      "../crc32": 370,
64714      "../utils": 398,
64715      "./GenericWorker": 394
64716    }],
64717    392: [function (require, module, exports) {
64718      'use strict';
64719
64720      var utils = require('../utils');
64721
64722      var GenericWorker = require('./GenericWorker');
64723      /**
64724       * A worker which calculate the total length of the data flowing through.
64725       * @constructor
64726       * @param {String} propName the name used to expose the length
64727       */
64728
64729
64730      function DataLengthProbe(propName) {
64731        GenericWorker.call(this, "DataLengthProbe for " + propName);
64732        this.propName = propName;
64733        this.withStreamInfo(propName, 0);
64734      }
64735
64736      utils.inherits(DataLengthProbe, GenericWorker);
64737      /**
64738       * @see GenericWorker.processChunk
64739       */
64740
64741      DataLengthProbe.prototype.processChunk = function (chunk) {
64742        if (chunk) {
64743          var length = this.streamInfo[this.propName] || 0;
64744          this.streamInfo[this.propName] = length + chunk.data.length;
64745        }
64746
64747        GenericWorker.prototype.processChunk.call(this, chunk);
64748      };
64749
64750      module.exports = DataLengthProbe;
64751    }, {
64752      "../utils": 398,
64753      "./GenericWorker": 394
64754    }],
64755    393: [function (require, module, exports) {
64756      'use strict';
64757
64758      var utils = require('../utils');
64759
64760      var GenericWorker = require('./GenericWorker'); // the size of the generated chunks
64761      // TODO expose this as a public variable
64762
64763
64764      var DEFAULT_BLOCK_SIZE = 16 * 1024;
64765      /**
64766       * A worker that reads a content and emits chunks.
64767       * @constructor
64768       * @param {Promise} dataP the promise of the data to split
64769       */
64770
64771      function DataWorker(dataP) {
64772        GenericWorker.call(this, "DataWorker");
64773        var self = this;
64774        this.dataIsReady = false;
64775        this.index = 0;
64776        this.max = 0;
64777        this.data = null;
64778        this.type = "";
64779        this._tickScheduled = false;
64780        dataP.then(function (data) {
64781          self.dataIsReady = true;
64782          self.data = data;
64783          self.max = data && data.length || 0;
64784          self.type = utils.getTypeOf(data);
64785
64786          if (!self.isPaused) {
64787            self._tickAndRepeat();
64788          }
64789        }, function (e) {
64790          self.error(e);
64791        });
64792      }
64793
64794      utils.inherits(DataWorker, GenericWorker);
64795      /**
64796       * @see GenericWorker.cleanUp
64797       */
64798
64799      DataWorker.prototype.cleanUp = function () {
64800        GenericWorker.prototype.cleanUp.call(this);
64801        this.data = null;
64802      };
64803      /**
64804       * @see GenericWorker.resume
64805       */
64806
64807
64808      DataWorker.prototype.resume = function () {
64809        if (!GenericWorker.prototype.resume.call(this)) {
64810          return false;
64811        }
64812
64813        if (!this._tickScheduled && this.dataIsReady) {
64814          this._tickScheduled = true;
64815          utils.delay(this._tickAndRepeat, [], this);
64816        }
64817
64818        return true;
64819      };
64820      /**
64821       * Trigger a tick a schedule an other call to this function.
64822       */
64823
64824
64825      DataWorker.prototype._tickAndRepeat = function () {
64826        this._tickScheduled = false;
64827
64828        if (this.isPaused || this.isFinished) {
64829          return;
64830        }
64831
64832        this._tick();
64833
64834        if (!this.isFinished) {
64835          utils.delay(this._tickAndRepeat, [], this);
64836          this._tickScheduled = true;
64837        }
64838      };
64839      /**
64840       * Read and push a chunk.
64841       */
64842
64843
64844      DataWorker.prototype._tick = function () {
64845        if (this.isPaused || this.isFinished) {
64846          return false;
64847        }
64848
64849        var size = DEFAULT_BLOCK_SIZE;
64850        var data = null,
64851            nextIndex = Math.min(this.max, this.index + size);
64852
64853        if (this.index >= this.max) {
64854          // EOF
64855          return this.end();
64856        } else {
64857          switch (this.type) {
64858            case "string":
64859              data = this.data.substring(this.index, nextIndex);
64860              break;
64861
64862            case "uint8array":
64863              data = this.data.subarray(this.index, nextIndex);
64864              break;
64865
64866            case "array":
64867            case "nodebuffer":
64868              data = this.data.slice(this.index, nextIndex);
64869              break;
64870          }
64871
64872          this.index = nextIndex;
64873          return this.push({
64874            data: data,
64875            meta: {
64876              percent: this.max ? this.index / this.max * 100 : 0
64877            }
64878          });
64879        }
64880      };
64881
64882      module.exports = DataWorker;
64883    }, {
64884      "../utils": 398,
64885      "./GenericWorker": 394
64886    }],
64887    394: [function (require, module, exports) {
64888      'use strict';
64889      /**
64890       * A worker that does nothing but passing chunks to the next one. This is like
64891       * a nodejs stream but with some differences. On the good side :
64892       * - it works on IE 6-9 without any issue / polyfill
64893       * - it weights less than the full dependencies bundled with browserify
64894       * - it forwards errors (no need to declare an error handler EVERYWHERE)
64895       *
64896       * A chunk is an object with 2 attributes : `meta` and `data`. The former is an
64897       * object containing anything (`percent` for example), see each worker for more
64898       * details. The latter is the real data (String, Uint8Array, etc).
64899       *
64900       * @constructor
64901       * @param {String} name the name of the stream (mainly used for debugging purposes)
64902       */
64903
64904      function GenericWorker(name) {
64905        // the name of the worker
64906        this.name = name || "default";
vendor: 5,279 bytes, lines 64906-65067
64906 // an object containing metadata about the workers chain
64907
64908        this.streamInfo = {}; // an error which happened when the worker was paused
64909
64910        this.generatedError = null; // an object containing metadata to be merged by this worker into the general metadata
64911
64912        this.extraStreamInfo = {}; // true if the stream is paused (and should not do anything), false otherwise
64913
64914        this.isPaused = true; // true if the stream is finished (and should not do anything), false otherwise
64915
64916        this.isFinished = false; // true if the stream is locked to prevent further structure updates (pipe), false otherwise
64917
64918        this.isLocked = false; // the event listeners
64919
64920        this._listeners = {
64921          'data': [],
64922          'end': [],
64923          'error': []
64924        }; // the previous worker, if any
64925
64926        this.previous = null;
64927      }
64928
64929      GenericWorker.prototype = {
64930        /**
64931         * Push a chunk to the next workers.
64932         * @param {Object} chunk the chunk to push
64933         */
64934        push: function push(chunk) {
64935          this.emit("data", chunk);
64936        },
64937
64938        /**
64939         * End the stream.
64940         * @return {Boolean} true if this call ended the worker, false otherwise.
64941         */
64942        end: function end() {
64943          if (this.isFinished) {
64944            return false;
64945          }
64946
64947          this.flush();
64948
64949          try {
64950            this.emit("end");
64951            this.cleanUp();
64952            this.isFinished = true;
64953          } catch (e) {
64954            this.emit("error", e);
64955          }
64956
64957          return true;
64958        },
64959
64960        /**
64961         * End the stream with an error.
64962         * @param {Error} e the error which caused the premature end.
64963         * @return {Boolean} true if this call ended the worker with an error, false otherwise.
64964         */
64965        error: function error(e) {
64966          if (this.isFinished) {
64967            return false;
64968          }
64969
64970          if (this.isPaused) {
64971            this.generatedError = e;
64972          } else {
64973            this.isFinished = true;
64974            this.emit("error", e); // in the workers chain exploded in the middle of the chain,
64975            // the error event will go downward but we also need to notify
64976            // workers upward that there has been an error.
64977
64978            if (this.previous) {
64979              this.previous.error(e);
64980            }
64981
64982            this.cleanUp();
64983          }
64984
64985          return true;
64986        },
64987
64988        /**
64989         * Add a callback on an event.
64990         * @param {String} name the name of the event (data, end, error)
64991         * @param {Function} listener the function to call when the event is triggered
64992         * @return {GenericWorker} the current object for chainability
64993         */
64994        on: function on(name, listener) {
64995          this._listeners[name].push(listener);
64996
64997          return this;
64998        },
64999
65000        /**
65001         * Clean any references when a worker is ending.
65002         */
65003        cleanUp: function cleanUp() {
65004          this.streamInfo = this.generatedError = this.extraStreamInfo = null;
65005          this._listeners = [];
65006        },
65007
65008        /**
65009         * Trigger an event. This will call registered callback with the provided arg.
65010         * @param {String} name the name of the event (data, end, error)
65011         * @param {Object} arg the argument to call the callback with.
65012         */
65013        emit: function emit(name, arg) {
65014          if (this._listeners[name]) {
65015            for (var i = 0; i < this._listeners[name].length; i++) {
65016              this._listeners[name][i].call(this, arg);
65017            }
65018          }
65019        },
65020
65021        /**
65022         * Chain a worker with an other.
65023         * @param {Worker} next the worker receiving events from the current one.
65024         * @return {worker} the next worker for chainability
65025         */
65026        pipe: function pipe(next) {
65027          return next.registerPrevious(this);
65028        },
65029
65030        /**
65031         * Same as `pipe` in the other direction.
65032         * Using an API with `pipe(next)` is very easy.
65033         * Implementing the API with the point of view of the next one registering
65034         * a source is easier, see the ZipFileWorker.
65035         * @param {Worker} previous the previous worker, sending events to this one
65036         * @return {Worker} the current worker for chainability
65037         */
65038        registerPrevious: function registerPrevious(previous) {
65039          if (this.isLocked) {
65040            throw new Error("The stream '" + this + "' has already been used.");
65041          } // sharing the streamInfo...
65042
65043
65044          this.streamInfo = previous.streamInfo; // ... and adding our own bits
65045
65046          this.mergeStreamInfo();
65047          this.previous = previous;
65048          var self = this;
65049          previous.on('data', function (chunk) {
65050            self.processChunk(chunk);
65051          });
65052          previous.on('end', function () {
65053            self.end();
65054          });
65055          previous.on('error', function (e) {
65056            self.error(e);
65057          });
65058          return this;
65059        },
65060
65061        /**
65062         * Pause the stream so it doesn't send events anymore.
65063         * @return {Boolean} true if this call paused the worker, false otherwise.
65064         */
65065        pause: function pause() {
65066          if (this.isPaused || this.isFinished) {
65067            return false;
65068          }
65069
65070          this.isPaused = true;
65071
65072          if (this.previous) {
65073            this.previous.pause();
65074          }
65075
65076          return true;
65077        },
65078
65079        /**
65080         * Resume a paused stream.
65081         * @return {Boolean} true if this call resumed the worker, false otherwise.
65082         */
65083        resume: function resume() {
65084          if (!this.isPaused || this.isFinished) {
65085            return false;
65086          }
65087
65088          this.isPaused = false; // if true, the worker tried to resume but failed
65089
65090          var withError = false;
65091
65092          if (this.generatedError) {
65093            this.error(this.generatedError);
65094            withError = true;
65095          }
65096
65097          if (this.previous) {
65098            this.previous.resume();
65099          }
65100
65101          return !withError;
65102        },
65103
65104        /**
65105         * Flush any remaining bytes as the stream is ending.
65106         */
65107        flush: function flush() {},
65108
65109        /**
65110         * Process a chunk. This is usually the method overridden.
65111         * @param {Object} chunk the chunk to process.
65112         */
65113        processChunk: function processChunk(chunk) {
65114          this.push(chunk);
65115        },
65116
65117        /**
65118         * Add a key/value to be added in the workers chain streamInfo once activated.
65119         * @param {String} key the key to use
65120         * @param {Object} value the associated value
65121         * @return {Worker} the current worker for chainability
65122         */
65123        withStreamInfo: function withStreamInfo(key, value) {
vendor: 9,368 bytes, lines 65124-65418
65124          this.extraStreamInfo[key] = value;
65125          this.mergeStreamInfo();
65126          return this;
65127        },
65128
65129        /**
65130         * Merge this worker's streamInfo into the chain's streamInfo.
65131         */
65132        mergeStreamInfo: function mergeStreamInfo() {
65133          for (var key in this.extraStreamInfo) {
65134            if (!this.extraStreamInfo.hasOwnProperty(key)) {
65135              continue;
65136            }
65137
65138            this.streamInfo[key] = this.extraStreamInfo[key];
65139          }
65140        },
65141
65142        /**
65143         * Lock the stream to prevent further updates on the workers chain.
65144         * After calling this method, all calls to pipe will fail.
65145         */
65146        lock: function lock() {
65147          if (this.isLocked) {
65148            throw new Error("The stream '" + this + "' has already been used.");
65149          }
65150
65151          this.isLocked = true;
65152
65153          if (this.previous) {
65154            this.previous.lock();
65155          }
65156        },
65157
65158        /**
65159         *
65160         * Pretty print the workers chain.
65161         */
65162        toString: function toString() {
65163          var me = "Worker " + this.name;
65164
65165          if (this.previous) {
65166            return this.previous + " -> " + me;
65167          } else {
65168            return me;
65169          }
65170        }
65171      };
65172      module.exports = GenericWorker;
65173    }, {}],
65174    395: [function (require, module, exports) {
65175      (function (Buffer) {
65176        'use strict';
65177
65178        var utils = require('../utils');
65179
65180        var ConvertWorker = require('./ConvertWorker');
65181
65182        var GenericWorker = require('./GenericWorker');
65183
65184        var base64 = require('../base64');
65185
65186        var support = require("../support");
65187
65188        var external = require("../external");
65189
65190        var NodejsStreamOutputAdapter = null;
65191
65192        if (support.nodestream) {
65193          try {
65194            NodejsStreamOutputAdapter = require('../nodejs/NodejsStreamOutputAdapter');
65195          } catch (e) {}
65196        }
65197        /**
65198         * Apply the final transformation of the data. If the user wants a Blob for
65199         * example, it's easier to work with an U8intArray and finally do the
65200         * ArrayBuffer/Blob conversion.
65201         * @param {String} type the name of the final type
65202         * @param {String|Uint8Array|Buffer} content the content to transform
65203         * @param {String} mimeType the mime type of the content, if applicable.
65204         * @return {String|Uint8Array|ArrayBuffer|Buffer|Blob} the content in the right format.
65205         */
65206
65207
65208        function transformZipOutput(type, content, mimeType) {
65209          switch (type) {
65210            case "blob":
65211              return utils.newBlob(utils.transformTo("arraybuffer", content), mimeType);
65212
65213            case "base64":
65214              return base64.encode(content);
65215
65216            default:
65217              return utils.transformTo(type, content);
65218          }
65219        }
65220        /**
65221         * Concatenate an array of data of the given type.
65222         * @param {String} type the type of the data in the given array.
65223         * @param {Array} dataArray the array containing the data chunks to concatenate
65224         * @return {String|Uint8Array|Buffer} the concatenated data
65225         * @throws Error if the asked type is unsupported
65226         */
65227
65228
65229        function concat(type, dataArray) {
65230          var i,
65231              index = 0,
65232              res = null,
65233              totalLength = 0;
65234
65235          for (i = 0; i < dataArray.length; i++) {
65236            totalLength += dataArray[i].length;
65237          }
65238
65239          switch (type) {
65240            case "string":
65241              return dataArray.join("");
65242
65243            case "array":
65244              return Array.prototype.concat.apply([], dataArray);
65245
65246            case "uint8array":
65247              res = new Uint8Array(totalLength);
65248
65249              for (i = 0; i < dataArray.length; i++) {
65250                res.set(dataArray[i], index);
65251                index += dataArray[i].length;
65252              }
65253
65254              return res;
65255
65256            case "nodebuffer":
65257              return Buffer.concat(dataArray);
65258
65259            default:
65260              throw new Error("concat : unsupported type '" + type + "'");
65261          }
65262        }
65263        /**
65264         * Listen a StreamHelper, accumulate its content and concatenate it into a
65265         * complete block.
65266         * @param {StreamHelper} helper the helper to use.
65267         * @param {Function} updateCallback a callback called on each update. Called
65268         * with one arg :
65269         * - the metadata linked to the update received.
65270         * @return Promise the promise for the accumulation.
65271         */
65272
65273
65274        function _accumulate(helper, updateCallback) {
65275          return new external.Promise(function (resolve, reject) {
65276            var dataArray = [];
65277            var chunkType = helper._internalType,
65278                resultType = helper._outputType,
65279                mimeType = helper._mimeType;
65280            helper.on('data', function (data, meta) {
65281              dataArray.push(data);
65282
65283              if (updateCallback) {
65284                updateCallback(meta);
65285              }
65286            }).on('error', function (err) {
65287              dataArray = [];
65288              reject(err);
65289            }).on('end', function () {
65290              try {
65291                var result = transformZipOutput(resultType, concat(chunkType, dataArray), mimeType);
65292                resolve(result);
65293              } catch (e) {
65294                reject(e);
65295              }
65296
65297              dataArray = [];
65298            }).resume();
65299          });
65300        }
65301        /**
65302         * An helper to easily use workers outside of JSZip.
65303         * @constructor
65304         * @param {Worker} worker the worker to wrap
65305         * @param {String} outputType the type of data expected by the use
65306         * @param {String} mimeType the mime type of the content, if applicable.
65307         */
65308
65309
65310        function StreamHelper(worker, outputType, mimeType) {
65311          var internalType = outputType;
65312
65313          switch (outputType) {
65314            case "blob":
65315            case "arraybuffer":
65316              internalType = "uint8array";
65317              break;
65318
65319            case "base64":
65320              internalType = "string";
65321              break;
65322          }
65323
65324          try {
65325            // the type used internally
65326            this._internalType = internalType; // the type used to output results
65327
65328            this._outputType = outputType; // the mime type
65329
65330            this._mimeType = mimeType;
65331            utils.checkSupport(internalType);
65332            this._worker = worker.pipe(new ConvertWorker(internalType)); // the last workers can be rewired without issues but we need to
65333            // prevent any updates on previous workers.
65334
65335            worker.lock();
65336          } catch (e) {
65337            this._worker = new GenericWorker("error");
65338
65339            this._worker.error(e);
65340          }
65341        }
65342
65343        StreamHelper.prototype = {
65344          /**
65345           * Listen a StreamHelper, accumulate its content and concatenate it into a
65346           * complete block.
65347           * @param {Function} updateCb the update callback.
65348           * @return Promise the promise for the accumulation.
65349           */
65350          accumulate: function accumulate(updateCb) {
65351            return _accumulate(this, updateCb);
65352          },
65353
65354          /**
65355           * Add a listener on an event triggered on a stream.
65356           * @param {String} evt the name of the event
65357           * @param {Function} fn the listener
65358           * @return {StreamHelper} the current helper.
65359           */
65360          on: function on(evt, fn) {
65361            var self = this;
65362
65363            if (evt === "data") {
65364              this._worker.on(evt, function (chunk) {
65365                fn.call(self, chunk.data, chunk.meta);
65366              });
65367            } else {
65368              this._worker.on(evt, function () {
65369                utils.delay(fn, arguments, self);
65370              });
65371            }
65372
65373            return this;
65374          },
65375
65376          /**
65377           * Resume the flow of chunks.
65378           * @return {StreamHelper} the current helper.
65379           */
65380          resume: function resume() {
65381            utils.delay(this._worker.resume, [], this._worker);
65382            return this;
65383          },
65384
65385          /**
65386           * Pause the flow of chunks.
65387           * @return {StreamHelper} the current helper.
65388           */
65389          pause: function pause() {
65390            this._worker.pause();
65391
65392            return this;
65393          },
65394
65395          /**
65396           * Return a nodejs stream for this helper.
65397           * @param {Function} updateCb the update callback.
65398           * @return {NodejsStreamOutputAdapter} the nodejs stream.
65399           */
65400          toNodejsStream: function toNodejsStream(updateCb) {
65401            utils.checkSupport("nodestream");
65402
65403            if (this._outputType !== "nodebuffer") {
65404              // an object stream containing blob/arraybuffer/uint8array/string
65405              // is strange and I don't know if it would be useful.
65406              // I you find this comment and have a good usecase, please open a
65407              // bug report !
65408              throw new Error(this._outputType + " is not supported by this method");
65409            }
65410
65411            return new NodejsStreamOutputAdapter(this, {
65412              objectMode: this._outputType !== "nodebuffer"
65413            }, updateCb);
65414          }
65415        };
65416        module.exports = StreamHelper;
65417      }).call(this, require("buffer").Buffer);
65418    }, {
65419      "../base64": 367,
65420      "../external": 372,
65421      "../nodejs/NodejsStreamOutputAdapter": 379,
65422      "../support": 396,
65423      "../utils": 398,
65424      "./ConvertWorker": 390,
65425      "./GenericWorker": 394,
65426      "buffer": 214
65427    }],
65428    396: [function (require, module, exports) {
65429      (function (Buffer) {
65430        'use strict';
65431
65432        exports.base64 = true;
65433        exports.array = true;
65434        exports.string = true;
65435        exports.arraybuffer = typeof ArrayBuffer !== "undefined" && typeof Uint8Array !== "undefined";
65436        exports.nodebuffer = typeof Buffer !== "undefined"; // contains true if JSZip can read/generate Uint8Array, false otherwise.
65437
65438        exports.uint8array = typeof Uint8Array !== "undefined";
65439
65440        if (typeof ArrayBuffer === "undefined") {
65441          exports.blob = false;
65442        } else {
65443          var buffer = new ArrayBuffer(0);
65444
65445          try {
65446            exports.blob = new Blob([buffer], {
65447              type: "application/zip"
65448            }).size === 0;
65449          } catch (e) {
65450            try {
65451              var Builder = self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder;
65452              var builder = new Builder();
65453              builder.append(buffer);
65454              exports.blob = builder.getBlob('application/zip').size === 0;
65455            } catch (e) {
65456              exports.blob = false;
65457            }
65458          }
65459        }
65460
65461        try {
65462          exports.nodestream = !!require('readable-stream').Readable;
65463        } catch (e) {
65464          exports.nodestream = false;
65465        }
65466      }).call(this, require("buffer").Buffer);
65467    }, {
65468      "buffer": 214,
65469      "readable-stream": 382
65470    }],
65471    397: [function (require, module, exports) {
65472      'use strict';
65473
65474      var utils = require('./utils');
65475
65476      var support = require('./support');
65477
65478      var nodejsUtils = require('./nodejsUtils');
65479
65480      var GenericWorker = require('./stream/GenericWorker');
65481      /**
65482       * The following functions come from pako, from pako/lib/utils/strings
65483       * released under the MIT license, see pako https://github.com/nodeca/pako/
65484       */
65485      // Table with utf8 lengths (calculated by first byte of sequence)
65486      // Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,
65487      // because max possible codepoint is 0x10ffff
65488
65489
65490      var _utf8len = new Array(256);
65491
65492      for (var i = 0; i < 256; i++) {
65493        _utf8len[i] = i >= 252 ? 6 : i >= 248 ? 5 : i >= 240 ? 4 : i >= 224 ? 3 : i >= 192 ? 2 : 1;
65494      }
65495
65496      _utf8len[254] = _utf8len[254] = 1; // Invalid sequence start
65497      // convert string to array (typed, when possible)
65498
65499      var string2buf = function string2buf(str) {
65500        var buf,
65501            c,
65502            c2,
65503            m_pos,
65504            i,
65505            str_len = str.length,
65506            buf_len = 0; // count binary size
65507
65508        for (m_pos = 0; m_pos < str_len; m_pos++) {
65509          c = str.charCodeAt(m_pos);
65510
65511          if ((c & 0xfc00) === 0xd800 && m_pos + 1 < str_len) {
65512            c2 = str.charCodeAt(m_pos + 1);
65513
65514            if ((c2 & 0xfc00) === 0xdc00) {
65515              c = 0x10000 + (c - 0xd800 << 10) + (c2 - 0xdc00);
65516              m_pos++;
65517            }
65518          }
65519
65520          buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4;
65521        } // allocate buffer
65522
65523
65524        if (support.uint8array) {
65525          buf = new Uint8Array(buf_len);
65526        } else {
65527          buf = new Array(buf_len);
65528        } // convert
65529
65530
65531        for (i = 0, m_pos = 0; i < buf_len; m_pos++) {
65532          c = str.charCodeAt(m_pos);
65533
65534          if ((c & 0xfc00) === 0xd800 && m_pos + 1 < str_len) {
65535            c2 = str.charCodeAt(m_pos + 1);
65536
65537            if ((c2 & 0xfc00) === 0xdc00) {
65538              c = 0x10000 + (c - 0xd800 << 10) + (c2 - 0xdc00);
65539              m_pos++;
65540            }
65541          }
65542
65543          if (c < 0x80) {
65544            /* one byte */
65545            buf[i++] = c;
65546          } else if (c < 0x800) {
65547            /* two bytes */
65548            buf[i++] = 0xC0 | c >>> 6;
65549            buf[i++] = 0x80 | c & 0x3f;
65550          } else if (c < 0x10000) {
65551            /* three bytes */
65552            buf[i++] = 0xE0 | c >>> 12;
65553            buf[i++] = 0x80 | c >>> 6 & 0x3f;
65554            buf[i++] = 0x80 | c & 0x3f;
65555          } else {
65556            /* four bytes */
65557            buf[i++] = 0xf0 | c >>> 18;
65558            buf[i++] = 0x80 | c >>> 12 & 0x3f;
65559            buf[i++] = 0x80 | c >>> 6 & 0x3f;
65560            buf[i++] = 0x80 | c & 0x3f;
65561          }
65562        }
65563
65564        return buf;
65565      }; // Calculate max possible position in utf8 buffer,
65566      // that will not break sequence. If that's not possible
65567      // - (very small limits) return max size as is.
65568      //
65569      // buf[] - utf8 bytes array
65570      // max   - length limit (mandatory);
65571
65572
65573      var utf8border = function utf8border(buf, max) {
65574        var pos;
65575        max = max || buf.length;
65576
65577        if (max > buf.length) {
65578          max = buf.length;
65579        } // go back from last position, until start of sequence found
65580
65581
65582        pos = max - 1;
65583
65584        while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) {
65585          pos--;
65586        } // Fuckup - very small and broken sequence,
65587        // return max, because we should return something anyway.
65588
65589
65590        if (pos < 0) {
65591          return max;
65592        } // If we came to start of buffer - that means vuffer is too small,
65593        // return max too.
65594
65595
65596        if (pos === 0) {
65597          return max;
65598        }
65599
65600        return pos + _utf8len[buf[pos]] > max ? pos : max;
65601      }; // convert array to string
65602
65603
65604      var buf2string = function buf2string(buf) {
65605        var str, i, out, c, c_len;
65606        var len = buf.length; // Reserve max possible length (2 words per char)
65607        // NB: by unknown reasons, Array is significantly faster for
65608        //     String.fromCharCode.apply than Uint16Array.
65609
65610        var utf16buf = new Array(len * 2);
65611
65612        for (out = 0, i = 0; i < len;) {
65613          c = buf[i++]; // quick process ascii
65614
65615          if (c < 0x80) {
65616            utf16buf[out++] = c;
65617            continue;
65618          }
65619
65620          c_len = _utf8len[c];
65620 // skip 5 & 6 byte codes
65621
65622          if (c_len > 4) {
65623            utf16buf[out++] = 0xfffd;
65624            i += c_len - 1;
65625            continue;
65626          } // apply mask on first byte
65627
65628
65629          c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07; // join the rest
65630
65631          while (c_len > 1 && i < len) {
65632            c = c << 6 | buf[i++] & 0x3f;
65633            c_len--;
65634          } // terminated by end of string?
65635
65636
65637          if (c_len > 1) {
65638            utf16buf[out++] = 0xfffd;
65639            continue;
65640          }
65641
65642          if (c < 0x10000) {
65643            utf16buf[out++] = c;
65644          } else {
65645            c -= 0x10000;
65646            utf16buf[out++] = 0xd800 | c >> 10 & 0x3ff;
65647            utf16buf[out++] = 0xdc00 | c & 0x3ff;
65648          }
65649        } // shrinkBuf(utf16buf, out)
65650
65651
65652        if (utf16buf.length !== out) {
65653          if (utf16buf.subarray) {
65654            utf16buf = utf16buf.subarray(0, out);
65655          } else {
65656            utf16buf.length = out;
65657          }
65658        } // return String.fromCharCode.apply(null, utf16buf);
65659
65660
65661        return utils.applyFromCharCode(utf16buf);
65662      }; // That's all for the pako functions.
65663
65664      /**
65665       * Transform a javascript string into an array (typed if possible) of bytes,
65666       * UTF-8 encoded.
65667       * @param {String} str the string to encode
65668       * @return {Array|Uint8Array|Buffer} the UTF-8 encoded string.
65669       */
65670
65671
65672      exports.utf8encode = function utf8encode(str) {
65673        if (support.nodebuffer) {
65674          return nodejsUtils.newBufferFrom(str, "utf-8");
65675        }
65676
65677        return string2buf(str);
65678      };
65679      /**
65680       * Transform a bytes array (or a representation) representing an UTF-8 encoded
65681       * string into a javascript string.
65682       * @param {Array|Uint8Array|Buffer} buf the data de decode
65683       * @return {String} the decoded string.
65684       */
65685
65686
65687      exports.utf8decode = function utf8decode(buf) {
65688        if (support.nodebuffer) {
65689          return utils.transformTo("nodebuffer", buf).toString("utf-8");
65690        }
65691
65692        buf = utils.transformTo(support.uint8array ? "uint8array" : "array", buf);
65693        return buf2string(buf);
65694      };
65695      /**
65696       * A worker to decode utf8 encoded binary chunks into string chunks.
65697       * @constructor
65698       */
65699
65700
65701      function Utf8DecodeWorker() {
65702        GenericWorker.call(this, "utf-8 decode"); // the last bytes if a chunk didn't end with a complete codepoint.
65703
65704        this.leftOver = null;
65705      }
65706
65707      utils.inherits(Utf8DecodeWorker, GenericWorker);
65708      /**
65709       * @see GenericWorker.processChunk
65710       */
65711
65712      Utf8DecodeWorker.prototype.processChunk = function (chunk) {
65713        var data = utils.transformTo(support.uint8array ? "uint8array" : "array", chunk.data); // 1st step, re-use what's left of the previous chunk
65714
65715        if (this.leftOver && this.leftOver.length) {
65716          if (support.uint8array) {
65717            var previousData = data;
65718            data = new Uint8Array(previousData.length + this.leftOver.length);
65719            data.set(this.leftOver, 0);
65720            data.set(previousData, this.leftOver.length);
65721          } else {
65722            data = this.leftOver.concat(data);
65723          }
65724
65725          this.leftOver = null;
65726        }
65727
65728        var nextBoundary = utf8border(data);
65729        var usableData = data;
65730
65731        if (nextBoundary !== data.length) {
65732          if (support.uint8array) {
65733            usableData = data.subarray(0, nextBoundary);
65734            this.leftOver = data.subarray(nextBoundary, data.length);
65735          } else {
65736            usableData = data.slice(0, nextBoundary);
65737            this.leftOver = data.slice(nextBoundary, data.length);
65738          }
65739        }
65740
65741        this.push({
65742          data: exports.utf8decode(usableData),
65743          meta: chunk.meta
65744        });
65745      };
65746      /**
65747       * @see GenericWorker.flush
65748       */
65749
65750
65751      Utf8DecodeWorker.prototype.flush = function () {
65752        if (this.leftOver && this.leftOver.length) {
65753          this.push({
65754            data: exports.utf8decode(this.leftOver),
65755            meta: {}
65756          });
65757          this.leftOver = null;
65758        }
65759      };
65760
65761      exports.Utf8DecodeWorker = Utf8DecodeWorker;
65762      /**
65763       * A worker to endcode string chunks into utf8 encoded binary chunks.
65764       * @constructor
65765       */
65766
65767      function Utf8EncodeWorker() {
65768        GenericWorker.call(this, "utf-8 encode");
65769      }
65770
65771      utils.inherits(Utf8EncodeWorker, GenericWorker);
65772      /**
65773       * @see GenericWorker.processChunk
65774       */
65775
65776      Utf8EncodeWorker.prototype.processChunk = function (chunk) {
65777        this.push({
65778          data: exports.utf8encode(chunk.data),
65779          meta: chunk.meta
65780        });
65781      };
65782
65783      exports.Utf8EncodeWorker = Utf8EncodeWorker;
65784    }, {
vendor: 4,795 bytes, lines 65785-65928
65785      "./nodejsUtils": 380,
65786      "./stream/GenericWorker": 394,
65787      "./support": 396,
65788      "./utils": 398
65789    }],
65790    398: [function (require, module, exports) {
65791      'use strict';
65792
65793      var support = require('./support');
65794
65795      var base64 = require('./base64');
65796
65797      var nodejsUtils = require('./nodejsUtils');
65798
65799      var setImmediate = require('set-immediate-shim');
65800
65801      var external = require("./external");
65802      /**
65803       * Convert a string that pass as a "binary string": it should represent a byte
65804       * array but may have > 255 char codes. Be sure to take only the first byte
65805       * and returns the byte array.
65806       * @param {String} str the string to transform.
65807       * @return {Array|Uint8Array} the string in a binary format.
65808       */
65809
65810
65811      function string2binary(str) {
65812        var result = null;
65813
65814        if (support.uint8array) {
65815          result = new Uint8Array(str.length);
65816        } else {
65817          result = new Array(str.length);
65818        }
65819
65820        return stringToArrayLike(str, result);
65821      }
65822      /**
65823       * Create a new blob with the given content and the given type.
65824       * @param {String|ArrayBuffer} part the content to put in the blob. DO NOT use
65825       * an Uint8Array because the stock browser of android 4 won't accept it (it
65826       * will be silently converted to a string, "[object Uint8Array]").
65827       *
65828       * Use only ONE part to build the blob to avoid a memory leak in IE11 / Edge:
65829       * when a large amount of Array is used to create the Blob, the amount of
65830       * memory consumed is nearly 100 times the original data amount.
65831       *
65832       * @param {String} type the mime type of the blob.
65833       * @return {Blob} the created blob.
65834       */
65835
65836
65837      exports.newBlob = function (part, type) {
65838        exports.checkSupport("blob");
65839
65840        try {
65841          // Blob constructor
65842          return new Blob([part], {
65843            type: type
65844          });
65845        } catch (e) {
65846          try {
65847            // deprecated, browser only, old way
65848            var Builder = self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder;
65849            var builder = new Builder();
65850            builder.append(part);
65851            return builder.getBlob(type);
65852          } catch (e) {
65853            // well, fuck ?!
65854            throw new Error("Bug : can't construct the Blob.");
65855          }
65856        }
65857      };
65858      /**
65859       * The identity function.
65860       * @param {Object} input the input.
65861       * @return {Object} the same input.
65862       */
65863
65864
65865      function identity(input) {
65866        return input;
65867      }
65868      /**
65869       * Fill in an array with a string.
65870       * @param {String} str the string to use.
65871       * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to fill in (will be mutated).
65872       * @return {Array|ArrayBuffer|Uint8Array|Buffer} the updated array.
65873       */
65874
65875
65876      function stringToArrayLike(str, array) {
65877        for (var i = 0; i < str.length; ++i) {
65878          array[i] = str.charCodeAt(i) & 0xFF;
65879        }
65880
65881        return array;
65882      }
65883      /**
65884       * An helper for the function arrayLikeToString.
65885       * This contains static information and functions that
65886       * can be optimized by the browser JIT compiler.
65887       */
65888
65889
65890      var arrayToStringHelper = {
65891        /**
65892         * Transform an array of int into a string, chunk by chunk.
65893         * See the performances notes on arrayLikeToString.
65894         * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to transform.
65895         * @param {String} type the type of the array.
65896         * @param {Integer} chunk the chunk size.
65897         * @return {String} the resulting string.
65898         * @throws Error if the chunk is too big for the stack.
65899         */
65900        stringifyByChunk: function stringifyByChunk(array, type, chunk) {
65901          var result = [],
65902              k = 0,
65903              len = array.length; // shortcut
65904
65905          if (len <= chunk) {
65906            return String.fromCharCode.apply(null, array);
65907          }
65908
65909          while (k < len) {
65910            if (type === "array" || type === "nodebuffer") {
65911              result.push(String.fromCharCode.apply(null, array.slice(k, Math.min(k + chunk, len))));
65912            } else {
65913              result.push(String.fromCharCode.apply(null, array.subarray(k, Math.min(k + chunk, len))));
65914            }
65915
65916            k += chunk;
65917          }
65918
65919          return result.join("");
65920        },
65921
65922        /**
65923         * Call String.fromCharCode on every item in the array.
65924         * This is the naive implementation, which generate A LOT of intermediate string.
65925         * This should be used when everything else fail.
65926         * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to transform.
65927         * @return {String} the result.
65928         */
65929        stringifyByChar: function stringifyByChar(array) {
65930          var resultStr = "";
65931
65932          for (var i = 0; i < array.length; i++) {
65933            resultStr += String.fromCharCode(array[i]);
65934          }
65935
65936          return resultStr;
65937        },
65938        applyCanBeUsed: {
65939          /**
65940           * true if the browser accepts to use String.fromCharCode on Uint8Array
65941           */
65942          uint8array: function () {
65943            try {
65944              return support.uint8array && String.fromCharCode.apply(null, new Uint8Array(1)).length === 1;
65945            } catch (e) {
65946              return false;
65947            }
65948          }(),
65949
65950          /**
65951           * true if the browser accepts to use String.fromCharCode on nodejs Buffer.
65952           */
65953          nodebuffer: function () {
65954            try {
65955              return support.nodebuffer && String.fromCharCode.apply(null, nodejsUtils.allocBuffer(1)).length === 1;
65956            } catch (e) {
65957              return false;
65958            }
65959          }()
65960        }
65961      };
65962      /**
65963       * Transform an array-like object to a string.
65964       * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to transform.
65965       * @return {String} the result.
65966       */
65967
65968      function arrayLikeToString(array) {
65969        // Performances notes :
65970        // --------------------
65971        // String.fromCharCode.apply(null, array) is the fastest, see
65972        // see http://jsperf.com/converting-a-uint8array-to-a-string/2
65973        // but the stack is limited (and we can get huge arrays !).
65974        //
65975        // result += String.fromCharCode(array[i]); generate too many strings !
65976        //
65977        // This code is inspired by http://jsperf.com/arraybuffer-to-string-apply-performance/2
65978        // TODO : we now have workers that split the work. Do we still need that ?
65979        var chunk = 65536,
65980            type = exports.getTypeOf(array),
65981            canUseApply = true;
65982
65983        if (type === "uint8array") {
65984          canUseApply = arrayToStringHelper.applyCanBeUsed.uint8array;
65985        } else if (type === "nodebuffer") {
65986          canUseApply = arrayToStringHelper.applyCanBeUsed.nodebuffer;
65987        }
65988
65989        if (canUseApply) {
65990          while (chunk > 1) {
65991            try {
65992              return arrayToStringHelper.stringifyByChunk(array, type, chunk);
65993            } catch (e) {
65994              chunk = Math.floor(chunk / 2);
65995            }
65996          }
65997        } // no apply or chunk error : slow and painful algorithm
65998        // default browser on android 4.*
65999
66000
66001        return arrayToStringHelper.stringifyByChar(array);
66002      }
66003
66004      exports.applyFromCharCode = arrayLikeToString;
66005      /**
66006       * Copy the data from an array-like to an other array-like.
66007       * @param {Array|ArrayBuffer|Uint8Array|Buffer} arrayFrom the origin array.
66008       * @param {Array|ArrayBuffer|Uint8Array|Buffer} arrayTo the destination array which will be mutated.
66009       * @return {Array|ArrayBuffer|Uint8Array|Buffer} the updated destination array.
66010       */
66011
66012      function arrayLikeToArrayLike(arrayFrom, arrayTo) {
66013        for (var i = 0; i < arrayFrom.length; i++) {
66014          arrayTo[i] = arrayFrom[i];
66015        }
66016
66017        return arrayTo;
66018      } // a matrix containing functions to transform everything into everything.
66019
66020
66021      var transform = {}; // string to ?
66022
66023      transform["string"] = {
66024        "string": identity,
66025        "array": function array(input) {
66026          return stringToArrayLike(input, new Array(input.length));
66027        },
66028        "arraybuffer": function arraybuffer(input) {
66029          return transform["string"]["uint8array"](input).buffer;
66030        },
66031        "uint8array": function uint8array(input) {
66032          return stringToArrayLike(input, new Uint8Array(input.length));
66033        },
66034        "nodebuffer": function nodebuffer(input) {
66035          return stringToArrayLike(input, nodejsUtils.allocBuffer(input.length));
66036        }
66037      }; // array to ?
66038
66039      transform["array"] = {
66040        "string": arrayLikeToString,
66041        "array": identity,
66042        "arraybuffer": function arraybuffer(input) {
66043          return new Uint8Array(input).buffer;
66044        },
66045        "uint8array": function uint8array(input) {
66046          return new Uint8Array(input);
66047        },
66048        "nodebuffer": function nodebuffer(input) {
66049          return nodejsUtils.newBufferFrom(input);
66050        }
66051      }; // arraybuffer to ?
66052
66053      transform["arraybuffer"] = {
66054        "string": function string(input) {
66055          return arrayLikeToString(new Uint8Array(input));
66056        },
66057        "array": function array(input) {
66058          return arrayLikeToArrayLike(new Uint8Array(input), new Array(input.byteLength));
66059        },
66060        "arraybuffer": identity,
66061        "uint8array": function uint8array(input) {
66062          return new Uint8Array(input);
66063        },
66064        "nodebuffer": function nodebuffer(input) {
66065          return nodejsUtils.newBufferFrom(new Uint8Array(input));
66066        }
66067      }; // uint8array to ?
66068
66069      transform["uint8array"] = {
66070        "string": arrayLikeToString,
66071        "array": function array(input) {
66072          return arrayLikeToArrayLike(input, new Array(input.length));
66073        },
66074        "arraybuffer": function arraybuffer(input) {
66075          return input.buffer;
66076        },
66077        "uint8array": identity,
66078        "nodebuffer": function nodebuffer(input) {
66079          return nodejsUtils.newBufferFrom(input);
66080        }
66081      }; // nodebuffer to ?
66082
66083      transform["nodebuffer"] = {
66084        "string": arrayLikeToString,
66085        "array": function array(input) {
66086          return arrayLikeToArrayLike(input, new Array(input.length));
66087        },
66088        "arraybuffer": function arraybuffer(input) {
66089          return transform["nodebuffer"]["uint8array"](input).buffer;
66090        },
66091        "uint8array": function uint8array(input) {
66092          return arrayLikeToArrayLike(input, new Uint8Array(input.length));
66093        },
66094        "nodebuffer": identity
66095      };
66096      /**
66097       * Transform an input into any type.
66098       * The supported output type are : string, array, uint8array, arraybuffer, nodebuffer.
66099       * If no output type is specified, the unmodified input will be returned.
66100       * @param {String} outputType the output type.
66101       * @param {String|Array|ArrayBuffer|Uint8Array|Buffer} input the input to convert.
66102       * @throws {Error} an Error if the browser doesn't support the requested output type.
66103       */
66104
66105      exports.transformTo = function (outputType, input) {
66106        if (!input) {
66107          // undefined, null, etc
66108          // an empty string won't harm.
66109          input = "";
66110        }
66111
66112        if (!outputType) {
66113          return input;
66114        }
66115
66116        exports.checkSupport(outputType);
66117        var inputType = exports.getTypeOf(input);
66118        var result = transform[inputType][outputType](input);
66119        return result;
66120      };
66121      /**
66122       * Return the type of the input.
66123       * The type will be in a format valid for JSZip.utils.transformTo : string, array, uint8array, arraybuffer.
66124       * @param {Object} input the input to identify.
66125       * @return {String} the (lowercase) type of the input.
66126       */
66127
66128
66129      exports.getTypeOf = function (input) {
66130        if (typeof input === "string") {
66131          return "string";
66132        }
66133
66134        if (Object.prototype.toString.call(input) === "[object Array]") {
66135          return "array";
66136        }
66137
66138        if (support.nodebuffer && nodejsUtils.isBuffer(input)) {
66139          return "nodebuffer";
66140        }
66141
66142        if (support.uint8array && input instanceof Uint8Array) {
66143          return "uint8array";
66144        }
66145
66146        if (support.arraybuffer && input instanceof ArrayBuffer) {
66147          return "arraybuffer";
66148        }
66149      };
66150      /**
66151       * Throw an exception if the type is not supported.
66152       * @param {String} type the type to check.
66153       * @throws {Error} an Error if the browser doesn't support the requested type.
66154       */
66155
66156
66157      exports.checkSupport = function (type) {
66158        var supported = support[type.toLowerCase()];
66159
66160        if (!supported) {
66161          throw new Error(type + " is not supported by this platform");
66162        }
66163      };
66164
66165      exports.MAX_VALUE_16BITS = 65535;
66166      exports.MAX_VALUE_32BITS = -1;
vendor: 4,590 bytes, lines 66166-66296
66166 // well, "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" is parsed as -1
66167
66168      /**
66169       * Prettify a string read as binary.
66170       * @param {string} str the string to prettify.
66171       * @return {string} a pretty string.
66172       */
66173
66174      exports.pretty = function (str) {
66175        var res = '',
66176            code,
66177            i;
66178
66179        for (i = 0; i < (str || "").length; i++) {
66180          code = str.charCodeAt(i);
66181          res += '\\x' + (code < 16 ? "0" : "") + code.toString(16).toUpperCase();
66182        }
66183
66184        return res;
66185      };
66186      /**
66187       * Defer the call of a function.
66188       * @param {Function} callback the function to call asynchronously.
66189       * @param {Array} args the arguments to give to the callback.
66190       */
66191
66192
66193      exports.delay = function (callback, args, self) {
66194        setImmediate(function () {
66195          callback.apply(self || null, args || []);
66196        });
66197      };
66198      /**
66199       * Extends a prototype with an other, without calling a constructor with
66200       * side effects. Inspired by nodejs' `utils.inherits`
66201       * @param {Function} ctor the constructor to augment
66202       * @param {Function} superCtor the parent constructor to use
66203       */
66204
66205
66206      exports.inherits = function (ctor, superCtor) {
66207        var Obj = function Obj() {};
66208
66209        Obj.prototype = superCtor.prototype;
66210        ctor.prototype = new Obj();
66211      };
66212      /**
66213       * Merge the objects passed as parameters into a new one.
66214       * @private
66215       * @param {...Object} var_args All objects to merge.
66216       * @return {Object} a new object with the data of the others.
66217       */
66218
66219
66220      exports.extend = function () {
66221        var result = {},
66222            i,
66223            attr;
66224
66225        for (i = 0; i < arguments.length; i++) {
66226          // arguments is not enumerable in some browsers
66227          for (attr in arguments[i]) {
66228            if (arguments[i].hasOwnProperty(attr) && typeof result[attr] === "undefined") {
66229              result[attr] = arguments[i][attr];
66230            }
66231          }
66232        }
66233
66234        return result;
66235      };
66236      /**
66237       * Transform arbitrary content into a Promise.
66238       * @param {String} name a name for the content being processed.
66239       * @param {Object} inputData the content to process.
66240       * @param {Boolean} isBinary true if the content is not an unicode string
66241       * @param {Boolean} isOptimizedBinaryString true if the string content only has one byte per character.
66242       * @param {Boolean} isBase64 true if the string content is encoded with base64.
66243       * @return {Promise} a promise in a format usable by JSZip.
66244       */
66245
66246
66247      exports.prepareContent = function (name, inputData, isBinary, isOptimizedBinaryString, isBase64) {
66248        // if inputData is already a promise, this flatten it.
66249        var promise = external.Promise.resolve(inputData).then(function (data) {
66250          var isBlob = support.blob && (data instanceof Blob || ['[object File]', '[object Blob]'].indexOf(Object.prototype.toString.call(data)) !== -1);
66251
66252          if (isBlob && typeof FileReader !== "undefined") {
66253            return new external.Promise(function (resolve, reject) {
66254              var reader = new FileReader();
66255
66256              reader.onload = function (e) {
66257                resolve(e.target.result);
66258              };
66259
66260              reader.onerror = function (e) {
66261                reject(e.target.error);
66262              };
66263
66264              reader.readAsArrayBuffer(data);
66265            });
66266          } else {
66267            return data;
66268          }
66269        });
66270        return promise.then(function (data) {
66271          var dataType = exports.getTypeOf(data);
66272
66273          if (!dataType) {
66274            return external.Promise.reject(new Error("Can't read the data of '" + name + "'. Is it " + "in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"));
66275          } // special case : it's way easier to work with Uint8Array than with ArrayBuffer
66276
66277
66278          if (dataType === "arraybuffer") {
66279            data = exports.transformTo("uint8array", data);
66280          } else if (dataType === "string") {
66281            if (isBase64) {
66282              data = base64.decode(data);
66283            } else if (isBinary) {
66284              // optimizedBinaryString === true means that the file has already been filtered with a 0xFF mask
66285              if (isOptimizedBinaryString !== true) {
66286                // this is a string, not in a base64 format.
66287                // Be sure that this is a correct "binary string"
66288                data = string2binary(data);
66289              }
66290            }
66291          }
66292
66293          return data;
66294        });
66295      };
66296    }, {
vendor: 6,156 bytes, lines 66297-66453
66297      "./base64": 367,
66298      "./external": 372,
66299      "./nodejsUtils": 380,
66300      "./support": 396,
66301      "set-immediate-shim": 472
66302    }],
66303    399: [function (require, module, exports) {
66304      'use strict';
66305
66306      var readerFor = require('./reader/readerFor');
66307
66308      var utils = require('./utils');
66309
66310      var sig = require('./signature');
66311
66312      var ZipEntry = require('./zipEntry');
66313
66314      var utf8 = require('./utf8');
66315
66316      var support = require('./support'); //  class ZipEntries {{{
66317
66318      /**
66319       * All the entries in the zip file.
66320       * @constructor
66321       * @param {Object} loadOptions Options for loading the stream.
66322       */
66323
66324
66325      function ZipEntries(loadOptions) {
66326        this.files = [];
66327        this.loadOptions = loadOptions;
66328      }
66329
66330      ZipEntries.prototype = {
66331        /**
66332         * Check that the reader is on the specified signature.
66333         * @param {string} expectedSignature the expected signature.
66334         * @throws {Error} if it is an other signature.
66335         */
66336        checkSignature: function checkSignature(expectedSignature) {
66337          if (!this.reader.readAndCheckSignature(expectedSignature)) {
66338            this.reader.index -= 4;
66339            var signature = this.reader.readString(4);
66340            throw new Error("Corrupted zip or bug: unexpected signature " + "(" + utils.pretty(signature) + ", expected " + utils.pretty(expectedSignature) + ")");
66341          }
66342        },
66343
66344        /**
66345         * Check if the given signature is at the given index.
66346         * @param {number} askedIndex the index to check.
66347         * @param {string} expectedSignature the signature to expect.
66348         * @return {boolean} true if the signature is here, false otherwise.
66349         */
66350        isSignature: function isSignature(askedIndex, expectedSignature) {
66351          var currentIndex = this.reader.index;
66352          this.reader.setIndex(askedIndex);
66353          var signature = this.reader.readString(4);
66354          var result = signature === expectedSignature;
66355          this.reader.setIndex(currentIndex);
66356          return result;
66357        },
66358
66359        /**
66360         * Read the end of the central directory.
66361         */
66362        readBlockEndOfCentral: function readBlockEndOfCentral() {
66363          this.diskNumber = this.reader.readInt(2);
66364          this.diskWithCentralDirStart = this.reader.readInt(2);
66365          this.centralDirRecordsOnThisDisk = this.reader.readInt(2);
66366          this.centralDirRecords = this.reader.readInt(2);
66367          this.centralDirSize = this.reader.readInt(4);
66368          this.centralDirOffset = this.reader.readInt(4);
66369          this.zipCommentLength = this.reader.readInt(2); // warning : the encoding depends of the system locale
66370          // On a linux machine with LANG=en_US.utf8, this field is utf8 encoded.
66371          // On a windows machine, this field is encoded with the localized windows code page.
66372
66373          var zipComment = this.reader.readData(this.zipCommentLength);
66374          var decodeParamType = support.uint8array ? "uint8array" : "array"; // To get consistent behavior with the generation part, we will assume that
66375          // this is utf8 encoded unless specified otherwise.
66376
66377          var decodeContent = utils.transformTo(decodeParamType, zipComment);
66378          this.zipComment = this.loadOptions.decodeFileName(decodeContent);
66379        },
66380
66381        /**
66382         * Read the end of the Zip 64 central directory.
66383         * Not merged with the method readEndOfCentral :
66384         * The end of central can coexist with its Zip64 brother,
66385         * I don't want to read the wrong number of bytes !
66386         */
66387        readBlockZip64EndOfCentral: function readBlockZip64EndOfCentral() {
66388          this.zip64EndOfCentralSize = this.reader.readInt(8);
66389          this.reader.skip(4); // this.versionMadeBy = this.reader.readString(2);
66390          // this.versionNeeded = this.reader.readInt(2);
66391
66392          this.diskNumber = this.reader.readInt(4);
66393          this.diskWithCentralDirStart = this.reader.readInt(4);
66394          this.centralDirRecordsOnThisDisk = this.reader.readInt(8);
66395          this.centralDirRecords = this.reader.readInt(8);
66396          this.centralDirSize = this.reader.readInt(8);
66397          this.centralDirOffset = this.reader.readInt(8);
66398          this.zip64ExtensibleData = {};
66399          var extraDataSize = this.zip64EndOfCentralSize - 44,
66400              index = 0,
66401              extraFieldId,
66402              extraFieldLength,
66403              extraFieldValue;
66404
66405          while (index < extraDataSize) {
66406            extraFieldId = this.reader.readInt(2);
66407            extraFieldLength = this.reader.readInt(4);
66408            extraFieldValue = this.reader.readData(extraFieldLength);
66409            this.zip64ExtensibleData[extraFieldId] = {
66410              id: extraFieldId,
66411              length: extraFieldLength,
66412              value: extraFieldValue
66413            };
66414          }
66415        },
66416
66417        /**
66418         * Read the end of the Zip 64 central directory locator.
66419         */
66420        readBlockZip64EndOfCentralLocator: function readBlockZip64EndOfCentralLocator() {
66421          this.diskWithZip64CentralDirStart = this.reader.readInt(4);
66422          this.relativeOffsetEndOfZip64CentralDir = this.reader.readInt(8);
66423          this.disksCount = this.reader.readInt(4);
66424
66425          if (this.disksCount > 1) {
66426            throw new Error("Multi-volumes zip are not supported");
66427          }
66428        },
66429
66430        /**
66431         * Read the local files, based on the offset read in the central part.
66432         */
66433        readLocalFiles: function readLocalFiles() {
66434          var i, file;
66435
66436          for (i = 0; i < this.files.length; i++) {
66437            file = this.files[i];
66438            this.reader.setIndex(file.localHeaderOffset);
66439            this.checkSignature(sig.LOCAL_FILE_HEADER);
66440            file.readLocalPart(this.reader);
66441            file.handleUTF8();
66442            file.processAttributes();
66443          }
66444        },
66445
66446        /**
66447         * Read the central directory.
66448         */
66449        readCentralDir: function readCentralDir() {
66450          var file;
66451          this.reader.setIndex(this.centralDirOffset);
66452
66453          while (this.reader.readAndCheckSignature(sig.CENTRAL_FILE_HEADER)
vendor: 5,478 bytes, lines 66453-66559
66453) {
66454            file = new ZipEntry({
66455              zip64: this.zip64
66456            }, this.loadOptions);
66457            file.readCentralPart(this.reader);
66458            this.files.push(file);
66459          }
66460
66461          if (this.centralDirRecords !== this.files.length) {
66462            if (this.centralDirRecords !== 0 && this.files.length === 0) {
66463              // We expected some records but couldn't find ANY.
66464              // This is really suspicious, as if something went wrong.
66465              throw new Error("Corrupted zip or bug: expected " + this.centralDirRecords + " records in central dir, got " + this.files.length);
66466            } else {// We found some records but not all.
66467              // Something is wrong but we got something for the user: no error here.
66468              // console.warn("expected", this.centralDirRecords, "records in central dir, got", this.files.length);
66469            }
66470          }
66471        },
66472
66473        /**
66474         * Read the end of central directory.
66475         */
66476        readEndOfCentral: function readEndOfCentral() {
66477          var offset = this.reader.lastIndexOfSignature(sig.CENTRAL_DIRECTORY_END);
66478
66479          if (offset < 0) {
66480            // Check if the content is a truncated zip or complete garbage.
66481            // A "LOCAL_FILE_HEADER" is not required at the beginning (auto
66482            // extractible zip for example) but it can give a good hint.
66483            // If an ajax request was used without responseType, we will also
66484            // get unreadable data.
66485            var isGarbage = !this.isSignature(0, sig.LOCAL_FILE_HEADER);
66486
66487            if (isGarbage) {
66488              throw new Error("Can't find end of central directory : is this a zip file ? " + "If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");
66489            } else {
66490              throw new Error("Corrupted zip: can't find end of central directory");
66491            }
66492          }
66493
66494          this.reader.setIndex(offset);
66495          var endOfCentralDirOffset = offset;
66496          this.checkSignature(sig.CENTRAL_DIRECTORY_END);
66497          this.readBlockEndOfCentral();
66498          /* extract from the zip spec :
66499              4)  If one of the fields in the end of central directory
66500                  record is too small to hold required data, the field
66501                  should be set to -1 (0xFFFF or 0xFFFFFFFF) and the
66502                  ZIP64 format record should be created.
66503              5)  The end of central directory record and the
66504                  Zip64 end of central directory locator record must
66505                  reside on the same disk when splitting or spanning
66506                  an archive.
66507           */
66508
66509          if (this.diskNumber === utils.MAX_VALUE_16BITS || this.diskWithCentralDirStart === utils.MAX_VALUE_16BITS || this.centralDirRecordsOnThisDisk === utils.MAX_VALUE_16BITS || this.centralDirRecords === utils.MAX_VALUE_16BITS || this.centralDirSize === utils.MAX_VALUE_32BITS || this.centralDirOffset === utils.MAX_VALUE_32BITS) {
66510            this.zip64 = true;
66511            /*
66512            Warning : the zip64 extension is supported, but ONLY if the 64bits integer read from
66513            the zip file can fit into a 32bits integer. This cannot be solved : JavaScript represents
66514            all numbers as 64-bit double precision IEEE 754 floating point numbers.
66515            So, we have 53bits for integers and bitwise operations treat everything as 32bits.
66516            see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Bitwise_Operators
66517            and http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf section 8.5
66518            */
66519            // should look for a zip64 EOCD locator
66520
66521            offset = this.reader.lastIndexOfSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR);
66522
66523            if (offset < 0) {
66524              throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");
66525            }
66526
66527            this.reader.setIndex(offset);
66528            this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR);
66529            this.readBlockZip64EndOfCentralLocator(); // now the zip64 EOCD record
66530
66531            if (!this.isSignature(this.relativeOffsetEndOfZip64CentralDir, sig.ZIP64_CENTRAL_DIRECTORY_END)) {
66532              // console.warn("ZIP64 end of central directory not where expected.");
66533              this.relativeOffsetEndOfZip64CentralDir = this.reader.lastIndexOfSignature(sig.ZIP64_CENTRAL_DIRECTORY_END);
66534
66535              if (this.relativeOffsetEndOfZip64CentralDir < 0) {
66536                throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");
66537              }
66538            }
66539
66540            this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir);
66541            this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_END);
66542            this.readBlockZip64EndOfCentral();
66543          }
66544
66545          var expectedEndOfCentralDirOffset = this.centralDirOffset + this.centralDirSize;
66546
66547          if (this.zip64) {
66548            expectedEndOfCentralDirOffset += 20; // end of central dir 64 locator
66549
66550            expectedEndOfCentralDirOffset += 12
66551            /* should not include the leading 12 bytes */
66552            + this.zip64EndOfCentralSize;
66553          }
66554
66555          var extraBytes = endOfCentralDirOffset - expectedEndOfCentralDirOffset;
66556
66557          if (extraBytes > 0) {
66558            // console.warn(extraBytes, "extra bytes at beginning or within zipfile");
66559            if (this.isSignature(endOfCentralDirOffset, sig.CENTRAL_FILE_HEADER)
66559) {// The offsets seem wrong, but we have something at the specified offset.
66560              // So… we keep it.
66561            } else {
66562              // the offset is wrong, update the "zero" of the reader
66563              // this happens if data has been prepended (crx files for example)
66564              this.reader.zero = extraBytes;
66565            }
66566          } else if (extraBytes < 0) {
66567            throw new Error("Corrupted zip: missing " + Math.abs(extraBytes) + " bytes.");
66568          }
66569        },
66570        prepareReader: function prepareReader(data) {
66571          this.reader = readerFor(data);
66572        },
66573
66574        /**
66575         * Read a zip file and create ZipEntries.
66576         * @param {String|ArrayBuffer|Uint8Array|Buffer} data the binary string representing a zip file.
66577         */
66578        load: function load(data) {
66579          this.prepareReader(data);
66580          this.readEndOfCentral();
66581          this.readCentralDir();
66582          this.readLocalFiles();
66583        }
66584      }; // }}} end of ZipEntries
66585
66586      module.exports = ZipEntries;
66587    }, {
66588      "./reader/readerFor": 388,
66589      "./signature": 389,
66590      "./support": 396,
66591      "./utf8": 397,
66592      "./utils": 398,
66593      "./zipEntry": 400
66594    }],
66595    400: [function (require, module, exports) {
66596      'use strict';
66597
66598      var readerFor = require('./reader/readerFor');
66599
66600      var utils = require('./utils');
66601
66602      var CompressedObject = require('./compressedObject');
66603
66604      var crc32fn = require('./crc32');
66605
66606      var utf8 = require('./utf8');
66607
66608      var compressions = require('./compressions');
66609
66610      var support = require('./support');
66611
66612      var MADE_BY_DOS = 0x00;
66613      var MADE_BY_UNIX = 0x03;
66614      /**
66615       * Find a compression registered in JSZip.
66616       * @param {string} compressionMethod the method magic to find.
66617       * @return {Object|null} the JSZip compression object, null if none found.
66618       */
66619
66620      var findCompression = function findCompression(compressionMethod) {
66621        for (var method in compressions) {
66622          if (!compressions.hasOwnProperty(method)) {
66623            continue;
66624          }
66625
66626          if (compressions[method].magic === compressionMethod) {
66627            return compressions[method];
66628          }
66629        }
66630
66631        return null;
66632      }; // class ZipEntry {{{
66633
66634      /**
66635       * An entry in the zip file.
66636       * @constructor
66637       * @param {Object} options Options of the current file.
66638       * @param {Object} loadOptions Options for loading the stream.
66639       */
66640
66641
66642      function ZipEntry(options, loadOptions) {
66643        this.options = options;
66644        this.loadOptions = loadOptions;
66645      }
66646
66647      ZipEntry.prototype = {
66648        /**
66649         * say if the file is encrypted.
66650         * @return {boolean} true if the file is encrypted, false otherwise.
66651         */
66652        isEncrypted: function isEncrypted() {
66653          // bit 1 is set
66654          return (this.bitFlag & 0x0001) === 0x0001;
66655        },
66656
66657        /**
66658         * say if the file has utf-8 filename/comment.
66659         * @return {boolean} true if the filename/comment is in utf-8, false otherwise.
66660         */
66661        useUTF8: function useUTF8() {
66662          // bit 11 is set
66663          return (this.bitFlag & 0x0800) === 0x0800;
66664        },
66665
66666        /**
66667         * Read the local part of a zip file and add the info in this object.
66668         * @param {DataReader} reader the reader to use.
66669         */
66670        readLocalPart: function readLocalPart(reader) {
66671          var compression, localExtraFieldsLength; // we already know everything from the central dir !
66672          // If the central dir data are false, we are doomed.
66673          // On the bright side, the local part is scary  : zip64, data descriptors, both, etc.
66674          // The less data we get here, the more reliable this should be.
66675          // Let's skip the whole header and dash to the data !
66676
66677          reader.skip(22); // in some zip created on windows, the filename stored in the central dir contains \ instead of /.
66678          // Strangely, the filename here is OK.
66679          // I would love to treat these zip files as corrupted (see http://www.info-zip.org/FAQ.html#backslashes
66680          // or APPNOTE#4.4.17.1, "All slashes MUST be forward slashes '/'") but there are a lot of bad zip generators...
66681          // Search "unzip mismatching "local" filename continuing with "central" filename version" on
66682          // the internet.
66683          //
66684          // I think I see the logic here : the central directory is used to display
66685          // content and the local directory is used to extract the files. Mixing / and \
66686          // may be used to display \ to windows users and use / when extracting the files.
66687          // Unfortunately, this lead also to some issues : http://seclists.org/fulldisclosure/2009/Sep/394
66688
66689          this.fileNameLength = reader.readInt(2);
66690          localExtraFieldsLength = reader.readInt(2); // can't be sure this will be the same as the central dir
66691          // the fileName is stored as binary data, the handleUTF8 method will take care of the encoding.
66692
66693          this.fileName = reader.readData(this.fileNameLength);
66694          reader.skip(localExtraFieldsLength);
66695
66696          if (this.compressedSize === -1 || this.uncompressedSize === -1) {
66697            throw new Error("Bug or corrupted zip : didn't get enough information from the central directory " + "(compressedSize === -1 || uncompressedSize === -1)");
66698          }
66699
66700          compression = findCompression(this.compressionMethod);
66701
66702          if (compression === null) {
66703            // no compression found
66704            throw new Error("Corrupted zip : compression " + utils.pretty(this.compressionMethod) + " unknown (inner file : " + utils.transformTo("string", this.fileName) + ")");
66705          }
66706
66707          this.decompressed = new CompressedObject(this.compressedSize, this.uncompressedSize, this.crc32, compression, reader.readData(this.compressedSize));
66708        },
66709
66710        /**
66711         * Read the central part of a zip file and add the info in this object.
66712         * @param {DataReader} reader the reader to use.
66713         */
66714        readCentralPart: function readCentralPart(reader) {
66715          this.versionMadeBy = reader.readInt(2);
66716          reader.skip(2); // this.versionNeeded = reader.readInt(2);
66717
66718          this.bitFlag = reader.readInt(2);
66719          this.compressionMethod = reader.readString(2);
66720          this.date = reader.readDate();
66721          this.crc32 = reader.readInt(4);
66722          this.compressedSize = reader.readInt(4);
66723          this.uncompressedSize = reader.readInt(4);
66724          var fileNameLength = reader.readInt(2);
66725          this.extraFieldsLength = reader.readInt(2);
66726          this.fileCommentLength = reader.readInt(2);
66727          this.diskNumberStart = reader.readInt(2);
66728          this.internalFileAttributes = reader.readInt(2);
66729          this.externalFileAttributes = reader.readInt(4);
66730          this.localHeaderOffset = reader.readInt(4);
66731
66732          if (this.isEncrypted()) {
66733            throw new Error("Encrypted zip are not supported");
66734          } // will be read in the local part, see the comments there
66735
66736
66737          reader.skip(fileNameLength);
66738          this.readExtraFields(reader);
66739          this.parseZIP64ExtraField(reader);
66740          this.fileComment = reader.readData(this.fileCommentLength);
66741        },
66742
66743        /**
66744         * Parse the external file attributes and get the unix/dos permissions.
66745         */
66746        processAttributes: function processAttributes() {
66747          this.unixPermissions = null;
66748          this.dosPermissions = null;
66749          var madeBy = this.versionMadeBy >> 8; // Check if we have the DOS directory flag set.
66750          // We look for it in the DOS and UNIX permissions
66751          // but some unknown platform could set it as a compatibility flag.
66752
66753          this.dir = this.externalFileAttributes & 0x0010 ? true : false;
66754
66755          if (madeBy === MADE_BY_DOS) {
66756            // first 6 bits (0 to 5)
66757            this.dosPermissions = this.externalFileAttributes & 0x3F;
66758          }
66759
66760          if (madeBy === MADE_BY_UNIX) {
66761            this.unixPermissions = this.externalFileAttributes >> 16 & 0xFFFF; // the octal permissions are in (this.unixPermissions & 0x01FF).toString(8);
66762          } // fail safe : if the name ends with a / it probably means a folder
66763
66764
66765          if (!this.dir && this.fileNameStr.slice(-1) === '/') {
66766            this.dir = true;
66767          }
66768        },
66769
66770        /**
66771         * Parse the ZIP64 extra field and merge the info in the current ZipEntry.
66772         * @param {DataReader} reader the reader to use.
66773         */
66774        parseZIP64ExtraField: function parseZIP64ExtraField(reader) {
66775          if (!this.extraFields[0x0001]) {
66776            return;
66777          } // should be something, preparing the extra reader
66778
66779
66780          var extraReader = readerFor(this.extraFields[0x0001].value); // I really hope that these 64bits integer can fit in 32 bits integer, because js
66781          // won't let us have more.
66782
66783          if (this.uncompressedSize === utils.MAX_VALUE_32BITS) {
66784            this.uncompressedSize = extraReader.readInt(8);
66785          }
66786
66787          if (this.compressedSize === utils.MAX_VALUE_32BITS) {
66788            this.compressedSize = extraReader.readInt(8);
66789          }
66790
66791          if (this.localHeaderOffset === utils.MAX_VALUE_32BITS) {
66792            this.localHeaderOffset = extraReader.readInt(8);
66793          }
66794
66795          if (this.diskNumberStart === utils.MAX_VALUE_32BITS) {
66796            this.diskNumberStart = extraReader.readInt(4);
66797          }
66798        },
66799
66800        /**
66801         * Read the central part of a zip file and add the info in this object.
66802         * @param {DataReader} reader the reader to use.
66803         */
66804        readExtraFields: function readExtraFields(reader) {
66805          var end = reader.index + this.extraFieldsLength,
66806              extraFieldId,
66807              extraFieldLength,
66808              extraFieldValue;
66809
66810          if (!this.extraFields) {
66811            this.extraFields = {};
66812          }
66813
66814          while (reader.index < end) {
66815            extraFieldId = reader.readInt(2);
66816            extraFieldLength = reader.readInt(2);
66817            extraFieldValue = reader.readData(extraFieldLength);
66818            this.extraFields[extraFieldId] = {
66819              id: extraFieldId,
66820              length: extraFieldLength,
66821              value: extraFieldValue
66822            };
66823          }
66824        },
66825
66826        /**
66827         * Apply an UTF8 transformation if needed.
66828         */
66829        handleUTF8: function handleUTF8() {
66830          var decodeParamType = support.uint8array ? "uint8array" : "array";
66831
66832          if (this.useUTF8()) {
66833            this.fileNameStr = utf8.utf8decode(this.fileName);
66834            this.fileCommentStr = utf8.utf8decode(this.fileComment);
66835          } else {
66836            var upath = this.findExtraFieldUnicodePath();
66837
66838            if (upath !== null) {
66839              this.fileNameStr = upath;
66840            } else {
66841              // ASCII text or unsupported code page
66842              var fileNameByteArray = utils.transformTo(decodeParamType, this.fileName);
66843              this.fileNameStr = this.loadOptions.decodeFileName(fileNameByteArray);
66844            }
66845
66846            var ucomment = this.findExtraFieldUnicodeComment();
66847
66848            if (ucomment !== null) {
66849              this.fileCommentStr = ucomment;
66850            } else {
66851              // ASCII text or unsupported code page
66852              var commentByteArray = utils.transformTo(decodeParamType, this.fileComment);
66853              this.fileCommentStr = this.loadOptions.decodeFileName(commentByteArray);
66854            }
66855          }
66856        },
66857
66858        /**
66859         * Find the unicode path declared in the extra field, if any.
66860         * @return {String} the unicode path, null otherwise.
66861         */
66862        findExtraFieldUnicodePath: function findExtraFieldUnicodePath() {
66863          var upathField = this.extraFields[0x7075];
66864
66865          if (upathField) {
66866            var extraReader = readerFor(upathField.value); // wrong version
66867
66868            if (extraReader.readInt(1) !== 1) {
66869              return null;
66870            } // the crc of the filename changed, this field is out of date.
66871
66872
66873            if (crc32fn(this.fileName) !== extraReader.readInt(4)) {
66874              return null;
66875            }
66876
66877            return utf8.utf8decode(extraReader.readData(upathField.length - 5));
66878          }
66879
66880          return null;
66881        },
66882
66883        /**
66884         * Find the unicode comment declared in the extra field, if any.
66885         * @return {String} the unicode comment, null otherwise.
66886         */
66887        findExtraFieldUnicodeComment: function findExtraFieldUnicodeComment() {
66888          var ucommentField = this.extraFields[0x6375];
66889
66890          if (ucommentField) {
66891            var extraReader = readerFor(ucommentField.value); // wrong version
66892
66893            if (extraReader.readInt(1) !== 1) {
66894              return null;
66895            } // the crc of the comment changed, this field is out of date.
66896
66897
66898            if (crc32fn(this.fileComment) !== extraReader.readInt(4)) {
66899              return null;
66900            }
66901
66902            return utf8.utf8decode(extraReader.readData(ucommentField.length - 5));
66903          }
66904
66905          return null;
66906        }
66907      };
66908      module.exports = ZipEntry;
66909    }, {
66910      "./compressedObject": 368,
66911      "./compressions": 369,
66912      "./crc32": 370,
66913      "./reader/readerFor": 388,
66914      "./support": 396,
66915      "./utf8": 397,
66916      "./utils": 398
66917    }],
66918    401: [function (require, module, exports) {
66919      'use strict';
66920
66921      var StreamHelper = require('./stream/StreamHelper');
66922
66923      var DataWorker = require('./stream/DataWorker');
66924
66925      var utf8 = require('./utf8');
66926
66927      var CompressedObject = require('./compressedObject');
66928
66929      var GenericWorker = require('./stream/GenericWorker');
66930      /**
66931       * A simple object representing a file in the zip file.
66932       * @constructor
66933       * @param {string} name the name of the file
66934       * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data
66935       * @param {Object} options the options of the file
66936       */
66937
66938
66939      var ZipObject = function ZipObject(name, data, options) {
66940        this.name = name;
66941        this.dir = options.dir;
66942        this.date = options.date;
66943        this.comment = options.comment;
66944        this.unixPermissions = options.unixPermissions;
66945        this.dosPermissions = options.dosPermissions;
66946        this._data = data;
66947        this._dataBinary = options.binary; // keep only the compression
66948
66949        this.options = {
66950          compression: options.compression,
66951          compressionOptions: options.compressionOptions
66952        };
66953      };
66954
66955      ZipObject.prototype = {
66956        /**
66957         * Create an internal stream for the content of this object.
66958         * @param {String} type the type of each chunk.
66959         * @return StreamHelper the stream.
66960         */
66961        internalStream: function internalStream(type) {
66962          var result = null,
66963              outputType = "string";
66964
66965          try {
66966            if (!type) {
66967              throw new Error("No output type specified.");
66968            }
66969
66970            outputType = type.toLowerCase();
66971            var askUnicodeString = outputType === "string" || outputType === "text";
66972
66973            if (outputType === "binarystring" || outputType === "text") {
66974              outputType = "string";
66975            }
66976
66977            result = this._decompressWorker();
66978            var isUnicodeString = !this._dataBinary;
66979
66980            if (isUnicodeString && !askUnicodeString) {
66981              result = result.pipe(new utf8.Utf8EncodeWorker());
66982            }
66983
66984            if (!isUnicodeString && askUnicodeString) {
66985              result = result.pipe(new utf8.Utf8DecodeWorker());
66986            }
66987          } catch (e) {
66988            result = new GenericWorker("error");
66989            result.error(e);
66990          }
66991
66992          return new StreamHelper(result, outputType, "");
66993        },
66994
66995        /**
66996         * Prepare the content in the asked type.
66997         * @param {String} type the type of the result.
66998         * @param {Function} onUpdate a function to call on each internal update.
66999         * @return Promise the promise of the result.
67000         */
67001        async: function async(type, onUpdate) {
67002          return this.internalStream(type).accumulate(onUpdate);
67003        },
67004
67005        /**
67006         * Prepare the content as a nodejs stream.
67007         * @param {String} type the type of each chunk.
67008         * @param {Function} onUpdate a function to call on each internal update.
67009         * @return Stream the stream.
67010         */
vendor: 6,802 bytes, lines 67011-67243
67011        nodeStream: function nodeStream(type, onUpdate) {
67012          return this.internalStream(type || "nodebuffer").toNodejsStream(onUpdate);
67013        },
67014
67015        /**
67016         * Return a worker for the compressed content.
67017         * @private
67018         * @param {Object} compression the compression object to use.
67019         * @param {Object} compressionOptions the options to use when compressing.
67020         * @return Worker the worker.
67021         */
67022        _compressWorker: function _compressWorker(compression, compressionOptions) {
67023          if (this._data instanceof CompressedObject && this._data.compression.magic === compression.magic) {
67024            return this._data.getCompressedWorker();
67025          } else {
67026            var result = this._decompressWorker();
67027
67028            if (!this._dataBinary) {
67029              result = result.pipe(new utf8.Utf8EncodeWorker());
67030            }
67031
67032            return CompressedObject.createWorkerFrom(result, compression, compressionOptions);
67033          }
67034        },
67035
67036        /**
67037         * Return a worker for the decompressed content.
67038         * @private
67039         * @return Worker the worker.
67040         */
67041        _decompressWorker: function _decompressWorker() {
67042          if (this._data instanceof CompressedObject) {
67043            return this._data.getContentWorker();
67044          } else if (this._data instanceof GenericWorker) {
67045            return this._data;
67046          } else {
67047            return new DataWorker(this._data);
67048          }
67049        }
67050      };
67051      var removedMethods = ["asText", "asBinary", "asNodeBuffer", "asUint8Array", "asArrayBuffer"];
67052
67053      var removedFn = function removedFn() {
67054        throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.");
67055      };
67056
67057      for (var i = 0; i < removedMethods.length; i++) {
67058        ZipObject.prototype[removedMethods[i]] = removedFn;
67059      }
67060
67061      module.exports = ZipObject;
67062    }, {
67063      "./compressedObject": 368,
67064      "./stream/DataWorker": 393,
67065      "./stream/GenericWorker": 394,
67066      "./stream/StreamHelper": 395,
67067      "./utf8": 397
67068    }],
67069    402: [function (require, module, exports) {
67070      'use strict';
67071
67072      var immediate = require('immediate');
67073      /* istanbul ignore next */
67074
67075
67076      function INTERNAL() {}
67077
67078      var handlers = {};
67079      var REJECTED = ['REJECTED'];
67080      var FULFILLED = ['FULFILLED'];
67081      var PENDING = ['PENDING'];
67082      module.exports = Promise;
67083
67084      function Promise(resolver) {
67085        if (typeof resolver !== 'function') {
67086          throw new TypeError('resolver must be a function');
67087        }
67088
67089        this.state = PENDING;
67090        this.queue = [];
67091        this.outcome = void 0;
67092
67093        if (resolver !== INTERNAL) {
67094          safelyResolveThenable(this, resolver);
67095        }
67096      }
67097
67098      Promise.prototype["finally"] = function (callback) {
67099        if (typeof callback !== 'function') {
67100          return this;
67101        }
67102
67103        var p = this.constructor;
67104        return this.then(resolve, reject);
67105
67106        function resolve(value) {
67107          function yes() {
67108            return value;
67109          }
67110
67111          return p.resolve(callback()).then(yes);
67112        }
67113
67114        function reject(reason) {
67115          function no() {
67116            throw reason;
67117          }
67118
67119          return p.resolve(callback()).then(no);
67120        }
67121      };
67122
67123      Promise.prototype["catch"] = function (onRejected) {
67124        return this.then(null, onRejected);
67125      };
67126
67127      Promise.prototype.then = function (onFulfilled, onRejected) {
67128        if (typeof onFulfilled !== 'function' && this.state === FULFILLED || typeof onRejected !== 'function' && this.state === REJECTED) {
67129          return this;
67130        }
67131
67132        var promise = new this.constructor(INTERNAL);
67133
67134        if (this.state !== PENDING) {
67135          var resolver = this.state === FULFILLED ? onFulfilled : onRejected;
67136          unwrap(promise, resolver, this.outcome);
67137        } else {
67138          this.queue.push(new QueueItem(promise, onFulfilled, onRejected));
67139        }
67140
67141        return promise;
67142      };
67143
67144      function QueueItem(promise, onFulfilled, onRejected) {
67145        this.promise = promise;
67146
67147        if (typeof onFulfilled === 'function') {
67148          this.onFulfilled = onFulfilled;
67149          this.callFulfilled = this.otherCallFulfilled;
67150        }
67151
67152        if (typeof onRejected === 'function') {
67153          this.onRejected = onRejected;
67154          this.callRejected = this.otherCallRejected;
67155        }
67156      }
67157
67158      QueueItem.prototype.callFulfilled = function (value) {
67159        handlers.resolve(this.promise, value);
67160      };
67161
67162      QueueItem.prototype.otherCallFulfilled = function (value) {
67163        unwrap(this.promise, this.onFulfilled, value);
67164      };
67165
67166      QueueItem.prototype.callRejected = function (value) {
67167        handlers.reject(this.promise, value);
67168      };
67169
67170      QueueItem.prototype.otherCallRejected = function (value) {
67171        unwrap(this.promise, this.onRejected, value);
67172      };
67173
67174      function unwrap(promise, func, value) {
67175        immediate(function () {
67176          var returnValue;
67177
67178          try {
67179            returnValue = func(value);
67180          } catch (e) {
67181            return handlers.reject(promise, e);
67182          }
67183
67184          if (returnValue === promise) {
67185            handlers.reject(promise, new TypeError('Cannot resolve promise with itself'));
67186          } else {
67187            handlers.resolve(promise, returnValue);
67188          }
67189        });
67190      }
67191
67192      handlers.resolve = function (self, value) {
67193        var result = tryCatch(getThen, value);
67194
67195        if (result.status === 'error') {
67196          return handlers.reject(self, result.value);
67197        }
67198
67199        var thenable = result.value;
67200
67201        if (thenable) {
67202          safelyResolveThenable(self, thenable);
67203        } else {
67204          self.state = FULFILLED;
67205          self.outcome = value;
67206          var i = -1;
67207          var len = self.queue.length;
67208
67209          while (++i < len) {
67210            self.queue[i].callFulfilled(value);
67211          }
67212        }
67213
67214        return self;
67215      };
67216
67217      handlers.reject = function (self, error) {
67218        self.state = REJECTED;
67219        self.outcome = error;
67220        var i = -1;
67221        var len = self.queue.length;
67222
67223        while (++i < len) {
67224          self.queue[i].callRejected(error);
67225        }
67226
67227        return self;
67228      };
67229
67230      function getThen(obj) {
67231        // Make sure we only access the accessor once as required by the spec
67232        var then = obj && obj.then;
67233
67234        if (obj && (_typeof2(obj) === 'object' || typeof obj === 'function') && typeof then === 'function') {
67235          return function appyThen() {
67236            then.apply(obj, arguments);
67237          };
67238        }
67239      }
67240
67241      function safelyResolveThenable(self, thenable) {
67242        // Either fulfill, reject or reject with error
67243        var called = false;
vendor: 4,287 bytes, lines 67244-67417
67244
67245        function onError(value) {
67246          if (called) {
67247            return;
67248          }
67249
67250          called = true;
67251          handlers.reject(self, value);
67252        }
67253
67254        function onSuccess(value) {
67255          if (called) {
67256            return;
67257          }
67258
67259          called = true;
67260          handlers.resolve(self, value);
67261        }
67262
67263        function tryToUnwrap() {
67264          thenable(onSuccess, onError);
67265        }
67266
67267        var result = tryCatch(tryToUnwrap);
67268
67269        if (result.status === 'error') {
67270          onError(result.value);
67271        }
67272      }
67273
67274      function tryCatch(func, value) {
67275        var out = {};
67276
67277        try {
67278          out.value = func(value);
67279          out.status = 'success';
67280        } catch (e) {
67281          out.status = 'error';
67282          out.value = e;
67283        }
67284
67285        return out;
67286      }
67287
67288      Promise.resolve = resolve;
67289
67290      function resolve(value) {
67291        if (value instanceof this) {
67292          return value;
67293        }
67294
67295        return handlers.resolve(new this(INTERNAL), value);
67296      }
67297
67298      Promise.reject = reject;
67299
67300      function reject(reason) {
67301        var promise = new this(INTERNAL);
67302        return handlers.reject(promise, reason);
67303      }
67304
67305      Promise.all = all;
67306
67307      function all(iterable) {
67308        var self = this;
67309
67310        if (Object.prototype.toString.call(iterable) !== '[object Array]') {
67311          return this.reject(new TypeError('must be an array'));
67312        }
67313
67314        var len = iterable.length;
67315        var called = false;
67316
67317        if (!len) {
67318          return this.resolve([]);
67319        }
67320
67321        var values = new Array(len);
67322        var resolved = 0;
67323        var i = -1;
67324        var promise = new this(INTERNAL);
67325
67326        while (++i < len) {
67327          allResolver(iterable[i], i);
67328        }
67329
67330        return promise;
67331
67332        function allResolver(value, i) {
67333          self.resolve(value).then(resolveFromAll, function (error) {
67334            if (!called) {
67335              called = true;
67336              handlers.reject(promise, error);
67337            }
67338          });
67339
67340          function resolveFromAll(outValue) {
67341            values[i] = outValue;
67342
67343            if (++resolved === len && !called) {
67344              called = true;
67345              handlers.resolve(promise, values);
67346            }
67347          }
67348        }
67349      }
67350
67351      Promise.race = race;
67352
67353      function race(iterable) {
67354        var self = this;
67355
67356        if (Object.prototype.toString.call(iterable) !== '[object Array]') {
67357          return this.reject(new TypeError('must be an array'));
67358        }
67359
67360        var len = iterable.length;
67361        var called = false;
67362
67363        if (!len) {
67364          return this.resolve([]);
67365        }
67366
67367        var i = -1;
67368        var promise = new this(INTERNAL);
67369
67370        while (++i < len) {
67371          resolver(iterable[i]);
67372        }
67373
67374        return promise;
67375
67376        function resolver(value) {
67377          self.resolve(value).then(function (response) {
67378            if (!called) {
67379              called = true;
67380              handlers.resolve(promise, response);
67381            }
67382          }, function (error) {
67383            if (!called) {
67384              called = true;
67385              handlers.reject(promise, error);
67386            }
67387          });
67388        }
67389      }
67390    }, {
67391      "immediate": 363
67392    }],
67393    403: [function (require, module, exports) {
67394      (function (global) {
67395        /**
67396         * lodash (Custom Build) <https://lodash.com/>
67397         * Build: `lodash modularize exports="npm" -o ./`
67398         * Copyright jQuery Foundation and other contributors <https://jquery.org/>
67399         * Released under MIT license <https://lodash.com/license>
67400         * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
67401         * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
67402         */
67403
67404        /** Used as references for various `Number` constants. */
67405        var INFINITY = 1 / 0;
67406        /** `Object#toString` result references. */
67407
67408        var symbolTag = '[object Symbol]';
67409        /**
67410         * Used to match `RegExp`
67411         * [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns).
67412         */
67413
67414        var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
67415            reHasRegExpChar = RegExp(reRegExpChar.source);
67416        /** Detect free variable `global` from Node.js. */
67417
vendor: 4,467 bytes, lines 67418-67558
67418        var freeGlobal = _typeof2(global) == 'object' && global && global.Object === Object && global;
67419        /** Detect free variable `self`. */
67420
67421        var freeSelf = (typeof self === "undefined" ? "undefined" : _typeof2(self)) == 'object' && self && self.Object === Object && self;
67422        /** Used as a reference to the global object. */
67423
67424        var root = freeGlobal || freeSelf || Function('return this')();
67425        /** Used for built-in method references. */
67426
67427        var objectProto = Object.prototype;
67428        /**
67429         * Used to resolve the
67430         * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
67431         * of values.
67432         */
67433
67434        var objectToString = objectProto.toString;
67435        /** Built-in value references. */
67436
67437        var _Symbol4 = root.Symbol;
67438        /** Used to convert symbols to primitives and strings. */
67439
67440        var symbolProto = _Symbol4 ? _Symbol4.prototype : undefined,
67441            symbolToString = symbolProto ? symbolProto.toString : undefined;
67442        /**
67443         * The base implementation of `_.toString` which doesn't convert nullish
67444         * values to empty strings.
67445         *
67446         * @private
67447         * @param {*} value The value to process.
67448         * @returns {string} Returns the string.
67449         */
67450
67451        function baseToString(value) {
67452          // Exit early for strings to avoid a performance hit in some environments.
67453          if (typeof value == 'string') {
67454            return value;
67455          }
67456
67457          if (isSymbol(value)) {
67458            return symbolToString ? symbolToString.call(value) : '';
67459          }
67460
67461          var result = value + '';
67462          return result == '0' && 1 / value == -INFINITY ? '-0' : result;
67463        }
67464        /**
67465         * Checks if `value` is object-like. A value is object-like if it's not `null`
67466         * and has a `typeof` result of "object".
67467         *
67468         * @static
67469         * @memberOf _
67470         * @since 4.0.0
67471         * @category Lang
67472         * @param {*} value The value to check.
67473         * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
67474         * @example
67475         *
67476         * _.isObjectLike({});
67477         * // => true
67478         *
67479         * _.isObjectLike([1, 2, 3]);
67480         * // => true
67481         *
67482         * _.isObjectLike(_.noop);
67483         * // => false
67484         *
67485         * _.isObjectLike(null);
67486         * // => false
67487         */
67488
67489
67490        function isObjectLike(value) {
67491          return !!value && _typeof2(value) == 'object';
67492        }
67493        /**
67494         * Checks if `value` is classified as a `Symbol` primitive or object.
67495         *
67496         * @static
67497         * @memberOf _
67498         * @since 4.0.0
67499         * @category Lang
67500         * @param {*} value The value to check.
67501         * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
67502         * @example
67503         *
67504         * _.isSymbol(Symbol.iterator);
67505         * // => true
67506         *
67507         * _.isSymbol('abc');
67508         * // => false
67509         */
67510
67511
67512        function isSymbol(value) {
67513          return _typeof2(value) == 'symbol' || isObjectLike(value) && objectToString.call(value) == symbolTag;
67514        }
67515        /**
67516         * Converts `value` to a string. An empty string is returned for `null`
67517         * and `undefined` values. The sign of `-0` is preserved.
67518         *
67519         * @static
67520         * @memberOf _
67521         * @since 4.0.0
67522         * @category Lang
67523         * @param {*} value The value to process.
67524         * @returns {string} Returns the string.
67525         * @example
67526         *
67527         * _.toString(null);
67528         * // => ''
67529         *
67530         * _.toString(-0);
67531         * // => '-0'
67532         *
67533         * _.toString([1, 2, 3]);
67534         * // => '1,2,3'
67535         */
67536
67537
67538        function toString(value) {
67539          return value == null ? '' : baseToString(value);
67540        }
67541        /**
67542         * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
67543         * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
67544         *
67545         * @static
67546         * @memberOf _
67547         * @since 3.0.0
67548         * @category String
67549         * @param {string} [string=''] The string to escape.
67550         * @returns {string} Returns the escaped string.
67551         * @example
67552         *
67553         * _.escapeRegExp('[lodash](https://lodash.com/)');
67554         * // => '\[lodash\]\(https://lodash\.com/\)'
67555         */
67556
67557
67558        function escapeRegExp(string) {
67559          string = toString(string);
67560          return string && reHasRegExpChar.test(string) ? string.replace(reRegExpChar, '\\$&') : string;
67561        }
67562
67563        module.exports = escapeRegExp;
67564      }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
67565    }, {}],
67566    404: [function (require, module, exports) {
67567      (function (global) {
67568        /**
67569         * lodash (Custom Build) <https://lodash.com/>
67570         * Build: `lodash modularize exports="npm" -o ./`
67571         * Copyright jQuery Foundation and other contributors <https://jquery.org/>
67572         * Released under MIT license <https://lodash.com/license>
67573         * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
67574         * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
67575         */
67576
67577        /** Used as the size to enable large array optimizations. */
67578        var LARGE_ARRAY_SIZE = 200;
67579        /** Used as the `TypeError` message for "Functions" methods. */
67580
67581        var FUNC_ERROR_TEXT = 'Expected a function';
67582        /** Used to stand-in for `undefined` hash values. */
67583
67584        var HASH_UNDEFINED = '__lodash_hash_undefined__';
67585        /** Used to compose bitmasks for comparison styles. */
67586
67587        var UNORDERED_COMPARE_FLAG = 1,
67588            PARTIAL_COMPARE_FLAG = 2;
67589        /** Used as references for various `Number` constants. */
67590
67591        var INFINITY = 1 / 0,
67592            MAX_SAFE_INTEGER = 9007199254740991;
67593        /** `Object#toString` result references. */
67594
67595        var argsTag = '[object Arguments]',
67596            arrayTag = '[object Array]',
67597            boolTag = '[object Boolean]',
67598            dateTag = '[object Date]',
67599            errorTag = '[object Error]',
67600            funcTag = '[object Function]',
67601            genTag = '[object GeneratorFunction]',
67602            mapTag = '[object Map]',
67603            numberTag = '[object Number]',
67604            objectTag = '[object Object]',
67605            promiseTag = '[object Promise]',
67606            regexpTag = '[object RegExp]',
67607            setTag = '[object Set]',
67608            stringTag = '[object String]',
67609            symbolTag = '[object Symbol]',
67610            weakMapTag = '[object WeakMap]';
67611        var arrayBufferTag = '[object ArrayBuffer]',
67612            dataViewTag = '[object DataView]',
67613            float32Tag = '[object Float32Array]',
67614            float64Tag = '[object Float64Array]',
67615            int8Tag = '[object Int8Array]',
67616            int16Tag = '[object Int16Array]',
67617            int32Tag = '[object Int32Array]',
67618            uint8Tag = '[object Uint8Array]',
67619            uint8ClampedTag = '[object Uint8ClampedArray]',
67620            uint16Tag = '[object Uint16Array]',
67621            uint32Tag = '[object Uint32Array]';
67622        /** Used to match property names within property paths. */
67623
67624        var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
67625            reIsPlainProp = /^\w*$/,
67626            reLeadingDot = /^\./,
67627            rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
67628        /**
67629         * Used to match `RegExp`
67630         * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
67631         */
67632
67633        var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
67634        /** Used to match backslashes in property paths. */
67635
67636        var reEscapeChar = /\\(\\)?/g;
67637        /** Used to detect host constructors (Safari). */
67638
67639        var reIsHostCtor = /^\[object .+?Constructor\]$/;
67640        /** Used to detect unsigned integer values. */
67641
67642        var reIsUint = /^(?:0|[1-9]\d*)$/;
67643        /** Used to identify `toStringTag` values of typed arrays. */
67644
67645        var typedArrayTags = {};
67646        typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
67647        typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] 
67647= typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
67648        /** Detect free variable `global` from Node.js. */
67649
67650        var freeGlobal = _typeof2(global) == 'object' && global && global.Object === Object && global;
67651        /** Detect free variable `self`. */
67652
67653        var freeSelf = (typeof self === "undefined" ? "undefined" : _typeof2(self)) == 'object' && self && self.Object === Object && self;
67654        /** Used as a reference to the global object. */
67655
67656        var root = freeGlobal || freeSelf || Function('return this')();
67657        /** Detect free variable `exports`. */
67658
67659        var freeExports = _typeof2(exports) == 'object' && exports && !exports.nodeType && exports;
67660        /** Detect free variable `module`. */
67661
67662        var freeModule = freeExports && _typeof2(module) == 'object' && module && !module.nodeType && module;
67663        /** Detect the popular CommonJS extension `module.exports`. */
67664
67665        var moduleExports = freeModule && freeModule.exports === freeExports;
67666        /** Detect free variable `process` from Node.js. */
67667
67668        var freeProcess = moduleExports && freeGlobal.process;
67669        /** Used to access faster Node.js helpers. */
67670
67671        var nodeUtil = function () {
67672          try {
67673            return freeProcess && freeProcess.binding('util');
67674          } catch (e) {}
67675        }();
67676        /* Node.js helper references. */
67677
67678
67679        var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
67680        /**
67681         * A specialized version of `baseAggregator` for arrays.
67682         *
67683         * @private
67684         * @param {Array} [array] The array to iterate over.
67685         * @param {Function} setter The function to set `accumulator` values.
67686         * @param {Function} iteratee The iteratee to transform keys.
67687         * @param {Object} accumulator The initial aggregated object.
67688         * @returns {Function} Returns `accumulator`.
67689         */
67690
67691        function arrayAggregator(array, setter, iteratee, accumulator) {
67692          var index = -1,
67693              length = array ? array.length : 0;
67694
67695          while (++index < length) {
67696            var value = array[index];
67697            setter(accumulator, value, iteratee(value), array);
67698          }
67699
67700          return accumulator;
67701        }
67702        /**
67703         * A specialized version of `_.some` for arrays without support for iteratee
67704         * shorthands.
67705         *
67706         * @private
67707         * @param {Array} [array] The array to iterate over.
67708         * @param {Function} predicate The function invoked per iteration.
67709         * @returns {boolean} Returns `true` if any element passes the predicate check,
67710         *  else `false`.
67711         */
67712
67713
67714        function arraySome(array, predicate) {
67715          var index = -1,
67716              length = array ? array.length : 0;
67717
67718          while (++index < length) {
67719            if (predicate(array[index], index, array)) {
67720              return true;
67721            }
67722          }
67723
67724          return false;
67725        }
67726        /**
67727         * The base implementation of `_.property` without support for deep paths.
67728         *
67729         * @private
67730         * @param {string} key The key of the property to get.
67731         * @returns {Function} Returns the new accessor function.
67732         */
67733
67734
67735        function baseProperty(key) {
67736          return function (object) {
67737            return object == null ? undefined : object[key];
67738          };
67739        }
67740        /**
67741         * The base implementation of `_.times` without support for iteratee shorthands
67742         * or max array length checks.
67743         *
67744         * @private
67745         * @param {number} n The number of times to invoke `iteratee`.
67746         * @param {Function} iteratee The function invoked per iteration.
67747         * @returns {Array} Returns the array of results.
67748         */
67749
67750
67751        function baseTimes(n, iteratee) {
67752          var index = -1,
67753              result = Array(n);
67754
67755          while (++index < n) {
67756            result[index] = iteratee(index);
67757          }
67758
67759          return result;
67760        }
67761        /**
67762         * The base implementation of `_.unary` without support for storing metadata.
67763         *
67764         * @private
67765         * @param {Function} func The function to cap arguments for.
67766         * @returns {Function} Returns the new capped function.
67767         */
67768
67769
67770        function baseUnary(func) {
67771          return function (value) {
67772            return func(value);
67773          };
67774        }
67775        /**
67776         * Gets the value at `key` of `object`.
67777         *
67778         * @private
67779         * @param {Object} [object] The object to query.
67780         * @param {string} key The key of the property to get.
67781         * @returns {*} Returns the property value.
67782         */
67783
67784
67785        function getValue(object, key) {
67786          return object == null ? undefined : object[key];
67787        }
67788        /**
67789         * Checks if `value` is a host object in IE < 9.
67790         *
67791         * @private
67792         * @param {*} value The value to check.
67793         * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
67794         */
67795
67796
67797        function isHostObject(value) {
vendor: 25,096 bytes, lines 67798-68604
67798          // Many host objects are `Object` objects that can coerce to strings
67799          // despite having improperly defined `toString` methods.
67800          var result = false;
67801
67802          if (value != null && typeof value.toString != 'function') {
67803            try {
67804              result = !!(value + '');
67805            } catch (e) {}
67806          }
67807
67808          return result;
67809        }
67810        /**
67811         * Converts `map` to its key-value pairs.
67812         *
67813         * @private
67814         * @param {Object} map The map to convert.
67815         * @returns {Array} Returns the key-value pairs.
67816         */
67817
67818
67819        function mapToArray(map) {
67820          var index = -1,
67821              result = Array(map.size);
67822          map.forEach(function (value, key) {
67823            result[++index] = [key, value];
67824          });
67825          return result;
67826        }
67827        /**
67828         * Creates a unary function that invokes `func` with its argument transformed.
67829         *
67830         * @private
67831         * @param {Function} func The function to wrap.
67832         * @param {Function} transform The argument transform.
67833         * @returns {Function} Returns the new function.
67834         */
67835
67836
67837        function overArg(func, transform) {
67838          return function (arg) {
67839            return func(transform(arg));
67840          };
67841        }
67842        /**
67843         * Converts `set` to an array of its values.
67844         *
67845         * @private
67846         * @param {Object} set The set to convert.
67847         * @returns {Array} Returns the values.
67848         */
67849
67850
67851        function setToArray(set) {
67852          var index = -1,
67853              result = Array(set.size);
67854          set.forEach(function (value) {
67855            result[++index] = value;
67856          });
67857          return result;
67858        }
67859        /** Used for built-in method references. */
67860
67861
67862        var arrayProto = Array.prototype,
67863            funcProto = Function.prototype,
67864            objectProto = Object.prototype;
67865        /** Used to detect overreaching core-js shims. */
67866
67867        var coreJsData = root['__core-js_shared__'];
67868        /** Used to detect methods masquerading as native. */
67869
67870        var maskSrcKey = function () {
67871          var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
67872          return uid ? 'Symbol(src)_1.' + uid : '';
67873        }();
67874        /** Used to resolve the decompiled source of functions. */
67875
67876
67877        var funcToString = funcProto.toString;
67878        /** Used to check objects for own properties. */
67879
67880        var hasOwnProperty = objectProto.hasOwnProperty;
67881        /**
67882         * Used to resolve the
67883         * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
67884         * of values.
67885         */
67886
67887        var objectToString = objectProto.toString;
67888        /** Used to detect if a method is native. */
67889
67890        var reIsNative = RegExp('^' + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&').replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$');
67891        /** Built-in value references. */
67892
67893        var _Symbol5 = root.Symbol,
67894            Uint8Array = root.Uint8Array,
67895            propertyIsEnumerable = objectProto.propertyIsEnumerable,
67896            splice = arrayProto.splice;
67897        /* Built-in method references for those with the same name as other `lodash` methods. */
67898
67899        var nativeKeys = overArg(Object.keys, Object);
67900        /* Built-in method references that are verified to be native. */
67901
67902        var DataView = getNative(root, 'DataView'),
67903            Map = getNative(root, 'Map'),
67904            Promise = getNative(root, 'Promise'),
67905            Set = getNative(root, 'Set'),
67906            WeakMap = getNative(root, 'WeakMap'),
67907            nativeCreate = getNative(Object, 'create');
67908        /** Used to detect maps, sets, and weakmaps. */
67909
67910        var dataViewCtorString = toSource(DataView),
67911            mapCtorString = toSource(Map),
67912            promiseCtorString = toSource(Promise),
67913            setCtorString = toSource(Set),
67914            weakMapCtorString = toSource(WeakMap);
67915        /** Used to convert symbols to primitives and strings. */
67916
67917        var symbolProto = _Symbol5 ? _Symbol5.prototype : undefined,
67918            symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
67919            symbolToString = symbolProto ? symbolProto.toString : undefined;
67920        /**
67921         * Creates a hash object.
67922         *
67923         * @private
67924         * @constructor
67925         * @param {Array} [entries] The key-value pairs to cache.
67926         */
67927
67928        function Hash(entries) {
67929          var index = -1,
67930              length = entries ? entries.length : 0;
67931          this.clear();
67932
67933          while (++index < length) {
67934            var entry = entries[index];
67935            this.set(entry[0], entry[1]);
67936          }
67937        }
67938        /**
67939         * Removes all key-value entries from the hash.
67940         *
67941         * @private
67942         * @name clear
67943         * @memberOf Hash
67944         */
67945
67946
67947        function hashClear() {
67948          this.__data__ = nativeCreate ? nativeCreate(null) : {};
67949        }
67950        /**
67951         * Removes `key` and its value from the hash.
67952         *
67953         * @private
67954         * @name delete
67955         * @memberOf Hash
67956         * @param {Object} hash The hash to modify.
67957         * @param {string} key The key of the value to remove.
67958         * @returns {boolean} Returns `true` if the entry was removed, else `false`.
67959         */
67960
67961
67962        function hashDelete(key) {
67963          return this.has(key) && delete this.__data__[key];
67964        }
67965        /**
67966         * Gets the hash value for `key`.
67967         *
67968         * @private
67969         * @name get
67970         * @memberOf Hash
67971         * @param {string} key The key of the value to get.
67972         * @returns {*} Returns the entry value.
67973         */
67974
67975
67976        function hashGet(key) {
67977          var data = this.__data__;
67978
67979          if (nativeCreate) {
67980            var result = data[key];
67981            return result === HASH_UNDEFINED ? undefined : result;
67982          }
67983
67984          return hasOwnProperty.call(data, key) ? data[key] : undefined;
67985        }
67986        /**
67987         * Checks if a hash value for `key` exists.
67988         *
67989         * @private
67990         * @name has
67991         * @memberOf Hash
67992         * @param {string} key The key of the entry to check.
67993         * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
67994         */
67995
67996
67997        function hashHas(key) {
67998          var data = this.__data__;
67999          return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
68000        }
68001        /**
68002         * Sets the hash `key` to `value`.
68003         *
68004         * @private
68005         * @name set
68006         * @memberOf Hash
68007         * @param {string} key The key of the value to set.
68008         * @param {*} value The value to set.
68009         * @returns {Object} Returns the hash instance.
68010         */
68011
68012
68013        function hashSet(key, value) {
68014          var data = this.__data__;
68015          data[key] = nativeCreate && value === undefined ? HASH_UNDEFINED : value;
68016          return this;
68017        } // Add methods to `Hash`.
68018
68019
68020        Hash.prototype.clear = hashClear;
68021        Hash.prototype['delete'] = hashDelete;
68022        Hash.prototype.get = hashGet;
68023        Hash.prototype.has = hashHas;
68024        Hash.prototype.set = hashSet;
68025        /**
68026         * Creates an list cache object.
68027         *
68028         * @private
68029         * @constructor
68030         * @param {Array} [entries] The key-value pairs to cache.
68031         */
68032
68033        function ListCache(entries) {
68034          var index = -1,
68035              length = entries ? entries.length : 0;
68036          this.clear();
68037
68038          while (++index < length) {
68039            var entry = entries[index];
68040            this.set(entry[0], entry[1]);
68041          }
68042        }
68043        /**
68044         * Removes all key-value entries from the list cache.
68045         *
68046         * @private
68047         * @name clear
68048         * @memberOf ListCache
68049         */
68050
68051
68052        function listCacheClear() {
68053          this.__data__ = [];
68054        }
68055        /**
68056         * Removes `key` and its value from the list cache.
68057         *
68058         * @private
68059         * @name delete
68060         * @memberOf ListCache
68061         * @param {string} key The key of the value to remove.
68062         * @returns {boolean} Returns `true` if the entry was removed, else `false`.
68063         */
68064
68065
68066        function listCacheDelete(key) {
68067          var data = this.__data__,
68068              index = assocIndexOf(data, key);
68069
68070          if (index < 0) {
68071            return false;
68072          }
68073
68074          var lastIndex = data.length - 1;
68075
68076          if (index == lastIndex) {
68077            data.pop();
68078          } else {
68079            splice.call(data, index, 1);
68080          }
68081
68082          return true;
68083        }
68084        /**
68085         * Gets the list cache value for `key`.
68086         *
68087         * @private
68088         * @name get
68089         * @memberOf ListCache
68090         * @param {string} key The key of the value to get.
68091         * @returns {*} Returns the entry value.
68092         */
68093
68094
68095        function listCacheGet(key) {
68096          var data = this.__data__,
68097              index = assocIndexOf(data, key);
68098          return index < 0 ? undefined : data[index][1];
68099        }
68100        /**
68101         * Checks if a list cache value for `key` exists.
68102         *
68103         * @private
68104         * @name has
68105         * @memberOf ListCache
68106         * @param {string} key The key of the entry to check.
68107         * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
68108         */
68109
68110
68111        function listCacheHas(key) {
68112          return assocIndexOf(this.__data__, key) > -1;
68113        }
68114        /**
68115         * Sets the list cache `key` to `value`.
68116         *
68117         * @private
68118         * @name set
68119         * @memberOf ListCache
68120         * @param {string} key The key of the value to set.
68121         * @param {*} value The value to set.
68122         * @returns {Object} Returns the list cache instance.
68123         */
68124
68125
68126        function listCacheSet(key, value) {
68127          var data = this.__data__,
68128              index = assocIndexOf(data, key);
68129
68130          if (index < 0) {
68131            data.push([key, value]);
68132          } else {
68133            data[index][1] = value;
68134          }
68135
68136          return this;
68137        } // Add methods to `ListCache`.
68138
68139
68140        ListCache.prototype.clear = listCacheClear;
68141        ListCache.prototype['delete'] = listCacheDelete;
68142        ListCache.prototype.get = listCacheGet;
68143        ListCache.prototype.has = listCacheHas;
68144        ListCache.prototype.set = listCacheSet;
68145        /**
68146         * Creates a map cache object to store key-value pairs.
68147         *
68148         * @private
68149         * @constructor
68150         * @param {Array} [entries] The key-value pairs to cache.
68151         */
68152
68153        function MapCache(entries) {
68154          var index = -1,
68155              length = entries ? entries.length : 0;
68156          this.clear();
68157
68158          while (++index < length) {
68159            var entry = entries[index];
68160            this.set(entry[0], entry[1]);
68161          }
68162        }
68163        /**
68164         * Removes all key-value entries from the map.
68165         *
68166         * @private
68167         * @name clear
68168         * @memberOf MapCache
68169         */
68170
68171
68172        function mapCacheClear() {
68173          this.__data__ = {
68174            'hash': new Hash(),
68175            'map': new (Map || ListCache)(),
68176            'string': new Hash()
68177          };
68178        }
68179        /**
68180         * Removes `key` and its value from the map.
68181         *
68182         * @private
68183         * @name delete
68184         * @memberOf MapCache
68185         * @param {string} key The key of the value to remove.
68186         * @returns {boolean} Returns `true` if the entry was removed, else `false`.
68187         */
68188
68189
68190        function mapCacheDelete(key) {
68191          return getMapData(this, key)['delete'](key);
68192        }
68193        /**
68194         * Gets the map value for `key`.
68195         *
68196         * @private
68197         * @name get
68198         * @memberOf MapCache
68199         * @param {string} key The key of the value to get.
68200         * @returns {*} Returns the entry value.
68201         */
68202
68203
68204        function mapCacheGet(key) {
68205          return getMapData(this, key).get(key);
68206        }
68207        /**
68208         * Checks if a map value for `key` exists.
68209         *
68210         * @private
68211         * @name has
68212         * @memberOf MapCache
68213         * @param {string} key The key of the entry to check.
68214         * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
68215         */
68216
68217
68218        function mapCacheHas(key) {
68219          return getMapData(this, key).has(key);
68220        }
68221        /**
68222         * Sets the map `key` to `value`.
68223         *
68224         * @private
68225         * @name set
68226         * @memberOf MapCache
68227         * @param {string} key The key of the value to set.
68228         * @param {*} value The value to set.
68229         * @returns {Object} Returns the map cache instance.
68230         */
68231
68232
68233        function mapCacheSet(key, value) {
68234          getMapData(this, key).set(key, value);
68235          return this;
68236        } // Add methods to `MapCache`.
68237
68238
68239        MapCache.prototype.clear = mapCacheClear;
68240        MapCache.prototype['delete'] = mapCacheDelete;
68241        MapCache.prototype.get = mapCacheGet;
68242        MapCache.prototype.has = mapCacheHas;
68243        MapCache.prototype.set = mapCacheSet;
68244        /**
68245         *
68246         * Creates an array cache object to store unique values.
68247         *
68248         * @private
68249         * @constructor
68250         * @param {Array} [values] The values to cache.
68251         */
68252
68253        function SetCache(values) {
68254          var index = -1,
68255              length = values ? values.length : 0;
68256          this.__data__ = new MapCache();
68257
68258          while (++index < length) {
68259            this.add(values[index]);
68260          }
68261        }
68262        /**
68263         * Adds `value` to the array cache.
68264         *
68265         * @private
68266         * @name add
68267         * @memberOf SetCache
68268         * @alias push
68269         * @param {*} value The value to cache.
68270         * @returns {Object} Returns the cache instance.
68271         */
68272
68273
68274        function setCacheAdd(value) {
68275          this.__data__.set(value, HASH_UNDEFINED);
68276
68277          return this;
68278        }
68279        /**
68280         * Checks if `value` is in the array cache.
68281         *
68282         * @private
68283         * @name has
68284         * @memberOf SetCache
68285         * @param {*} value The value to search for.
68286         * @returns {number} Returns `true` if `value` is found, else `false`.
68287         */
68288
68289
68290        function setCacheHas(value) {
68291          return this.__data__.has(value);
68292        } // Add methods to `SetCache`.
68293
68294
68295        SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
68296        SetCache.prototype.has = setCacheHas;
68297        /**
68298         * Creates a stack cache object to store key-value pairs.
68299         *
68300         * @private
68301         * @constructor
68302         * @param {Array} [entries] The key-value pairs to cache.
68303         */
68304
68305        function Stack(entries) {
68306          this.__data__ = new ListCache(entries);
68307        }
68308        /**
68309         * Removes all key-value entries from the stack.
68310         *
68311         * @private
68312         * @name clear
68313         * @memberOf Stack
68314         */
68315
68316
68317        function stackClear() {
68318          this.__data__ = new ListCache();
68319        }
68320        /**
68321         * Removes `key` and its value from the stack.
68322         *
68323         * @private
68324         * @name delete
68325         * @memberOf Stack
68326         * @param {string} key The key of the value to remove.
68327         * @returns {boolean} Returns `true` if the entry was removed, else `false`.
68328         */
68329
68330
68331        function stackDelete(key) {
68332          return this.__data__['delete'](key);
68333        }
68334        /**
68335         * Gets the stack value for `key`.
68336         *
68337         * @private
68338         * @name get
68339         * @memberOf Stack
68340         * @param {string} key The key of the value to get.
68341         * @returns {*} Returns the entry value.
68342         */
68343
68344
68345        function stackGet(key) {
68346          return this.__data__.get(key);
68347        }
68348        /**
68349         * Checks if a stack value for `key` exists.
68350         *
68351         * @private
68352         * @name has
68353         * @memberOf Stack
68354         * @param {string} key The key of the entry to check.
68355         * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
68356         */
68357
68358
68359        function stackHas(key) {
68360          return this.__data__.has(key);
68361        }
68362        /**
68363         * Sets the stack `key` to `value`.
68364         *
68365         * @private
68366         * @name set
68367         * @memberOf Stack
68368         * @param {string} key The key of the value to set.
68369         * @param {*} value The value to set.
68370         * @returns {Object} Returns the stack cache instance.
68371         */
68372
68373
68374        function stackSet(key, value) {
68375          var cache = this.__data__;
68376
68377          if (cache instanceof ListCache) {
68378            var pairs = cache.__data__;
68379
68380            if (!Map || pairs.length < LARGE_ARRAY_SIZE - 1) {
68381              pairs.push([key, value]);
68382              return this;
68383            }
68384
68385            cache = this.__data__ = new MapCache(pairs);
68386          }
68387
68388          cache.set(key, value);
68389          return this;
68390        } // Add methods to `Stack`.
68391
68392
68393        Stack.prototype.clear = stackClear;
68394        Stack.prototype['delete'] = stackDelete;
68395        Stack.prototype.get = stackGet;
68396        Stack.prototype.has = stackHas;
68397        Stack.prototype.set = stackSet;
68398        /**
68399         * Creates an array of the enumerable property names of the array-like `value`.
68400         *
68401         * @private
68402         * @param {*} value The value to query.
68403         * @param {boolean} inherited Specify returning inherited property names.
68404         * @returns {Array} Returns the array of property names.
68405         */
68406
68407        function arrayLikeKeys(value, inherited) {
68408          // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
68409          // Safari 9 makes `arguments.length` enumerable in strict mode.
68410          var result = isArray(value) || isArguments(value) ? baseTimes(value.length, String) : [];
68411          var length = result.length,
68412              skipIndexes = !!length;
68413
68414          for (var key in value) {
68415            if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && (key == 'length' || isIndex(key, length)))) {
68416              result.push(key);
68417            }
68418          }
68419
68420          return result;
68421        }
68422        /**
68423         * Gets the index at which the `key` is found in `array` of key-value pairs.
68424         *
68425         * @private
68426         * @param {Array} array The array to inspect.
68427         * @param {*} key The key to search for.
68428         * @returns {number} Returns the index of the matched value, else `-1`.
68429         */
68430
68431
68432        function assocIndexOf(array, key) {
68433          var length = array.length;
68434
68435          while (length--) {
68436            if (eq(array[length][0], key)) {
68437              return length;
68438            }
68439          }
68440
68441          return -1;
68442        }
68443        /**
68444         * Aggregates elements of `collection` on `accumulator` with keys transformed
68445         * by `iteratee` and values set by `setter`.
68446         *
68447         * @private
68448         * @param {Array|Object} collection The collection to iterate over.
68449         * @param {Function} setter The function to set `accumulator` values.
68450         * @param {Function} iteratee The iteratee to transform keys.
68451         * @param {Object} accumulator The initial aggregated object.
68452         * @returns {Function} Returns `accumulator`.
68453         */
68454
68455
68456        function baseAggregator(collection, setter, iteratee, accumulator) {
68457          baseEach(collection, function (value, key, collection) {
68458            setter(accumulator, value, iteratee(value), collection);
68459          });
68460          return accumulator;
68461        }
68462        /**
68463         * The base implementation of `_.forEach` without support for iteratee shorthands.
68464         *
68465         * @private
68466         * @param {Array|Object} collection The collection to iterate over.
68467         * @param {Function} iteratee The function invoked per iteration.
68468         * @returns {Array|Object} Returns `collection`.
68469         */
68470
68471
68472        var baseEach = createBaseEach(baseForOwn);
68473        /**
68474         * The base implementation of `baseForOwn` which iterates over `object`
68475         * properties returned by `keysFunc` and invokes `iteratee` for each property.
68476         * Iteratee functions may exit iteration early by explicitly returning `false`.
68477         *
68478         * @private
68479         * @param {Object} object The object to iterate over.
68480         * @param {Function} iteratee The function invoked per iteration.
68481         * @param {Function} keysFunc The function to get the keys of `object`.
68482         * @returns {Object} Returns `object`.
68483         */
68484
68485        var baseFor = createBaseFor();
68486        /**
68487         * The base implementation of `_.forOwn` without support for iteratee shorthands.
68488         *
68489         * @private
68490         * @param {Object} object The object to iterate over.
68491         * @param {Function} iteratee The function invoked per iteration.
68492         * @returns {Object} Returns `object`.
68493         */
68494
68495        function baseForOwn(object, iteratee) {
68496          return object && baseFor(object, iteratee, keys);
68497        }
68498        /**
68499         * The base implementation of `_.get` without support for default values.
68500         *
68501         * @private
68502         * @param {Object} object The object to query.
68503         * @param {Array|string} path The path of the property to get.
68504         * @returns {*} Returns the resolved value.
68505         */
68506
68507
68508        function baseGet(object, path) {
68509          path = isKey(path, object) ? [path] : castPath(path);
68510          var index = 0,
68511              length = path.length;
68512
68513          while (object != null && index < length) {
68514            object = object[toKey(path[index++])];
68515          }
68516
68517          return index && index == length ? object : undefined;
68518        }
68519        /**
68520         * The base implementation of `getTag`.
68521         *
68522         * @private
68523         * @param {*} value The value to query.
68524         * @returns {string} Returns the `toStringTag`.
68525         */
68526
68527
68528        function baseGetTag(value) {
68529          return objectToString.call(value);
68530        }
68531        /**
68532         * The base implementation of `_.hasIn` without support for deep paths.
68533         *
68534         * @private
68535         * @param {Object} [object] The object to query.
68536         * @param {Array|string} key The key to check.
68537         * @returns {boolean} Returns `true` if `key` exists, else `false`.
68538         */
68539
68540
68541        function baseHasIn(object, key) {
68542          return object != null && key in Object(object);
68543        }
68544        /**
68545         * The base implementation of `_.isEqual` which supports partial comparisons
68546         * and tracks traversed objects.
68547         *
68548         * @private
68549         * @param {*} value The value to compare.
68550         * @param {*} other The other value to compare.
68551         * @param {Function} [customizer] The function to customize comparisons.
68552         * @param {boolean} [bitmask] The bitmask of comparison flags.
68553         *  The bitmask may be composed of the following flags:
68554         *     1 - Unordered comparison
68555         *     2 - Partial comparison
68556         * @param {Object} [stack] Tracks traversed `value` and `other` objects.
68557         * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
68558         */
68559
68560
68561        function baseIsEqual(value, other, customizer, bitmask, stack) {
68562          if (value === other) {
68563            return true;
68564          }
68565
68566          if (value == null || other == null || !isObject(value) && !isObjectLike(other)) {
68567            return value !== value && other !== other;
68568          }
68569
68570          return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack);
68571        }
68572        /**
68573         * A specialized version of `baseIsEqual` for arrays and objects which performs
68574         * deep comparisons and tracks traversed objects enabling objects with circular
68575         * references to be compared.
68576         *
68577         * @private
68578         * @param {Object} object The object to compare.
68579         * @param {Object} other The other object to compare.
68580         * @param {Function} equalFunc The function to determine equivalents of values.
68581         * @param {Function} [customizer] The function to customize comparisons.
68582         * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual`
68583         *  for more details.
68584         * @param {Object} [stack] Tracks traversed `object` and `other` objects.
68585         * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
68586         */
68587
68588
68589        function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) {
68590          var objIsArr = isArray(object),
68591              othIsArr = isArray(other),
68592              objTag = arrayTag,
68593              othTag = arrayTag;
68594
68595          if (!objIsArr) {
68596            objTag = getTag(object);
68597            objTag = objTag == argsTag ? objectTag : objTag;
68598          }
68599
68600          if (!othIsArr) {
68601            othTag = getTag(other);
68602            othTag = othTag == argsTag ? objectTag : othTag;
68603          }
68604
vendor: 8,363 bytes, lines 68605-68851
68605          var objIsObj = objTag == objectTag && !isHostObject(object),
68606              othIsObj = othTag == objectTag && !isHostObject(other),
68607              isSameTag = objTag == othTag;
68608
68609          if (isSameTag && !objIsObj) {
68610            stack || (stack = new Stack());
68611            return objIsArr || isTypedArray(object) ? equalArrays(object, other, equalFunc, customizer, bitmask, stack) : equalByTag(object, other, objTag, equalFunc, customizer, bitmask, stack);
68612          }
68613
68614          if (!(bitmask & PARTIAL_COMPARE_FLAG)) {
68615            var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
68616                othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
68617
68618            if (objIsWrapped || othIsWrapped) {
68619              var objUnwrapped = objIsWrapped ? object.value() : object,
68620                  othUnwrapped = othIsWrapped ? other.value() : other;
68621              stack || (stack = new Stack());
68622              return equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack);
68623            }
68624          }
68625
68626          if (!isSameTag) {
68627            return false;
68628          }
68629
68630          stack || (stack = new Stack());
68631          return equalObjects(object, other, equalFunc, customizer, bitmask, stack);
68632        }
68633        /**
68634         * The base implementation of `_.isMatch` without support for iteratee shorthands.
68635         *
68636         * @private
68637         * @param {Object} object The object to inspect.
68638         * @param {Object} source The object of property values to match.
68639         * @param {Array} matchData The property names, values, and compare flags to match.
68640         * @param {Function} [customizer] The function to customize comparisons.
68641         * @returns {boolean} Returns `true` if `object` is a match, else `false`.
68642         */
68643
68644
68645        function baseIsMatch(object, source, matchData, customizer) {
68646          var index = matchData.length,
68647              length = index,
68648              noCustomizer = !customizer;
68649
68650          if (object == null) {
68651            return !length;
68652          }
68653
68654          object = Object(object);
68655
68656          while (index--) {
68657            var data = matchData[index];
68658
68659            if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) {
68660              return false;
68661            }
68662          }
68663
68664          while (++index < length) {
68665            data = matchData[index];
68666            var key = data[0],
68667                objValue = object[key],
68668                srcValue = data[1];
68669
68670            if (noCustomizer && data[2]) {
68671              if (objValue === undefined && !(key in object)) {
68672                return false;
68673              }
68674            } else {
68675              var stack = new Stack();
68676
68677              if (customizer) {
68678                var result = customizer(objValue, srcValue, key, object, source, stack);
68679              }
68680
68681              if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack) : result)) {
68682                return false;
68683              }
68684            }
68685          }
68686
68687          return true;
68688        }
68689        /**
68690         * The base implementation of `_.isNative` without bad shim checks.
68691         *
68692         * @private
68693         * @param {*} value The value to check.
68694         * @returns {boolean} Returns `true` if `value` is a native function,
68695         *  else `false`.
68696         */
68697
68698
68699        function baseIsNative(value) {
68700          if (!isObject(value) || isMasked(value)) {
68701            return false;
68702          }
68703
68704          var pattern = isFunction(value) || isHostObject(value) ? reIsNative : reIsHostCtor;
68705          return pattern.test(toSource(value));
68706        }
68707        /**
68708         * The base implementation of `_.isTypedArray` without Node.js optimizations.
68709         *
68710         * @private
68711         * @param {*} value The value to check.
68712         * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
68713         */
68714
68715
68716        function baseIsTypedArray(value) {
68717          return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objectToString.call(value)];
68718        }
68719        /**
68720         * The base implementation of `_.iteratee`.
68721         *
68722         * @private
68723         * @param {*} [value=_.identity] The value to convert to an iteratee.
68724         * @returns {Function} Returns the iteratee.
68725         */
68726
68727
68728        function baseIteratee(value) {
68729          // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
68730          // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
68731          if (typeof value == 'function') {
68732            return value;
68733          }
68734
68735          if (value == null) {
68736            return identity;
68737          }
68738
68739          if (_typeof2(value) == 'object') {
68740            return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
68741          }
68742
68743          return property(value);
68744        }
68745        /**
68746         * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
68747         *
68748         * @private
68749         * @param {Object} object The object to query.
68750         * @returns {Array} Returns the array of property names.
68751         */
68752
68753
68754        function baseKeys(object) {
68755          if (!isPrototype(object)) {
68756            return nativeKeys(object);
68757          }
68758
68759          var result = [];
68760
68761          for (var key in Object(object)) {
68762            if (hasOwnProperty.call(object, key) && key != 'constructor') {
68763              result.push(key);
68764            }
68765          }
68766
68767          return result;
68768        }
68769        /**
68770         * The base implementation of `_.matches` which doesn't clone `source`.
68771         *
68772         * @private
68773         * @param {Object} source The object of property values to match.
68774         * @returns {Function} Returns the new spec function.
68775         */
68776
68777
68778        function baseMatches(source) {
68779          var matchData = getMatchData(source);
68780
68781          if (matchData.length == 1 && matchData[0][2]) {
68782            return matchesStrictComparable(matchData[0][0], matchData[0][1]);
68783          }
68784
68785          return function (object) {
68786            return object === source || baseIsMatch(object, source, matchData);
68787          };
68788        }
68789        /**
68790         * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
68791         *
68792         * @private
68793         * @param {string} path The path of the property to get.
68794         * @param {*} srcValue The value to match.
68795         * @returns {Function} Returns the new spec function.
68796         */
68797
68798
68799        function baseMatchesProperty(path, srcValue) {
68800          if (isKey(path) && isStrictComparable(srcValue)) {
68801            return matchesStrictComparable(toKey(path), srcValue);
68802          }
68803
68804          return function (object) {
68805            var objValue = get(object, path);
68806            return objValue === undefined && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG);
68807          };
68808        }
68809        /**
68810         * A specialized version of `baseProperty` which supports deep paths.
68811         *
68812         * @private
68813         * @param {Array|string} path The path of the property to get.
68814         * @returns {Function} Returns the new accessor function.
68815         */
68816
68817
68818        function basePropertyDeep(path) {
68819          return function (object) {
68820            return baseGet(object, path);
68821          };
68822        }
68823        /**
68824         * The base implementation of `_.toString` which doesn't convert nullish
68825         * values to empty strings.
68826         *
68827         * @private
68828         * @param {*} value The value to process.
68829         * @returns {string} Returns the string.
68830         */
68831
68832
68833        function baseToString(value) {
68834          // Exit early for strings to avoid a performance hit in some environments.
68835          if (typeof value == 'string') {
68836            return value;
68837          }
68838
68839          if (isSymbol(value)) {
68840            return symbolToString ? symbolToString.call(value) : '';
68841          }
68842
68843          var result = value + '';
68844          return result == '0' && 1 / value == -INFINITY ? '-0' : result;
68845        }
68846        /**
68847         * Casts `value` to a path array if it's not one.
68848         *
68849         * @private
68850         * @param {*} value The value to inspect.
68851         * @returns {Array} Returns the cast property path array.
vendor: 10,973 bytes, lines 68852-69158
68852         */
68853
68854
68855        function castPath(value) {
68856          return isArray(value) ? value : stringToPath(value);
68857        }
68858        /**
68859         * Creates a function like `_.groupBy`.
68860         *
68861         * @private
68862         * @param {Function} setter The function to set accumulator values.
68863         * @param {Function} [initializer] The accumulator object initializer.
68864         * @returns {Function} Returns the new aggregator function.
68865         */
68866
68867
68868        function createAggregator(setter, initializer) {
68869          return function (collection, iteratee) {
68870            var func = isArray(collection) ? arrayAggregator : baseAggregator,
68871                accumulator = initializer ? initializer() : {};
68872            return func(collection, setter, baseIteratee(iteratee, 2), accumulator);
68873          };
68874        }
68875        /**
68876         * Creates a `baseEach` or `baseEachRight` function.
68877         *
68878         * @private
68879         * @param {Function} eachFunc The function to iterate over a collection.
68880         * @param {boolean} [fromRight] Specify iterating from right to left.
68881         * @returns {Function} Returns the new base function.
68882         */
68883
68884
68885        function createBaseEach(eachFunc, fromRight) {
68886          return function (collection, iteratee) {
68887            if (collection == null) {
68888              return collection;
68889            }
68890
68891            if (!isArrayLike(collection)) {
68892              return eachFunc(collection, iteratee);
68893            }
68894
68895            var length = collection.length,
68896                index = fromRight ? length : -1,
68897                iterable = Object(collection);
68898
68899            while (fromRight ? index-- : ++index < length) {
68900              if (iteratee(iterable[index], index, iterable) === false) {
68901                break;
68902              }
68903            }
68904
68905            return collection;
68906          };
68907        }
68908        /**
68909         * Creates a base function for methods like `_.forIn` and `_.forOwn`.
68910         *
68911         * @private
68912         * @param {boolean} [fromRight] Specify iterating from right to left.
68913         * @returns {Function} Returns the new base function.
68914         */
68915
68916
68917        function createBaseFor(fromRight) {
68918          return function (object, iteratee, keysFunc) {
68919            var index = -1,
68920                iterable = Object(object),
68921                props = keysFunc(object),
68922                length = props.length;
68923
68924            while (length--) {
68925              var key = props[fromRight ? length : ++index];
68926
68927              if (iteratee(iterable[key], key, iterable) === false) {
68928                break;
68929              }
68930            }
68931
68932            return object;
68933          };
68934        }
68935        /**
68936         * A specialized version of `baseIsEqualDeep` for arrays with support for
68937         * partial deep comparisons.
68938         *
68939         * @private
68940         * @param {Array} array The array to compare.
68941         * @param {Array} other The other array to compare.
68942         * @param {Function} equalFunc The function to determine equivalents of values.
68943         * @param {Function} customizer The function to customize comparisons.
68944         * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
68945         *  for more details.
68946         * @param {Object} stack Tracks traversed `array` and `other` objects.
68947         * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
68948         */
68949
68950
68951        function equalArrays(array, other, equalFunc, customizer, bitmask, stack) {
68952          var isPartial = bitmask & PARTIAL_COMPARE_FLAG,
68953              arrLength = array.length,
68954              othLength = other.length;
68955
68956          if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
68957            return false;
68958          } // Assume cyclic values are equal.
68959
68960
68961          var stacked = stack.get(array);
68962
68963          if (stacked && stack.get(other)) {
68964            return stacked == other;
68965          }
68966
68967          var index = -1,
68968              result = true,
68969              seen = bitmask & UNORDERED_COMPARE_FLAG ? new SetCache() : undefined;
68970          stack.set(array, other);
68971          stack.set(other, array); // Ignore non-index properties.
68972
68973          while (++index < arrLength) {
68974            var arrValue = array[index],
68975                othValue = other[index];
68976
68977            if (customizer) {
68978              var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
68979            }
68980
68981            if (compared !== undefined) {
68982              if (compared) {
68983                continue;
68984              }
68985
68986              result = false;
68987              break;
68988            } // Recursively compare arrays (susceptible to call stack limits).
68989
68990
68991            if (seen) {
68992              if (!arraySome(other, function (othValue, othIndex) {
68993                if (!seen.has(othIndex) && (arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) {
68994                  return seen.add(othIndex);
68995                }
68996              })) {
68997                result = false;
68998                break;
68999              }
69000            } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) {
69001              result = false;
69002              break;
69003            }
69004          }
69005
69006          stack['delete'](array);
69007          stack['delete'](other);
69008          return result;
69009        }
69010        /**
69011         * A specialized version of `baseIsEqualDeep` for comparing objects of
69012         * the same `toStringTag`.
69013         *
69014         * **Note:** This function only supports comparing values with tags of
69015         * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
69016         *
69017         * @private
69018         * @param {Object} object The object to compare.
69019         * @param {Object} other The other object to compare.
69020         * @param {string} tag The `toStringTag` of the objects to compare.
69021         * @param {Function} equalFunc The function to determine equivalents of values.
69022         * @param {Function} customizer The function to customize comparisons.
69023         * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
69024         *  for more details.
69025         * @param {Object} stack Tracks traversed `object` and `other` objects.
69026         * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
69027         */
69028
69029
69030        function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) {
69031          switch (tag) {
69032            case dataViewTag:
69033              if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
69034                return false;
69035              }
69036
69037              object = object.buffer;
69038              other = other.buffer;
69039
69040            case arrayBufferTag:
69041              if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
69042                return false;
69043              }
69044
69045              return true;
69046
69047            case boolTag:
69048            case dateTag:
69049            case numberTag:
69050              // Coerce booleans to `1` or `0` and dates to milliseconds.
69051              // Invalid dates are coerced to `NaN`.
69052              return eq(+object, +other);
69053
69054            case errorTag:
69055              return object.name == other.name && object.message == other.message;
69056
69057            case regexpTag:
69058            case stringTag:
69059              // Coerce regexes to strings and treat strings, primitives and objects,
69060              // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
69061              // for more details.
69062              return object == other + '';
69063
69064            case mapTag:
69065              var convert = mapToArray;
69066
69067            case setTag:
69068              var isPartial = bitmask & PARTIAL_COMPARE_FLAG;
69069              convert || (convert = setToArray);
69070
69071              if (object.size != other.size && !isPartial) {
69072                return false;
69073              } // Assume cyclic values are equal.
69074
69075
69076              var stacked = stack.get(object);
69077
69078              if (stacked) {
69079                return stacked == other;
69080              }
69081
69082              bitmask |= UNORDERED_COMPARE_FLAG; // Recursively compare objects (susceptible to call stack limits).
69083
69084              stack.set(object, other);
69085              var result = equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask, stack);
69086              stack['delete'](object);
69087              return result;
69088
69089            case symbolTag:
69090              if (symbolValueOf) {
69091                return symbolValueOf.call(object) == symbolValueOf.call(other);
69092              }
69093
69094          }
69095
69096          return false;
69097        }
69098        /**
69099         * A specialized version of `baseIsEqualDeep` for objects with support for
69100         * partial deep comparisons.
69101         *
69102         * @private
69103         * @param {Object} object The object to compare.
69104         * @param {Object} other The other object to compare.
69105         * @param {Function} equalFunc The function to determine equivalents of values.
69106         * @param {Function} customizer The function to customize comparisons.
69107         * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
69108         *  for more details.
69109         * @param {Object} stack Tracks traversed `object` and `other` objects.
69110         * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
69111         */
69112
69113
69114        function equalObjects(object, other, equalFunc, customizer, bitmask, stack) {
69115          var isPartial = bitmask & PARTIAL_COMPARE_FLAG,
69116              objProps = keys(object),
69117              objLength = objProps.length,
69118              othProps = keys(other),
69119              othLength = othProps.length;
69120
69121          if (objLength != othLength && !isPartial) {
69122            return false;
69123          }
69124
69125          var index = objLength;
69126
69127          while (index--) {
69128            var key = objProps[index];
69129
69130            if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
69131              return false;
69132            }
69133          } // Assume cyclic values are equal.
69134
69135
69136          var stacked = stack.get(object);
69137
69138          if (stacked && stack.get(other)) {
69139            return stacked == other;
69140          }
69141
69142          var result = true;
69143          stack.set(object, other);
69144          stack.set(other, object);
69145          var skipCtor = isPartial;
69146
69147          while (++index < objLength) {
69148            key = objProps[index];
69149            var objValue = object[key],
69150                othValue = other[key];
69151
69152            if (customizer) {
69153              var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
69154            } // Recursively compare objects (susceptible to call stack limits).
69155
69156
69157            if (!(compared === undefined ? objValue === othValue || equalFunc(objValue, othValue, customizer, bitmask, stack) : compared)) {
69158              result = false;
vendor: 9,959 bytes, lines 69159-69471
69159              break;
69160            }
69161
69162            skipCtor || (skipCtor = key == 'constructor');
69163          }
69164
69165          if (result && !skipCtor) {
69166            var objCtor = object.constructor,
69167                othCtor = other.constructor; // Non `Object` object instances with different constructors are not equal.
69168
69169            if (objCtor != othCtor && 'constructor' in object && 'constructor' in other && !(typeof objCtor == 'function' && objCtor instanceof objCtor && typeof othCtor == 'function' && othCtor instanceof othCtor)) {
69170              result = false;
69171            }
69172          }
69173
69174          stack['delete'](object);
69175          stack['delete'](other);
69176          return result;
69177        }
69178        /**
69179         * Gets the data for `map`.
69180         *
69181         * @private
69182         * @param {Object} map The map to query.
69183         * @param {string} key The reference key.
69184         * @returns {*} Returns the map data.
69185         */
69186
69187
69188        function getMapData(map, key) {
69189          var data = map.__data__;
69190          return isKeyable(key) ? data[typeof key == 'string' ? 'string' : 'hash'] : data.map;
69191        }
69192        /**
69193         * Gets the property names, values, and compare flags of `object`.
69194         *
69195         * @private
69196         * @param {Object} object The object to query.
69197         * @returns {Array} Returns the match data of `object`.
69198         */
69199
69200
69201        function getMatchData(object) {
69202          var result = keys(object),
69203              length = result.length;
69204
69205          while (length--) {
69206            var key = result[length],
69207                value = object[key];
69208            result[length] = [key, value, isStrictComparable(value)];
69209          }
69210
69211          return result;
69212        }
69213        /**
69214         * Gets the native function at `key` of `object`.
69215         *
69216         * @private
69217         * @param {Object} object The object to query.
69218         * @param {string} key The key of the method to get.
69219         * @returns {*} Returns the function if it's native, else `undefined`.
69220         */
69221
69222
69223        function getNative(object, key) {
69224          var value = getValue(object, key);
69225          return baseIsNative(value) ? value : undefined;
69226        }
69227        /**
69228         * Gets the `toStringTag` of `value`.
69229         *
69230         * @private
69231         * @param {*} value The value to query.
69232         * @returns {string} Returns the `toStringTag`.
69233         */
69234
69235
69236        var getTag = baseGetTag; // Fallback for data views, maps, sets, and weak maps in IE 11,
69237        // for data views in Edge < 14, and promises in Node.js.
69238
69239        if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map && getTag(new Map()) != mapTag || Promise && getTag(Promise.resolve()) != promiseTag || Set && getTag(new Set()) != setTag || WeakMap && getTag(new WeakMap()) != weakMapTag) {
69240          getTag = function getTag(value) {
69241            var result = objectToString.call(value),
69242                Ctor = result == objectTag ? value.constructor : undefined,
69243                ctorString = Ctor ? toSource(Ctor) : undefined;
69244
69245            if (ctorString) {
69246              switch (ctorString) {
69247                case dataViewCtorString:
69248                  return dataViewTag;
69249
69250                case mapCtorString:
69251                  return mapTag;
69252
69253                case promiseCtorString:
69254                  return promiseTag;
69255
69256                case setCtorString:
69257                  return setTag;
69258
69259                case weakMapCtorString:
69260                  return weakMapTag;
69261              }
69262            }
69263
69264            return result;
69265          };
69266        }
69267        /**
69268         * Checks if `path` exists on `object`.
69269         *
69270         * @private
69271         * @param {Object} object The object to query.
69272         * @param {Array|string} path The path to check.
69273         * @param {Function} hasFunc The function to check properties.
69274         * @returns {boolean} Returns `true` if `path` exists, else `false`.
69275         */
69276
69277
69278        function hasPath(object, path, hasFunc) {
69279          path = isKey(path, object) ? [path] : castPath(path);
69280          var result,
69281              index = -1,
69282              length = path.length;
69283
69284          while (++index < length) {
69285            var key = toKey(path[index]);
69286
69287            if (!(result = object != null && hasFunc(object, key))) {
69288              break;
69289            }
69290
69291            object = object[key];
69292          }
69293
69294          if (result) {
69295            return result;
69296          }
69297
69298          var length = object ? object.length : 0;
69299          return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object));
69300        }
69301        /**
69302         * Checks if `value` is a valid array-like index.
69303         *
69304         * @private
69305         * @param {*} value The value to check.
69306         * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
69307         * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
69308         */
69309
69310
69311        function isIndex(value, length) {
69312          length = length == null ? MAX_SAFE_INTEGER : length;
69313          return !!length && (typeof value == 'number' || reIsUint.test(value)) && value > -1 && value % 1 == 0 && value < length;
69314        }
69315        /**
69316         * Checks if `value` is a property name and not a property path.
69317         *
69318         * @private
69319         * @param {*} value The value to check.
69320         * @param {Object} [object] The object to query keys on.
69321         * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
69322         */
69323
69324
69325        function isKey(value, object) {
69326          if (isArray(value)) {
69327            return false;
69328          }
69329
69330          var type = _typeof2(value);
69331
69332          if (type == 'number' || type == 'symbol' || type == 'boolean' || value == null || isSymbol(value)) {
69333            return true;
69334          }
69335
69336          return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
69337        }
69338        /**
69339         * Checks if `value` is suitable for use as unique object key.
69340         *
69341         * @private
69342         * @param {*} value The value to check.
69343         * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
69344         */
69345
69346
69347        function isKeyable(value) {
69348          var type = _typeof2(value);
69349
69350          return type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean' ? value !== '__proto__' : value === null;
69351        }
69352        /**
69353         * Checks if `func` has its source masked.
69354         *
69355         * @private
69356         * @param {Function} func The function to check.
69357         * @returns {boolean} Returns `true` if `func` is masked, else `false`.
69358         */
69359
69360
69361        function isMasked(func) {
69362          return !!maskSrcKey && maskSrcKey in func;
69363        }
69364        /**
69365         * Checks if `value` is likely a prototype object.
69366         *
69367         * @private
69368         * @param {*} value The value to check.
69369         * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
69370         */
69371
69372
69373        function isPrototype(value) {
69374          var Ctor = value && value.constructor,
69375              proto = typeof Ctor == 'function' && Ctor.prototype || objectProto;
69376          return value === proto;
69377        }
69378        /**
69379         * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
69380         *
69381         * @private
69382         * @param {*} value The value to check.
69383         * @returns {boolean} Returns `true` if `value` if suitable for strict
69384         *  equality comparisons, else `false`.
69385         */
69386
69387
69388        function isStrictComparable(value) {
69389          return value === value && !isObject(value);
69390        }
69391        /**
69392         * A specialized version of `matchesProperty` for source values suitable
69393         * for strict equality comparisons, i.e. `===`.
69394         *
69395         * @private
69396         * @param {string} key The key of the property to get.
69397         * @param {*} srcValue The value to match.
69398         * @returns {Function} Returns the new spec function.
69399         */
69400
69401
69402        function matchesStrictComparable(key, srcValue) {
69403          return function (object) {
69404            if (object == null) {
69405              return false;
69406            }
69407
69408            return object[key] === srcValue && (srcValue !== undefined || key in Object(object));
69409          };
69410        }
69411        /**
69412         * Converts `string` to a property path array.
69413         *
69414         * @private
69415         * @param {string} string The string to convert.
69416         * @returns {Array} Returns the property path array.
69417         */
69418
69419
69420        var stringToPath = memoize(function (string) {
69421          string = toString(string);
69422          var result = [];
69423
69424          if (reLeadingDot.test(string)) {
69425            result.push('');
69426          }
69427
69428          string.replace(rePropName, function (match, number, quote, string) {
69429            result.push(quote ? string.replace(reEscapeChar, '$1') : number || match);
69430          });
69431          return result;
69432        });
69433        /**
69434         * Converts `value` to a string key if it's not a string or symbol.
69435         *
69436         * @private
69437         * @param {*} value The value to inspect.
69438         * @returns {string|symbol} Returns the key.
69439         */
69440
69441        function toKey(value) {
69442          if (typeof value == 'string' || isSymbol(value)) {
69443            return value;
69444          }
69445
69446          var result = value + '';
69447          return result == '0' && 1 / value == -INFINITY ? '-0' : result;
69448        }
69449        /**
69450         * Converts `func` to its source code.
69451         *
69452         * @private
69453         * @param {Function} func The function to process.
69454         * @returns {string} Returns the source code.
69455         */
69456
69457
69458        function toSource(func) {
69459          if (func != null) {
69460            try {
69461              return funcToString.call(func);
69462            } catch (e) {}
69463
69464            try {
69465              return func + '';
69466            } catch (e) {}
69467          }
69468
69469          return '';
69470        }
69471        /**
69472         * Creates an object composed of keys generated from the results of running
69473         * each element of `collection` thru `iteratee`. The order of grouped values
69474         * is determined by the order they occur in `collection`. The corresponding
69475         * value of each key is an array of elements responsible for generating the
69476         * key. The iteratee is invoked with one argument: (value).
69477         *
69478         * @static
69479         * @memberOf _
69480         * @since 0.1.0
69481         * @category Collection
69482         * @param {Array|Object} collection The collection to iterate over.
69483         * @param {Function} [iteratee=_.identity]
69484         *  The iteratee to transform keys.
69485         * @returns {Object} Returns the composed aggregate object.
69486         * @example
69487         *
69488         * _.groupBy([6.1, 4.2, 6.3], Math.floor);
69489         * // => { '4': [4.2], '6': [6.1, 6.3] }
69490         *
69491         * // The `_.property` iteratee shorthand.
69492         * _.groupBy(['one', 'two', 'three'], 'length');
69493         * // => { '3': ['one', 'two'], '5': ['three'] }
69494         */
69495
69496
69497        var groupBy = createAggregator(function (result, value, key) {
69498          if (hasOwnProperty.call(result, key)) {
69499            result[key].push(value);
69500          } else {
69501            result[key] = [value];
69502          }
69503        });
69504        /**
69505         * Creates a function that memoizes the result of `func`. If `resolver` is
69506         * provided, it determines the cache key for storing the result based on the
69507         * arguments provided to the memoized function. By default, the first argument
69508         * provided to the memoized function is used as the map cache key. The `func`
69509         * is invoked with the `this` binding of the memoized function.
69510         *
69511         * **Note:** The cache is exposed as the `cache` property on the memoized
69512         * function. Its creation may be customized by replacing the `_.memoize.Cache`
69513         * constructor with one whose instances implement the
69514         * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
69515         * method interface of `delete`, `get`, `has`, and `set`.
69516         *
69517         * @static
69518         * @memberOf _
69519         * @since 0.1.0
69520         * @category Function
69521         * @param {Function} func The function to have its output memoized.
69522         * @param {Function} [resolver] The function to resolve the cache key.
69523         * @returns {Function} Returns the new memoized function.
69524         * @example
69525         *
69526         * var object = { 'a': 1, 'b': 2 };
69527         * var other = { 'c': 3, 'd': 4 };
69528         *
69529         * var values = _.memoize(_.values);
69530         * values(object);
69531         * // => [1, 2]
69532         *
69533         * values(other);
69534         * // => [3, 4]
69535         *
69536         * object.a = 2;
69537         * values(object);
69538         * // => [1, 2]
69539         *
69540         * // Modify the result cache.
69541         * values.cache.set(object, ['a', 'b']);
69542         * values(object);
69543         * // => ['a', 'b']
69544         *
69545         * // Replace `_.memoize.Cache`.
69546         * _.memoize.Cache = WeakMap;
69547         */
69548
69549        function memoize(func, resolver) {
69550          if (typeof func != 'function' || resolver && typeof resolver != 'function') {
69551            throw new TypeError(FUNC_ERROR_TEXT);
69552          }
69553
69554          var memoized = function memoized() {
69555            var args = arguments,
69556                key = resolver ? resolver.apply(this, args) : args[0],
69557                cache = memoized.cache;
69558
69559            if (cache.has(key)) {
69560              return cache.get(key);
69561            }
69562
69563            var result = func.apply(this, args);
69564            memoized.cache = cache.set(key, result);
69565            return result;
69566          };
69567
69568          memoized.cache = new (memoize.Cache || MapCache)();
69569          return memoized;
69570        } // Assign cache to `_.memoize`.
69571
69572
69573        memoize.Cache = MapCache;
69574        /**
69575         * Performs a
69576         * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
69577         * comparison between two values to determine if they are equivalent.
69578         *
69579         * @static
69580         * @memberOf _
69581         * @since 4.0.0
69582         * @category Lang
69583         * @param {*} value The value to compare.
69584         * @param {*} other The other value to compare.
69585         * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
69586         * @example
69587         *
69588         * var object = { 'a': 1 };
69589         * var other = { 'a': 1 };
69590         *
69591         * _.eq(object, object);
69592         * // => true
69593         *
69594         * _.eq(object, other);
69595         * // => false
69596         *
69597         * _.eq('a', 'a');
69598         * // => true
69599         *
69600         * _.eq('a', Object('a'));
69601         * // => false
69602         *
69603         * _.eq(NaN, NaN);
69604         * // => true
69605         */
69606
69607        function eq(value, other) {
69608          return value === other || value !== value && other !== other;
69609        }
69610        /**
69611         * Checks if `value` is likely an `arguments` object.
69612         *
69613         * @static
69614         * @memberOf _
69615         * @since 0.1.0
69616         * @category Lang
69617         * @param {*} value The value to check.
69618         * @returns {boolean} Returns `true` if `value` is an `arguments` object,
69619         *  else `false`.
69620         * @example
69621         *
69622         * _.isArguments(function() { return arguments; }());
69623         * // => true
69624         *
69625         * _.isArguments([1, 2, 3]);
69626         * // => false
69627         */
69628
69629
69630        function isArguments(value) {
69631          // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
69632          return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
69633        }
69634        /**
69635         * Checks if `value` is classified as an `Array` object.
69636         *
69637         * @static
69638         * @memberOf _
69639         * @since 0.1.0
69640         * @category Lang
69641         * @param {*} value The value to check.
69642         * @returns {boolean} Returns `true` if `value` is an array, else `false`.
69643         * @example
69644         *
69645         * _.isArray([1, 2, 3]);
69646         * // => true
69647         *
69648         * _.isArray(document.body.children);
69649         * // => false
69650         *
69651         * _.isArray('abc');
69652         * // => false
69653         *
69654         * _.isArray(_.noop);
69655         * // => false
69656         */
69657
69658
69659        var isArray = Array.isArray;
69660        /**
69661         * Checks if `value` is array-like. A value is considered array-like if it's
69662         * not a function and has a `value.length` that's an integer greater than or
69663         * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
69664         *
69665         * @static
69666         * @memberOf _
69667         * @since 4.0.0
69668         * @category Lang
69669         * @param {*} value The value to check.
69670         * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
69671         * @example
69672         *
69673         * _.isArrayLike([1, 2, 3]);
69674         * // => true
69675         *
69676         * _.isArrayLike(document.body.children);
69677         * // => true
69678         *
69679         * _.isArrayLike('abc');
69680         * // => true
69681         *
69682         * _.isArrayLike(_.noop);
69683         * // => false
69684         */
69685
69686        function isArrayLike(value) {
69687          return value != null && isLength(value.length) && !isFunction(value);
69688        }
69689        /**
69690         * This method is like `_.isArrayLike` except that it also checks if `value`
69691         * is an object.
69692         *
69693         * @static
69694         * @memberOf _
69695         * @since 4.0.0
69696         * @category Lang
69697         * @param {*} value The value to check.
69698         * @returns {boolean} Returns `true` if `value` is an array-like object,
69699         *  else `false`.
69700         * @example
69701         *
69702         * _.isArrayLikeObject([1, 2, 3]);
69703         * // => true
69704         *
69705         * _.isArrayLikeObject(document.body.children);
69706         * // => true
69707         *
69708         * _.isArrayLikeObject('abc');
69709         * // => false
69710         *
69711         * _.isArrayLikeObject(_.noop);
69712         * // => false
69713         */
69714
69715
69716        function isArrayLikeObject(value) {
69717          return isObjectLike(value) && isArrayLike(value);
69718        }
69719        /**
69720         * Checks if `value` is classified as a `Function` object.
69721         *
69722         * @static
69723         * @memberOf _
69724         * @since 0.1.0
69725         * @category Lang
69726         * @param {*} value The value to check.
69727         * @returns {boolean} Returns `true` if `value` is a function, else `false`.
69728         * @example
69729         *
69730         * _.isFunction(_);
69731         * // => true
69732         *
69733         * _.isFunction(/abc/);
69734         * // => false
69735         */
69736
69737
69738        function isFunction(value) {
vendor: 9,264 bytes, lines 69739-70049
69739          // The use of `Object#toString` avoids issues with the `typeof` operator
69740          // in Safari 8-9 which returns 'object' for typed array and other constructors.
69741          var tag = isObject(value) ? objectToString.call(value) : '';
69742          return tag == funcTag || tag == genTag;
69743        }
69744        /**
69745         * Checks if `value` is a valid array-like length.
69746         *
69747         * **Note:** This method is loosely based on
69748         * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
69749         *
69750         * @static
69751         * @memberOf _
69752         * @since 4.0.0
69753         * @category Lang
69754         * @param {*} value The value to check.
69755         * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
69756         * @example
69757         *
69758         * _.isLength(3);
69759         * // => true
69760         *
69761         * _.isLength(Number.MIN_VALUE);
69762         * // => false
69763         *
69764         * _.isLength(Infinity);
69765         * // => false
69766         *
69767         * _.isLength('3');
69768         * // => false
69769         */
69770
69771
69772        function isLength(value) {
69773          return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
69774        }
69775        /**
69776         * Checks if `value` is the
69777         * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
69778         * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
69779         *
69780         * @static
69781         * @memberOf _
69782         * @since 0.1.0
69783         * @category Lang
69784         * @param {*} value The value to check.
69785         * @returns {boolean} Returns `true` if `value` is an object, else `false`.
69786         * @example
69787         *
69788         * _.isObject({});
69789         * // => true
69790         *
69791         * _.isObject([1, 2, 3]);
69792         * // => true
69793         *
69794         * _.isObject(_.noop);
69795         * // => true
69796         *
69797         * _.isObject(null);
69798         * // => false
69799         */
69800
69801
69802        function isObject(value) {
69803          var type = _typeof2(value);
69804
69805          return !!value && (type == 'object' || type == 'function');
69806        }
69807        /**
69808         * Checks if `value` is object-like. A value is object-like if it's not `null`
69809         * and has a `typeof` result of "object".
69810         *
69811         * @static
69812         * @memberOf _
69813         * @since 4.0.0
69814         * @category Lang
69815         * @param {*} value The value to check.
69816         * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
69817         * @example
69818         *
69819         * _.isObjectLike({});
69820         * // => true
69821         *
69822         * _.isObjectLike([1, 2, 3]);
69823         * // => true
69824         *
69825         * _.isObjectLike(_.noop);
69826         * // => false
69827         *
69828         * _.isObjectLike(null);
69829         * // => false
69830         */
69831
69832
69833        function isObjectLike(value) {
69834          return !!value && _typeof2(value) == 'object';
69835        }
69836        /**
69837         * Checks if `value` is classified as a `Symbol` primitive or object.
69838         *
69839         * @static
69840         * @memberOf _
69841         * @since 4.0.0
69842         * @category Lang
69843         * @param {*} value The value to check.
69844         * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
69845         * @example
69846         *
69847         * _.isSymbol(Symbol.iterator);
69848         * // => true
69849         *
69850         * _.isSymbol('abc');
69851         * // => false
69852         */
69853
69854
69855        function isSymbol(value) {
69856          return _typeof2(value) == 'symbol' || isObjectLike(value) && objectToString.call(value) == symbolTag;
69857        }
69858        /**
69859         * Checks if `value` is classified as a typed array.
69860         *
69861         * @static
69862         * @memberOf _
69863         * @since 3.0.0
69864         * @category Lang
69865         * @param {*} value The value to check.
69866         * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
69867         * @example
69868         *
69869         * _.isTypedArray(new Uint8Array);
69870         * // => true
69871         *
69872         * _.isTypedArray([]);
69873         * // => false
69874         */
69875
69876
69877        var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
69878        /**
69879         * Converts `value` to a string. An empty string is returned for `null`
69880         * and `undefined` values. The sign of `-0` is preserved.
69881         *
69882         * @static
69883         * @memberOf _
69884         * @since 4.0.0
69885         * @category Lang
69886         * @param {*} value The value to process.
69887         * @returns {string} Returns the string.
69888         * @example
69889         *
69890         * _.toString(null);
69891         * // => ''
69892         *
69893         * _.toString(-0);
69894         * // => '-0'
69895         *
69896         * _.toString([1, 2, 3]);
69897         * // => '1,2,3'
69898         */
69899
69900        function toString(value) {
69901          return value == null ? '' : baseToString(value);
69902        }
69903        /**
69904         * Gets the value at `path` of `object`. If the resolved value is
69905         * `undefined`, the `defaultValue` is returned in its place.
69906         *
69907         * @static
69908         * @memberOf _
69909         * @since 3.7.0
69910         * @category Object
69911         * @param {Object} object The object to query.
69912         * @param {Array|string} path The path of the property to get.
69913         * @param {*} [defaultValue] The value returned for `undefined` resolved values.
69914         * @returns {*} Returns the resolved value.
69915         * @example
69916         *
69917         * var object = { 'a': [{ 'b': { 'c': 3 } }] };
69918         *
69919         * _.get(object, 'a[0].b.c');
69920         * // => 3
69921         *
69922         * _.get(object, ['a', '0', 'b', 'c']);
69923         * // => 3
69924         *
69925         * _.get(object, 'a.b.c', 'default');
69926         * // => 'default'
69927         */
69928
69929
69930        function get(object, path, defaultValue) {
69931          var result = object == null ? undefined : baseGet(object, path);
69932          return result === undefined ? defaultValue : result;
69933        }
69934        /**
69935         * Checks if `path` is a direct or inherited property of `object`.
69936         *
69937         * @static
69938         * @memberOf _
69939         * @since 4.0.0
69940         * @category Object
69941         * @param {Object} object The object to query.
69942         * @param {Array|string} path The path to check.
69943         * @returns {boolean} Returns `true` if `path` exists, else `false`.
69944         * @example
69945         *
69946         * var object = _.create({ 'a': _.create({ 'b': 2 }) });
69947         *
69948         * _.hasIn(object, 'a');
69949         * // => true
69950         *
69951         * _.hasIn(object, 'a.b');
69952         * // => true
69953         *
69954         * _.hasIn(object, ['a', 'b']);
69955         * // => true
69956         *
69957         * _.hasIn(object, 'b');
69958         * // => false
69959         */
69960
69961
69962        function hasIn(object, path) {
69963          return object != null && hasPath(object, path, baseHasIn);
69964        }
69965        /**
69966         * Creates an array of the own enumerable property names of `object`.
69967         *
69968         * **Note:** Non-object values are coerced to objects. See the
69969         * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
69970         * for more details.
69971         *
69972         * @static
69973         * @since 0.1.0
69974         * @memberOf _
69975         * @category Object
69976         * @param {Object} object The object to query.
69977         * @returns {Array} Returns the array of property names.
69978         * @example
69979         *
69980         * function Foo() {
69981         *   this.a = 1;
69982         *   this.b = 2;
69983         * }
69984         *
69985         * Foo.prototype.c = 3;
69986         *
69987         * _.keys(new Foo);
69988         * // => ['a', 'b'] (iteration order is not guaranteed)
69989         *
69990         * _.keys('hi');
69991         * // => ['0', '1']
69992         */
69993
69994
69995        function keys(object) {
69996          return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
69997        }
69998        /**
69999         * This method returns the first argument it receives.
70000         *
70001         * @static
70002         * @since 0.1.0
70003         * @memberOf _
70004         * @category Util
70005         * @param {*} value Any value.
70006         * @returns {*} Returns `value`.
70007         * @example
70008         *
70009         * var object = { 'a': 1 };
70010         *
70011         * console.log(_.identity(object) === object);
70012         * // => true
70013         */
70014
70015
70016        function identity(value) {
70017          return value;
70018        }
70019        /**
70020         * Creates a function that returns the value at `path` of a given object.
70021         *
70022         * @static
70023         * @memberOf _
70024         * @since 2.4.0
70025         * @category Util
70026         * @param {Array|string} path The path of the property to get.
70027         * @returns {Function} Returns the new accessor function.
70028         * @example
70029         *
70030         * var objects = [
70031         *   { 'a': { 'b': 2 } },
70032         *   { 'a': { 'b': 1 } }
70033         * ];
70034         *
70035         * _.map(objects, _.property('a.b'));
70036         * // => [2, 1]
70037         *
70038         * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
70039         * // => [1, 2]
70040         */
70041
70042
70043        function property(path) {
70044          return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
70045        }
70046
70047        module.exports = groupBy;
70048      }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
70049    }, {}],
70050    405: [function (require, module, exports) {
70051      /**
70052       * lodash 3.0.3 (Custom Build) <https://lodash.com/>
70053       * Build: `lodash modularize exports="npm" -o ./`
70054       * Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>
70055       * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
70056       * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
70057       * Available under MIT license <https://lodash.com/license>
70058       */
70059
70060      /** `Object#toString` result references. */
70061      var boolTag = '[object Boolean]';
70062      /** Used for built-in method references. */
70063
70064      var objectProto = Object.prototype;
70065      /**
70066       * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
70067       * of values.
70068       */
70069
70070      var objectToString = objectProto.toString;
70071      /**
70072       * Checks if `value` is classified as a boolean primitive or object.
70073       *
70074       * @static
70075       * @memberOf _
70076       * @category Lang
70077       * @param {*} value The value to check.
70078       * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
70079       * @example
70080       *
70081       * _.isBoolean(false);
70082       * // => true
70083       *
70084       * _.isBoolean(null);
70085       * // => false
70086       */
70087
70088      function isBoolean(value) {
70089        return value === true || value === false || isObjectLike(value) && objectToString.call(value) == boolTag;
70090      }
70091      /**
70092       * Checks if `value` is object-like. A value is object-like if it's not `null`
70093       * and has a `typeof` result of "object".
70094       *
70095       * @static
70096       * @memberOf _
70097       * @category Lang
70098       * @param {*} value The value to check.
70099       * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
70100       * @example
70101       *
70102       * _.isObjectLike({});
70103       * // => true
70104       *
70105       * _.isObjectLike([1, 2, 3]);
70106       * // => true
70107       *
70108       * _.isObjectLike(_.noop);
70109       * // => false
70110       *
70111       * _.isObjectLike(null);
70112       * // => false
70113       */
70114
70115
70116      function isObjectLike(value) {
70117        return !!value && _typeof2(value) == 'object';
70118      }
70119
70120      module.exports = isBoolean;
70121    }, {}],
70122    406: [function (require, module, exports) {
70123      (function (global) {
70124        /**
70125         * Lodash (Custom Build) <https://lodash.com/>
70126         * Build: `lodash modularize exports="npm" -o ./`
70127         * Copyright JS Foundation and other contributors <https://js.foundation/>
70128         * Released under MIT license <https://lodash.com/license>
70129         * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
70130         * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
70131         */
70132
70133        /** Used as the size to enable large array optimizations. */
70134        var LARGE_ARRAY_SIZE = 200;
70135        /** Used to stand-in for `undefined` hash values. */
70136
70137        var HASH_UNDEFINED = '__lodash_hash_undefined__';
70138        /** Used to compose bitmasks for value comparisons. */
70139
70140        var COMPARE_PARTIAL_FLAG = 1,
70141            COMPARE_UNORDERED_FLAG = 2;
70142        /** Used as references for various `Number` constants. */
70143
70144        var MAX_SAFE_INTEGER = 9007199254740991;
70145        /** `Object#toString` result references. */
70146
70147        var argsTag = '[object Arguments]',
70148            arrayTag = '[object Array]',
70149            asyncTag = '[object AsyncFunction]',
70150            boolTag = '[object Boolean]',
70151            dateTag = '[object Date]',
70152            errorTag = '[object Error]',
70153            funcTag = '[object Function]',
70154            genTag = '[object GeneratorFunction]',
70155            mapTag = '[object Map]',
70156            numberTag = '[object Number]',
70157            nullTag = '[object Null]',
70158            objectTag = '[object Object]',
70159            promiseTag = '[object Promise]',
70160            proxyTag = '[object Proxy]',
70161            regexpTag = '[object RegExp]',
70162            setTag = '[object Set]',
70163            stringTag = '[object String]',
70164            symbolTag = '[object Symbol]',
70165            undefinedTag = '[object Undefined]',
70166            weakMapTag = '[object WeakMap]';
70167        var arrayBufferTag = '[object ArrayBuffer]',
70168            dataViewTag = '[object DataView]',
70169            float32Tag = '[object Float32Array]',
70170            float64Tag = '[object Float64Array]',
70171            int8Tag = '[object Int8Array]',
70172            int16Tag = '[object Int16Array]',
70173            int32Tag = '[object Int32Array]',
70174            uint8Tag = '[object Uint8Array]',
70175            uint8ClampedTag = '[object Uint8ClampedArray]',
70176            uint16Tag = '[object Uint16Array]',
70177            uint32Tag = '[object Uint32Array]';
70178        /**
70179         * Used to match `RegExp`
70180         * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
70181         */
70182
70183        var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
70184        /** Used to detect host constructors (Safari). */
70185
70186        var reIsHostCtor = /^\[object .+?Constructor\]$/;
70187        /** Used to detect unsigned integer values. */
70188
70189        var reIsUint = /^(?:0|[1-9]\d*)$/;
70190        /** Used to identify `toStringTag` values of typed arrays. */
70191
70192        var typedArrayTags = {};
70193        typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
70194        typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
70195        /** Detect free variable `global` from Node.js. */
70196
70197        var freeGlobal = _typeof2(global) == 'object' && global && global.Object === Object && global;
70198        /** Detect free variable `self`. */
70199
70200        var freeSelf = (typeof self === "undefined" ? "undefined" : _typeof2(self)) == 'object' && self && self.Object === Object && self;
70201        /** Used as a reference to the global object. */
70202
70203        var root = freeGlobal || freeSelf || Function('return this')();
70204        /** Detect free variable `exports`. */
70205
70206        var freeExports = _typeof2(exports) == 'object' && exports && !exports.nodeType && exports;
70207        /** Detect free variable `module`. */
70208
70209        var freeModule = freeExports && _typeof2(module) == 'object' && module && !module.nodeType && module;
70210        /** Detect the popular CommonJS extension `module.exports`. */
70211
70212        var moduleExports = freeModule && freeModule.exports === freeExports;
70213        /** Detect free variable `process` from Node.js. */
70214
70215        var freeProcess = moduleExports && freeGlobal.process;
70216        /** Used to access faster Node.js helpers. */
70217
70218        var nodeUtil = function () {
70219          try {
70220            return freeProcess && freeProcess.binding && freeProcess.binding('util');
70221          } catch (e) {}
70222        }();
70223        /* Node.js helper references. */
70224
70225
70226        var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
70227        /**
70228         * A specialized version of `_.filter` for arrays without support for
70229         * iteratee shorthands.
70230         *
70231         * @private
70232         * @param {Array} [array] The array to iterate over.
70233         * @param {Function} predicate The function invoked per iteration.
70234         * @returns {Array} Returns the new filtered array.
70235         */
70236
70237        function arrayFilter(array, predicate) {
70238          var index = -1,
70239              length = array == null ? 0 : array.length,
70240              resIndex = 0,
70241              result = [];
70242
70243          while (++index < length) {
70244            var value = array[index];
70245
70246            if (predicate(value, index, array)) {
70247              result[resIndex++] = value;
70248            }
70249          }
70250
70251          return result;
70252        }
70253        /**
70254         * Appends the elements of `values` to `array`.
70255         *
70256         * @private
70257         * @param {Array} array The array to modify.
70258         * @param {Array} values The values to append.
70259         * @returns {Array} Returns `array`.
70260         */
70261
70262
70263        function arrayPush(array, values) {
70264          var index = -1,
70265              length = values.length,
70266              offset = array.length;
70267
70268          while (++index < length) {
70269            array[offset + index] = values[index];
70270          }
70271
70272          return array;
70273        }
70274        /**
70275         * A specialized version of `_.some` for arrays without support for iteratee
70276         * shorthands.
70277         *
70278         * @private
70279         * @param {Array} [array] The array to iterate over.
70280         * @param {Function} predicate The function invoked per iteration.
70281         * @returns {boolean} Returns `true` if any element passes the predicate check,
70282         *  else `false`.
70283         */
70284
70285
70286        function arraySome(array, predicate) {
70287          var index = -1,
70288              length = array == null ? 0 : array.length;
70289
70290          while (++index < length) {
70291            if (predicate(array[index], index, array)) {
70292              return true;
70293            }
70294          }
70295
70296          return false;
vendor: 50,012 bytes, lines 70297-71851
70297        }
70298        /**
70299         * The base implementation of `_.times` without support for iteratee shorthands
70300         * or max array length checks.
70301         *
70302         * @private
70303         * @param {number} n The number of times to invoke `iteratee`.
70304         * @param {Function} iteratee The function invoked per iteration.
70305         * @returns {Array} Returns the array of results.
70306         */
70307
70308
70309        function baseTimes(n, iteratee) {
70310          var index = -1,
70311              result = Array(n);
70312
70313          while (++index < n) {
70314            result[index] = iteratee(index);
70315          }
70316
70317          return result;
70318        }
70319        /**
70320         * The base implementation of `_.unary` without support for storing metadata.
70321         *
70322         * @private
70323         * @param {Function} func The function to cap arguments for.
70324         * @returns {Function} Returns the new capped function.
70325         */
70326
70327
70328        function baseUnary(func) {
70329          return function (value) {
70330            return func(value);
70331          };
70332        }
70333        /**
70334         * Checks if a `cache` value for `key` exists.
70335         *
70336         * @private
70337         * @param {Object} cache The cache to query.
70338         * @param {string} key The key of the entry to check.
70339         * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
70340         */
70341
70342
70343        function cacheHas(cache, key) {
70344          return cache.has(key);
70345        }
70346        /**
70347         * Gets the value at `key` of `object`.
70348         *
70349         * @private
70350         * @param {Object} [object] The object to query.
70351         * @param {string} key The key of the property to get.
70352         * @returns {*} Returns the property value.
70353         */
70354
70355
70356        function getValue(object, key) {
70357          return object == null ? undefined : object[key];
70358        }
70359        /**
70360         * Converts `map` to its key-value pairs.
70361         *
70362         * @private
70363         * @param {Object} map The map to convert.
70364         * @returns {Array} Returns the key-value pairs.
70365         */
70366
70367
70368        function mapToArray(map) {
70369          var index = -1,
70370              result = Array(map.size);
70371          map.forEach(function (value, key) {
70372            result[++index] = [key, value];
70373          });
70374          return result;
70375        }
70376        /**
70377         * Creates a unary function that invokes `func` with its argument transformed.
70378         *
70379         * @private
70380         * @param {Function} func The function to wrap.
70381         * @param {Function} transform The argument transform.
70382         * @returns {Function} Returns the new function.
70383         */
70384
70385
70386        function overArg(func, transform) {
70387          return function (arg) {
70388            return func(transform(arg));
70389          };
70390        }
70391        /**
70392         * Converts `set` to an array of its values.
70393         *
70394         * @private
70395         * @param {Object} set The set to convert.
70396         * @returns {Array} Returns the values.
70397         */
70398
70399
70400        function setToArray(set) {
70401          var index = -1,
70402              result = Array(set.size);
70403          set.forEach(function (value) {
70404            result[++index] = value;
70405          });
70406          return result;
70407        }
70408        /** Used for built-in method references. */
70409
70410
70411        var arrayProto = Array.prototype,
70412            funcProto = Function.prototype,
70413            objectProto = Object.prototype;
70414        /** Used to detect overreaching core-js shims. */
70415
70416        var coreJsData = root['__core-js_shared__'];
70417        /** Used to resolve the decompiled source of functions. */
70418
70419        var funcToString = funcProto.toString;
70420        /** Used to check objects for own properties. */
70421
70422        var hasOwnProperty = objectProto.hasOwnProperty;
70423        /** Used to detect methods masquerading as native. */
70424
70425        var maskSrcKey = function () {
70426          var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
70427          return uid ? 'Symbol(src)_1.' + uid : '';
70428        }();
70429        /**
70430         * Used to resolve the
70431         * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
70432         * of values.
70433         */
70434
70435
70436        var nativeObjectToString = objectProto.toString;
70437        /** Used to detect if a method is native. */
70438
70439        var reIsNative = RegExp('^' + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&').replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$');
70440        /** Built-in value references. */
70441
70442        var Buffer = moduleExports ? root.Buffer : undefined,
70443            _Symbol6 = root.Symbol,
70444            Uint8Array = root.Uint8Array,
70445            propertyIsEnumerable = objectProto.propertyIsEnumerable,
70446            splice = arrayProto.splice,
70447            symToStringTag = _Symbol6 ? _Symbol6.toStringTag : undefined;
70448        /* Built-in method references for those with the same name as other `lodash` methods. */
70449
70450        var nativeGetSymbols = Object.getOwnPropertySymbols,
70451            nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
70452            nativeKeys = overArg(Object.keys, Object);
70453        /* Built-in method references that are verified to be native. */
70454
70455        var DataView = getNative(root, 'DataView'),
70456            Map = getNative(root, 'Map'),
70457            Promise = getNative(root, 'Promise'),
70458            Set = getNative(root, 'Set'),
70459            WeakMap = getNative(root, 'WeakMap'),
70460            nativeCreate = getNative(Object, 'create');
70461        /** Used to detect maps, sets, and weakmaps. */
70462
70463        var dataViewCtorString = toSource(DataView),
70464            mapCtorString = toSource(Map),
70465            promiseCtorString = toSource(Promise),
70466            setCtorString = toSource(Set),
70467            weakMapCtorString = toSource(WeakMap);
70468        /** Used to convert symbols to primitives and strings. */
70469
70470        var symbolProto = _Symbol6 ? _Symbol6.prototype : undefined,
70471            symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
70472        /**
70473         * Creates a hash object.
70474         *
70475         * @private
70476         * @constructor
70477         * @param {Array} [entries] The key-value pairs to cache.
70478         */
70479
70480        function Hash(entries) {
70481          var index = -1,
70482              length = entries == null ? 0 : entries.length;
70483          this.clear();
70484
70485          while (++index < length) {
70486            var entry = entries[index];
70487            this.set(entry[0], entry[1]);
70488          }
70489        }
70490        /**
70491         * Removes all key-value entries from the hash.
70492         *
70493         * @private
70494         * @name clear
70495         * @memberOf Hash
70496         */
70497
70498
70499        function hashClear() {
70500          this.__data__ = nativeCreate ? nativeCreate(null) : {};
70501          this.size = 0;
70502        }
70503        /**
70504         * Removes `key` and its value from the hash.
70505         *
70506         * @private
70507         * @name delete
70508         * @memberOf Hash
70509         * @param {Object} hash The hash to modify.
70510         * @param {string} key The key of the value to remove.
70511         * @returns {boolean} Returns `true` if the entry was removed, else `false`.
70512         */
70513
70514
70515        function hashDelete(key) {
70516          var result = this.has(key) && delete this.__data__[key];
70517          this.size -= result ? 1 : 0;
70518          return result;
70519        }
70520        /**
70521         * Gets the hash value for `key`.
70522         *
70523         * @private
70524         * @name get
70525         * @memberOf Hash
70526         * @param {string} key The key of the value to get.
70527         * @returns {*} Returns the entry value.
70528         */
70529
70530
70531        function hashGet(key) {
70532          var data = this.__data__;
70533
70534          if (nativeCreate) {
70535            var result = data[key];
70536            return result === HASH_UNDEFINED ? undefined : result;
70537          }
70538
70539          return hasOwnProperty.call(data, key) ? data[key] : undefined;
70540        }
70541        /**
70542         * Checks if a hash value for `key` exists.
70543         *
70544         * @private
70545         * @name has
70546         * @memberOf Hash
70547         * @param {string} key The key of the entry to check.
70548         * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
70549         */
70550
70551
70552        function hashHas(key) {
70553          var data = this.__data__;
70554          return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
70555        }
70556        /**
70557         * Sets the hash `key` to `value`.
70558         *
70559         * @private
70560         * @name set
70561         * @memberOf Hash
70562         * @param {string} key The key of the value to set.
70563         * @param {*} value The value to set.
70564         * @returns {Object} Returns the hash instance.
70565         */
70566
70567
70568        function hashSet(key, value) {
70569          var data = this.__data__;
70570          this.size += this.has(key) ? 0 : 1;
70571          data[key] = nativeCreate && value === undefined ? HASH_UNDEFINED : value;
70572          return this;
70573        } // Add methods to `Hash`.
70574
70575
70576        Hash.prototype.clear = hashClear;
70577        Hash.prototype['delete'] = hashDelete;
70578        Hash.prototype.get = hashGet;
70579        Hash.prototype.has = hashHas;
70580        Hash.prototype.set = hashSet;
70581        /**
70582         * Creates an list cache object.
70583         *
70584         * @private
70585         * @constructor
70586         * @param {Array} [entries] The key-value pairs to cache.
70587         */
70588
70589        function ListCache(entries) {
70590          var index = -1,
70591              length = entries == null ? 0 : entries.length;
70592          this.clear();
70593
70594          while (++index < length) {
70595            var entry = entries[index];
70596            this.set(entry[0], entry[1]);
70597          }
70598        }
70599        /**
70600         * Removes all key-value entries from the list cache.
70601         *
70602         * @private
70603         * @name clear
70604         * @memberOf ListCache
70605         */
70606
70607
70608        function listCacheClear() {
70609          this.__data__ = [];
70610          this.size = 0;
70611        }
70612        /**
70613         * Removes `key` and its value from the list cache.
70614         *
70615         * @private
70616         * @name delete
70617         * @memberOf ListCache
70618         * @param {string} key The key of the value to remove.
70619         * @returns {boolean} Returns `true` if the entry was removed, else `false`.
70620         */
70621
70622
70623        function listCacheDelete(key) {
70624          var data = this.__data__,
70625              index = assocIndexOf(data, key);
70626
70627          if (index < 0) {
70628            return false;
70629          }
70630
70631          var lastIndex = data.length - 1;
70632
70633          if (index == lastIndex) {
70634            data.pop();
70635          } else {
70636            splice.call(data, index, 1);
70637          }
70638
70639          --this.size;
70640          return true;
70641        }
70642        /**
70643         * Gets the list cache value for `key`.
70644         *
70645         * @private
70646         * @name get
70647         * @memberOf ListCache
70648         * @param {string} key The key of the value to get.
70649         * @returns {*} Returns the entry value.
70650         */
70651
70652
70653        function listCacheGet(key) {
70654          var data = this.__data__,
70655              index = assocIndexOf(data, key);
70656          return index < 0 ? undefined : data[index][1];
70657        }
70658        /**
70659         * Checks if a list cache value for `key` exists.
70660         *
70661         * @private
70662         * @name has
70663         * @memberOf ListCache
70664         * @param {string} key The key of the entry to check.
70665         * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
70666         */
70667
70668
70669        function listCacheHas(key) {
70670          return assocIndexOf(this.__data__, key) > -1;
70671        }
70672        /**
70673         * Sets the list cache `key` to `value`.
70674         *
70675         * @private
70676         * @name set
70677         * @memberOf ListCache
70678         * @param {string} key The key of the value to set.
70679         * @param {*} value The value to set.
70680         * @returns {Object} Returns the list cache instance.
70681         */
70682
70683
70684        function listCacheSet(key, value) {
70685          var data = this.__data__,
70686              index = assocIndexOf(data, key);
70687
70688          if (index < 0) {
70689            ++this.size;
70690            data.push([key, value]);
70691          } else {
70692            data[index][1] = value;
70693          }
70694
70695          return this;
70696        } // Add methods to `ListCache`.
70697
70698
70699        ListCache.prototype.clear = listCacheClear;
70700        ListCache.prototype['delete'] = listCacheDelete;
70701        ListCache.prototype.get = listCacheGet;
70702        ListCache.prototype.has = listCacheHas;
70703        ListCache.prototype.set = listCacheSet;
70704        /**
70705         * Creates a map cache object to store key-value pairs.
70706         *
70707         * @private
70708         * @constructor
70709         * @param {Array} [entries] The key-value pairs to cache.
70710         */
70711
70712        function MapCache(entries) {
70713          var index = -1,
70714              length = entries == null ? 0 : entries.length;
70715          this.clear();
70716
70717          while (++index < length) {
70718            var entry = entries[index];
70719            this.set(entry[0], entry[1]);
70720          }
70721        }
70722        /**
70723         * Removes all key-value entries from the map.
70724         *
70725         * @private
70726         * @name clear
70727         * @memberOf MapCache
70728         */
70729
70730
70731        function mapCacheClear() {
70732          this.size = 0;
70733          this.__data__ = {
70734            'hash': new Hash(),
70735            'map': new (Map || ListCache)(),
70736            'string': new Hash()
70737          };
70738        }
70739        /**
70740         * Removes `key` and its value from the map.
70741         *
70742         * @private
70743         * @name delete
70744         * @memberOf MapCache
70745         * @param {string} key The key of the value to remove.
70746         * @returns {boolean} Returns `true` if the entry was removed, else `false`.
70747         */
70748
70749
70750        function mapCacheDelete(key) {
70751          var result = getMapData(this, key)['delete'](key);
70752          this.size -= result ? 1 : 0;
70753          return result;
70754        }
70755        /**
70756         * Gets the map value for `key`.
70757         *
70758         * @private
70759         * @name get
70760         * @memberOf MapCache
70761         * @param {string} key The key of the value to get.
70762         * @returns {*} Returns the entry value.
70763         */
70764
70765
70766        function mapCacheGet(key) {
70767          return getMapData(this, key).get(key);
70768        }
70769        /**
70770         * Checks if a map value for `key` exists.
70771         *
70772         * @private
70773         * @name has
70774         * @memberOf MapCache
70775         * @param {string} key The key of the entry to check.
70776         * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
70777         */
70778
70779
70780        function mapCacheHas(key) {
70781          return getMapData(this, key).has(key);
70782        }
70783        /**
70784         * Sets the map `key` to `value`.
70785         *
70786         * @private
70787         * @name set
70788         * @memberOf MapCache
70789         * @param {string} key The key of the value to set.
70790         * @param {*} value The value to set.
70791         * @returns {Object} Returns the map cache instance.
70792         */
70793
70794
70795        function mapCacheSet(key, value) {
70796          var data = getMapData(this, key),
70797              size = data.size;
70798          data.set(key, value);
70799          this.size += data.size == size ? 0 : 1;
70800          return this;
70801        } // Add methods to `MapCache`.
70802
70803
70804        MapCache.prototype.clear = mapCacheClear;
70805        MapCache.prototype['delete'] = mapCacheDelete;
70806        MapCache.prototype.get = mapCacheGet;
70807        MapCache.prototype.has = mapCacheHas;
70808        MapCache.prototype.set = mapCacheSet;
70809        /**
70810         *
70811         * Creates an array cache object to store unique values.
70812         *
70813         * @private
70814         * @constructor
70815         * @param {Array} [values] The values to cache.
70816         */
70817
70818        function SetCache(values) {
70819          var index = -1,
70820              length = values == null ? 0 : values.length;
70821          this.__data__ = new MapCache();
70822
70823          while (++index < length) {
70824            this.add(values[index]);
70825          }
70826        }
70827        /**
70828         * Adds `value` to the array cache.
70829         *
70830         * @private
70831         * @name add
70832         * @memberOf SetCache
70833         * @alias push
70834         * @param {*} value The value to cache.
70835         * @returns {Object} Returns the cache instance.
70836         */
70837
70838
70839        function setCacheAdd(value) {
70840          this.__data__.set(value, HASH_UNDEFINED);
70841
70842          return this;
70843        }
70844        /**
70845         * Checks if `value` is in the array cache.
70846         *
70847         * @private
70848         * @name has
70849         * @memberOf SetCache
70850         * @param {*} value The value to search for.
70851         * @returns {number} Returns `true` if `value` is found, else `false`.
70852         */
70853
70854
70855        function setCacheHas(value) {
70856          return this.__data__.has(value);
70857        } // Add methods to `SetCache`.
70858
70859
70860        SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
70861        SetCache.prototype.has = setCacheHas;
70862        /**
70863         * Creates a stack cache object to store key-value pairs.
70864         *
70865         * @private
70866         * @constructor
70867         * @param {Array} [entries] The key-value pairs to cache.
70868         */
70869
70870        function Stack(entries) {
70871          var data = this.__data__ = new ListCache(entries);
70872          this.size = data.size;
70873        }
70874        /**
70875         * Removes all key-value entries from the stack.
70876         *
70877         * @private
70878         * @name clear
70879         * @memberOf Stack
70880         */
70881
70882
70883        function stackClear() {
70884          this.__data__ = new ListCache();
70885          this.size = 0;
70886        }
70887        /**
70888         * Removes `key` and its value from the stack.
70889         *
70890         * @private
70891         * @name delete
70892         * @memberOf Stack
70893         * @param {string} key The key of the value to remove.
70894         * @returns {boolean} Returns `true` if the entry was removed, else `false`.
70895         */
70896
70897
70898        function stackDelete(key) {
70899          var data = this.__data__,
70900              result = data['delete'](key);
70901          this.size = data.size;
70902          return result;
70903        }
70904        /**
70905         * Gets the stack value for `key`.
70906         *
70907         * @private
70908         * @name get
70909         * @memberOf Stack
70910         * @param {string} key The key of the value to get.
70911         * @returns {*} Returns the entry value.
70912         */
70913
70914
70915        function stackGet(key) {
70916          return this.__data__.get(key);
70917        }
70918        /**
70919         * Checks if a stack value for `key` exists.
70920         *
70921         * @private
70922         * @name has
70923         * @memberOf Stack
70924         * @param {string} key The key of the entry to check.
70925         * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
70926         */
70927
70928
70929        function stackHas(key) {
70930          return this.__data__.has(key);
70931        }
70932        /**
70933         * Sets the stack `key` to `value`.
70934         *
70935         * @private
70936         * @name set
70937         * @memberOf Stack
70938         * @param {string} key The key of the value to set.
70939         * @param {*} value The value to set.
70940         * @returns {Object} Returns the stack cache instance.
70941         */
70942
70943
70944        function stackSet(key, value) {
70945          var data = this.__data__;
70946
70947          if (data instanceof ListCache) {
70948            var pairs = data.__data__;
70949
70950            if (!Map || pairs.length < LARGE_ARRAY_SIZE - 1) {
70951              pairs.push([key, value]);
70952              this.size = ++data.size;
70953              return this;
70954            }
70955
70956            data = this.__data__ = new MapCache(pairs);
70957          }
70958
70959          data.set(key, value);
70960          this.size = data.size;
70961          return this;
70962        } // Add methods to `Stack`.
70963
70964
70965        Stack.prototype.clear = stackClear;
70966        Stack.prototype['delete'] = stackDelete;
70967        Stack.prototype.get = stackGet;
70968        Stack.prototype.has = stackHas;
70969        Stack.prototype.set = stackSet;
70970        /**
70971         * Creates an array of the enumerable property names of the array-like `value`.
70972         *
70973         * @private
70974         * @param {*} value The value to query.
70975         * @param {boolean} inherited Specify returning inherited property names.
70976         * @returns {Array} Returns the array of property names.
70977         */
70978
70979        function arrayLikeKeys(value, inherited) {
70980          var isArr = isArray(value),
70981              isArg = !isArr && isArguments(value),
70982              isBuff = !isArr && !isArg && isBuffer(value),
70983              isType = !isArr && !isArg && !isBuff && isTypedArray(value),
70984              skipIndexes = isArr || isArg || isBuff || isType,
70985              result = skipIndexes ? baseTimes(value.length, String) : [],
70986              length = result.length;
70987
70988          for (var key in value) {
70989            if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && ( // Safari 9 has enumerable `arguments.length` in strict mode.
70990            key == 'length' || // Node.js 0.10 has enumerable non-index properties on buffers.
70991            isBuff && (key == 'offset' || key == 'parent') || // PhantomJS 2 has enumerable non-index properties on typed arrays.
70992            isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset') || // Skip index properties.
70993            isIndex(key, length)))) {
70994              result.push(key);
70995            }
70996          }
70997
70998          return result;
70999        }
71000        /**
71001         * Gets the index at which the `key` is found in `array` of key-value pairs.
71002         *
71003         * @private
71004         * @param {Array} array The array to inspect.
71005         * @param {*} key The key to search for.
71006         * @returns {number} Returns the index of the matched value, else `-1`.
71007         */
71008
71009
71010        function assocIndexOf(array, key) {
71011          var length = array.length;
71012
71013          while (length--) {
71014            if (eq(array[length][0], key)) {
71015              return length;
71016            }
71017          }
71018
71019          return -1;
71020        }
71021        /**
71022         * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
71023         * `keysFunc` and `symbolsFunc` to get the enumerable property names and
71024         * symbols of `object`.
71025         *
71026         * @private
71027         * @param {Object} object The object to query.
71028         * @param {Function} keysFunc The function to get the keys of `object`.
71029         * @param {Function} symbolsFunc The function to get the symbols of `object`.
71030         * @returns {Array} Returns the array of property names and symbols.
71031         */
71032
71033
71034        function baseGetAllKeys(object, keysFunc, symbolsFunc) {
71035          var result = keysFunc(object);
71036          return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
71037        }
71038        /**
71039         * The base implementation of `getTag` without fallbacks for buggy environments.
71040         *
71041         * @private
71042         * @param {*} value The value to query.
71043         * @returns {string} Returns the `toStringTag`.
71044         */
71045
71046
71047        function baseGetTag(value) {
71048          if (value == null) {
71049            return value === undefined ? undefinedTag : nullTag;
71050          }
71051
71052          return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
71053        }
71054        /**
71055         * The base implementation of `_.isArguments`.
71056         *
71057         * @private
71058         * @param {*} value The value to check.
71059         * @returns {boolean} Returns `true` if `value` is an `arguments` object,
71060         */
71061
71062
71063        function baseIsArguments(value) {
71064          return isObjectLike(value) && baseGetTag(value) == argsTag;
71065        }
71066        /**
71067         * The base implementation of `_.isEqual` which supports partial comparisons
71068         * and tracks traversed objects.
71069         *
71070         * @private
71071         * @param {*} value The value to compare.
71072         * @param {*} other The other value to compare.
71073         * @param {boolean} bitmask The bitmask flags.
71074         *  1 - Unordered comparison
71075         *  2 - Partial comparison
71076         * @param {Function} [customizer] The function to customize comparisons.
71077         * @param {Object} [stack] Tracks traversed `value` and `other` objects.
71078         * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
71079         */
71080
71081
71082        function baseIsEqual(value, other, bitmask, customizer, stack) {
71083          if (value === other) {
71084            return true;
71085          }
71086
71087          if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
71088            return value !== value && other !== other;
71089          }
71090
71091          return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
71092        }
71093        /**
71094         * A specialized version of `baseIsEqual` for arrays and objects which performs
71095         * deep comparisons and tracks traversed objects enabling objects with circular
71096         * references to be compared.
71097         *
71098         * @private
71099         * @param {Object} object The object to compare.
71100         * @param {Object} other The other object to compare.
71101         * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
71102         * @param {Function} customizer The function to customize comparisons.
71103         * @param {Function} equalFunc The function to determine equivalents of values.
71104         * @param {Object} [stack] Tracks traversed `object` and `other` objects.
71105         * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
71106         */
71107
71108
71109        function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
71110          var objIsArr = isArray(object),
71111              othIsArr = isArray(other),
71112              objTag = objIsArr ? arrayTag : getTag(object),
71113              othTag = othIsArr ? arrayTag : getTag(other);
71114          objTag = objTag == argsTag ? objectTag : objTag;
71115          othTag = othTag == argsTag ? objectTag : othTag;
71116          var objIsObj = objTag == objectTag,
71117              othIsObj = othTag == objectTag,
71118              isSameTag = objTag == othTag;
71119
71120          if (isSameTag && isBuffer(object)) {
71121            if (!isBuffer(other)) {
71122              return false;
71123            }
71124
71125            objIsArr = true;
71126            objIsObj = false;
71127          }
71128
71129          if (isSameTag && !objIsObj) {
71130            stack || (stack = new Stack());
71131            return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
71132          }
71133
71134          if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
71135            var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
71136                othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
71137
71138            if (objIsWrapped || othIsWrapped) {
71139              var objUnwrapped = objIsWrapped ? object.value() : object,
71140                  othUnwrapped = othIsWrapped ? other.value() : other;
71141              stack || (stack = new Stack());
71142              return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
71143            }
71144          }
71145
71146          if (!isSameTag) {
71147            return false;
71148          }
71149
71150          stack || (stack = new Stack());
71151          return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
71152        }
71153        /**
71154         * The base implementation of `_.isNative` without bad shim checks.
71155         *
71156         * @private
71157         * @param {*} value The value to check.
71158         * @returns {boolean} Returns `true` if `value` is a native function,
71159         *  else `false`.
71160         */
71161
71162
71163        function baseIsNative(value) {
71164          if (!isObject(value) || isMasked(value)) {
71165            return false;
71166          }
71167
71168          var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
71169          return pattern.test(toSource(value));
71170        }
71171        /**
71172         * The base implementation of `_.isTypedArray` without Node.js optimizations.
71173         *
71174         * @private
71175         * @param {*} value The value to check.
71176         * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
71177         */
71178
71179
71180        function baseIsTypedArray(value) {
71181          return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
71182        }
71183        /**
71184         * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
71185         *
71186         * @private
71187         * @param {Object} object The object to query.
71188         * @returns {Array} Returns the array of property names.
71189         */
71190
71191
71192        function baseKeys(object) {
71193          if (!isPrototype(object)) {
71194            return nativeKeys(object);
71195          }
71196
71197          var result = [];
71198
71199          for (var key in Object(object)) {
71200            if (hasOwnProperty.call(object, key) && key != 'constructor') {
71201              result.push(key);
71202            }
71203          }
71204
71205          return result;
71206        }
71207        /**
71208         * A specialized version of `baseIsEqualDeep` for arrays with support for
71209         * partial deep comparisons.
71210         *
71211         * @private
71212         * @param {Array} array The array to compare.
71213         * @param {Array} other The other array to compare.
71214         * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
71215         * @param {Function} customizer The function to customize comparisons.
71216         * @param {Function} equalFunc The function to determine equivalents of values.
71217         * @param {Object} stack Tracks traversed `array` and `other` objects.
71218         * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
71219         */
71220
71221
71222        function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
71223          var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
71224              arrLength = array.length,
71225              othLength = other.length;
71226
71227          if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
71228            return false;
71229          } // Assume cyclic values are equal.
71230
71231
71232          var stacked = stack.get(array);
71233
71234          if (stacked && stack.get(other)) {
71235            return stacked == other;
71236          }
71237
71238          var index = -1,
71239              result = true,
71240              seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache() : undefined;
71241          stack.set(array, other);
71242          stack.set(other, array); // Ignore non-index properties.
71243
71244          while (++index < arrLength) {
71245            var arrValue = array[index],
71246                othValue = other[index];
71247
71248            if (customizer) {
71249              var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
71250            }
71251
71252            if (compared !== undefined) {
71253              if (compared) {
71254                continue;
71255              }
71256
71257              result = false;
71258              break;
71259            } // Recursively compare arrays (susceptible to call stack limits).
71260
71261
71262            if (seen) {
71263              if (!arraySome(other, function (othValue, othIndex) {
71264                if (!cacheHas(seen, othIndex) && (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
71265                  return seen.push(othIndex);
71266                }
71267              })) {
71268                result = false;
71269                break;
71270              }
71271            } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
71272              result = false;
71273              break;
71274            }
71275          }
71276
71277          stack['delete'](array);
71278          stack['delete'](other);
71279          return result;
71280        }
71281        /**
71282         * A specialized version of `baseIsEqualDeep` for comparing objects of
71283         * the same `toStringTag`.
71284         *
71285         * **Note:** This function only supports comparing values with tags of
71286         * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
71287         *
71288         * @private
71289         * @param {Object} object The object to compare.
71290         * @param {Object} other The other object to compare.
71291         * @param {string} tag The `toStringTag` of the objects to compare.
71292         * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
71293         * @param {Function} customizer The function to customize comparisons.
71294         * @param {Function} equalFunc The function to determine equivalents of values.
71295         * @param {Object} stack Tracks traversed `object` and `other` objects.
71296         * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
71297         */
71298
71299
71300        function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
71301          switch (tag) {
71302            case dataViewTag:
71303              if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
71304                return false;
71305              }
71306
71307              object = object.buffer;
71308              other = other.buffer;
71309
71310            case arrayBufferTag:
71311              if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
71312                return false;
71313              }
71314
71315              return true;
71316
71317            case boolTag:
71318            case dateTag:
71319            case numberTag:
71320              // Coerce booleans to `1` or `0` and dates to milliseconds.
71321              // Invalid dates are coerced to `NaN`.
71322              return eq(+object, +other);
71323
71324            case errorTag:
71325              return object.name == other.name && object.message == other.message;
71326
71327            case regexpTag:
71328            case stringTag:
71329              // Coerce regexes to strings and treat strings, primitives and objects,
71330              // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
71331              // for more details.
71332              return object == other + '';
71333
71334            case mapTag:
71335              var convert = mapToArray;
71336
71337            case setTag:
71338              var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
71339              convert || (convert = setToArray);
71340
71341              if (object.size != other.size && !isPartial) {
71342                return false;
71343              } // Assume cyclic values are equal.
71344
71345
71346              var stacked = stack.get(object);
71347
71348              if (stacked) {
71349                return stacked == other;
71350              }
71351
71352              bitmask |= COMPARE_UNORDERED_FLAG; // Recursively compare objects (susceptible to call stack limits).
71353
71354              stack.set(object, other);
71355              var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
71356              stack['delete'](object);
71357              return result;
71358
71359            case symbolTag:
71360              if (symbolValueOf) {
71361                return symbolValueOf.call(object) == symbolValueOf.call(other);
71362              }
71363
71364          }
71365
71366          return false;
71367        }
71368        /**
71369         * A specialized version of `baseIsEqualDeep` for objects with support for
71370         * partial deep comparisons.
71371         *
71372         * @private
71373         * @param {Object} object The object to compare.
71374         * @param {Object} other The other object to compare.
71375         * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
71376         * @param {Function} customizer The function to customize comparisons.
71377         * @param {Function} equalFunc The function to determine equivalents of values.
71378         * @param {Object} stack Tracks traversed `object` and `other` objects.
71379         * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
71380         */
71381
71382
71383        function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
71384          var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
71385              objProps = getAllKeys(object),
71386              objLength = objProps.length,
71387              othProps = getAllKeys(other),
71388              othLength = othProps.length;
71389
71390          if (objLength != othLength && !isPartial) {
71391            return false;
71392          }
71393
71394          var index = objLength;
71395
71396          while (index--) {
71397            var key = objProps[index];
71398
71399            if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
71400              return false;
71401            }
71402          } // Assume cyclic values are equal.
71403
71404
71405          var stacked = stack.get(object);
71406
71407          if (stacked && stack.get(other)) {
71408            return stacked == other;
71409          }
71410
71411          var result = true;
71412          stack.set(object, other);
71413          stack.set(other, object);
71414          var skipCtor = isPartial;
71415
71416          while (++index < objLength) {
71417            key = objProps[index];
71418            var objValue = object[key],
71419                othValue = other[key];
71420
71421            if (customizer) {
71422              var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
71423            } // Recursively compare objects (susceptible to call stack limits).
71424
71425
71426            if (!(compared === undefined ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
71427              result = false;
71428              break;
71429            }
71430
71431            skipCtor || (skipCtor = key == 'constructor');
71432          }
71433
71434          if (result && !skipCtor) {
71435            var objCtor = object.constructor,
71436                othCtor = other.constructor; // Non `Object` object instances with different constructors are not equal.
71437
71438            if (objCtor != othCtor && 'constructor' in object && 'constructor' in other && !(typeof objCtor == 'function' && objCtor instanceof objCtor && typeof othCtor == 'function' && othCtor instanceof othCtor)) {
71439              result = false;
71440            }
71441          }
71442
71443          stack['delete'](object);
71444          stack['delete'](other);
71445          return result;
71446        }
71447        /**
71448         * Creates an array of own enumerable property names and symbols of `object`.
71449         *
71450         * @private
71451         * @param {Object} object The object to query.
71452         * @returns {Array} Returns the array of property names and symbols.
71453         */
71454
71455
71456        function getAllKeys(object) {
71457          return baseGetAllKeys(object, keys, getSymbols);
71458        }
71459        /**
71460         * Gets the data for `map`.
71461         *
71462         * @private
71463         * @param {Object} map The map to query.
71464         * @param {string} key The reference key.
71465         * @returns {*} Returns the map data.
71466         */
71467
71468
71469        function getMapData(map, key) {
71470          var data = map.__data__;
71471          return isKeyable(key) ? data[typeof key == 'string' ? 'string' : 'hash'] : data.map;
71472        }
71473        /**
71474         * Gets the native function at `key` of `object`.
71475         *
71476         * @private
71477         * @param {Object} object The object to query.
71478         * @param {string} key The key of the method to get.
71479         * @returns {*} Returns the function if it's native, else `undefined`.
71480         */
71481
71482
71483        function getNative(object, key) {
71484          var value = getValue(object, key);
71485          return baseIsNative(value) ? value : undefined;
71486        }
71487        /**
71488         * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
71489         *
71490         * @private
71491         * @param {*} value The value to query.
71492         * @returns {string} Returns the raw `toStringTag`.
71493         */
71494
71495
71496        function getRawTag(value) {
71497          var isOwn = hasOwnProperty.call(value, symToStringTag),
71498              tag = value[symToStringTag];
71499
71500          try {
71501            value[symToStringTag] = undefined;
71502            var unmasked = true;
71503          } catch (e) {}
71504
71505          var result = nativeObjectToString.call(value);
71506
71507          if (unmasked) {
71508            if (isOwn) {
71509              value[symToStringTag] = tag;
71510            } else {
71511              delete value[symToStringTag];
71512            }
71513          }
71514
71515          return result;
71516        }
71517        /**
71518         * Creates an array of the own enumerable symbols of `object`.
71519         *
71520         * @private
71521         * @param {Object} object The object to query.
71522         * @returns {Array} Returns the array of symbols.
71523         */
71524
71525
71526        var getSymbols = !nativeGetSymbols ? stubArray : function (object) {
71527          if (object == null) {
71528            return [];
71529          }
71530
71531          object = Object(object);
71532          return arrayFilter(nativeGetSymbols(object), function (symbol) {
71533            return propertyIsEnumerable.call(object, symbol);
71534          });
71535        };
71536        /**
71537         * Gets the `toStringTag` of `value`.
71538         *
71539         * @private
71540         * @param {*} value The value to query.
71541         * @returns {string} Returns the `toStringTag`.
71542         */
71543
71544        var getTag = baseGetTag; // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
71545
71546        if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map && getTag(new Map()) != mapTag || Promise && getTag(Promise.resolve()) != promiseTag || Set && getTag(new Set()) != setTag || WeakMap && getTag(new WeakMap()) != weakMapTag) {
71547          getTag = function getTag(value) {
71548            var result = baseGetTag(value),
71549                Ctor = result == objectTag ? value.constructor : undefined,
71550                ctorString = Ctor ? toSource(Ctor) : '';
71551
71552            if (ctorString) {
71553              switch (ctorString) {
71554                case dataViewCtorString:
71555                  return dataViewTag;
71556
71557                case mapCtorString:
71558                  return mapTag;
71559
71560                case promiseCtorString:
71561                  return promiseTag;
71562
71563                case setCtorString:
71564                  return setTag;
71565
71566                case weakMapCtorString:
71567                  return weakMapTag;
71568              }
71569            }
71570
71571            return result;
71572          };
71573        }
71574        /**
71575         * Checks if `value` is a valid array-like index.
71576         *
71577         * @private
71578         * @param {*} value The value to check.
71579         * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
71580         * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
71581         */
71582
71583
71584        function isIndex(value, length) {
71585          length = length == null ? MAX_SAFE_INTEGER : length;
71586          return !!length && (typeof value == 'number' || reIsUint.test(value)) && value > -1 && value % 1 == 0 && value < length;
71587        }
71588        /**
71589         * Checks if `value` is suitable for use as unique object key.
71590         *
71591         * @private
71592         * @param {*} value The value to check.
71593         * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
71594         */
71595
71596
71597        function isKeyable(value) {
71598          var type = _typeof2(value);
71599
71600          return type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean' ? value !== '__proto__' : value === null;
71601        }
71602        /**
71603         * Checks if `func` has its source masked.
71604         *
71605         * @private
71606         * @param {Function} func The function to check.
71607         * @returns {boolean} Returns `true` if `func` is masked, else `false`.
71608         */
71609
71610
71611        function isMasked(func) {
71612          return !!maskSrcKey && maskSrcKey in func;
71613        }
71614        /**
71615         * Checks if `value` is likely a prototype object.
71616         *
71617         * @private
71618         * @param {*} value The value to check.
71619         * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
71620         */
71621
71622
71623        function isPrototype(value) {
71624          var Ctor = value && value.constructor,
71625              proto = typeof Ctor == 'function' && Ctor.prototype || objectProto;
71626          return value === proto;
71627        }
71628        /**
71629         * Converts `value` to a string using `Object.prototype.toString`.
71630         *
71631         * @private
71632         * @param {*} value The value to convert.
71633         * @returns {string} Returns the converted string.
71634         */
71635
71636
71637        function objectToString(value) {
71638          return nativeObjectToString.call(value);
71639        }
71640        /**
71641         * Converts `func` to its source code.
71642         *
71643         * @private
71644         * @param {Function} func The function to convert.
71645         * @returns {string} Returns the source code.
71646         */
71647
71648
71649        function toSource(func) {
71650          if (func != null) {
71651            try {
71652              return funcToString.call(func);
71653            } catch (e) {}
71654
71655            try {
71656              return func + '';
71657            } catch (e) {}
71658          }
71659
71660          return '';
71661        }
71662        /**
71663         * Performs a
71664         * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
71665         * comparison between two values to determine if they are equivalent.
71666         *
71667         * @static
71668         * @memberOf _
71669         * @since 4.0.0
71670         * @category Lang
71671         * @param {*} value The value to compare.
71672         * @param {*} other The other value to compare.
71673         * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
71674         * @example
71675         *
71676         * var object = { 'a': 1 };
71677         * var other = { 'a': 1 };
71678         *
71679         * _.eq(object, object);
71680         * // => true
71681         *
71682         * _.eq(object, other);
71683         * // => false
71684         *
71685         * _.eq('a', 'a');
71686         * // => true
71687         *
71688         * _.eq('a', Object('a'));
71689         * // => false
71690         *
71691         * _.eq(NaN, NaN);
71692         * // => true
71693         */
71694
71695
71696        function eq(value, other) {
71697          return value === other || value !== value && other !== other;
71698        }
71699        /**
71700         * Checks if `value` is likely an `arguments` object.
71701         *
71702         * @static
71703         * @memberOf _
71704         * @since 0.1.0
71705         * @category Lang
71706         * @param {*} value The value to check.
71707         * @returns {boolean} Returns `true` if `value` is an `arguments` object,
71708         *  else `false`.
71709         * @example
71710         *
71711         * _.isArguments(function() { return arguments; }());
71712         * // => true
71713         *
71714         * _.isArguments([1, 2, 3]);
71715         * // => false
71716         */
71717
71718
71719        var isArguments = baseIsArguments(function () {
71720          return arguments;
71721        }()) ? baseIsArguments : function (value) {
71722          return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee');
71723        };
71724        /**
71725         * Checks if `value` is classified as an `Array` object.
71726         *
71727         * @static
71728         * @memberOf _
71729         * @since 0.1.0
71730         * @category Lang
71731         * @param {*} value The value to check.
71732         * @returns {boolean} Returns `true` if `value` is an array, else `false`.
71733         * @example
71734         *
71735         * _.isArray([1, 2, 3]);
71736         * // => true
71737         *
71738         * _.isArray(document.body.children);
71739         * // => false
71740         *
71741         * _.isArray('abc');
71742         * // => false
71743         *
71744         * _.isArray(_.noop);
71745         * // => false
71746         */
71747
71748        var isArray = Array.isArray;
71749        /**
71750         * Checks if `value` is array-like. A value is considered array-like if it's
71751         * not a function and has a `value.length` that's an integer greater than or
71752         * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
71753         *
71754         * @static
71755         * @memberOf _
71756         * @since 4.0.0
71757         * @category Lang
71758         * @param {*} value The value to check.
71759         * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
71760         * @example
71761         *
71762         * _.isArrayLike([1, 2, 3]);
71763         * // => true
71764         *
71765         * _.isArrayLike(document.body.children);
71766         * // => true
71767         *
71768         * _.isArrayLike('abc');
71769         * // => true
71770         *
71771         * _.isArrayLike(_.noop);
71772         * // => false
71773         */
71774
71775        function isArrayLike(value) {
71776          return value != null && isLength(value.length) && !isFunction(value);
71777        }
71778        /**
71779         * Checks if `value` is a buffer.
71780         *
71781         * @static
71782         * @memberOf _
71783         * @since 4.3.0
71784         * @category Lang
71785         * @param {*} value The value to check.
71786         * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
71787         * @example
71788         *
71789         * _.isBuffer(new Buffer(2));
71790         * // => true
71791         *
71792         * _.isBuffer(new Uint8Array(2));
71793         * // => false
71794         */
71795
71796
71797        var isBuffer = nativeIsBuffer || stubFalse;
71798        /**
71799         * Performs a deep comparison between two values to determine if they are
71800         * equivalent.
71801         *
71802         * **Note:** This method supports comparing arrays, array buffers, booleans,
71803         * date objects, error objects, maps, numbers, `Object` objects, regexes,
71804         * sets, strings, symbols, and typed arrays. `Object` objects are compared
71805         * by their own, not inherited, enumerable properties. Functions and DOM
71806         * nodes are compared by strict equality, i.e. `===`.
71807         *
71808         * @static
71809         * @memberOf _
71810         * @since 0.1.0
71811         * @category Lang
71812         * @param {*} value The value to compare.
71813         * @param {*} other The other value to compare.
71814         * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
71815         * @example
71816         *
71817         * var object = { 'a': 1 };
71818         * var other = { 'a': 1 };
71819         *
71820         * _.isEqual(object, other);
71821         * // => true
71822         *
71823         * object === other;
71824         * // => false
71825         */
71826
71827        function isEqual(value, other) {
71828          return baseIsEqual(value, other);
71829        }
71830        /**
71831         * Checks if `value` is classified as a `Function` object.
71832         *
71833         * @static
71834         * @memberOf _
71835         * @since 0.1.0
71836         * @category Lang
71837         * @param {*} value The value to check.
71838         * @returns {boolean} Returns `true` if `value` is a function, else `false`.
71839         * @example
71840         *
71841         * _.isFunction(_);
71842         * // => true
71843         *
71844         * _.isFunction(/abc/);
71845         * // => false
71846         */
71847
71848
71849        function isFunction(value) {
71850          if (!isObject(value)) {
71851            return false;
71852          } // The use of `Object#toString` avoids issues with the `typeof` operator
71853          // in Safari 9 which returns 'object' for typed arrays and other constructors.
71854
71855
71856          var tag = baseGetTag(value);
71857          return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
71858        }
71859        /**
71860         * Checks if `value` is a valid array-like length.
71861         *
71862         * **Note:** This method is loosely based on
71863         * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
71864         *
71865         * @static
71866         * @memberOf _
71867         * @since 4.0.0
71868         * @category Lang
71869         * @param {*} value The value to check.
71870         * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
71871         * @example
71872         *
71873         * _.isLength(3);
71874         * // => true
71875         *
71876         * _.isLength(Number.MIN_VALUE);
71877         * // => false
71878         *
71879         * _.isLength(Infinity);
71880         * // => false
71881         *
71882         * _.isLength('3');
71883         * // => false
71884         */
71885
71886
71887        function isLength(value) {
71888          return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
71889        }
71890        /**
71891         * Checks if `value` is the
71892         * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
71893         * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
71894         *
71895         * @static
71896         * @memberOf _
71897         * @since 0.1.0
71898         * @category Lang
71899         * @param {*} value The value to check.
71900         * @returns {boolean} Returns `true` if `value` is an object, else `false`.
71901         * @example
71902         *
71903         * _.isObject({});
71904         * // => true
71905         *
71906         * _.isObject([1, 2, 3]);
71907         * // => true
71908         *
71909         * _.isObject(_.noop);
71910         * // => true
71911         *
71912         * _.isObject(null);
71913         * // => false
71914         */
71915
71916
71917        function isObject(value) {
71918          var type = _typeof2(value);
71919
71920          return value != null && (type == 'object' || type == 'function');
71921        }
71922        /**
71923         * Checks if `value` is object-like. A value is object-like if it's not `null`
71924         * and has a `typeof` result of "object".
71925         *
71926         * @static
71927         * @memberOf _
71928         * @since 4.0.0
71929         * @category Lang
71930         * @param {*} value The value to check.
71931         * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
71932         * @example
71933         *
71934         * _.isObjectLike({});
71935         * // => true
71936         *
71937         * _.isObjectLike([1, 2, 3]);
71938         * // => true
71939         *
71940         * _.isObjectLike(_.noop);
71941         * // => false
71942         *
71943         * _.isObjectLike(null);
71944         * // => false
71945         */
71946
71947
71948        function isObjectLike(value) {
71949          return value != null && _typeof2(value) == 'object';
71950        }
71951        /**
71952         * Checks if `value` is classified as a typed array.
71953         *
71954         * @static
71955         * @memberOf _
71956         * @since 3.0.0
71957         * @category Lang
71958         * @param {*} value The value to check.
71959         * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
71960         * @example
71961         *
71962         * _.isTypedArray(new Uint8Array);
71963         * // => true
71964         *
71965         * _.isTypedArray([]);
71966         * // => false
71967         */
71968
71969
71970        var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
71971        /**
71972         * Creates an array of the own enumerable property names of `object`.
71973         *
71974         * **Note:** Non-object values are coerced to objects. See the
71975         * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
71976         * for more details.
71977         *
71978         * @static
71979         * @since 0.1.0
71980         * @memberOf _
71981         * @category Object
71982         * @param {Object} object The object to query.
71983         * @returns {Array} Returns the array of property names.
71984         * @example
71985         *
71986         * function Foo() {
71987         *   this.a = 1;
71988         *   this.b = 2;
71989         * }
71990         *
71991         * Foo.prototype.c = 3;
71992         *
71993         * _.keys(new Foo);
71994         * // => ['a', 'b'] (iteration order is not guaranteed)
71995         *
71996         * _.keys('hi');
71997         * // => ['0', '1']
71998         */
71999
72000        function keys(object) {
72001          return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
72002        }
72003        /**
72004         * This method returns a new empty array.
72005         *
72006         * @static
72007         * @memberOf _
72008         * @since 4.13.0
72009         * @category Util
72010         * @returns {Array} Returns the new empty array.
72011         * @example
72012         *
72013         * var arrays = _.times(2, _.stubArray);
72014         *
72015         * console.log(arrays);
72016         * // => [[], []]
72017         *
72018         * console.log(arrays[0] === arrays[1]);
72019         * // => false
72020         */
72021
72022
72023        function stubArray() {
72024          return [];
72025        }
72026        /**
72027         * This method returns `false`.
72028         *
72029         * @static
72030         * @memberOf _
72031         * @since 4.13.0
72032         * @category Util
72033         * @returns {boolean} Returns `false`.
72034         * @example
72035         *
72036         * _.times(2, _.stubFalse);
72037         * // => [false, false]
72038         */
72039
72040
72041        function stubFalse() {
72042          return false;
72043        }
72044
72045        module.exports = isEqual;
72046      }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
72047    }, {}],
72048    407: [function (require, module, exports) {
72049      (function (global) {
72050        /**
72051         * Lodash (Custom Build) <https://lodash.com/>
72052         * Build: `lodash modularize exports="npm" -o ./`
72053         * Copyright JS Foundation and other contributors <https://js.foundation/>
72054         * Released under MIT license <https://lodash.com/license>
72055         * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
72056         * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
72057         */
72058
72059        /** `Object#toString` result references. */
72060        var asyncTag = '[object AsyncFunction]',
72061            funcTag = '[object Function]',
72062            genTag = '[object GeneratorFunction]',
72063            nullTag = '[object Null]',
72064            proxyTag = '[object Proxy]',
72065            undefinedTag = '[object Undefined]';
72066        /** Detect free variable `global` from Node.js. */
72067
72068        var freeGlobal = _typeof2(global) == 'object' && global && global.Object === Object && global;
72069        /** Detect free variable `self`. */
72070
72071        var freeSelf = (typeof self === "undefined" ? "undefined" : _typeof2(self)) == 'object' && self && self.Object === Object && self;
72072        /** Used as a reference to the global object. */
72073
72074        var root = freeGlobal || freeSelf || Function('return this')();
72075        /** Used for built-in method references. */
72076
72077        var objectProto = Object.prototype;
72078        /** Used to check objects for own properties. */
72079
72080        var hasOwnProperty = objectProto.hasOwnProperty;
72081        /**
72082         * Used to resolve the
72083         * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
72084         * of values.
72085         */
72086
72087        var nativeObjectToString = objectProto.toString;
72088        /** Built-in value references. */
72089
72090        var _Symbol7 = root.Symbol,
72091            symToStringTag = _Symbol7 ? _Symbol7.toStringTag : undefined;
72092        /**
72093         * The base implementation of `getTag` without fallbacks for buggy environments.
72094         *
72095         * @private
72096         * @param {*} value The value to query.
72097         * @returns {string} Returns the `toStringTag`.
72098         */
72099
72100        function baseGetTag(value) {
72101          if (value == null) {
72102            return value === undefined ? undefinedTag : nullTag;
72103          }
72104
72105          return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
72106        }
72107        /**
72108         * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
72109         *
72110         * @private
72111         * @param {*} value The value to query.
72112         * @returns {string} Returns the raw `toStringTag`.
72113         */
72114
72115
72116        function getRawTag(value) {
72117          var isOwn = hasOwnProperty.call(value, symToStringTag),
72118              tag = value[symToStringTag];
72119
72120          try {
72121            value[symToStringTag] = undefined;
72122            var unmasked = true;
72123          } catch (e) {}
72124
72125          var result = nativeObjectToString.call(value);
72126
72127          if (unmasked) {
72128            if (isOwn) {
72129              value[symToStringTag] = tag;
72130            } else {
72131              delete value[symToStringTag];
72132            }
72133          }
72134
72135          return result;
72136        }
72137        /**
72138         * Converts `value` to a string using `Object.prototype.toString`.
72139         *
72140         * @private
72141         * @param {*} value The value to convert.
72142         * @returns {string} Returns the converted string.
72143         */
72144
72145
72146        function objectToString(value) {
72147          return nativeObjectToString.call(value);
72148        }
72149        /**
72150         * Checks if `value` is classified as a `Function` object.
72151         *
72152         * @static
72153         * @memberOf _
72154         * @since 0.1.0
72155         * @category Lang
72156         * @param {*} value The value to check.
72157         * @returns {boolean} Returns `true` if `value` is a function, else `false`.
72158         * @example
72159         *
72160         * _.isFunction(_);
72161         * // => true
72162         *
72163         * _.isFunction(/abc/);
72164         * // => false
72165         */
72166
72167
72168        function isFunction(value) {
72169          if (!isObject(value)) {
72170            return false;
vendor: 4,918 bytes, lines 72171-72314
72171          } // The use of `Object#toString` avoids issues with the `typeof` operator
72172          // in Safari 9 which returns 'object' for typed arrays and other constructors.
72173
72174
72175          var tag = baseGetTag(value);
72176          return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
72177        }
72178        /**
72179         * Checks if `value` is the
72180         * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
72181         * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
72182         *
72183         * @static
72184         * @memberOf _
72185         * @since 0.1.0
72186         * @category Lang
72187         * @param {*} value The value to check.
72188         * @returns {boolean} Returns `true` if `value` is an object, else `false`.
72189         * @example
72190         *
72191         * _.isObject({});
72192         * // => true
72193         *
72194         * _.isObject([1, 2, 3]);
72195         * // => true
72196         *
72197         * _.isObject(_.noop);
72198         * // => true
72199         *
72200         * _.isObject(null);
72201         * // => false
72202         */
72203
72204
72205        function isObject(value) {
72206          var type = _typeof2(value);
72207
72208          return value != null && (type == 'object' || type == 'function');
72209        }
72210
72211        module.exports = isFunction;
72212      }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
72213    }, {}],
72214    408: [function (require, module, exports) {
72215      /**
72216       * lodash 4.0.0 (Custom Build) <https://lodash.com/>
72217       * Build: `lodash modularize exports="npm" -o ./`
72218       * Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>
72219       * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
72220       * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
72221       * Available under MIT license <https://lodash.com/license>
72222       */
72223
72224      /**
72225       * Checks if `value` is `null` or `undefined`.
72226       *
72227       * @static
72228       * @memberOf _
72229       * @category Lang
72230       * @param {*} value The value to check.
72231       * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
72232       * @example
72233       *
72234       * _.isNil(null);
72235       * // => true
72236       *
72237       * _.isNil(void 0);
72238       * // => true
72239       *
72240       * _.isNil(NaN);
72241       * // => false
72242       */
72243      function isNil(value) {
72244        return value == null;
72245      }
72246
72247      module.exports = isNil;
72248    }, {}],
72249    409: [function (require, module, exports) {
72250      /**
72251       * lodash 3.0.1 (Custom Build) <https://lodash.com/>
72252       * Build: `lodash modern modularize exports="npm" -o ./`
72253       * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
72254       * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
72255       * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
72256       * Available under MIT license <https://lodash.com/license>
72257       */
72258
72259      /**
72260       * Checks if `value` is `undefined`.
72261       *
72262       * @static
72263       * @memberOf _
72264       * @category Lang
72265       * @param {*} value The value to check.
72266       * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
72267       * @example
72268       *
72269       * _.isUndefined(void 0);
72270       * // => true
72271       *
72272       * _.isUndefined(null);
72273       * // => false
72274       */
72275      function isUndefined(value) {
72276        return value === undefined;
72277      }
72278
72279      module.exports = isUndefined;
72280    }, {}],
72281    410: [function (require, module, exports) {
72282      (function (global) {
72283        /**
72284         * lodash (Custom Build) <https://lodash.com/>
72285         * Build: `lodash modularize exports="npm" -o ./`
72286         * Copyright jQuery Foundation and other contributors <https://jquery.org/>
72287         * Released under MIT license <https://lodash.com/license>
72288         * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
72289         * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
72290         */
72291
72292        /** Used as the size to enable large array optimizations. */
72293        var LARGE_ARRAY_SIZE = 200;
72294        /** Used to stand-in for `undefined` hash values. */
72295
72296        var HASH_UNDEFINED = '__lodash_hash_undefined__';
72297        /** Used as references for various `Number` constants. */
72298
72299        var INFINITY = 1 / 0;
72300        /** `Object#toString` result references. */
72301
72302        var funcTag = '[object Function]',
72303            genTag = '[object GeneratorFunction]';
72304        /**
72305         * Used to match `RegExp`
72306         * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
72307         */
72308
72309        var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
72310        /** Used to detect host constructors (Safari). */
72311
72312        var reIsHostCtor = /^\[object .+?Constructor\]$/;
72313        /** Detect free variable `global` from Node.js. */
72314
vendor: 4,807 bytes, lines 72315-72458
72315        var freeGlobal = _typeof2(global) == 'object' && global && global.Object === Object && global;
72316        /** Detect free variable `self`. */
72317
72318        var freeSelf = (typeof self === "undefined" ? "undefined" : _typeof2(self)) == 'object' && self && self.Object === Object && self;
72319        /** Used as a reference to the global object. */
72320
72321        var root = freeGlobal || freeSelf || Function('return this')();
72322        /**
72323         * A specialized version of `_.includes` for arrays without support for
72324         * specifying an index to search from.
72325         *
72326         * @private
72327         * @param {Array} [array] The array to inspect.
72328         * @param {*} target The value to search for.
72329         * @returns {boolean} Returns `true` if `target` is found, else `false`.
72330         */
72331
72332        function arrayIncludes(array, value) {
72333          var length = array ? array.length : 0;
72334          return !!length && baseIndexOf(array, value, 0) > -1;
72335        }
72336        /**
72337         * This function is like `arrayIncludes` except that it accepts a comparator.
72338         *
72339         * @private
72340         * @param {Array} [array] The array to inspect.
72341         * @param {*} target The value to search for.
72342         * @param {Function} comparator The comparator invoked per element.
72343         * @returns {boolean} Returns `true` if `target` is found, else `false`.
72344         */
72345
72346
72347        function arrayIncludesWith(array, value, comparator) {
72348          var index = -1,
72349              length = array ? array.length : 0;
72350
72351          while (++index < length) {
72352            if (comparator(value, array[index])) {
72353              return true;
72354            }
72355          }
72356
72357          return false;
72358        }
72359        /**
72360         * The base implementation of `_.findIndex` and `_.findLastIndex` without
72361         * support for iteratee shorthands.
72362         *
72363         * @private
72364         * @param {Array} array The array to inspect.
72365         * @param {Function} predicate The function invoked per iteration.
72366         * @param {number} fromIndex The index to search from.
72367         * @param {boolean} [fromRight] Specify iterating from right to left.
72368         * @returns {number} Returns the index of the matched value, else `-1`.
72369         */
72370
72371
72372        function baseFindIndex(array, predicate, fromIndex, fromRight) {
72373          var length = array.length,
72374              index = fromIndex + (fromRight ? 1 : -1);
72375
72376          while (fromRight ? index-- : ++index < length) {
72377            if (predicate(array[index], index, array)) {
72378              return index;
72379            }
72380          }
72381
72382          return -1;
72383        }
72384        /**
72385         * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
72386         *
72387         * @private
72388         * @param {Array} array The array to inspect.
72389         * @param {*} value The value to search for.
72390         * @param {number} fromIndex The index to search from.
72391         * @returns {number} Returns the index of the matched value, else `-1`.
72392         */
72393
72394
72395        function baseIndexOf(array, value, fromIndex) {
72396          if (value !== value) {
72397            return baseFindIndex(array, baseIsNaN, fromIndex);
72398          }
72399
72400          var index = fromIndex - 1,
72401              length = array.length;
72402
72403          while (++index < length) {
72404            if (array[index] === value) {
72405              return index;
72406            }
72407          }
72408
72409          return -1;
72410        }
72411        /**
72412         * The base implementation of `_.isNaN` without support for number objects.
72413         *
72414         * @private
72415         * @param {*} value The value to check.
72416         * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
72417         */
72418
72419
72420        function baseIsNaN(value) {
72421          return value !== value;
72422        }
72423        /**
72424         * Checks if a cache value for `key` exists.
72425         *
72426         * @private
72427         * @param {Object} cache The cache to query.
72428         * @param {string} key The key of the entry to check.
72429         * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
72430         */
72431
72432
72433        function cacheHas(cache, key) {
72434          return cache.has(key);
72435        }
72436        /**
72437         * Gets the value at `key` of `object`.
72438         *
72439         * @private
72440         * @param {Object} [object] The object to query.
72441         * @param {string} key The key of the property to get.
72442         * @returns {*} Returns the property value.
72443         */
72444
72445
72446        function getValue(object, key) {
72447          return object == null ? undefined : object[key];
72448        }
72449        /**
72450         * Checks if `value` is a host object in IE < 9.
72451         *
72452         * @private
72453         * @param {*} value The value to check.
72454         * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
72455         */
72456
72457
72458        function isHostObject(value) {
vendor: 16,465 bytes, lines 72459-73031
72459          // Many host objects are `Object` objects that can coerce to strings
72460          // despite having improperly defined `toString` methods.
72461          var result = false;
72462
72463          if (value != null && typeof value.toString != 'function') {
72464            try {
72465              result = !!(value + '');
72466            } catch (e) {}
72467          }
72468
72469          return result;
72470        }
72471        /**
72472         * Converts `set` to an array of its values.
72473         *
72474         * @private
72475         * @param {Object} set The set to convert.
72476         * @returns {Array} Returns the values.
72477         */
72478
72479
72480        function setToArray(set) {
72481          var index = -1,
72482              result = Array(set.size);
72483          set.forEach(function (value) {
72484            result[++index] = value;
72485          });
72486          return result;
72487        }
72488        /** Used for built-in method references. */
72489
72490
72491        var arrayProto = Array.prototype,
72492            funcProto = Function.prototype,
72493            objectProto = Object.prototype;
72494        /** Used to detect overreaching core-js shims. */
72495
72496        var coreJsData = root['__core-js_shared__'];
72497        /** Used to detect methods masquerading as native. */
72498
72499        var maskSrcKey = function () {
72500          var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
72501          return uid ? 'Symbol(src)_1.' + uid : '';
72502        }();
72503        /** Used to resolve the decompiled source of functions. */
72504
72505
72506        var funcToString = funcProto.toString;
72507        /** Used to check objects for own properties. */
72508
72509        var hasOwnProperty = objectProto.hasOwnProperty;
72510        /**
72511         * Used to resolve the
72512         * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
72513         * of values.
72514         */
72515
72516        var objectToString = objectProto.toString;
72517        /** Used to detect if a method is native. */
72518
72519        var reIsNative = RegExp('^' + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&').replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$');
72520        /** Built-in value references. */
72521
72522        var splice = arrayProto.splice;
72523        /* Built-in method references that are verified to be native. */
72524
72525        var Map = getNative(root, 'Map'),
72526            Set = getNative(root, 'Set'),
72527            nativeCreate = getNative(Object, 'create');
72528        /**
72529         * Creates a hash object.
72530         *
72531         * @private
72532         * @constructor
72533         * @param {Array} [entries] The key-value pairs to cache.
72534         */
72535
72536        function Hash(entries) {
72537          var index = -1,
72538              length = entries ? entries.length : 0;
72539          this.clear();
72540
72541          while (++index < length) {
72542            var entry = entries[index];
72543            this.set(entry[0], entry[1]);
72544          }
72545        }
72546        /**
72547         * Removes all key-value entries from the hash.
72548         *
72549         * @private
72550         * @name clear
72551         * @memberOf Hash
72552         */
72553
72554
72555        function hashClear() {
72556          this.__data__ = nativeCreate ? nativeCreate(null) : {};
72557        }
72558        /**
72559         * Removes `key` and its value from the hash.
72560         *
72561         * @private
72562         * @name delete
72563         * @memberOf Hash
72564         * @param {Object} hash The hash to modify.
72565         * @param {string} key The key of the value to remove.
72566         * @returns {boolean} Returns `true` if the entry was removed, else `false`.
72567         */
72568
72569
72570        function hashDelete(key) {
72571          return this.has(key) && delete this.__data__[key];
72572        }
72573        /**
72574         * Gets the hash value for `key`.
72575         *
72576         * @private
72577         * @name get
72578         * @memberOf Hash
72579         * @param {string} key The key of the value to get.
72580         * @returns {*} Returns the entry value.
72581         */
72582
72583
72584        function hashGet(key) {
72585          var data = this.__data__;
72586
72587          if (nativeCreate) {
72588            var result = data[key];
72589            return result === HASH_UNDEFINED ? undefined : result;
72590          }
72591
72592          return hasOwnProperty.call(data, key) ? data[key] : undefined;
72593        }
72594        /**
72595         * Checks if a hash value for `key` exists.
72596         *
72597         * @private
72598         * @name has
72599         * @memberOf Hash
72600         * @param {string} key The key of the entry to check.
72601         * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
72602         */
72603
72604
72605        function hashHas(key) {
72606          var data = this.__data__;
72607          return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
72608        }
72609        /**
72610         * Sets the hash `key` to `value`.
72611         *
72612         * @private
72613         * @name set
72614         * @memberOf Hash
72615         * @param {string} key The key of the value to set.
72616         * @param {*} value The value to set.
72617         * @returns {Object} Returns the hash instance.
72618         */
72619
72620
72621        function hashSet(key, value) {
72622          var data = this.__data__;
72623          data[key] = nativeCreate && value === undefined ? HASH_UNDEFINED : value;
72624          return this;
72625        } // Add methods to `Hash`.
72626
72627
72628        Hash.prototype.clear = hashClear;
72629        Hash.prototype['delete'] = hashDelete;
72630        Hash.prototype.get = hashGet;
72631        Hash.prototype.has = hashHas;
72632        Hash.prototype.set = hashSet;
72633        /**
72634         * Creates an list cache object.
72635         *
72636         * @private
72637         * @constructor
72638         * @param {Array} [entries] The key-value pairs to cache.
72639         */
72640
72641        function ListCache(entries) {
72642          var index = -1,
72643              length = entries ? entries.length : 0;
72644          this.clear();
72645
72646          while (++index < length) {
72647            var entry = entries[index];
72648            this.set(entry[0], entry[1]);
72649          }
72650        }
72651        /**
72652         * Removes all key-value entries from the list cache.
72653         *
72654         * @private
72655         * @name clear
72656         * @memberOf ListCache
72657         */
72658
72659
72660        function listCacheClear() {
72661          this.__data__ = [];
72662        }
72663        /**
72664         * Removes `key` and its value from the list cache.
72665         *
72666         * @private
72667         * @name delete
72668         * @memberOf ListCache
72669         * @param {string} key The key of the value to remove.
72670         * @returns {boolean} Returns `true` if the entry was removed, else `false`.
72671         */
72672
72673
72674        function listCacheDelete(key) {
72675          var data = this.__data__,
72676              index = assocIndexOf(data, key);
72677
72678          if (index < 0) {
72679            return false;
72680          }
72681
72682          var lastIndex = data.length - 1;
72683
72684          if (index == lastIndex) {
72685            data.pop();
72686          } else {
72687            splice.call(data, index, 1);
72688          }
72689
72690          return true;
72691        }
72692        /**
72693         * Gets the list cache value for `key`.
72694         *
72695         * @private
72696         * @name get
72697         * @memberOf ListCache
72698         * @param {string} key The key of the value to get.
72699         * @returns {*} Returns the entry value.
72700         */
72701
72702
72703        function listCacheGet(key) {
72704          var data = this.__data__,
72705              index = assocIndexOf(data, key);
72706          return index < 0 ? undefined : data[index][1];
72707        }
72708        /**
72709         * Checks if a list cache value for `key` exists.
72710         *
72711         * @private
72712         * @name has
72713         * @memberOf ListCache
72714         * @param {string} key The key of the entry to check.
72715         * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
72716         */
72717
72718
72719        function listCacheHas(key) {
72720          return assocIndexOf(this.__data__, key) > -1;
72721        }
72722        /**
72723         * Sets the list cache `key` to `value`.
72724         *
72725         * @private
72726         * @name set
72727         * @memberOf ListCache
72728         * @param {string} key The key of the value to set.
72729         * @param {*} value The value to set.
72730         * @returns {Object} Returns the list cache instance.
72731         */
72732
72733
72734        function listCacheSet(key, value) {
72735          var data = this.__data__,
72736              index = assocIndexOf(data, key);
72737
72738          if (index < 0) {
72739            data.push([key, value]);
72740          } else {
72741            data[index][1] = value;
72742          }
72743
72744          return this;
72745        } // Add methods to `ListCache`.
72746
72747
72748        ListCache.prototype.clear = listCacheClear;
72749        ListCache.prototype['delete'] = listCacheDelete;
72750        ListCache.prototype.get = listCacheGet;
72751        ListCache.prototype.has = listCacheHas;
72752        ListCache.prototype.set = listCacheSet;
72753        /**
72754         * Creates a map cache object to store key-value pairs.
72755         *
72756         * @private
72757         * @constructor
72758         * @param {Array} [entries] The key-value pairs to cache.
72759         */
72760
72761        function MapCache(entries) {
72762          var index = -1,
72763              length = entries ? entries.length : 0;
72764          this.clear();
72765
72766          while (++index < length) {
72767            var entry = entries[index];
72768            this.set(entry[0], entry[1]);
72769          }
72770        }
72771        /**
72772         * Removes all key-value entries from the map.
72773         *
72774         * @private
72775         * @name clear
72776         * @memberOf MapCache
72777         */
72778
72779
72780        function mapCacheClear() {
72781          this.__data__ = {
72782            'hash': new Hash(),
72783            'map': new (Map || ListCache)(),
72784            'string': new Hash()
72785          };
72786        }
72787        /**
72788         * Removes `key` and its value from the map.
72789         *
72790         * @private
72791         * @name delete
72792         * @memberOf MapCache
72793         * @param {string} key The key of the value to remove.
72794         * @returns {boolean} Returns `true` if the entry was removed, else `false`.
72795         */
72796
72797
72798        function mapCacheDelete(key) {
72799          return getMapData(this, key)['delete'](key);
72800        }
72801        /**
72802         * Gets the map value for `key`.
72803         *
72804         * @private
72805         * @name get
72806         * @memberOf MapCache
72807         * @param {string} key The key of the value to get.
72808         * @returns {*} Returns the entry value.
72809         */
72810
72811
72812        function mapCacheGet(key) {
72813          return getMapData(this, key).get(key);
72814        }
72815        /**
72816         * Checks if a map value for `key` exists.
72817         *
72818         * @private
72819         * @name has
72820         * @memberOf MapCache
72821         * @param {string} key The key of the entry to check.
72822         * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
72823         */
72824
72825
72826        function mapCacheHas(key) {
72827          return getMapData(this, key).has(key);
72828        }
72829        /**
72830         * Sets the map `key` to `value`.
72831         *
72832         * @private
72833         * @name set
72834         * @memberOf MapCache
72835         * @param {string} key The key of the value to set.
72836         * @param {*} value The value to set.
72837         * @returns {Object} Returns the map cache instance.
72838         */
72839
72840
72841        function mapCacheSet(key, value) {
72842          getMapData(this, key).set(key, value);
72843          return this;
72844        } // Add methods to `MapCache`.
72845
72846
72847        MapCache.prototype.clear = mapCacheClear;
72848        MapCache.prototype['delete'] = mapCacheDelete;
72849        MapCache.prototype.get = mapCacheGet;
72850        MapCache.prototype.has = mapCacheHas;
72851        MapCache.prototype.set = mapCacheSet;
72852        /**
72853         *
72854         * Creates an array cache object to store unique values.
72855         *
72856         * @private
72857         * @constructor
72858         * @param {Array} [values] The values to cache.
72859         */
72860
72861        function SetCache(values) {
72862          var index = -1,
72863              length = values ? values.length : 0;
72864          this.__data__ = new MapCache();
72865
72866          while (++index < length) {
72867            this.add(values[index]);
72868          }
72869        }
72870        /**
72871         * Adds `value` to the array cache.
72872         *
72873         * @private
72874         * @name add
72875         * @memberOf SetCache
72876         * @alias push
72877         * @param {*} value The value to cache.
72878         * @returns {Object} Returns the cache instance.
72879         */
72880
72881
72882        function setCacheAdd(value) {
72883          this.__data__.set(value, HASH_UNDEFINED);
72884
72885          return this;
72886        }
72887        /**
72888         * Checks if `value` is in the array cache.
72889         *
72890         * @private
72891         * @name has
72892         * @memberOf SetCache
72893         * @param {*} value The value to search for.
72894         * @returns {number} Returns `true` if `value` is found, else `false`.
72895         */
72896
72897
72898        function setCacheHas(value) {
72899          return this.__data__.has(value);
72900        } // Add methods to `SetCache`.
72901
72902
72903        SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
72904        SetCache.prototype.has = setCacheHas;
72905        /**
72906         * Gets the index at which the `key` is found in `array` of key-value pairs.
72907         *
72908         * @private
72909         * @param {Array} array The array to inspect.
72910         * @param {*} key The key to search for.
72911         * @returns {number} Returns the index of the matched value, else `-1`.
72912         */
72913
72914        function assocIndexOf(array, key) {
72915          var length = array.length;
72916
72917          while (length--) {
72918            if (eq(array[length][0], key)) {
72919              return length;
72920            }
72921          }
72922
72923          return -1;
72924        }
72925        /**
72926         * The base implementation of `_.isNative` without bad shim checks.
72927         *
72928         * @private
72929         * @param {*} value The value to check.
72930         * @returns {boolean} Returns `true` if `value` is a native function,
72931         *  else `false`.
72932         */
72933
72934
72935        function baseIsNative(value) {
72936          if (!isObject(value) || isMasked(value)) {
72937            return false;
72938          }
72939
72940          var pattern = isFunction(value) || isHostObject(value) ? reIsNative : reIsHostCtor;
72941          return pattern.test(toSource(value));
72942        }
72943        /**
72944         * The base implementation of `_.uniqBy` without support for iteratee shorthands.
72945         *
72946         * @private
72947         * @param {Array} array The array to inspect.
72948         * @param {Function} [iteratee] The iteratee invoked per element.
72949         * @param {Function} [comparator] The comparator invoked per element.
72950         * @returns {Array} Returns the new duplicate free array.
72951         */
72952
72953
72954        function baseUniq(array, iteratee, comparator) {
72955          var index = -1,
72956              includes = arrayIncludes,
72957              length = array.length,
72958              isCommon = true,
72959              result = [],
72960              seen = result;
72961
72962          if (comparator) {
72963            isCommon = false;
72964            includes = arrayIncludesWith;
72965          } else if (length >= LARGE_ARRAY_SIZE) {
72966            var set = iteratee ? null : createSet(array);
72967
72968            if (set) {
72969              return setToArray(set);
72970            }
72971
72972            isCommon = false;
72973            includes = cacheHas;
72974            seen = new SetCache();
72975          } else {
72976            seen = iteratee ? [] : result;
72977          }
72978
72979          outer: while (++index < length) {
72980            var value = array[index],
72981                computed = iteratee ? iteratee(value) : value;
72982            value = comparator || value !== 0 ? value : 0;
72983
72984            if (isCommon && computed === computed) {
72985              var seenIndex = seen.length;
72986
72987              while (seenIndex--) {
72988                if (seen[seenIndex] === computed) {
72989                  continue outer;
72990                }
72991              }
72992
72993              if (iteratee) {
72994                seen.push(computed);
72995              }
72996
72997              result.push(value);
72998            } else if (!includes(seen, computed, comparator)) {
72999              if (seen !== result) {
73000                seen.push(computed);
73001              }
73002
73003              result.push(value);
73004            }
73005          }
73006
73007          return result;
73008        }
73009        /**
73010         * Creates a set object of `values`.
73011         *
73012         * @private
73013         * @param {Array} values The values to add to the set.
73014         * @returns {Object} Returns the new set.
73015         */
73016
73017
73018        var createSet = !(Set && 1 / setToArray(new Set([, -0]))[1] == INFINITY) ? noop : function (values) {
73019          return new Set(values);
73020        };
73021        /**
73022         * Gets the data for `map`.
73023         *
73024         * @private
73025         * @param {Object} map The map to query.
73026         * @param {string} key The reference key.
73027         * @returns {*} Returns the map data.
73028         */
73029
73030        function getMapData(map, key) {
73031          var data = map.__data__;
vendor: 11,411 bytes, lines 73032-73385
73032          return isKeyable(key) ? data[typeof key == 'string' ? 'string' : 'hash'] : data.map;
73033        }
73034        /**
73035         * Gets the native function at `key` of `object`.
73036         *
73037         * @private
73038         * @param {Object} object The object to query.
73039         * @param {string} key The key of the method to get.
73040         * @returns {*} Returns the function if it's native, else `undefined`.
73041         */
73042
73043
73044        function getNative(object, key) {
73045          var value = getValue(object, key);
73046          return baseIsNative(value) ? value : undefined;
73047        }
73048        /**
73049         * Checks if `value` is suitable for use as unique object key.
73050         *
73051         * @private
73052         * @param {*} value The value to check.
73053         * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
73054         */
73055
73056
73057        function isKeyable(value) {
73058          var type = _typeof2(value);
73059
73060          return type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean' ? value !== '__proto__' : value === null;
73061        }
73062        /**
73063         * Checks if `func` has its source masked.
73064         *
73065         * @private
73066         * @param {Function} func The function to check.
73067         * @returns {boolean} Returns `true` if `func` is masked, else `false`.
73068         */
73069
73070
73071        function isMasked(func) {
73072          return !!maskSrcKey && maskSrcKey in func;
73073        }
73074        /**
73075         * Converts `func` to its source code.
73076         *
73077         * @private
73078         * @param {Function} func The function to process.
73079         * @returns {string} Returns the source code.
73080         */
73081
73082
73083        function toSource(func) {
73084          if (func != null) {
73085            try {
73086              return funcToString.call(func);
73087            } catch (e) {}
73088
73089            try {
73090              return func + '';
73091            } catch (e) {}
73092          }
73093
73094          return '';
73095        }
73096        /**
73097         * Creates a duplicate-free version of an array, using
73098         * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
73099         * for equality comparisons, in which only the first occurrence of each
73100         * element is kept.
73101         *
73102         * @static
73103         * @memberOf _
73104         * @since 0.1.0
73105         * @category Array
73106         * @param {Array} array The array to inspect.
73107         * @returns {Array} Returns the new duplicate free array.
73108         * @example
73109         *
73110         * _.uniq([2, 1, 2]);
73111         * // => [2, 1]
73112         */
73113
73114
73115        function uniq(array) {
73116          return array && array.length ? baseUniq(array) : [];
73117        }
73118        /**
73119         * Performs a
73120         * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
73121         * comparison between two values to determine if they are equivalent.
73122         *
73123         * @static
73124         * @memberOf _
73125         * @since 4.0.0
73126         * @category Lang
73127         * @param {*} value The value to compare.
73128         * @param {*} other The other value to compare.
73129         * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
73130         * @example
73131         *
73132         * var object = { 'a': 1 };
73133         * var other = { 'a': 1 };
73134         *
73135         * _.eq(object, object);
73136         * // => true
73137         *
73138         * _.eq(object, other);
73139         * // => false
73140         *
73141         * _.eq('a', 'a');
73142         * // => true
73143         *
73144         * _.eq('a', Object('a'));
73145         * // => false
73146         *
73147         * _.eq(NaN, NaN);
73148         * // => true
73149         */
73150
73151
73152        function eq(value, other) {
73153          return value === other || value !== value && other !== other;
73154        }
73155        /**
73156         * Checks if `value` is classified as a `Function` object.
73157         *
73158         * @static
73159         * @memberOf _
73160         * @since 0.1.0
73161         * @category Lang
73162         * @param {*} value The value to check.
73163         * @returns {boolean} Returns `true` if `value` is a function, else `false`.
73164         * @example
73165         *
73166         * _.isFunction(_);
73167         * // => true
73168         *
73169         * _.isFunction(/abc/);
73170         * // => false
73171         */
73172
73173
73174        function isFunction(value) {
73175          // The use of `Object#toString` avoids issues with the `typeof` operator
73176          // in Safari 8-9 which returns 'object' for typed array and other constructors.
73177          var tag = isObject(value) ? objectToString.call(value) : '';
73178          return tag == funcTag || tag == genTag;
73179        }
73180        /**
73181         * Checks if `value` is the
73182         * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
73183         * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
73184         *
73185         * @static
73186         * @memberOf _
73187         * @since 0.1.0
73188         * @category Lang
73189         * @param {*} value The value to check.
73190         * @returns {boolean} Returns `true` if `value` is an object, else `false`.
73191         * @example
73192         *
73193         * _.isObject({});
73194         * // => true
73195         *
73196         * _.isObject([1, 2, 3]);
73197         * // => true
73198         *
73199         * _.isObject(_.noop);
73200         * // => true
73201         *
73202         * _.isObject(null);
73203         * // => false
73204         */
73205
73206
73207        function isObject(value) {
73208          var type = _typeof2(value);
73209
73210          return !!value && (type == 'object' || type == 'function');
73211        }
73212        /**
73213         * This method returns `undefined`.
73214         *
73215         * @static
73216         * @memberOf _
73217         * @since 2.3.0
73218         * @category Util
73219         * @example
73220         *
73221         * _.times(2, _.noop);
73222         * // => [undefined, undefined]
73223         */
73224
73225
73226        function noop() {// No operation performed.
73227        }
73228
73229        module.exports = uniq;
73230      }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
73231    }, {}],
73232    411: [function (require, module, exports) {
73233      'use strict';
73234
73235      var inherits = require('inherits');
73236
73237      var HashBase = require('hash-base');
73238
73239      var Buffer = require('safe-buffer').Buffer;
73240
73241      var ARRAY16 = new Array(16);
73242
73243      function MD5() {
73244        HashBase.call(this, 64); // state
73245
73246        this._a = 0x67452301;
73247        this._b = 0xefcdab89;
73248        this._c = 0x98badcfe;
73249        this._d = 0x10325476;
73250      }
73251
73252      inherits(MD5, HashBase);
73253
73254      MD5.prototype._update = function () {
73255        var M = ARRAY16;
73256
73257        for (var i = 0; i < 16; ++i) {
73258          M[i] = this._block.readInt32LE(i * 4);
73259        }
73260
73261        var a = this._a;
73262        var b = this._b;
73263        var c = this._c;
73264        var d = this._d;
73265        a = fnF(a, b, c, d, M[0], 0xd76aa478, 7);
73266        d = fnF(d, a, b, c, M[1], 0xe8c7b756, 12);
73267        c = fnF(c, d, a, b, M[2], 0x242070db, 17);
73268        b = fnF(b, c, d, a, M[3], 0xc1bdceee, 22);
73269        a = fnF(a, b, c, d, M[4], 0xf57c0faf, 7);
73270        d = fnF(d, a, b, c, M[5], 0x4787c62a, 12);
73271        c = fnF(c, d, a, b, M[6], 0xa8304613, 17);
73272        b = fnF(b, c, d, a, M[7], 0xfd469501, 22);
73273        a = fnF(a, b, c, d, M[8], 0x698098d8, 7);
73274        d = fnF(d, a, b, c, M[9], 0x8b44f7af, 12);
73275        c = fnF(c, d, a, b, M[10], 0xffff5bb1, 17);
73276        b = fnF(b, c, d, a, M[11], 0x895cd7be, 22);
73277        a = fnF(a, b, c, d, M[12], 0x6b901122, 7);
73278        d = fnF(d, a, b, c, M[13], 0xfd987193, 12);
73279        c = fnF(c, d, a, b, M[14], 0xa679438e, 17);
73280        b = fnF(b, c, d, a, M[15], 0x49b40821, 22);
73281        a = fnG(a, b, c, d, M[1], 0xf61e2562, 5);
73282        d = fnG(d, a, b, c, M[6], 0xc040b340, 9);
73283        c = fnG(c, d, a, b, M[11], 0x265e5a51, 14);
73284        b = fnG(b, c, d, a, M[0], 0xe9b6c7aa, 20);
73285        a = fnG(a, b, c, d, M[5], 0xd62f105d, 5);
73286        d = fnG(d, a, b, c, M[10], 0x02441453, 9);
73287        c = fnG(c, d, a, b, M[15], 0xd8a1e681, 14);
73288        b = fnG(b, c, d, a, M[4], 0xe7d3fbc8, 20);
73289        a = fnG(a, b, c, d, M[9], 0x21e1cde6, 5);
73290        d = fnG(d, a, b, c, M[14], 0xc33707d6, 9);
73291        c = fnG(c, d, a, b, M[3], 0xf4d50d87, 14);
73292        b = fnG(b, c, d, a, M[8], 0x455a14ed, 20);
73293        a = fnG(a, b, c, d, M[13], 0xa9e3e905, 5);
73294        d = fnG(d, a, b, c, M[2], 0xfcefa3f8, 9);
73295        c = fnG(c, d, a, b, M[7], 0x676f02d9, 14);
73296        b = fnG(b, c, d, a, M[12], 0x8d2a4c8a, 20);
73297        a = fnH(a, b, c, d, M[5], 0xfffa3942, 4);
73298        d = fnH(d, a, b, c, M[8], 0x8771f681, 11);
73299        c = fnH(c, d, a, b, M[11], 0x6d9d6122, 16);
73300        b = fnH(b, c, d, a, M[14], 0xfde5380c, 23);
73301        a = fnH(a, b, c, d, M[1], 0xa4beea44, 4);
73302        d = fnH(d, a, b, c, M[4], 0x4bdecfa9, 11);
73303        c = fnH(c, d, a, b, M[7], 0xf6bb4b60, 16);
73304        b = fnH(b, c, d, a, M[10], 0xbebfbc70, 23);
73305        a = fnH(a, b, c, d, M[13], 0x289b7ec6, 4);
73306        d = fnH(d, a, b, c, M[0], 0xeaa127fa, 11);
73307        c = fnH(c, d, a, b, M[3], 0xd4ef3085, 16);
73308        b = fnH(b, c, d, a, M[6], 0x04881d05, 23);
73309        a = fnH(a, b, c, d, M[9], 0xd9d4d039, 4);
73310        d = fnH(d, a, b, c, M[12], 0xe6db99e5, 11);
73311        c = fnH(c, d, a, b, M[15], 0x1fa27cf8, 16);
73312        b = fnH(b, c, d, a, M[2], 0xc4ac5665, 23);
73313        a = fnI(a, b, c, d, M[0], 0xf4292244, 6);
73314        d = fnI(d, a, b, c, M[7], 0x432aff97, 10);
73315        c = fnI(c, d, a, b, M[14], 0xab9423a7, 15);
73316        b = fnI(b, c, d, a, M[5], 0xfc93a039, 21);
73317        a = fnI(a, b, c, d, M[12], 0x655b59c3, 6);
73318        d = fnI(d, a, b, c, M[3], 0x8f0ccc92, 10);
73319        c = fnI(c, d, a, b, M[10], 0xffeff47d, 15);
73320        b = fnI(b, c, d, a, M[1], 0x85845dd1, 21);
73321        a = fnI(a, b, c, d, M[8], 0x6fa87e4f, 6);
73322        d = fnI(d, a, b, c, M[15], 0xfe2ce6e0, 10);
73323        c = fnI(c, d, a, b, M[6], 0xa3014314, 15);
73324        b = fnI(b, c, d, a, M[13], 0x4e0811a1, 21);
73325        a = fnI(a, b, c, d, M[4], 0xf7537e82, 6);
73326        d = fnI(d, a, b, c, M[11], 0xbd3af235, 10);
73327        c = fnI(c, d, a, b, M[2], 0x2ad7d2bb, 15);
73328        b = fnI(b, c, d, a, M[9], 0xeb86d391, 21);
73329        this._a = this._a + a | 0;
73330        this._b = this._b + b | 0;
73331        this._c = this._c + c | 0;
73332        this._d = this._d + d | 0;
73333      };
73334
73335      MD5.prototype._digest = function () {
73336        // create padding and handle blocks
73337        this._block[this._blockOffset++] = 0x80;
73338
73339        if (this._blockOffset > 56) {
73340          this._block.fill(0, this._blockOffset, 64);
73341
73342          this._update();
73343
73344          this._blockOffset = 0;
73345        }
73346
73347        this._block.fill(0, this._blockOffset, 56);
73348
73349        this._block.writeUInt32LE(this._length[0], 56);
73350
73351        this._block.writeUInt32LE(this._length[1], 60);
73352
73353        this._update(); // produce result
73354
73355
73356        var buffer = Buffer.allocUnsafe(16);
73357        buffer.writeInt32LE(this._a, 0);
73358        buffer.writeInt32LE(this._b, 4);
73359        buffer.writeInt32LE(this._c, 8);
73360        buffer.writeInt32LE(this._d, 12);
73361        return buffer;
73362      };
73363
73364      function rotl(x, n) {
73365        return x << n | x >>> 32 - n;
73366      }
73367
73368      function fnF(a, b, c, d, m, k, s) {
73369        return rotl(a + (b & c | ~b & d) + m + k | 0, s) + b | 0;
73370      }
73371
73372      function fnG(a, b, c, d, m, k, s) {
73373        return rotl(a + (b & d | c & ~d) + m + k | 0, s) + b | 0;
73374      }
73375
73376      function fnH(a, b, c, d, m, k, s) {
73377        return rotl(a + (b ^ c ^ d) + m + k | 0, s) + b | 0;
73378      }
73379
73380      function fnI(a, b, c, d, m, k, s) {
73381        return rotl(a + (c ^ (b | ~d)) + m + k | 0, s) + b | 0;
73382      }
73383
73384      module.exports = MD5;
73385    }, {
vendor: 3,154 bytes, lines 73386-73497
73386      "hash-base": 347,
73387      "inherits": 364,
73388      "safe-buffer": 470
73389    }],
73390    412: [function (require, module, exports) {
73391      var bn = require('bn.js');
73392
73393      var brorand = require('brorand');
73394
73395      function MillerRabin(rand) {
73396        this.rand = rand || new brorand.Rand();
73397      }
73398
73399      module.exports = MillerRabin;
73400
73401      MillerRabin.create = function create(rand) {
73402        return new MillerRabin(rand);
73403      };
73404
73405      MillerRabin.prototype._randbelow = function _randbelow(n) {
73406        var len = n.bitLength();
73407        var min_bytes = Math.ceil(len / 8); // Generage random bytes until a number less than n is found.
73408        // This ensures that 0..n-1 have an equal probability of being selected.
73409
73410        do {
73411          var a = new bn(this.rand.generate(min_bytes));
73412        } while (a.cmp(n) >= 0);
73413
73414        return a;
73415      };
73416
73417      MillerRabin.prototype._randrange = function _randrange(start, stop) {
73418        // Generate a random number greater than or equal to start and less than stop.
73419        var size = stop.sub(start);
73420        return start.add(this._randbelow(size));
73421      };
73422
73423      MillerRabin.prototype.test = function test(n, k, cb) {
73424        var len = n.bitLength();
73425        var red = bn.mont(n);
73426        var rone = new bn(1).toRed(red);
73427        if (!k) k = Math.max(1, len / 48 | 0); // Find d and s, (n - 1) = (2 ^ s) * d;
73428
73429        var n1 = n.subn(1);
73430
73431        for (var s = 0; !n1.testn(s); s++) {}
73432
73433        var d = n.shrn(s);
73434        var rn1 = n1.toRed(red);
73435        var prime = true;
73436
73437        for (; k > 0; k--) {
73438          var a = this._randrange(new bn(2), n1);
73439
73440          if (cb) cb(a);
73441          var x = a.toRed(red).redPow(d);
73442          if (x.cmp(rone) === 0 || x.cmp(rn1) === 0) continue;
73443
73444          for (var i = 1; i < s; i++) {
73445            x = x.redSqr();
73446            if (x.cmp(rone) === 0) return false;
73447            if (x.cmp(rn1) === 0) break;
73448          }
73449
73450          if (i === s) return false;
73451        }
73452
73453        return prime;
73454      };
73455
73456      MillerRabin.prototype.getDivisor = function getDivisor(n, k) {
73457        var len = n.bitLength();
73458        var red = bn.mont(n);
73459        var rone = new bn(1).toRed(red);
73460        if (!k) k = Math.max(1, len / 48 | 0); // Find d and s, (n - 1) = (2 ^ s) * d;
73461
73462        var n1 = n.subn(1);
73463
73464        for (var s = 0; !n1.testn(s); s++) {}
73465
73466        var d = n.shrn(s);
73467        var rn1 = n1.toRed(red);
73468
73469        for (; k > 0; k--) {
73470          var a = this._randrange(new bn(2), n1);
73471
73472          var g = n.gcd(a);
73473          if (g.cmpn(1) !== 0) return g;
73474          var x = a.toRed(red).redPow(d);
73475          if (x.cmp(rone) === 0 || x.cmp(rn1) === 0) continue;
73476
73477          for (var i = 1; i < s; i++) {
73478            x = x.redSqr();
73479            if (x.cmp(rone) === 0) return x.fromRed().subn(1).gcd(n);
73480            if (x.cmp(rn1) === 0) break;
73481          }
73482
73483          if (i === s) {
73484            x = x.redSqr();
73485            return x.fromRed().subn(1).gcd(n);
73486          }
73487        }
73488
73489        return false;
73490      };
73491    }, {
73492      "bn.js": 413,
73493      "brorand": 182
73494    }],
73495    413: [function (require, module, exports) {
73496      arguments[4][179][0].apply(exports, arguments);
73497    }, {
73498      "buffer": 183,
73499      "dup": 179
73500    }],
73501    414: [function (require, module, exports) {
73502      module.exports = assert;
73503
73504      function assert(val, msg) {
73505        if (!val) throw new Error(msg || 'Assertion failed');
73506      }
73507
73508      assert.equal = function assertEqual(l, r, msg) {
73509        if (l != r) throw new Error(msg || 'Assertion failed: ' + l + ' != ' + r);
73510      };
73511    }, {}],
73512    415: [function (require, module, exports) {
73513      'use strict';
73514
73515      var utils = exports;
73516
73517      function toArray(msg, enc) {
73518        if (Array.isArray(msg)) return msg.slice();
73519        if (!msg) return [];
73520        var res = [];
73521
73522        if (typeof msg !== 'string') {
73523          for (var i = 0; i < msg.length; i++) {
73524            res[i] = msg[i] | 0;
73525          }
73526
73527          return res;
73528        }
73529
73530        if (enc === 'hex') {
73531          msg = msg.replace(/[^a-z0-9]+/ig, '');
73532          if (msg.length % 2 !== 0) msg = '0' + msg;
73533
73534          for (var i = 0; i < msg.length; i += 2) {
73535            res.push(parseInt(msg[i] + msg[i + 1], 16));
73536          }
73537        } else {
73538          for (var i = 0; i < msg.length; i++) {
73539            var c = msg.charCodeAt(i);
73540            var hi = c >> 8;
73541            var lo = c & 0xff;
73542            if (hi) res.push(hi, lo);else res.push(lo);
73543          }
73544        }
73545
73546        return res;
73547      }
73548
73549      utils.toArray = toArray;
73550
73551      function zero2(word) {
73552        if (word.length === 1) return '0' + word;else return word;
73553      }
73554
73555      utils.zero2 = zero2;
73556
73557      function toHex(msg) {
73558        var res = '';
73559
73560        for (var i = 0; i < msg.length; i++) {
73561          res += zero2(msg[i].toString(16));
73562        }
73563
73564        return res;
73565      }
73566
73567      utils.toHex = toHex;
73568
73569      utils.encode = function encode(arr, enc) {
73570        if (enc === 'hex') return toHex(arr);else return arr;
73571      };
73572    }, {}],
73573    416: [function (require, module, exports) {
73574      // Top level file is just a mixin of submodules & constants
73575      'use strict';
73576
73577      var assign = require('./lib/utils/common').assign;
73578
73579      var deflate = require('./lib/deflate');
73580
73581      var inflate = require('./lib/inflate');
73582
73583      var constants = require('./lib/zlib/constants');
73584
73585      var pako = {};
73586      assign(pako, deflate, inflate, constants);
73587      module.exports = pako;
73588    }, {
73589      "./lib/deflate": 417,
73590      "./lib/inflate": 418,
73591      "./lib/utils/common": 419,
73592      "./lib/zlib/constants": 422
73593    }],
73594    417: [function (require, module, exports) {
73595      'use strict';
73596
73597      var zlib_deflate = require('./zlib/deflate');
73598
73599      var utils = require('./utils/common');
73600
73601      var strings = require('./utils/strings');
73602
73603      var msg = require('./zlib/messages');
73604
73605      var ZStream = require('./zlib/zstream');
73606
73607      var toString = Object.prototype.toString;
73608      /* Public constants ==========================================================*/
73609
73610      /* ===========================================================================*/
73611
73612      var Z_NO_FLUSH = 0;
73613      var Z_FINISH = 4;
73614      var Z_OK = 0;
73615      var Z_STREAM_END = 1;
73616      var Z_SYNC_FLUSH = 2;
73617      var Z_DEFAULT_COMPRESSION = -1;
73618      var Z_DEFAULT_STRATEGY = 0;
73619      var Z_DEFLATED = 8;
73620      /* ===========================================================================*/
73621
73622      /**
73623       * class Deflate
73624       *
73625       * Generic JS-style wrapper for zlib calls. If you don't need
73626       * streaming behaviour - use more simple functions: [[deflate]],
73627       * [[deflateRaw]] and [[gzip]].
73628       **/
73629
73630      /* internal
73631       * Deflate.chunks -> Array
73632       *
73633       * Chunks of output data, if [[Deflate#onData]] not overridden.
73634       **/
73635
73636      /**
73637       * Deflate.result -> Uint8Array|Array
73638       *
73639       * Compressed result, generated by default [[Deflate#onData]]
73640       * and [[Deflate#onEnd]] handlers. Filled after you push last chunk
73641       * (call [[Deflate#push]] with `Z_FINISH` / `true` param)  or if you
73642       * push a chunk with explicit flush (call [[Deflate#push]] with
73643       * `Z_SYNC_FLUSH` param).
73644       **/
73645
73646      /**
73647       * Deflate.err -> Number
73648       *
73649       * Error code after deflate finished. 0 (Z_OK) on success.
73650       * You will not need it in real life, because deflate errors
73651       * are possible only on wrong options or bad `onData` / `onEnd`
73652       * custom handlers.
73653       **/
73654
73655      /**
73656       * Deflate.msg -> String
73657       *
73658       * Error message, if [[Deflate.err]] != 0
73659       **/
73660
73661      /**
73662       * new Deflate(options)
73663       * - options (Object): zlib deflate options.
73664       *
73665       * Creates new deflator instance with specified params. Throws exception
73666       * on bad params. Supported options:
73667       *
73668       * - `level`
73669       * - `windowBits`
73670       * - `memLevel`
73671       * - `strategy`
73672       * - `dictionary`
73673       *
73674       * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)
73675       * for more information on these.
73676       *
73677       * Additional options, for internal needs:
73678       *
73679       * - `chunkSize` - size of generated data chunks (16K by default)
73680       * - `raw` (Boolean) - do raw deflate
73681       * - `gzip` (Boolean) - create gzip wrapper
73682       * - `to` (String) - if equal to 'string', then result will be "binary string"
73683       *    (each char code [0..255])
73684       * - `header` (Object) - custom header for gzip
73685       *   - `text` (Boolean) - true if compressed data believed to be text
73686       *   - `time` (Number) - modification time, unix timestamp
73687       *   - `os` (Number) - operation system code
73688       *   - `extra` (Array) - array of bytes with extra data (max 65536)
73689       *   - `name` (String) - file name (binary string)
73690       *   - `comment` (String) - comment (binary string)
73691       *   - `hcrc` (Boolean) - true if header crc should be added
73692       *
73693       * ##### Example:
73694       *
73695       * ```javascript
73696       * var pako = require('pako')
73697       *   , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9])
73698       *   , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]);
73699       *
73700       * var deflate = new pako.Deflate({ level: 3});
73701       *
73702       * deflate.push(chunk1, false);
73703       * deflate.push(chunk2, true);  // true -> last chunk
73704       *
73705       * if (deflate.err) { throw new Error(deflate.err); }
73706       *
73707       * console.log(deflate.result);
73708       * ```
73709       **/
73710
73711      function Deflate(options) {
vendor: 14,749 bytes, lines 73712-74164
73712        if (!(this instanceof Deflate)) return new Deflate(options);
73713        this.options = utils.assign({
73714          level: Z_DEFAULT_COMPRESSION,
73715          method: Z_DEFLATED,
73716          chunkSize: 16384,
73717          windowBits: 15,
73718          memLevel: 8,
73719          strategy: Z_DEFAULT_STRATEGY,
73720          to: ''
73721        }, options || {});
73722        var opt = this.options;
73723
73724        if (opt.raw && opt.windowBits > 0) {
73725          opt.windowBits = -opt.windowBits;
73726        } else if (opt.gzip && opt.windowBits > 0 && opt.windowBits < 16) {
73727          opt.windowBits += 16;
73728        }
73729
73730        this.err = 0; // error code, if happens (0 = Z_OK)
73731
73732        this.msg = ''; // error message
73733
73734        this.ended = false; // used to avoid multiple onEnd() calls
73735
73736        this.chunks = []; // chunks of compressed data
73737
73738        this.strm = new ZStream();
73739        this.strm.avail_out = 0;
73740        var status = zlib_deflate.deflateInit2(this.strm, opt.level, opt.method, opt.windowBits, opt.memLevel, opt.strategy);
73741
73742        if (status !== Z_OK) {
73743          throw new Error(msg[status]);
73744        }
73745
73746        if (opt.header) {
73747          zlib_deflate.deflateSetHeader(this.strm, opt.header);
73748        }
73749
73750        if (opt.dictionary) {
73751          var dict; // Convert data if needed
73752
73753          if (typeof opt.dictionary === 'string') {
73754            // If we need to compress text, change encoding to utf8.
73755            dict = strings.string2buf(opt.dictionary);
73756          } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {
73757            dict = new Uint8Array(opt.dictionary);
73758          } else {
73759            dict = opt.dictionary;
73760          }
73761
73762          status = zlib_deflate.deflateSetDictionary(this.strm, dict);
73763
73764          if (status !== Z_OK) {
73765            throw new Error(msg[status]);
73766          }
73767
73768          this._dict_set = true;
73769        }
73770      }
73771      /**
73772       * Deflate#push(data[, mode]) -> Boolean
73773       * - data (Uint8Array|Array|ArrayBuffer|String): input data. Strings will be
73774       *   converted to utf8 byte sequence.
73775       * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.
73776       *   See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH.
73777       *
73778       * Sends input data to deflate pipe, generating [[Deflate#onData]] calls with
73779       * new compressed chunks. Returns `true` on success. The last data block must have
73780       * mode Z_FINISH (or `true`). That will flush internal pending buffers and call
73781       * [[Deflate#onEnd]]. For interim explicit flushes (without ending the stream) you
73782       * can use mode Z_SYNC_FLUSH, keeping the compression context.
73783       *
73784       * On fail call [[Deflate#onEnd]] with error code and return false.
73785       *
73786       * We strongly recommend to use `Uint8Array` on input for best speed (output
73787       * array format is detected automatically). Also, don't skip last param and always
73788       * use the same type in your code (boolean or number). That will improve JS speed.
73789       *
73790       * For regular `Array`-s make sure all elements are [0..255].
73791       *
73792       * ##### Example
73793       *
73794       * ```javascript
73795       * push(chunk, false); // push one of data chunks
73796       * ...
73797       * push(chunk, true);  // push last chunk
73798       * ```
73799       **/
73800
73801
73802      Deflate.prototype.push = function (data, mode) {
73803        var strm = this.strm;
73804        var chunkSize = this.options.chunkSize;
73805
73806        var status, _mode;
73807
73808        if (this.ended) {
73809          return false;
73810        }
73811
73812        _mode = mode === ~~mode ? mode : mode === true ? Z_FINISH : Z_NO_FLUSH; // Convert data if needed
73813
73814        if (typeof data === 'string') {
73815          // If we need to compress text, change encoding to utf8.
73816          strm.input = strings.string2buf(data);
73817        } else if (toString.call(data) === '[object ArrayBuffer]') {
73818          strm.input = new Uint8Array(data);
73819        } else {
73820          strm.input = data;
73821        }
73822
73823        strm.next_in = 0;
73824        strm.avail_in = strm.input.length;
73825
73826        do {
73827          if (strm.avail_out === 0) {
73828            strm.output = new utils.Buf8(chunkSize);
73829            strm.next_out = 0;
73830            strm.avail_out = chunkSize;
73831          }
73832
73833          status = zlib_deflate.deflate(strm, _mode);
73834          /* no bad return value */
73835
73836          if (status !== Z_STREAM_END && status !== Z_OK) {
73837            this.onEnd(status);
73838            this.ended = true;
73839            return false;
73840          }
73841
73842          if (strm.avail_out === 0 || strm.avail_in === 0 && (_mode === Z_FINISH || _mode === Z_SYNC_FLUSH)) {
73843            if (this.options.to === 'string') {
73844              this.onData(strings.buf2binstring(utils.shrinkBuf(strm.output, strm.next_out)));
73845            } else {
73846              this.onData(utils.shrinkBuf(strm.output, strm.next_out));
73847            }
73848          }
73849        } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== Z_STREAM_END); // Finalize on the last chunk.
73850
73851
73852        if (_mode === Z_FINISH) {
73853          status = zlib_deflate.deflateEnd(this.strm);
73854          this.onEnd(status);
73855          this.ended = true;
73856          return status === Z_OK;
73857        } // callback interim results if Z_SYNC_FLUSH.
73858
73859
73860        if (_mode === Z_SYNC_FLUSH) {
73861          this.onEnd(Z_OK);
73862          strm.avail_out = 0;
73863          return true;
73864        }
73865
73866        return true;
73867      };
73868      /**
73869       * Deflate#onData(chunk) -> Void
73870       * - chunk (Uint8Array|Array|String): output data. Type of array depends
73871       *   on js engine support. When string output requested, each chunk
73872       *   will be string.
73873       *
73874       * By default, stores data blocks in `chunks[]` property and glue
73875       * those in `onEnd`. Override this handler, if you need another behaviour.
73876       **/
73877
73878
73879      Deflate.prototype.onData = function (chunk) {
73880        this.chunks.push(chunk);
73881      };
73882      /**
73883       * Deflate#onEnd(status) -> Void
73884       * - status (Number): deflate status. 0 (Z_OK) on success,
73885       *   other if not.
73886       *
73887       * Called once after you tell deflate that the input stream is
73888       * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)
73889       * or if an error happened. By default - join collected chunks,
73890       * free memory and fill `results` / `err` properties.
73891       **/
73892
73893
73894      Deflate.prototype.onEnd = function (status) {
73895        // On success - join
73896        if (status === Z_OK) {
73897          if (this.options.to === 'string') {
73898            this.result = this.chunks.join('');
73899          } else {
73900            this.result = utils.flattenChunks(this.chunks);
73901          }
73902        }
73903
73904        this.chunks = [];
73905        this.err = status;
73906        this.msg = this.strm.msg;
73907      };
73908      /**
73909       * deflate(data[, options]) -> Uint8Array|Array|String
73910       * - data (Uint8Array|Array|String): input data to compress.
73911       * - options (Object): zlib deflate options.
73912       *
73913       * Compress `data` with deflate algorithm and `options`.
73914       *
73915       * Supported options are:
73916       *
73917       * - level
73918       * - windowBits
73919       * - memLevel
73920       * - strategy
73921       * - dictionary
73922       *
73923       * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)
73924       * for more information on these.
73925       *
73926       * Sugar (options):
73927       *
73928       * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify
73929       *   negative windowBits implicitly.
73930       * - `to` (String) - if equal to 'string', then result will be "binary string"
73931       *    (each char code [0..255])
73932       *
73933       * ##### Example:
73934       *
73935       * ```javascript
73936       * var pako = require('pako')
73937       *   , data = Uint8Array([1,2,3,4,5,6,7,8,9]);
73938       *
73939       * console.log(pako.deflate(data));
73940       * ```
73941       **/
73942
73943
73944      function deflate(input, options) {
73945        var deflator = new Deflate(options);
73946        deflator.push(input, true); // That will never happens, if you don't cheat with options :)
73947
73948        if (deflator.err) {
73949          throw deflator.msg || msg[deflator.err];
73950        }
73951
73952        return deflator.result;
73953      }
73954      /**
73955       * deflateRaw(data[, options]) -> Uint8Array|Array|String
73956       * - data (Uint8Array|Array|String): input data to compress.
73957       * - options (Object): zlib deflate options.
73958       *
73959       * The same as [[deflate]], but creates raw data, without wrapper
73960       * (header and adler32 crc).
73961       **/
73962
73963
73964      function deflateRaw(input, options) {
73965        options = options || {};
73966        options.raw = true;
73967        return deflate(input, options);
73968      }
73969      /**
73970       * gzip(data[, options]) -> Uint8Array|Array|String
73971       * - data (Uint8Array|Array|String): input data to compress.
73972       * - options (Object): zlib deflate options.
73973       *
73974       * The same as [[deflate]], but create gzip wrapper instead of
73975       * deflate one.
73976       **/
73977
73978
73979      function gzip(input, options) {
73980        options = options || {};
73981        options.gzip = true;
73982        return deflate(input, options);
73983      }
73984
73985      exports.Deflate = Deflate;
73986      exports.deflate = deflate;
73987      exports.deflateRaw = deflateRaw;
73988      exports.gzip = gzip;
73989    }, {
73990      "./utils/common": 419,
73991      "./utils/strings": 420,
73992      "./zlib/deflate": 424,
73993      "./zlib/messages": 429,
73994      "./zlib/zstream": 431
73995    }],
73996    418: [function (require, module, exports) {
73997      'use strict';
73998
73999      var zlib_inflate = require('./zlib/inflate');
74000
74001      var utils = require('./utils/common');
74002
74003      var strings = require('./utils/strings');
74004
74005      var c = require('./zlib/constants');
74006
74007      var msg = require('./zlib/messages');
74008
74009      var ZStream = require('./zlib/zstream');
74010
74011      var GZheader = require('./zlib/gzheader');
74012
74013      var toString = Object.prototype.toString;
74014      /**
74015       * class Inflate
74016       *
74017       * Generic JS-style wrapper for zlib calls. If you don't need
74018       * streaming behaviour - use more simple functions: [[inflate]]
74019       * and [[inflateRaw]].
74020       **/
74021
74022      /* internal
74023       * inflate.chunks -> Array
74024       *
74025       * Chunks of output data, if [[Inflate#onData]] not overridden.
74026       **/
74027
74028      /**
74029       * Inflate.result -> Uint8Array|Array|String
74030       *
74031       * Uncompressed result, generated by default [[Inflate#onData]]
74032       * and [[Inflate#onEnd]] handlers. Filled after you push last chunk
74033       * (call [[Inflate#push]] with `Z_FINISH` / `true` param) or if you
74034       * push a chunk with explicit flush (call [[Inflate#push]] with
74035       * `Z_SYNC_FLUSH` param).
74036       **/
74037
74038      /**
74039       * Inflate.err -> Number
74040       *
74041       * Error code after inflate finished. 0 (Z_OK) on success.
74042       * Should be checked if broken data possible.
74043       **/
74044
74045      /**
74046       * Inflate.msg -> String
74047       *
74048       * Error message, if [[Inflate.err]] != 0
74049       **/
74050
74051      /**
74052       * new Inflate(options)
74053       * - options (Object): zlib inflate options.
74054       *
74055       * Creates new inflator instance with specified params. Throws exception
74056       * on bad params. Supported options:
74057       *
74058       * - `windowBits`
74059       * - `dictionary`
74060       *
74061       * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)
74062       * for more information on these.
74063       *
74064       * Additional options, for internal needs:
74065       *
74066       * - `chunkSize` - size of generated data chunks (16K by default)
74067       * - `raw` (Boolean) - do raw inflate
74068       * - `to` (String) - if equal to 'string', then result will be converted
74069       *   from utf8 to utf16 (javascript) string. When string output requested,
74070       *   chunk length can differ from `chunkSize`, depending on content.
74071       *
74072       * By default, when no options set, autodetect deflate/gzip data format via
74073       * wrapper header.
74074       *
74075       * ##### Example:
74076       *
74077       * ```javascript
74078       * var pako = require('pako')
74079       *   , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9])
74080       *   , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]);
74081       *
74082       * var inflate = new pako.Inflate({ level: 3});
74083       *
74084       * inflate.push(chunk1, false);
74085       * inflate.push(chunk2, true);  // true -> last chunk
74086       *
74087       * if (inflate.err) { throw new Error(inflate.err); }
74088       *
74089       * console.log(inflate.result);
74090       * ```
74091       **/
74092
74093      function Inflate(options) {
74094        if (!(this instanceof Inflate)) return new Inflate(options);
74095        this.options = utils.assign({
74096          chunkSize: 16384,
74097          windowBits: 0,
74098          to: ''
74099        }, options || {});
74100        var opt = this.options; // Force window size for `raw` data, if not set directly,
74101        // because we have no header for autodetect.
74102
74103        if (opt.raw && opt.windowBits >= 0 && opt.windowBits < 16) {
74104          opt.windowBits = -opt.windowBits;
74105
74106          if (opt.windowBits === 0) {
74107            opt.windowBits = -15;
74108          }
74109        } // If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate
74110
74111
74112        if (opt.windowBits >= 0 && opt.windowBits < 16 && !(options && options.windowBits)) {
74113          opt.windowBits += 32;
74114        } // Gzip header has no info about windows size, we can do autodetect only
74115        // for deflate. So, if window size not set, force it to max when gzip possible
74116
74117
74118        if (opt.windowBits > 15 && opt.windowBits < 48) {
74119          // bit 3 (16) -> gzipped data
74120          // bit 4 (32) -> autodetect gzip/deflate
74121          if ((opt.windowBits & 15) === 0) {
74122            opt.windowBits |= 15;
74123          }
74124        }
74125
74126        this.err = 0; // error code, if happens (0 = Z_OK)
74127
74128        this.msg = ''; // error message
74129
74130        this.ended = false; // used to avoid multiple onEnd() calls
74131
74132        this.chunks = []; // chunks of compressed data
74133
74134        this.strm = new ZStream();
74135        this.strm.avail_out = 0;
74136        var status = zlib_inflate.inflateInit2(this.strm, opt.windowBits);
74137
74138        if (status !== c.Z_OK) {
74139          throw new Error(msg[status]);
74140        }
74141
74142        this.header = new GZheader();
74143        zlib_inflate.inflateGetHeader(this.strm, this.header); // Setup dictionary
74144
74145        if (opt.dictionary) {
74146          // Convert data if needed
74147          if (typeof opt.dictionary === 'string') {
74148            opt.dictionary = strings.string2buf(opt.dictionary);
74149          } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {
74150            opt.dictionary = new Uint8Array(opt.dictionary);
74151          }
74152
74153          if (opt.raw) {
74154            //In raw mode we need to set the dictionary early
74155            status = zlib_inflate.inflateSetDictionary(this.strm, opt.dictionary);
74156
74157            if (status !== c.Z_OK) {
74158              throw new Error(msg[status]);
74159            }
74160          }
74161        }
74162      }
74163      /**
74164       * Inflate#push(data[, mode]) -> Boolean
74165       * - data (Uint8Array|Array|ArrayBuffer|String): input data
74166       * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.
74167       *   See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH.
74168       *
74169       * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with
74170       * new output chunks. Returns `true` on success. The last data block must have
74171       * mode Z_FINISH (or `true`). That will flush internal pending buffers and call
74172       * [[Inflate#onEnd]]. For interim explicit flushes (without ending the stream) you
74173       * can use mode Z_SYNC_FLUSH, keeping the decompression context.
74174       *
74175       * On fail call [[Inflate#onEnd]] with error code and return false.
74176       *
74177       * We strongly recommend to use `Uint8Array` on input for best speed (output
74178       * format is detected automatically). Also, don't skip last param and always
74179       * use the same type in your code (boolean or number). That will improve JS speed.
74180       *
74181       * For regular `Array`-s make sure all elements are [0..255].
74182       *
74183       * ##### Example
74184       *
74185       * ```javascript
74186       * push(chunk, false); // push one of data chunks
74187       * ...
74188       * push(chunk, true);  // push last chunk
74189       * ```
74190       **/
74191
74192
74193      Inflate.prototype.push = function (data, mode) {
74194        var strm = this.strm;
74195        var chunkSize = this.options.chunkSize;
74196        var dictionary = this.options.dictionary;
74197
74198        var status, _mode;
74199
74200        var next_out_utf8, tail, utf8str; // Flag to properly process Z_BUF_ERROR on testing inflate call
74201        // when we check that all output data was flushed.
74202
74203        var allowBufError = false;
74204
74205        if (this.ended) {
74206          return false;
74207        }
74208
74209        _mode = mode === ~~mode ? mode : mode === true ? c.Z_FINISH : c.Z_NO_FLUSH; // Convert data if needed
74210
74211        if (typeof data === 'string') {
74212          // Only binary strings can be decompressed on practice
74213          strm.input = strings.binstring2buf(data);
74214        } else if (toString.call(data) === '[object ArrayBuffer]') {
74215          strm.input = new Uint8Array(data);
74216        } else {
74217          strm.input = data;
74218        }
74219
74220        strm.next_in = 0;
74221        strm.avail_in = strm.input.length;
74222
74223        do {
74224          if (strm.avail_out === 0) {
74225            strm.output = new utils.Buf8(chunkSize);
74226            strm.next_out = 0;
74227            strm.avail_out = chunkSize;
74228          }
74229
74230          status = zlib_inflate.inflate(strm, c.Z_NO_FLUSH);
74231          /* no bad return value */
74232
74233          if (status === c.Z_NEED_DICT && dictionary) {
74234            status = zlib_inflate.inflateSetDictionary(this.strm, dictionary);
74235          }
74236
74237          if (status === c.Z_BUF_ERROR && allowBufError === true) {
74238            status = c.Z_OK;
74239            allowBufError = false;
74240          }
74241
74242          if (status !== c.Z_STREAM_END && status !== c.Z_OK) {
74243            this.onEnd(status);
74244            this.ended = true;
74245            return false;
74246          }
74247
74248          if (strm.next_out) {
74249            if (strm.avail_out === 0 || status === c.Z_STREAM_END || strm.avail_in === 0 && (_mode === c.Z_FINISH || _mode === c.Z_SYNC_FLUSH)) {
74250              if (this.options.to === 'string') {
74251                next_out_utf8 = strings.utf8border(strm.output, strm.next_out);
74252                tail = strm.next_out - next_out_utf8;
74253                utf8str = strings.buf2string(strm.output, next_out_utf8); // move tail
74254
74255                strm.next_out = tail;
74256                strm.avail_out = chunkSize - tail;
74257
74258                if (tail) {
74259                  utils.arraySet(strm.output, strm.output, next_out_utf8, tail, 0);
74260                }
74261
74262                this.onData(utf8str);
74263              } else {
74264                this.onData(utils.shrinkBuf(strm.output, strm.next_out));
74265              }
74266            }
74267          } // When no more input data, we should check that internal inflate buffers
74268          // are flushed. The only way to do it when avail_out = 0 - run one more
74269          // inflate pass. But if output data not exists, inflate return Z_BUF_ER
vendor: 4,954 bytes, lines 74269-74424
74269ROR.
74270          // Here we set flag to process this error properly.
74271          //
74272          // NOTE. Deflate does not return error in this case and does not needs such
74273          // logic.
74274
74275
74276          if (strm.avail_in === 0 && strm.avail_out === 0) {
74277            allowBufError = true;
74278          }
74279        } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== c.Z_STREAM_END);
74280
74281        if (status === c.Z_STREAM_END) {
74282          _mode = c.Z_FINISH;
74283        } // Finalize on the last chunk.
74284
74285
74286        if (_mode === c.Z_FINISH) {
74287          status = zlib_inflate.inflateEnd(this.strm);
74288          this.onEnd(status);
74289          this.ended = true;
74290          return status === c.Z_OK;
74291        } // callback interim results if Z_SYNC_FLUSH.
74292
74293
74294        if (_mode === c.Z_SYNC_FLUSH) {
74295          this.onEnd(c.Z_OK);
74296          strm.avail_out = 0;
74297          return true;
74298        }
74299
74300        return true;
74301      };
74302      /**
74303       * Inflate#onData(chunk) -> Void
74304       * - chunk (Uint8Array|Array|String): output data. Type of array depends
74305       *   on js engine support. When string output requested, each chunk
74306       *   will be string.
74307       *
74308       * By default, stores data blocks in `chunks[]` property and glue
74309       * those in `onEnd`. Override this handler, if you need another behaviour.
74310       **/
74311
74312
74313      Inflate.prototype.onData = function (chunk) {
74314        this.chunks.push(chunk);
74315      };
74316      /**
74317       * Inflate#onEnd(status) -> Void
74318       * - status (Number): inflate status. 0 (Z_OK) on success,
74319       *   other if not.
74320       *
74321       * Called either after you tell inflate that the input stream is
74322       * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)
74323       * or if an error happened. By default - join collected chunks,
74324       * free memory and fill `results` / `err` properties.
74325       **/
74326
74327
74328      Inflate.prototype.onEnd = function (status) {
74329        // On success - join
74330        if (status === c.Z_OK) {
74331          if (this.options.to === 'string') {
74332            // Glue & convert here, until we teach pako to send
74333            // utf8 aligned strings to onData
74334            this.result = this.chunks.join('');
74335          } else {
74336            this.result = utils.flattenChunks(this.chunks);
74337          }
74338        }
74339
74340        this.chunks = [];
74341        this.err = status;
74342        this.msg = this.strm.msg;
74343      };
74344      /**
74345       * inflate(data[, options]) -> Uint8Array|Array|String
74346       * - data (Uint8Array|Array|String): input data to decompress.
74347       * - options (Object): zlib inflate options.
74348       *
74349       * Decompress `data` with inflate/ungzip and `options`. Autodetect
74350       * format via wrapper header by default. That's why we don't provide
74351       * separate `ungzip` method.
74352       *
74353       * Supported options are:
74354       *
74355       * - windowBits
74356       *
74357       * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)
74358       * for more information.
74359       *
74360       * Sugar (options):
74361       *
74362       * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify
74363       *   negative windowBits implicitly.
74364       * - `to` (String) - if equal to 'string', then result will be converted
74365       *   from utf8 to utf16 (javascript) string. When string output requested,
74366       *   chunk length can differ from `chunkSize`, depending on content.
74367       *
74368       *
74369       * ##### Example:
74370       *
74371       * ```javascript
74372       * var pako = require('pako')
74373       *   , input = pako.deflate([1,2,3,4,5,6,7,8,9])
74374       *   , output;
74375       *
74376       * try {
74377       *   output = pako.inflate(input);
74378       * } catch (err)
74379       *   console.log(err);
74380       * }
74381       * ```
74382       **/
74383
74384
74385      function inflate(input, options) {
74386        var inflator = new Inflate(options);
74387        inflator.push(input, true); // That will never happens, if you don't cheat with options :)
74388
74389        if (inflator.err) {
74390          throw inflator.msg || msg[inflator.err];
74391        }
74392
74393        return inflator.result;
74394      }
74395      /**
74396       * inflateRaw(data[, options]) -> Uint8Array|Array|String
74397       * - data (Uint8Array|Array|String): input data to decompress.
74398       * - options (Object): zlib inflate options.
74399       *
74400       * The same as [[inflate]], but creates raw data, without wrapper
74401       * (header and adler32 crc).
74402       **/
74403
74404
74405      function inflateRaw(input, options) {
74406        options = options || {};
74407        options.raw = true;
74408        return inflate(input, options);
74409      }
74410      /**
74411       * ungzip(data[, options]) -> Uint8Array|Array|String
74412       * - data (Uint8Array|Array|String): input data to decompress.
74413       * - options (Object): zlib inflate options.
74414       *
74415       * Just shortcut to [[inflate]], because it autodetects format
74416       * by header.content. Done for convenience.
74417       **/
74418
74419
74420      exports.Inflate = Inflate;
74421      exports.inflate = inflate;
74422      exports.inflateRaw = inflateRaw;
74423      exports.ungzip = inflate;
74424    }, {
vendor: 55,135 bytes, lines 74425-76082
74425      "./utils/common": 419,
74426      "./utils/strings": 420,
74427      "./zlib/constants": 422,
74428      "./zlib/gzheader": 425,
74429      "./zlib/inflate": 427,
74430      "./zlib/messages": 429,
74431      "./zlib/zstream": 431
74432    }],
74433    419: [function (require, module, exports) {
74434      'use strict';
74435
74436      var TYPED_OK = typeof Uint8Array !== 'undefined' && typeof Uint16Array !== 'undefined' && typeof Int32Array !== 'undefined';
74437
74438      function _has(obj, key) {
74439        return Object.prototype.hasOwnProperty.call(obj, key);
74440      }
74441
74442      exports.assign = function (obj
74443      /*from1, from2, from3, ...*/
74444      ) {
74445        var sources = Array.prototype.slice.call(arguments, 1);
74446
74447        while (sources.length) {
74448          var source = sources.shift();
74449
74450          if (!source) {
74451            continue;
74452          }
74453
74454          if (_typeof2(source) !== 'object') {
74455            throw new TypeError(source + 'must be non-object');
74456          }
74457
74458          for (var p in source) {
74459            if (_has(source, p)) {
74460              obj[p] = source[p];
74461            }
74462          }
74463        }
74464
74465        return obj;
74466      }; // reduce buffer size, avoiding mem copy
74467
74468
74469      exports.shrinkBuf = function (buf, size) {
74470        if (buf.length === size) {
74471          return buf;
74472        }
74473
74474        if (buf.subarray) {
74475          return buf.subarray(0, size);
74476        }
74477
74478        buf.length = size;
74479        return buf;
74480      };
74481
74482      var fnTyped = {
74483        arraySet: function arraySet(dest, src, src_offs, len, dest_offs) {
74484          if (src.subarray && dest.subarray) {
74485            dest.set(src.subarray(src_offs, src_offs + len), dest_offs);
74486            return;
74487          } // Fallback to ordinary array
74488
74489
74490          for (var i = 0; i < len; i++) {
74491            dest[dest_offs + i] = src[src_offs + i];
74492          }
74493        },
74494        // Join array of chunks to single array.
74495        flattenChunks: function flattenChunks(chunks) {
74496          var i, l, len, pos, chunk, result; // calculate data length
74497
74498          len = 0;
74499
74500          for (i = 0, l = chunks.length; i < l; i++) {
74501            len += chunks[i].length;
74502          } // join chunks
74503
74504
74505          result = new Uint8Array(len);
74506          pos = 0;
74507
74508          for (i = 0, l = chunks.length; i < l; i++) {
74509            chunk = chunks[i];
74510            result.set(chunk, pos);
74511            pos += chunk.length;
74512          }
74513
74514          return result;
74515        }
74516      };
74517      var fnUntyped = {
74518        arraySet: function arraySet(dest, src, src_offs, len, dest_offs) {
74519          for (var i = 0; i < len; i++) {
74520            dest[dest_offs + i] = src[src_offs + i];
74521          }
74522        },
74523        // Join array of chunks to single array.
74524        flattenChunks: function flattenChunks(chunks) {
74525          return [].concat.apply([], chunks);
74526        }
74527      }; // Enable/Disable typed arrays use, for testing
74528      //
74529
74530      exports.setTyped = function (on) {
74531        if (on) {
74532          exports.Buf8 = Uint8Array;
74533          exports.Buf16 = Uint16Array;
74534          exports.Buf32 = Int32Array;
74535          exports.assign(exports, fnTyped);
74536        } else {
74537          exports.Buf8 = Array;
74538          exports.Buf16 = Array;
74539          exports.Buf32 = Array;
74540          exports.assign(exports, fnUntyped);
74541        }
74542      };
74543
74544      exports.setTyped(TYPED_OK);
74545    }, {}],
74546    420: [function (require, module, exports) {
74547      // String encode/decode helpers
74548      'use strict';
74549
74550      var utils = require('./common'); // Quick check if we can use fast array to bin string conversion
74551      //
74552      // - apply(Array) can fail on Android 2.2
74553      // - apply(Uint8Array) can fail on iOS 5.1 Safari
74554      //
74555
74556
74557      var STR_APPLY_OK = true;
74558      var STR_APPLY_UIA_OK = true;
74559
74560      try {
74561        String.fromCharCode.apply(null, [0]);
74562      } catch (__) {
74563        STR_APPLY_OK = false;
74564      }
74565
74566      try {
74567        String.fromCharCode.apply(null, new Uint8Array(1));
74568      } catch (__) {
74569        STR_APPLY_UIA_OK = false;
74570      } // Table with utf8 lengths (calculated by first byte of sequence)
74571      // Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,
74572      // because max possible codepoint is 0x10ffff
74573
74574
74575      var _utf8len = new utils.Buf8(256);
74576
74577      for (var q = 0; q < 256; q++) {
74578        _utf8len[q] = q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1;
74579      }
74580
74581      _utf8len[254] = _utf8len[254] = 1; // Invalid sequence start
74582      // convert string to array (typed, when possible)
74583
74584      exports.string2buf = function (str) {
74585        var buf,
74586            c,
74587            c2,
74588            m_pos,
74589            i,
74590            str_len = str.length,
74591            buf_len = 0; // count binary size
74592
74593        for (m_pos = 0; m_pos < str_len; m_pos++) {
74594          c = str.charCodeAt(m_pos);
74595
74596          if ((c & 0xfc00) === 0xd800 && m_pos + 1 < str_len) {
74597            c2 = str.charCodeAt(m_pos + 1);
74598
74599            if ((c2 & 0xfc00) === 0xdc00) {
74600              c = 0x10000 + (c - 0xd800 << 10) + (c2 - 0xdc00);
74601              m_pos++;
74602            }
74603          }
74604
74605          buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4;
74606        } // allocate buffer
74607
74608
74609        buf = new utils.Buf8(buf_len); // convert
74610
74611        for (i = 0, m_pos = 0; i < buf_len; m_pos++) {
74612          c = str.charCodeAt(m_pos);
74613
74614          if ((c & 0xfc00) === 0xd800 && m_pos + 1 < str_len) {
74615            c2 = str.charCodeAt(m_pos + 1);
74616
74617            if ((c2 & 0xfc00) === 0xdc00) {
74618              c = 0x10000 + (c - 0xd800 << 10) + (c2 - 0xdc00);
74619              m_pos++;
74620            }
74621          }
74622
74623          if (c < 0x80) {
74624            /* one byte */
74625            buf[i++] = c;
74626          } else if (c < 0x800) {
74627            /* two bytes */
74628            buf[i++] = 0xC0 | c >>> 6;
74629            buf[i++] = 0x80 | c & 0x3f;
74630          } else if (c < 0x10000) {
74631            /* three bytes */
74632            buf[i++] = 0xE0 | c >>> 12;
74633            buf[i++] = 0x80 | c >>> 6 & 0x3f;
74634            buf[i++] = 0x80 | c & 0x3f;
74635          } else {
74636            /* four bytes */
74637            buf[i++] = 0xf0 | c >>> 18;
74638            buf[i++] = 0x80 | c >>> 12 & 0x3f;
74639            buf[i++] = 0x80 | c >>> 6 & 0x3f;
74640            buf[i++] = 0x80 | c & 0x3f;
74641          }
74642        }
74643
74644        return buf;
74645      }; // Helper (used in 2 places)
74646
74647
74648      function buf2binstring(buf, len) {
74649        // On Chrome, the arguments in a function call that are allowed is `65534`.
74650        // If the length of the buffer is smaller than that, we can use this optimization,
74651        // otherwise we will take a slower path.
74652        if (len < 65534) {
74653          if (buf.subarray && STR_APPLY_UIA_OK || !buf.subarray && STR_APPLY_OK) {
74654            return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len));
74655          }
74656        }
74657
74658        var result = '';
74659
74660        for (var i = 0; i < len; i++) {
74661          result += String.fromCharCode(buf[i]);
74662        }
74663
74664        return result;
74665      } // Convert byte array to binary string
74666
74667
74668      exports.buf2binstring = function (buf) {
74669        return buf2binstring(buf, buf.length);
74670      }; // Convert binary string (typed, when possible)
74671
74672
74673      exports.binstring2buf = function (str) {
74674        var buf = new utils.Buf8(str.length);
74675
74676        for (var i = 0, len = buf.length; i < len; i++) {
74677          buf[i] = str.charCodeAt(i);
74678        }
74679
74680        return buf;
74681      }; // convert array to string
74682
74683
74684      exports.buf2string = function (buf, max) {
74685        var i, out, c, c_len;
74686        var len = max || buf.length; // Reserve max possible length (2 words per char)
74687        // NB: by unknown reasons, Array is significantly faster for
74688        //     String.fromCharCode.apply than Uint16Array.
74689
74690        var utf16buf = new Array(len * 2);
74691
74692        for (out = 0, i = 0; i < len;) {
74693          c = buf[i++]; // quick process ascii
74694
74695          if (c < 0x80) {
74696            utf16buf[out++] = c;
74697            continue;
74698          }
74699
74700          c_len = _utf8len[c]; // skip 5 & 6 byte codes
74701
74702          if (c_len > 4) {
74703            utf16buf[out++] = 0xfffd;
74704            i += c_len - 1;
74705            continue;
74706          } // apply mask on first byte
74707
74708
74709          c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07; // join the rest
74710
74711          while (c_len > 1 && i < len) {
74712            c = c << 6 | buf[i++] & 0x3f;
74713            c_len--;
74714          } // terminated by end of string?
74715
74716
74717          if (c_len > 1) {
74718            utf16buf[out++] = 0xfffd;
74719            continue;
74720          }
74721
74722          if (c < 0x10000) {
74723            utf16buf[out++] = c;
74724          } else {
74725            c -= 0x10000;
74726            utf16buf[out++] = 0xd800 | c >> 10 & 0x3ff;
74727            utf16buf[out++] = 0xdc00 | c & 0x3ff;
74728          }
74729        }
74730
74731        return buf2binstring(utf16buf, out);
74732      }; // Calculate max possible position in utf8 buffer,
74733      // that will not break sequence. If that's not possible
74734      // - (very small limits) return max size as is.
74735      //
74736      // buf[] - utf8 bytes array
74737      // max   - length limit (mandatory);
74738
74739
74740      exports.utf8border = function (buf, max) {
74741        var pos;
74742        max = max || buf.length;
74743
74744        if (max > buf.length) {
74745          max = buf.length;
74746        } // go back from last position, until start of sequence found
74747
74748
74749        pos = max - 1;
74750
74751        while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) {
74752          pos--;
74753        } // Very small and broken sequence,
74754        // return max, because we should return something anyway.
74755
74756
74757        if (pos < 0) {
74758          return max;
74759        } // If we came to start of buffer - that means buffer is too small,
74760        // return max too.
74761
74762
74763        if (pos === 0) {
74764          return max;
74765        }
74766
74767        return pos + _utf8len[buf[pos]] > max ? pos : max;
74768      };
74769    }, {
74770      "./common": 419
74771    }],
74772    421: [function (require, module, exports) {
74773      'use strict'; // Note: adler32 takes 12% for level 0 and 2% for level 6.
74774      // It isn't worth it to make additional optimizations as in original.
74775      // Small size is preferable.
74776      // (C) 1995-2013 Jean-loup Gailly and Mark Adler
74777      // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
74778      //
74779      // This software is provided 'as-is', without any express or implied
74780      // warranty. In no event will the authors be held liable for any damages
74781      // arising from the use of this software.
74782      //
74783      // Permission is granted to anyone to use this software for any purpose,
74784      // including commercial applications, and to alter it and redistribute it
74785      // freely, subject to the following restrictions:
74786      //
74787      // 1. The origin of this software must not be misrepresented; you must not
74788      //   claim that you wrote the original software. If you use this software
74789      //   in a product, an acknowledgment in the product documentation would be
74790      //   appreciated but is not required.
74791      // 2. Altered source versions must be plainly marked as such, and must not be
74792      //   misrepresented as being the original software.
74793      // 3. This notice may not be removed or altered from any source distribution.
74794
74795      function adler32(adler, buf, len, pos) {
74796        var s1 = adler & 0xffff | 0,
74797            s2 = adler >>> 16 & 0xffff | 0,
74798            n = 0;
74799
74800        while (len !== 0) {
74801          // Set limit ~ twice less than 5552, to keep
74802          // s2 in 31-bits, because we force signed ints.
74803          // in other case %= will fail.
74804          n = len > 2000 ? 2000 : len;
74805          len -= n;
74806
74807          do {
74808            s1 = s1 + buf[pos++] | 0;
74809            s2 = s2 + s1 | 0;
74810          } while (--n);
74811
74812          s1 %= 65521;
74813          s2 %= 65521;
74814        }
74815
74816        return s1 | s2 << 16 | 0;
74817      }
74818
74819      module.exports = adler32;
74820    }, {}],
74821    422: [function (require, module, exports) {
74822      'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler
74823      // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
74824      //
74825      // This software is provided 'as-is', without any express or implied
74826      // warranty. In no event will the authors be held liable for any damages
74827      // arising from the use of this software.
74828      //
74829      // Permission is granted to anyone to use this software for any purpose,
74830      // including commercial applications, and to alter it and redistribute it
74831      // freely, subject to the following restrictions:
74832      //
74833      // 1. The origin of this software must not be misrepresented; you must not
74834      //   claim that you wrote the original software. If you use this software
74835      //   in a product, an acknowledgment in the product documentation would be
74836      //   appreciated but is not required.
74837      // 2. Altered source versions must be plainly marked as such, and must not be
74838      //   misrepresented as being the original software.
74839      // 3. This notice may not be removed or altered from any source distribution.
74840
74841      module.exports = {
74842        /* Allowed flush values; see deflate() and inflate() below for details */
74843        Z_NO_FLUSH: 0,
74844        Z_PARTIAL_FLUSH: 1,
74845        Z_SYNC_FLUSH: 2,
74846        Z_FULL_FLUSH: 3,
74847        Z_FINISH: 4,
74848        Z_BLOCK: 5,
74849        Z_TREES: 6,
74850
74851        /* Return codes for the compression/decompression functions. Negative values
74852        * are errors, positive values are used for special but normal events.
74853        */
74854        Z_OK: 0,
74855        Z_STREAM_END: 1,
74856        Z_NEED_DICT: 2,
74857        Z_ERRNO: -1,
74858        Z_STREAM_ERROR: -2,
74859        Z_DATA_ERROR: -3,
74860        //Z_MEM_ERROR:     -4,
74861        Z_BUF_ERROR: -5,
74862        //Z_VERSION_ERROR: -6,
74863
74864        /* compression levels */
74865        Z_NO_COMPRESSION: 0,
74866        Z_BEST_SPEED: 1,
74867        Z_BEST_COMPRESSION: 9,
74868        Z_DEFAULT_COMPRESSION: -1,
74869        Z_FILTERED: 1,
74870        Z_HUFFMAN_ONLY: 2,
74871        Z_RLE: 3,
74872        Z_FIXED: 4,
74873        Z_DEFAULT_STRATEGY: 0,
74874
74875        /* Possible values of the data_type field (though see inflate()) */
74876        Z_BINARY: 0,
74877        Z_TEXT: 1,
74878        //Z_ASCII:                1, // = Z_TEXT (deprecated)
74879        Z_UNKNOWN: 2,
74880
74881        /* The deflate compression method */
74882        Z_DEFLATED: 8 //Z_NULL:                 null // Use -1 or null inline, depending on var type
74883
74884      };
74885    }, {}],
74886    423: [function (require, module, exports) {
74887      'use strict'; // Note: we can't get significant speed boost here.
74888      // So write code to minimize size - no pregenerated tables
74889      // and array tools dependencies.
74890      // (C) 1995-2013 Jean-loup Gailly and Mark Adler
74891      // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
74892      //
74893      // This software is provided 'as-is', without any express or implied
74894      // warranty. In no event will the authors be held liable for any damages
74895      // arising from the use of this software.
74896      //
74897      // Permission is granted to anyone to use this software for any purpose,
74898      // including commercial applications, and to alter it and redistribute it
74899      // freely, subject to the following restrictions:
74900      //
74901      // 1. The origin of this software must not be misrepresented; you must not
74902      //   claim that you wrote the original software. If you use this software
74903      //   in a product, an acknowledgment in the product documentation would be
74904      //   appreciated but is not required.
74905      // 2. Altered source versions must be plainly marked as such, and must not be
74906      //   misrepresented as being the original software.
74907      // 3. This notice may not be removed or altered from any source distribution.
74908      // Use ordinary array, since untyped makes no boost here
74909
74910      function makeTable() {
74911        var c,
74912            table = [];
74913
74914        for (var n = 0; n < 256; n++) {
74915          c = n;
74916
74917          for (var k = 0; k < 8; k++) {
74918            c = c & 1 ? 0xEDB88320 ^ c >>> 1 : c >>> 1;
74919          }
74920
74921          table[n] = c;
74922        }
74923
74924        return table;
74925      } // Create table on load. Just 255 signed longs. Not a problem.
74926
74927
74928      var crcTable = makeTable();
74929
74930      function crc32(crc, buf, len, pos) {
74931        var t = crcTable,
74932            end = pos + len;
74933        crc ^= -1;
74934
74935        for (var i = pos; i < end; i++) {
74936          crc = crc >>> 8 ^ t[(crc ^ buf[i]) & 0xFF];
74937        }
74938
74939        return crc ^ -1; // >>> 0;
74940      }
74941
74942      module.exports = crc32;
74943    }, {}],
74944    424: [function (require, module, exports) {
74945      'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler
74946      // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
74947      //
74948      // This software is provided 'as-is', without any express or implied
74949      // warranty. In no event will the authors be held liable for any damages
74950      // arising from the use of this software.
74951      //
74952      // Permission is granted to anyone to use this software for any purpose,
74953      // including commercial applications, and to alter it and redistribute it
74954      // freely, subject to the following restrictions:
74955      //
74956      // 1. The origin of this software must not be misrepresented; you must not
74957      //   claim that you wrote the original software. If you use this software
74958      //   in a product, an acknowledgment in the product documentation would be
74959      //   appreciated but is not required.
74960      // 2. Altered source versions must be plainly marked as such, and must not be
74961      //   misrepresented as being the original software.
74962      // 3. This notice may not be removed or altered from any source distribution.
74963
74964      var utils = require('../utils/common');
74965
74966      var trees = require('./trees');
74967
74968      var adler32 = require('./adler32');
74969
74970      var crc32 = require('./crc32');
74971
74972      var msg = require('./messages');
74973      /* Public constants ==========================================================*/
74974
74975      /* ===========================================================================*/
74976
74977      /* Allowed flush values; see deflate() and inflate() below for details */
74978
74979
74980      var Z_NO_FLUSH = 0;
74981      var Z_PARTIAL_FLUSH = 1; //var Z_SYNC_FLUSH    = 2;
74982
74983      var Z_FULL_FLUSH = 3;
74984      var Z_FINISH = 4;
74985      var Z_BLOCK = 5; //var Z_TREES         = 6;
74986
74987      /* Return codes for the compression/decompression functions. Negative values
74988       * are errors, positive values are used for special but normal events.
74989       */
74990
74991      var Z_OK = 0;
74992      var Z_STREAM_END = 1; //var Z_NEED_DICT     = 2;
74993      //var Z_ERRNO         = -1;
74994
74995      var Z_STREAM_ERROR = -2;
74996      var Z_DATA_ERROR = -3; //var Z_MEM_ERROR     = -4;
74997
74998      var Z_BUF_ERROR = -5; //var Z_VERSION_ERROR = -6;
74999
75000      /* compression levels */
75001      //var Z_NO_COMPRESSION      = 0;
75002      //var Z_BEST_SPEED          = 1;
75003      //var Z_BEST_COMPRESSION    = 9;
75004
75005      var Z_DEFAULT_COMPRESSION = -1;
75006      var Z_FILTERED = 1;
75007      var Z_HUFFMAN_ONLY = 2;
75008      var Z_RLE = 3;
75009      var Z_FIXED = 4;
75010      var Z_DEFAULT_STRATEGY = 0;
75011      /* Possible values of the data_type field (though see inflate()) */
75012      //var Z_BINARY              = 0;
75013      //var Z_TEXT                = 1;
75014      //var Z_ASCII               = 1; // = Z_TEXT
75015
75016      var Z_UNKNOWN = 2;
75017      /* The deflate compression method */
75018
75019      var Z_DEFLATED = 8;
75020      /*============================================================================*/
75021
75022      var MAX_MEM_LEVEL = 9;
75023      /* Maximum value for memLevel in deflateInit2 */
75024
75025      var MAX_WBITS = 15;
75026      /* 32K LZ77 window */
75027
75028      var DEF_MEM_LEVEL = 8;
75029      var LENGTH_CODES = 29;
75030      /* number of length codes, not counting the special END_BLOCK code */
75031
75032      var LITERALS = 256;
75033      /* number of literal bytes 0..255 */
75034
75035      var L_CODES = LITERALS + 1 + LENGTH_CODES;
75036      /* number of Literal or Length codes, including the END_BLOCK code */
75037
75038      var D_CODES = 30;
75039      /* number of distance codes */
75040
75041      var BL_CODES = 19;
75042      /* number of codes used to transfer the bit lengths */
75043
75044      var HEAP_SIZE = 2 * L_CODES + 1;
75045      /* maximum heap size */
75046
75047      var MAX_BITS = 15;
75048      /* All codes must not exceed MAX_BITS bits */
75049
75050      var MIN_MATCH = 3;
75051      var MAX_MATCH = 258;
75052      var MIN_LOOKAHEAD = MAX_MATCH + MIN_MATCH + 1;
75053      var PRESET_DICT = 0x20;
75054      var INIT_STATE = 42;
75055      var EXTRA_STATE = 69;
75056      var NAME_STATE = 73;
75057      var COMMENT_STATE = 91;
75058      var HCRC_STATE = 103;
75059      var BUSY_STATE = 113;
75060      var FINISH_STATE = 666;
75061      var BS_NEED_MORE = 1;
75062      /* block not completed, need more input or more output */
75063
75064      var BS_BLOCK_DONE = 2;
75065      /* block flush performed */
75066
75067      var BS_FINISH_STARTED = 3;
75068      /* finish started, need only more output at next deflate */
75069
75070      var BS_FINISH_DONE = 4;
75071      /* finish done, accept no more input or output */
75072
75073      var OS_CODE = 0x03; // Unix :) . Don't detect, use this default.
75074
75075      function err(strm, errorCode) {
75076        strm.msg = msg[errorCode];
75077        return errorCode;
75078      }
75079
75080      function rank(f) {
75081        return (f << 1) - (f > 4 ? 9 : 0);
75082      }
75083
75084      function zero(buf) {
75085        var len = buf.length;
75086
75087        while (--len >= 0) {
75088          buf[len] = 0;
75089        }
75090      }
75091      /* =========================================================================
75092       * Flush as much pending output as possible. All deflate() output goes
75093       * through this function so some applications may wish to modify it
75094       * to avoid allocating a large strm->output buffer and copying into it.
75095       * (See also read_buf()).
75096       */
75097
75098
75099      function flush_pending(strm) {
75100        var s = strm.state; //_tr_flush_bits(s);
75101
75102        var len = s.pending;
75103
75104        if (len > strm.avail_out) {
75105          len = strm.avail_out;
75106        }
75107
75108        if (len === 0) {
75109          return;
75110        }
75111
75112        utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out);
75113        strm.next_out += len;
75114        s.pending_out += len;
75115        strm.total_out += len;
75116        strm.avail_out -= len;
75117        s.pending -= len;
75118
75119        if (s.pending === 0) {
75120          s.pending_out = 0;
75121        }
75122      }
75123
75124      function flush_block_only(s, last) {
75125        trees._tr_flush_block(s, s.block_start >= 0 ? s.block_start : -1, s.strstart - s.block_start, last);
75126
75127        s.block_start = s.strstart;
75128        flush_pending(s.strm);
75129      }
75130
75131      function put_byte(s, b) {
75132        s.pending_buf[s.pending++] = b;
75133      }
75134      /* =========================================================================
75135       * Put a short in the pending buffer. The 16-bit value is put in MSB order.
75136       * IN assertion: the stream state is correct and there is enough room in
75137       * pending_buf.
75138       */
75139
75140
75141      function putShortMSB(s, b) {
75142        //  put_byte(s, (Byte)(b >> 8));
75143        //  put_byte(s, (Byte)(b & 0xff));
75144        s.pending_buf[s.pending++] = b >>> 8 & 0xff;
75145        s.pending_buf[s.pending++] = b & 0xff;
75146      }
75147      /* ===========================================================================
75148       * Read a new buffer from the current input stream, update the adler32
75149       * and total number of bytes read.  All deflate() input goes through
75150       * this function so some applications may wish to modify it to avoid
75151       * allocating a large strm->input buffer and copying from it.
75152       * (See also flush_pending()).
75153       */
75154
75155
75156      function read_buf(strm, buf, start, size) {
75157        var len = strm.avail_in;
75158
75159        if (len > size) {
75160          len = size;
75161        }
75162
75163        if (len === 0) {
75164          return 0;
75165        }
75166
75167        strm.avail_in -= len; // zmemcpy(buf, strm->next_in, len);
75168
75169        utils.arraySet(buf, strm.input, strm.next_in, len, start);
75170
75171        if (strm.state.wrap === 1) {
75172          strm.adler = adler32(strm.adler, buf, len, start);
75173        } else if (strm.state.wrap === 2) {
75174          strm.adler = crc32(strm.adler, buf, len, start);
75175        }
75176
75177        strm.next_in += len;
75178        strm.total_in += len;
75179        return len;
75180      }
75181      /* ===========================================================================
75182       * Set match_start to the longest match starting at the given string and
75183       * return its length. Matches shorter or equal to prev_length are discarded,
75184       * in which case the result is equal to prev_length and match_start is
75185       * garbage.
75186       * IN assertions: cur_match is the head of the hash chain for the current
75187       *   string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1
75188       * OUT assertion: the match length is not greater than s->lookahead.
75189       */
75190
75191
75192      function longest_match(s, cur_match) {
75193        var chain_length = s.max_chain_length;
75194        /* max hash chain length */
75195
75196        var scan = s.strstart;
75197        /* current string */
75198
75199        var match;
75200        /* matched string */
75201
75202        var len;
75203        /* length of current match */
75204
75205        var best_len = s.prev_length;
75206        /* best match length so far */
75207
75208        var nice_match = s.nice_match;
75209        /* stop if match long enough */
75210
75211        var limit = s.strstart > s.w_size - MIN_LOOKAHEAD ? s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0
75212        /*NIL*/
75213        ;
75214        var _win = s.window; // shortcut
75215
75216        var wmask = s.w_mask;
75217        var prev = s.prev;
75218        /* Stop when cur_match becomes <= limit. To simplify the code,
75219         * we prevent matches with the string of window index 0.
75220         */
75221
75222        var strend = s.strstart + MAX_MATCH;
75223        var scan_end1 = _win[scan + best_len - 1];
75224        var scan_end = _win[scan + best_len];
75225        /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
75226         * It is easy to get rid of this optimization if necessary.
75227         */
75228        // Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
75229
75230        /* Do not waste too much time if we already have a good match: */
75231
75232        if (s.prev_length >= s.good_match) {
75233          chain_length >>= 2;
75234        }
75235        /* Do not look for matches beyond the end of the input. This is necessary
75236         * to make deflate deterministic.
75237         */
75238
75239
75240        if (nice_match > s.lookahead) {
75241          nice_match = s.lookahead;
75242        } // Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
75243
75244
75245        do {
75246          // Assert(cur_match < s->strstart, "no future");
75247          match = cur_match;
75248          /* Skip to next match if the match length cannot increase
75249           * or if the match length is less than 2.  Note that the checks below
75250           * for insufficient lookahead only occur occasionally for performance
75251           * reasons.  Therefore uninitialized memory will be accessed, and
75252           * conditional jumps will be made that depend on those values.
75253           * However the length of the match is limited to the lookahead, so
75254           * the output of deflate is not affected by the uninitialized values.
75255           */
75256
75257          if (_win[match + best_len] !== scan_end || _win[match + best_len - 1] !== scan_end1 || _win[match] !== _win[scan] || _win[++match] !== _win[scan + 1]) {
75258            continue;
75259          }
75260          /* The check at best_len-1 can be removed because it will be made
75261           * again later. (This heuristic is not always a win.)
75262           * It is not necessary to compare scan[2] and match[2] since they
75263           * are always equal when the other bytes match, given that
75264           * the hash keys are equal and that HASH_BITS >= 8.
75265           */
75266
75267
75268          scan += 2;
75269          match++; // Assert(*scan == *match, "match[2]?");
75270
75271          /* We check for insufficient lookahead only every 8th comparison;
75272           * the 256th check will be made at strstart+258.
75273           */
75274
75275          do {
75276            /*jshint noempty:false*/
75277          } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && scan < strend); // Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
75278
75279
75280          len = MAX_MATCH - (strend - scan);
75281          scan = strend - MAX_MATCH;
75282
75283          if (len > best_len) {
75284            s.match_start = cur_match;
75285            best_len = len;
75286
75287            if (len >= nice_match) {
75288              break;
75289            }
75290
75291            scan_end1 = _win[scan + best_len - 1];
75292            scan_end = _win[scan + best_len];
75293          }
75294        } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0);
75295
75296        if (best_len <= s.lookahead) {
75297          return best_len;
75298        }
75299
75300        return s.lookahead;
75301      }
75302      /* ===========================================================================
75303       * Fill the window when the lookahead becomes insufficient.
75304       * Updates strstart and lookahead.
75305       *
75306       * IN assertion: lookahead < MIN_LOOKAHEAD
75307       * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD
75308       *    At least one byte has been read, or avail_in == 0; reads are
75309       *    performed for at least two bytes (required for the zip translate_eol
75310       *    option -- not supported here).
75311       */
75312
75313
75314      function fill_window(s) {
75315        var _w_size = s.w_size;
75316        var p, n, m, more, str; //Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead");
75317
75318        do {
75319          more = s.window_size - s.lookahead - s.strstart; // JS ints have 32 bit, block below not needed
75320
75321          /* Deal with !@#$% 64K limit: */
75322          //if (sizeof(int) <= 2) {
75323          //    if (more == 0 && s->strstart == 0 && s->lookahead == 0) {
75324          //        more = wsize;
75325          //
75326          //  } else if (more == (unsigned)(-1)) {
75327          //        /* Very unlikely, but possible on 16 bit machine if
75328          //         * strstart == 0 && lookahead == 1 (input done a byte at time)
75329          //         */
75330          //        more--;
75331          //    }
75332          //}
75333
75334          /* If the window is almost full and there is insufficient lookahead,
75335           * move the upper half to the lower one to make room in the upper half.
75336           */
75337
75338          if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) {
75339            utils.arraySet(s.window, s.window, _w_size, _w_size, 0);
75340            s.match_start -= _w_size;
75341            s.strstart -= _w_size;
75342            /* we now have strstart >= MAX_DIST */
75343
75344            s.block_start -= _w_size;
75345            /* Slide the hash table (could be avoided with 32 bit values
75346             at the expense of memory usage). We slide even when level == 0
75347             to keep the hash table consistent if we switch back to level > 0
75348             later. (Using level 0 permanently is not an optimal usage of
75349             zlib, so we don't care about this pathological case.)
75350             */
75351
75352            n = s.hash_size;
75353            p = n;
75354
75355            do {
75356              m = s.head[--p];
75357              s.head[p] = m >= _w_size ? m - _w_size : 0;
75358            } while (--n);
75359
75360            n = _w_size;
75361            p = n;
75362
75363            do {
75364              m = s.prev[--p];
75365              s.prev[p] = m >= _w_size ? m - _w_size : 0;
75366              /* If n is not on any hash chain, prev[n] is garbage but
75367               * its value will never be used.
75368               */
75369            } while (--n);
75370
75371            more += _w_size;
75372          }
75373
75374          if (s.strm.avail_in === 0) {
75375            break;
75376          }
75377          /* If there was no sliding:
75378           *    strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&
75379           *    more == window_size - lookahead - strstart
75380           * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)
75381           * => more >= window_size - 2*WSIZE + 2
75382           * In the BIG_MEM or MMAP case (not yet supported),
75383           *   window_size == input_size + MIN_LOOKAHEAD  &&
75384           *   strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.
75385           * Otherwise, window_size == 2*WSIZE so more >= 2.
75386           * If there was sliding, more >= WSIZE. So in all cases, more >= 2.
75387           */
75388          //Assert(more >= 2, "more < 2");
75389
75390
75391          n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more);
75392          s.lookahead += n;
75393          /* Initialize the hash value now that we have some input: */
75394
75395          if (s.lookahead + s.insert >= MIN_MATCH) {
75396            str = s.strstart - s.insert;
75397            s.ins_h = s.window[str];
75398            /* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */
75399
75400            s.ins_h = (s.ins_h << s.hash_shift ^ s.window[str + 1]) & s.hash_mask; //#if MIN_MATCH != 3
75401            //        Call update_hash() MIN_MATCH-3 more times
75402            //#endif
75403
75404            while (s.insert) {
75405              /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */
75406              s.ins_h = (s.ins_h << s.hash_shift ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;
75407              s.prev[str & s.w_mask] = s.head[s.ins_h];
75408              s.head[s.ins_h] = str;
75409              str++;
75410              s.insert--;
75411
75412              if (s.lookahead + s.insert < MIN_MATCH) {
75413                break;
75414              }
75415            }
75416          }
75417          /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,
75418           * but this is not important since only literal bytes will be emitted.
75419           */
75420
75421        } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0);
75422        /* If the WIN_INIT bytes after the end of the current data have never been
75423         * written, then zero those bytes in order to avoid memory check reports of
75424         * the use of uninitialized (or uninitialised as Julian writes) bytes by
75425         * the longest match routines.  Update the high water mark for the next
75426         * time through here.  WIN_INIT is set to MAX_MATCH since the longest match
75427         * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.
75428         */
75429        //  if (s.high_water < s.window_size) {
75430        //    var curr = s.strstart + s.lookahead;
75431        //    var init = 0;
75432        //
75433        //    if (s.high_water < curr) {
75434        //      /* Previous high water mark below current data -- zero WIN_INIT
75435        //       * bytes or up to end of window, whichever is less.
75436        //       */
75437        //      init = s.window_size - curr;
75438        //      if (init > WIN_INIT)
75439        //        init = WIN_INIT;
75440        //      zmemzero(s->window + curr, (unsigned)init);
75441        //      s->high_water = curr + init;
75442        //    }
75443        //    else if (s->high_water < (ulg)curr + WIN_INIT) {
75444        //      /* High water mark at or above current data, but below current data
75445        //       * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up
75446        //       * to end of window, whichever is less.
75447        //       */
75448        //      init = (ulg)curr + WIN_INIT - s->high_water;
75449        //      if (init > s->window_size - s->high_water)
75450        //        init = s->window_size - s->high_water;
75451        //      zmemzero(s->window + s->high_water, (unsigned)init);
75452        //      s->high_water += init;
75453        //    }
75454        //  }
75455        //
75456        //  Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,
75457        //    "not enough room for search");
75458
75459      }
75460      /* ===========================================================================
75461       * Copy without compression as much as possible from the input stream, return
75462       * the current block state.
75463       * This function does not insert new strings in the dictionary since
75464       * uncompressible data is probably not useful. This function is used
75465       * only for the level=0 compression option.
75466       * NOTE: this function should be optimized to avoid extra copying from
75467       * window to pending_buf.
75468       */
75469
75470
75471      function deflate_stored(s, flush) {
75472        /* Stored blocks are limited to 0xffff bytes, pending_buf is limited
75473         * to pending_buf_size, and each stored block has a 5 byte header:
75474         */
75475        var max_block_size = 0xffff;
75476
75477        if (max_block_size > s.pending_buf_size - 5) {
75478          max_block_size = s.pending_buf_size - 5;
75479        }
75480        /* Copy as much as possible from input to output: */
75481
75482
75483        for (;;) {
75484          /* Fill the window as much as possible: */
75485          if (s.lookahead <= 1) {
75486            //Assert(s->strstart < s->w_size+MAX_DIST(s) ||
75487            //  s->block_start >= (long)s->w_size, "slide too late");
75488            //      if (!(s.strstart < s.w_size + (s.w_size - MIN_LOOKAHEAD) ||
75489            //        s.block_start >= s.w_size)) {
75490            //        throw  new Error("slide too late");
75491            //      }
75492            fill_window(s);
75493
75494            if (s.lookahead === 0 && flush === Z_NO_FLUSH) {
75495              return BS_NEED_MORE;
75496            }
75497
75498            if (s.lookahead === 0) {
75499              break;
75500            }
75501            /* flush the current block */
75502
75503          } //Assert(s->block_start >= 0L, "block gone");
75504          //    if (s.block_start < 0) throw new Error("block gone");
75505
75506
75507          s.strstart += s.lookahead;
75508          s.lookahead = 0;
75509          /* Emit a stored block if pending_buf will be full: */
75510
75511          var max_start = s.block_start + max_block_size;
75512
75513          if (s.strstart === 0 || s.strstart >= max_start) {
75514            /* strstart == 0 is possible when wraparound on 16-bit machine */
75515            s.lookahead = s.strstart - max_start;
75516            s.strstart = max_start;
75517            /*** FLUSH_BLOCK(s, 0); ***/
75518
75519            flush_block_only(s, false);
75520
75521            if (s.strm.avail_out === 0) {
75522              return BS_NEED_MORE;
75523            }
75524            /***/
75525
75526          }
75527          /* Flush if we may have to slide, otherwise block_start may become
75528           * negative and the data will be gone:
75529           */
75530
75531
75532          if (s.strstart - s.block_start >= s.w_size - MIN_LOOKAHEAD) {
75533            /*** FLUSH_BLOCK(s, 0); ***/
75534            flush_block_only(s, false);
75535
75536            if (s.strm.avail_out === 0) {
75537              return BS_NEED_MORE;
75538            }
75539            /***/
75540
75541          }
75542        }
75543
75544        s.insert = 0;
75545
75546        if (flush === Z_FINISH) {
75547          /*** FLUSH_BLOCK(s, 1); ***/
75548          flush_block_only(s, true);
75549
75550          if (s.strm.avail_out === 0) {
75551            return BS_FINISH_STARTED;
75552          }
75553          /***/
75554
75555
75556          return BS_FINISH_DONE;
75557        }
75558
75559        if (s.strstart > s.block_start) {
75560          /*** FLUSH_BLOCK(s, 0); ***/
75561          flush_block_only(s, false);
75562
75563          if (s.strm.avail_out === 0) {
75564            return BS_NEED_MORE;
75565          }
75566          /***/
75567
75568        }
75569
75570        return BS_NEED_MORE;
75571      }
75572      /* ===========================================================================
75573       * Compress as much as possible from the input stream, return the current
75574       * block state.
75575       * This function does not perform lazy evaluation of matches and inserts
75576       * new strings in the dictionary only for unmatched strings or for short
75577       * matches. It is used only for the fast compression options.
75578       */
75579
75580
75581      function deflate_fast(s, flush) {
75582        var hash_head;
75583        /* head of the hash chain */
75584
75585        var bflush;
75586        /* set if current block must be flushed */
75587
75588        for (;;) {
75589          /* Make sure that we always have enough lookahead, except
75590           * at the end of the input file. We need MAX_MATCH bytes
75591           * for the next match, plus MIN_MATCH bytes to insert the
75592           * string following the next match.
75593           */
75594          if (s.lookahead < MIN_LOOKAHEAD) {
75595            fill_window(s);
75596
75597            if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {
75598              return BS_NEED_MORE;
75599            }
75600
75601            if (s.lookahead === 0) {
75602              break;
75603              /* flush the current block */
75604            }
75605          }
75606          /* Insert the string window[strstart .. strstart+2] in the
75607           * dictionary, and set hash_head to the head of the hash chain:
75608           */
75609
75610
75611          hash_head = 0
75612          /*NIL*/
75613          ;
75614
75615          if (s.lookahead >= MIN_MATCH) {
75616            /*** INSERT_STRING(s, s.strstart, hash_head); ***/
75617            s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;
75618            hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
75619            s.head[s.ins_h] = s.strstart;
75620            /***/
75621          }
75622          /* Find the longest match, discarding those <= prev_length.
75623           * At this point we have always match_length < MIN_MATCH
75624           */
75625
75626
75627          if (hash_head !== 0
75628          /*NIL*/
75629          && s.strstart - hash_head <= s.w_size - MIN_LOOKAHEAD) {
75630            /* To simplify the code, we prevent matches with the string
75631             * of window index 0 (in particular we have to avoid a match
75632             * of the string with itself at the start of the input file).
75633             */
75634            s.match_length = longest_match(s, hash_head);
75635            /* longest_match() sets match_start */
75636          }
75637
75638          if (s.match_length >= MIN_MATCH) {
75639            // check_match(s, s.strstart, s.match_start, s.match_length); // for debug only
75640
75641            /*** _tr_tally_dist(s, s.strstart - s.match_start,
75642                           s.match_length - MIN_MATCH, bflush); ***/
75643            bflush = trees._tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH);
75644            s.lookahead -= s.match_length;
75645            /* Insert new strings in the hash table only if the match length
75646             * is not too large. This saves time but degrades compression.
75647             */
75648
75649            if (s.match_length <= s.max_lazy_match
75650            /*max_insert_length*/
75651            && s.lookahead >= MIN_MATCH) {
75652              s.match_length--;
75653              /* string at strstart already in table */
75654
75655              do {
75656                s.strstart++;
75657                /*** INSERT_STRING(s, s.strstart, hash_head); ***/
75658
75659                s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;
75660                hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
75661                s.head[s.ins_h] = s.strstart;
75662                /***/
75663
75664                /* strstart never exceeds WSIZE-MAX_MATCH, so there are
75665                 * always MIN_MATCH bytes ahead.
75666                 */
75667              } while (--s.match_length !== 0);
75668
75669              s.strstart++;
75670            } else {
75671              s.strstart += s.match_length;
75672              s.match_length = 0;
75673              s.ins_h = s.window[s.strstart];
75674              /* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */
75675
75676              s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + 1]) & s.hash_mask; //#if MIN_MATCH != 3
75677              //                Call UPDATE_HASH() MIN_MATCH-3 more times
75678              //#endif
75679
75680              /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not
75681               * matter since it will be recomputed at next deflate call.
75682               */
75683            }
75684          } else {
75685            /* No match, output a literal byte */
75686            //Tracevv((stderr,"%c", s.window[s.strstart]));
75687
75688            /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/
75689            bflush = trees._tr_tally(s, 0, s.window[s.strstart]);
75690            s.lookahead--;
75691            s.strstart++;
75692          }
75693
75694          if (bflush) {
75695            /*** FLUSH_BLOCK(s, 0); ***/
75696            flush_block_only(s, false);
75697
75698            if (s.strm.avail_out === 0) {
75699              return BS_NEED_MORE;
75700            }
75701            /***/
75702
75703          }
75704        }
75705
75706        s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1;
75707
75708        if (flush === Z_FINISH) {
75709          /*** FLUSH_BLOCK(s, 1); ***/
75710          flush_block_only(s, true);
75711
75712          if (s.strm.avail_out === 0) {
75713            return BS_FINISH_STARTED;
75714          }
75715          /***/
75716
75717
75718          return BS_FINISH_DONE;
75719        }
75720
75721        if (s.last_lit) {
75722          /*** FLUSH_BLOCK(s, 0); ***/
75723          flush_block_only(s, false);
75724
75725          if (s.strm.avail_out === 0) {
75726            return BS_NEED_MORE;
75727          }
75728          /***/
75729
75730        }
75731
75732        return BS_BLOCK_DONE;
75733      }
75734      /* ===========================================================================
75735       * Same as above, but achieves better compression. We use a lazy
75736       * evaluation for matches: a match is finally adopted only if there is
75737       * no better match at the next window position.
75738       */
75739
75740
75741      function deflate_slow(s, flush) {
75742        var hash_head;
75743        /* head of hash chain */
75744
75745        var bflush;
75746        /* set if current block must be flushed */
75747
75748        var max_insert;
75749        /* Process the input block. */
75750
75751        for (;;) {
75752          /* Make sure that we always have enough lookahead, except
75753           * at the end of the input file. We need MAX_MATCH bytes
75754           * for the next match, plus MIN_MATCH bytes to insert the
75755           * string following the next match.
75756           */
75757          if (s.lookahead < MIN_LOOKAHEAD) {
75758            fill_window(s);
75759
75760            if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {
75761              return BS_NEED_MORE;
75762            }
75763
75764            if (s.lookahead === 0) {
75765              break;
75766            }
75767            /* flush the current block */
75768
75769          }
75770          /* Insert the string window[strstart .. strstart+2] in the
75771           * dictionary, and set hash_head to the head of the hash chain:
75772           */
75773
75774
75775          hash_head = 0
75776          /*NIL*/
75777          ;
75778
75779          if (s.lookahead >= MIN_MATCH) {
75780            /*** INSERT_STRING(s, s.strstart, hash_head); ***/
75781            s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;
75782            hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
75783            s.head[s.ins_h] = s.strstart;
75784            /***/
75785          }
75786          /* Find the longest match, discarding those <= prev_length.
75787           */
75788
75789
75790          s.prev_length = s.match_length;
75791          s.prev_match = s.match_start;
75792          s.match_length = MIN_MATCH - 1;
75793
75794          if (hash_head !== 0
75795          /*NIL*/
75796          && s.prev_length < s.max_lazy_match && s.strstart - hash_head <= s.w_size - MIN_LOOKAHEAD
75797          /*MAX_DIST(s)*/
75798          ) {
75799              /* To simplify the code, we prevent matches with the string
75800               * of window index 0 (in particular we have to avoid a match
75801               * of the string with itself at the start of the input file).
75802               */
75803              s.match_length = longest_match(s, hash_head);
75804              /* longest_match() sets match_start */
75805
75806              if (s.match_length <= 5 && (s.strategy === Z_FILTERED || s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096
75807              /*TOO_FAR*/
75808              )) {
75809                /* If prev_match is also MIN_MATCH, match_start is garbage
75810                 * but we will ignore the current match anyway.
75811                 */
75812                s.match_length = MIN_MATCH - 1;
75813              }
75814            }
75815          /* If there was a match at the previous step and the current
75816           * match is not better, output the previous match:
75817           */
75818
75819
75820          if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) {
75821            max_insert = s.strstart + s.lookahead - MIN_MATCH;
75822            /* Do not insert strings in hash table beyond this. */
75823            //check_match(s, s.strstart-1, s.prev_match, s.prev_length);
75824
75825            /***_tr_tally_dist(s, s.strstart - 1 - s.prev_match,
75826                           s.prev_length - MIN_MATCH, bflush);***/
75827
75828            bflush = trees._tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH);
75829            /* Insert in hash table all strings up to the end of the match.
75830             * strstart-1 and strstart are already inserted. If there is not
75831             * enough lookahead, the last two strings are not inserted in
75832             * the hash table.
75833             */
75834
75835            s.lookahead -= s.prev_length - 1;
75836            s.prev_length -= 2;
75837
75838            do {
75839              if (++s.strstart <= max_insert) {
75840                /*** INSERT_STRING(s, s.strstart, hash_head); ***/
75841                s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;
75842                hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
75843                s.head[s.ins_h] = s.strstart;
75844                /***/
75845              }
75846            } while (--s.prev_length !== 0);
75847
75848            s.match_available = 0;
75849            s.match_length = MIN_MATCH - 1;
75850            s.strstart++;
75851
75852            if (bflush) {
75853              /*** FLUSH_BLOCK(s, 0); ***/
75854              flush_block_only(s, false);
75855
75856              if (s.strm.avail_out === 0) {
75857                return BS_NEED_MORE;
75858              }
75859              /***/
75860
75861            }
75862          } else if (s.match_available) {
75863            /* If there was no match at the previous position, output a
75864             * single literal. If there was a match but the current match
75865             * is longer, truncate the previous match to a single literal.
75866             */
75867            //Tracevv((stderr,"%c", s->window[s->strstart-1]));
75868
75869            /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/
75870            bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]);
75871
75872            if (bflush) {
75873              /*** FLUSH_BLOCK_ONLY(s, 0) ***/
75874              flush_block_only(s, false);
75875              /***/
75876            }
75877
75878            s.strstart++;
75879            s.lookahead--;
75880
75881            if (s.strm.avail_out === 0) {
75882              return BS_NEED_MORE;
75883            }
75884          } else {
75885            /* There is no previous match to compare with, wait for
75886             * the next step to decide.
75887             */
75888            s.match_available = 1;
75889            s.strstart++;
75890            s.lookahead--;
75891          }
75892        } //Assert (flush != Z_NO_FLUSH, "no flush?");
75893
75894
75895        if (s.match_available) {
75896          //Tracevv((stderr,"%c", s->window[s->strstart-1]));
75897
75898          /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/
75899          bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]);
75900          s.match_available = 0;
75901        }
75902
75903        s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1;
75904
75905        if (flush === Z_FINISH) {
75906          /*** FLUSH_BLOCK(s, 1); ***/
75907          flush_block_only(s, true);
75908
75909          if (s.strm.avail_out === 0) {
75910            return BS_FINISH_STARTED;
75911          }
75912          /***/
75913
75914
75915          return BS_FINISH_DONE;
75916        }
75917
75918        if (s.last_lit) {
75919          /*** FLUSH_BLOCK(s, 0); ***/
75920          flush_block_only(s, false);
75921
75922          if (s.strm.avail_out === 0) {
75923            return BS_NEED_MORE;
75924          }
75925          /***/
75926
75927        }
75928
75929        return BS_BLOCK_DONE;
75930      }
75931      /* ===========================================================================
75932       * For Z_RLE, simply look for runs of bytes, generate matches only of distance
75933       * one.  Do not maintain a hash table.  (It will be regenerated if this run of
75934       * deflate switches away from Z_RLE.)
75935       */
75936
75937
75938      function deflate_rle(s, flush) {
75939        var bflush;
75940        /* set if current block must be flushed */
75941
75942        var prev;
75943        /* byte at distance one to match */
75944
75945        var scan, strend;
75946        /* scan goes up to strend for length of run */
75947
75948        var _win = s.window;
75949
75950        for (;;) {
75951          /* Make sure that we always have enough lookahead, except
75952           * at the end of the input file. We need MAX_MATCH bytes
75953           * for the longest run, plus one for the unrolled loop.
75954           */
75955          if (s.lookahead <= MAX_MATCH) {
75956            fill_window(s);
75957
75958            if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) {
75959              return BS_NEED_MORE;
75960            }
75961
75962            if (s.lookahead === 0) {
75963              break;
75964            }
75965            /* flush the current block */
75966
75967          }
75968          /* See how many times the previous byte repeats */
75969
75970
75971          s.match_length = 0;
75972
75973          if (s.lookahead >= MIN_MATCH && s.strstart > 0) {
75974            scan = s.strstart - 1;
75975            prev = _win[scan];
75976
75977            if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) {
75978              strend = s.strstart + MAX_MATCH;
75979
75980              do {
75981                /*jshint noempty:false*/
75982              } while (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && scan < strend);
75983
75984              s.match_length = MAX_MATCH - (strend - scan);
75985
75986              if (s.match_length > s.lookahead) {
75987                s.match_length = s.lookahead;
75988              }
75989            } //Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan");
75990
75991          }
75992          /* Emit match if have run of MIN_MATCH or longer, else emit literal */
75993
75994
75995          if (s.match_length >= MIN_MATCH) {
75996            //check_match(s, s.strstart, s.strstart - 1, s.match_length);
75997
75998            /*** _tr_tally_dist(s, 1, s.match_length - MIN_MATCH, bflush); ***/
75999            bflush = trees._tr_tally(s, 1, s.match_length - MIN_MATCH);
76000            s.lookahead -= s.match_length;
76001            s.strstart += s.match_length;
76002            s.match_length = 0;
76003          } else {
76004            /* No match, output a literal byte */
76005            //Tracevv((stderr,"%c", s->window[s->strstart]));
76006
76007            /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/
76008            bflush = trees._tr_tally(s, 0, s.window[s.strstart]);
76009            s.lookahead--;
76010            s.strstart++;
76011          }
76012
76013          if (bflush) {
76014            /*** FLUSH_BLOCK(s, 0); ***/
76015            flush_block_only(s, false);
76016
76017            if (s.strm.avail_out === 0) {
76018              return BS_NEED_MORE;
76019            }
76020            /***/
76021
76022          }
76023        }
76024
76025        s.insert = 0;
76026
76027        if (flush === Z_FINISH) {
76028          /*** FLUSH_BLOCK(s, 1); ***/
76029          flush_block_only(s, true);
76030
76031          if (s.strm.avail_out === 0) {
76032            return BS_FINISH_STARTED;
76033          }
76034          /***/
76035
76036
76037          return BS_FINISH_DONE;
76038        }
76039
76040        if (s.last_lit) {
76041          /*** FLUSH_BLOCK(s, 0); ***/
76042          flush_block_only(s, false);
76043
76044          if (s.strm.avail_out === 0) {
76045            return BS_NEED_MORE;
76046          }
76047          /***/
76048
76049        }
76050
76051        return BS_BLOCK_DONE;
76052      }
76053      /* ===========================================================================
76054       * For Z_HUFFMAN_ONLY, do not look for matches.  Do not maintain a hash table.
76055       * (It will be regenerated if this run of deflate switches away from Huffman.)
76056       */
76057
76058
76059      function deflate_huff(s, flush) {
76060        var bflush;
76061        /* set if current block must be flushed */
76062
76063        for (;;) {
76064          /* Make sure that we have a literal to write. */
76065          if (s.lookahead === 0) {
76066            fill_window(s);
76067
76068            if (s.lookahead === 0) {
76069              if (flush === Z_NO_FLUSH) {
76070                return BS_NEED_MORE;
76071              }
76072
76073              break;
76074              /* flush the current block */
76075            }
76076          }
76077          /* Output a literal byte */
76078
76079
76080          s.match_length = 0; //Tracevv((stderr,"%c", s->window[s->strstart]));
76081
76082       
vendor: 5,161 bytes, lines 76082-76258
76082   /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/
76083
76084          bflush = trees._tr_tally(s, 0, s.window[s.strstart]);
76085          s.lookahead--;
76086          s.strstart++;
76087
76088          if (bflush) {
76089            /*** FLUSH_BLOCK(s, 0); ***/
76090            flush_block_only(s, false);
76091
76092            if (s.strm.avail_out === 0) {
76093              return BS_NEED_MORE;
76094            }
76095            /***/
76096
76097          }
76098        }
76099
76100        s.insert = 0;
76101
76102        if (flush === Z_FINISH) {
76103          /*** FLUSH_BLOCK(s, 1); ***/
76104          flush_block_only(s, true);
76105
76106          if (s.strm.avail_out === 0) {
76107            return BS_FINISH_STARTED;
76108          }
76109          /***/
76110
76111
76112          return BS_FINISH_DONE;
76113        }
76114
76115        if (s.last_lit) {
76116          /*** FLUSH_BLOCK(s, 0); ***/
76117          flush_block_only(s, false);
76118
76119          if (s.strm.avail_out === 0) {
76120            return BS_NEED_MORE;
76121          }
76122          /***/
76123
76124        }
76125
76126        return BS_BLOCK_DONE;
76127      }
76128      /* Values for max_lazy_match, good_match and max_chain_length, depending on
76129       * the desired pack level (0..9). The values given below have been tuned to
76130       * exclude worst case performance for pathological files. Better values may be
76131       * found for specific files.
76132       */
76133
76134
76135      function Config(good_length, max_lazy, nice_length, max_chain, func) {
76136        this.good_length = good_length;
76137        this.max_lazy = max_lazy;
76138        this.nice_length = nice_length;
76139        this.max_chain = max_chain;
76140        this.func = func;
76141      }
76142
76143      var configuration_table;
76144      configuration_table = [
76145      /*      good lazy nice chain */
76146      new Config(0, 0, 0, 0, deflate_stored),
76147      /* 0 store only */
76148      new Config(4, 4, 8, 4, deflate_fast),
76149      /* 1 max speed, no lazy matches */
76150      new Config(4, 5, 16, 8, deflate_fast),
76151      /* 2 */
76152      new Config(4, 6, 32, 32, deflate_fast),
76153      /* 3 */
76154      new Config(4, 4, 16, 16, deflate_slow),
76155      /* 4 lazy matches */
76156      new Config(8, 16, 32, 32, deflate_slow),
76157      /* 5 */
76158      new Config(8, 16, 128, 128, deflate_slow),
76159      /* 6 */
76160      new Config(8, 32, 128, 256, deflate_slow),
76161      /* 7 */
76162      new Config(32, 128, 258, 1024, deflate_slow),
76163      /* 8 */
76164      new Config(32, 258, 258, 4096, deflate_slow)
76165      /* 9 max compression */
76166      ];
76167      /* ===========================================================================
76168       * Initialize the "longest match" routines for a new zlib stream
76169       */
76170
76171      function lm_init(s) {
76172        s.window_size = 2 * s.w_size;
76173        /*** CLEAR_HASH(s); ***/
76174
76175        zero(s.head); // Fill with NIL (= 0);
76176
76177        /* Set the default configuration parameters:
76178         */
76179
76180        s.max_lazy_match = configuration_table[s.level].max_lazy;
76181        s.good_match = configuration_table[s.level].good_length;
76182        s.nice_match = configuration_table[s.level].nice_length;
76183        s.max_chain_length = configuration_table[s.level].max_chain;
76184        s.strstart = 0;
76185        s.block_start = 0;
76186        s.lookahead = 0;
76187        s.insert = 0;
76188        s.match_length = s.prev_length = MIN_MATCH - 1;
76189        s.match_available = 0;
76190        s.ins_h = 0;
76191      }
76192
76193      function DeflateState() {
76194        this.strm = null;
76195        /* pointer back to this zlib stream */
76196
76197        this.status = 0;
76198        /* as the name implies */
76199
76200        this.pending_buf = null;
76201        /* output still pending */
76202
76203        this.pending_buf_size = 0;
76204        /* size of pending_buf */
76205
76206        this.pending_out = 0;
76207        /* next pending byte to output to the stream */
76208
76209        this.pending = 0;
76210        /* nb of bytes in the pending buffer */
76211
76212        this.wrap = 0;
76213        /* bit 0 true for zlib, bit 1 true for gzip */
76214
76215        this.gzhead = null;
76216        /* gzip header information to write */
76217
76218        this.gzindex = 0;
76219        /* where in extra, name, or comment */
76220
76221        this.method = Z_DEFLATED;
76222        /* can only be DEFLATED */
76223
76224        this.last_flush = -1;
76225        /* value of flush param for previous deflate call */
76226
76227        this.w_size = 0;
76228        /* LZ77 window size (32K by default) */
76229
76230        this.w_bits = 0;
76231        /* log2(w_size)  (8..16) */
76232
76233        this.w_mask = 0;
76234        /* w_size - 1 */
76235
76236        this.window = null;
76237        /* Sliding window. Input bytes are read into the second half of the window,
76238         * and move to the first half later to keep a dictionary of at least wSize
76239         * bytes. With this organization, matches are limited to a distance of
76240         * wSize-MAX_MATCH bytes, but this ensures that IO is always
76241         * performed with a length multiple of the block size.
76242         */
76243
76244        this.window_size = 0;
76245        /* Actual size of window: 2*wSize, except when the user input buffer
76246         * is directly used as sliding window.
76247         */
76248
76249        this.prev = null;
76250        /* Link to older string with same hash index. To limit the size of this
76251         * array to 64K, this link is maintained only for the last 32K strings.
76252         * An index in this array is thus a window index modulo 32K.
76253         */
76254
76255        this.head = null;
76256        /* Heads of the hash chains or NIL. */
76257
76258        this.ins_h = 0;
76259        /* hash index of string to be inserted */
76260
76261        this.hash_size = 0;
76262        /* number of elements in hash table */
76263
76264        this.hash_bits = 0;
76265        /* log2(hash_size) */
76266
76267        this.hash_mask = 0;
76268        /* hash_size-1 */
76269
76270        this.hash_shift = 0;
76271        /* Number of bits by which ins_h must be shifted at each input
76272         * step. It must be such that after MIN_MATCH steps, the oldest
76273         * byte no longer takes part in the hash key, that is:
76274         *   hash_shift * MIN_MATCH >= hash_bits
76275         */
76276
76277        this.block_start = 0;
76278        /* Window position at the beginning of the current output block. Gets
76279         * negative when the window is moved backwards.
76280         */
76281
76282        this.match_length = 0;
76283        /* length of best match */
76284
76285        this.prev_match = 0;
76286        /* previous match */
76287
76288        this.match_available = 0;
76289        /* set if previous match exists */
76290
76291        this.strstart = 0;
76292        /* start of string to insert */
76293
76294        this.match_start = 0;
76295        /* start of matching string */
76296
76297        this.lookahead = 0;
76298        /* number of valid bytes ahead in window */
76299
76300        this.prev_length = 0;
76301        /* Length of the best match at previous step. Matches not greater than this
76302         * are discarded. This is used in the lazy match evaluation.
76303         */
76304
76305        this.max_chain_length = 0;
76306        /* To speed up deflation, hash chains are never searched beyond this
76307         * length.  A higher limit improves compression ratio but degrades the
76308         * speed.
76309         */
76310
76311        this.max_lazy_match = 0;
76312        /* Attempt to find a better match only when the current match is strictly
76313         * smaller than this value. This mechanism is used only for compression
76314         * levels >= 4.
76315         */
76316        // That's alias to max_lazy_match, don't use directly
76317        //this.max_insert_length = 0;
76318
76319        /* Insert new strings in the hash table only if the match length is not
76320         * greater than this length. This saves time but degrades compression.
76321         * max_insert_length is used only for compression levels <= 3.
76322         */
76323
76324        this.level = 0;
76325        /* compression level (1..9) */
76326
76327        this.strategy = 0;
76328        /* favor or force Huffman coding*/
76329
76330        this.good_match = 0;
76331        /* Use a faster search when the previous match is longer than this */
76332
76333        this.nice_match = 0;
76334        /* Stop searching when current match exceeds this */
76335
76336        /* used by trees.c: */
76337
76338        /* Didn't use ct_data typedef below to suppress compiler warning */
76339        // struct ct_data_s dyn_ltree[HEAP_SIZE];   /* literal and length tree */
76340        // struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */
76341        // struct ct_data_s bl_tree[2*BL_CODES+1];  /* Huffman tree for bit lengths */
76342        // Use flat array of DOUBLE size, with interleaved fata,
76343        // because JS does not support effective
76344
76345        this.dyn_ltree = new utils.Buf16(HEAP_SIZE * 2);
76346        this.dyn_dtree = new utils.Buf16((2 * D_CODES + 1) * 2);
76347        this.bl_tree = new utils.Buf16((2 * BL_CODES + 1) * 2);
76348        zero(this.dyn_ltree);
76349        zero(this.dyn_dtree);
76350        zero(this.bl_tree);
76351        this.l_desc = null;
76352        /* desc. for literal tree */
76353
76354        this.d_desc = null;
76355        /* desc. for distance tree */
76356
76357        this.bl_desc = null;
76358        /* desc. for bit length tree */
76359        //ush bl_count[MAX_BITS+1];
76360
76361        this.bl_count = new utils.Buf16(MAX_BITS + 1);
76362        /* number of codes at each bit length for an optimal tree */
76363        //int heap[2*L_CODES+1];      /* heap used to build the Huffman trees */
76364
76365        this.heap = new utils.Buf16(2 * L_CODES + 1);
76366        /* heap used to build the Huffman trees */
76367
76368        zero(this.heap);
76369        this.heap_len = 0;
76370        /* number of elements in the heap */
76371
76372        this.heap_max = 0;
76373        /* element of largest frequency */
76374
76375        /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.
76376         * The same heap array is used to build all trees.
76377         */
76378
76379        this.depth = new utils.Buf16(2 * L_CODES + 1); //uch depth[2*L_CODES+1];
76380
76381        zero(this.depth);
76382        /* Depth of each subtree used as tie breaker for trees of equal frequency
76383         */
76384
76385        this.l_buf = 0;
76386        /* buffer index for literals or lengths */
76387
76388        this.lit_bufsize = 0;
76389        /* Size of match buffer for literals/lengths.  There are 4 reasons for
76390         * limiting lit_bufsize to 64K:
76391         *   - frequencies can be kept in 16 bit counters
76392         *   - if compression is not successful for the first block, all input
76393         *     data is still in the window so we can still emit a stored block even
76394         *     when input comes from standard input.  (This can also be done for
76395         *     all blocks if lit_bufsize is not greater than 32K.)
76396         *   - if compression is not successful for a file smaller than 64K, we can
76397         *     even emit a stored file instead of a stored block (saving 5 bytes).
76398         *     This is applicable only for zip (not gzip or zlib).
76399         *   - creating new Huffman trees less frequently may not provide fast
76400         *     adaptation to changes in the input data statistics. (Take for
76401         *     example a binary file with poorly compressible code followed by
vendor: 21,548 bytes, lines 76402-77091
76402         *     a highly compressible string table.) Smaller buffer sizes give
76403         *     fast adaptation but have of course the overhead of transmitting
76404         *     trees more frequently.
76405         *   - I can't count above 4
76406         */
76407
76408        this.last_lit = 0;
76409        /* running index in l_buf */
76410
76411        this.d_buf = 0;
76412        /* Buffer index for distances. To simplify the code, d_buf and l_buf have
76413         * the same number of elements. To use different lengths, an extra flag
76414         * array would be necessary.
76415         */
76416
76417        this.opt_len = 0;
76418        /* bit length of current block with optimal trees */
76419
76420        this.static_len = 0;
76421        /* bit length of current block with static trees */
76422
76423        this.matches = 0;
76424        /* number of string matches in current block */
76425
76426        this.insert = 0;
76427        /* bytes at end of window left to insert */
76428
76429        this.bi_buf = 0;
76430        /* Output buffer. bits are inserted starting at the bottom (least
76431         * significant bits).
76432         */
76433
76434        this.bi_valid = 0;
76435        /* Number of valid bits in bi_buf.  All bits above the last valid bit
76436         * are always zero.
76437         */
76438        // Used for window memory init. We safely ignore it for JS. That makes
76439        // sense only for pointers and memory check tools.
76440        //this.high_water = 0;
76441
76442        /* High water mark offset in window for initialized bytes -- bytes above
76443         * this are set to zero in order to avoid memory check warnings when
76444         * longest match routines access bytes past the input.  This is then
76445         * updated to the new high water mark.
76446         */
76447      }
76448
76449      function deflateResetKeep(strm) {
76450        var s;
76451
76452        if (!strm || !strm.state) {
76453          return err(strm, Z_STREAM_ERROR);
76454        }
76455
76456        strm.total_in = strm.total_out = 0;
76457        strm.data_type = Z_UNKNOWN;
76458        s = strm.state;
76459        s.pending = 0;
76460        s.pending_out = 0;
76461
76462        if (s.wrap < 0) {
76463          s.wrap = -s.wrap;
76464          /* was made negative by deflate(..., Z_FINISH); */
76465        }
76466
76467        s.status = s.wrap ? INIT_STATE : BUSY_STATE;
76468        strm.adler = s.wrap === 2 ? 0 // crc32(0, Z_NULL, 0)
76469        : 1; // adler32(0, Z_NULL, 0)
76470
76471        s.last_flush = Z_NO_FLUSH;
76472
76473        trees._tr_init(s);
76474
76475        return Z_OK;
76476      }
76477
76478      function deflateReset(strm) {
76479        var ret = deflateResetKeep(strm);
76480
76481        if (ret === Z_OK) {
76482          lm_init(strm.state);
76483        }
76484
76485        return ret;
76486      }
76487
76488      function deflateSetHeader(strm, head) {
76489        if (!strm || !strm.state) {
76490          return Z_STREAM_ERROR;
76491        }
76492
76493        if (strm.state.wrap !== 2) {
76494          return Z_STREAM_ERROR;
76495        }
76496
76497        strm.state.gzhead = head;
76498        return Z_OK;
76499      }
76500
76501      function deflateInit2(strm, level, method, windowBits, memLevel, strategy) {
76502        if (!strm) {
76503          // === Z_NULL
76504          return Z_STREAM_ERROR;
76505        }
76506
76507        var wrap = 1;
76508
76509        if (level === Z_DEFAULT_COMPRESSION) {
76510          level = 6;
76511        }
76512
76513        if (windowBits < 0) {
76514          /* suppress zlib wrapper */
76515          wrap = 0;
76516          windowBits = -windowBits;
76517        } else if (windowBits > 15) {
76518          wrap = 2;
76519          /* write gzip wrapper instead */
76520
76521          windowBits -= 16;
76522        }
76523
76524        if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED || windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) {
76525          return err(strm, Z_STREAM_ERROR);
76526        }
76527
76528        if (windowBits === 8) {
76529          windowBits = 9;
76530        }
76531        /* until 256-byte window bug fixed */
76532
76533
76534        var s = new DeflateState();
76535        strm.state = s;
76536        s.strm = strm;
76537        s.wrap = wrap;
76538        s.gzhead = null;
76539        s.w_bits = windowBits;
76540        s.w_size = 1 << s.w_bits;
76541        s.w_mask = s.w_size - 1;
76542        s.hash_bits = memLevel + 7;
76543        s.hash_size = 1 << s.hash_bits;
76544        s.hash_mask = s.hash_size - 1;
76545        s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH);
76546        s.window = new utils.Buf8(s.w_size * 2);
76547        s.head = new utils.Buf16(s.hash_size);
76548        s.prev = new utils.Buf16(s.w_size); // Don't need mem init magic for JS.
76549        //s.high_water = 0;  /* nothing written to s->window yet */
76550
76551        s.lit_bufsize = 1 << memLevel + 6;
76552        /* 16K elements by default */
76553
76554        s.pending_buf_size = s.lit_bufsize * 4; //overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);
76555        //s->pending_buf = (uchf *) overlay;
76556
76557        s.pending_buf = new utils.Buf8(s.pending_buf_size); // It is offset from `s.pending_buf` (size is `s.lit_bufsize * 2`)
76558        //s->d_buf = overlay + s->lit_bufsize/sizeof(ush);
76559
76560        s.d_buf = 1 * s.lit_bufsize; //s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;
76561
76562        s.l_buf = (1 + 2) * s.lit_bufsize;
76563        s.level = level;
76564        s.strategy = strategy;
76565        s.method = method;
76566        return deflateReset(strm);
76567      }
76568
76569      function deflateInit(strm, level) {
76570        return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);
76571      }
76572
76573      function deflate(strm, flush) {
76574        var old_flush, s;
76575        var beg, val; // for gzip header write only
76576
76577        if (!strm || !strm.state || flush > Z_BLOCK || flush < 0) {
76578          return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR;
76579        }
76580
76581        s = strm.state;
76582
76583        if (!strm.output || !strm.input && strm.avail_in !== 0 || s.status === FINISH_STATE && flush !== Z_FINISH) {
76584          return err(strm, strm.avail_out === 0 ? Z_BUF_ERROR : Z_STREAM_ERROR);
76585        }
76586
76587        s.strm = strm;
76588        /* just in case */
76589
76590        old_flush = s.last_flush;
76591        s.last_flush = flush;
76592        /* Write the header */
76593
76594        if (s.status === INIT_STATE) {
76595          if (s.wrap === 2) {
76596            // GZIP header
76597            strm.adler = 0; //crc32(0L, Z_NULL, 0);
76598
76599            put_byte(s, 31);
76600            put_byte(s, 139);
76601            put_byte(s, 8);
76602
76603            if (!s.gzhead) {
76604              // s->gzhead == Z_NULL
76605              put_byte(s, 0);
76606              put_byte(s, 0);
76607              put_byte(s, 0);
76608              put_byte(s, 0);
76609              put_byte(s, 0);
76610              put_byte(s, s.level === 9 ? 2 : s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? 4 : 0);
76611              put_byte(s, OS_CODE);
76612              s.status = BUSY_STATE;
76613            } else {
76614              put_byte(s, (s.gzhead.text ? 1 : 0) + (s.gzhead.hcrc ? 2 : 0) + (!s.gzhead.extra ? 0 : 4) + (!s.gzhead.name ? 0 : 8) + (!s.gzhead.comment ? 0 : 16));
76615              put_byte(s, s.gzhead.time & 0xff);
76616              put_byte(s, s.gzhead.time >> 8 & 0xff);
76617              put_byte(s, s.gzhead.time >> 16 & 0xff);
76618              put_byte(s, s.gzhead.time >> 24 & 0xff);
76619              put_byte(s, s.level === 9 ? 2 : s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? 4 : 0);
76620              put_byte(s, s.gzhead.os & 0xff);
76621
76622              if (s.gzhead.extra && s.gzhead.extra.length) {
76623                put_byte(s, s.gzhead.extra.length & 0xff);
76624                put_byte(s, s.gzhead.extra.length >> 8 & 0xff);
76625              }
76626
76627              if (s.gzhead.hcrc) {
76628                strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0);
76629              }
76630
76631              s.gzindex = 0;
76632              s.status = EXTRA_STATE;
76633            }
76634          } else // DEFLATE header
76635            {
76636              var header = Z_DEFLATED + (s.w_bits - 8 << 4) << 8;
76637              var level_flags = -1;
76638
76639              if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) {
76640                level_flags = 0;
76641              } else if (s.level < 6) {
76642                level_flags = 1;
76643              } else if (s.level === 6) {
76644                level_flags = 2;
76645              } else {
76646                level_flags = 3;
76647              }
76648
76649              header |= level_flags << 6;
76650
76651              if (s.strstart !== 0) {
76652                header |= PRESET_DICT;
76653              }
76654
76655              header += 31 - header % 31;
76656              s.status = BUSY_STATE;
76657              putShortMSB(s, header);
76658              /* Save the adler32 of the preset dictionary: */
76659
76660              if (s.strstart !== 0) {
76661                putShortMSB(s, strm.adler >>> 16);
76662                putShortMSB(s, strm.adler & 0xffff);
76663              }
76664
76665              strm.adler = 1; // adler32(0L, Z_NULL, 0);
76666            }
76667        } //#ifdef GZIP
76668
76669
76670        if (s.status === EXTRA_STATE) {
76671          if (s.gzhead.extra
76672          /* != Z_NULL*/
76673          ) {
76674              beg = s.pending;
76675              /* start of bytes to update crc */
76676
76677              while (s.gzindex < (s.gzhead.extra.length & 0xffff)) {
76678                if (s.pending === s.pending_buf_size) {
76679                  if (s.gzhead.hcrc && s.pending > beg) {
76680                    strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
76681                  }
76682
76683                  flush_pending(strm);
76684                  beg = s.pending;
76685
76686                  if (s.pending === s.pending_buf_size) {
76687                    break;
76688                  }
76689                }
76690
76691                put_byte(s, s.gzhead.extra[s.gzindex] & 0xff);
76692                s.gzindex++;
76693              }
76694
76695              if (s.gzhead.hcrc && s.pending > beg) {
76696                strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
76697              }
76698
76699              if (s.gzindex === s.gzhead.extra.length) {
76700                s.gzindex = 0;
76701                s.status = NAME_STATE;
76702              }
76703            } else {
76704            s.status = NAME_STATE;
76705          }
76706        }
76707
76708        if (s.status === NAME_STATE) {
76709          if (s.gzhead.name
76710          /* != Z_NULL*/
76711          ) {
76712              beg = s.pending;
76713              /* start of bytes to update crc */
76714              //int val;
76715
76716              do {
76717                if (s.pending === s.pending_buf_size) {
76718                  if (s.gzhead.hcrc && s.pending > beg) {
76719                    strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
76720                  }
76721
76722                  flush_pending(strm);
76723                  beg = s.pending;
76724
76725                  if (s.pending === s.pending_buf_size) {
76726                    val = 1;
76727                    break;
76728                  }
76729                } // JS specific: little magic to add zero terminator to end of string
76730
76731
76732                if (s.gzindex < s.gzhead.name.length) {
76733                  val = s.gzhead.name.charCodeAt(s.gzindex++) & 0xff;
76734                } else {
76735                  val = 0;
76736                }
76737
76738                put_byte(s, val);
76739              } while (val !== 0);
76740
76741              if (s.gzhead.hcrc && s.pending > beg) {
76742                strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
76743              }
76744
76745              if (val === 0) {
76746                s.gzindex = 0;
76747                s.status = COMMENT_STATE;
76748              }
76749            } else {
76750            s.status = COMMENT_STATE;
76751          }
76752        }
76753
76754        if (s.status === COMMENT_STATE) {
76755          if (s.gzhead.comment
76756          /* != Z_NULL*/
76757          ) {
76758              beg = s.pending;
76759              /* start of bytes to update crc */
76760              //int val;
76761
76762              do {
76763                if (s.pending === s.pending_buf_size) {
76764                  if (s.gzhead.hcrc && s.pending > beg) {
76765                    strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
76766                  }
76767
76768                  flush_pending(strm);
76769                  beg = s.pending;
76770
76771                  if (s.pending === s.pending_buf_size) {
76772                    val = 1;
76773                    break;
76774                  }
76775                } // JS specific: little magic to add zero terminator to end of string
76776
76777
76778                if (s.gzindex < s.gzhead.comment.length) {
76779                  val = s.gzhead.comment.charCodeAt(s.gzindex++) & 0xff;
76780                } else {
76781                  val = 0;
76782                }
76783
76784                put_byte(s, val);
76785              } while (val !== 0);
76786
76787              if (s.gzhead.hcrc && s.pending > beg) {
76788                strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
76789              }
76790
76791              if (val === 0) {
76792                s.status = HCRC_STATE;
76793              }
76794            } else {
76795            s.status = HCRC_STATE;
76796          }
76797        }
76798
76799        if (s.status === HCRC_STATE) {
76800          if (s.gzhead.hcrc) {
76801            if (s.pending + 2 > s.pending_buf_size) {
76802              flush_pending(strm);
76803            }
76804
76805            if (s.pending + 2 <= s.pending_buf_size) {
76806              put_byte(s, strm.adler & 0xff);
76807              put_byte(s, strm.adler >> 8 & 0xff);
76808              strm.adler = 0; //crc32(0L, Z_NULL, 0);
76809
76810              s.status = BUSY_STATE;
76811            }
76812          } else {
76813            s.status = BUSY_STATE;
76814          }
76815        } //#endif
76816
76817        /* Flush as much pending output as possible */
76818
76819
76820        if (s.pending !== 0) {
76821          flush_pending(strm);
76822
76823          if (strm.avail_out === 0) {
76824            /* Since avail_out is 0, deflate will be called again with
76825             * more output space, but possibly with both pending and
76826             * avail_in equal to zero. There won't be anything to do,
76827             * but this is not an error situation so make sure we
76828             * return OK instead of BUF_ERROR at next call of deflate:
76829             */
76830            s.last_flush = -1;
76831            return Z_OK;
76832          }
76833          /* Make sure there is something to do and avoid duplicate consecutive
76834           * flushes. For repeated and useless calls with Z_FINISH, we keep
76835           * returning Z_STREAM_END instead of Z_BUF_ERROR.
76836           */
76837
76838        } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) && flush !== Z_FINISH) {
76839          return err(strm, Z_BUF_ERROR);
76840        }
76841        /* User must not provide more input after the first FINISH: */
76842
76843
76844        if (s.status === FINISH_STATE && strm.avail_in !== 0) {
76845          return err(strm, Z_BUF_ERROR);
76846        }
76847        /* Start a new block or continue the current one.
76848         */
76849
76850
76851        if (strm.avail_in !== 0 || s.lookahead !== 0 || flush !== Z_NO_FLUSH && s.status !== FINISH_STATE) {
76852          var bstate = s.strategy === Z_HUFFMAN_ONLY ? deflate_huff(s, flush) : s.strategy === Z_RLE ? deflate_rle(s, flush) : configuration_table[s.level].func(s, flush);
76853
76854          if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) {
76855            s.status = FINISH_STATE;
76856          }
76857
76858          if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) {
76859            if (strm.avail_out === 0) {
76860              s.last_flush = -1;
76861              /* avoid BUF_ERROR next call, see above */
76862            }
76863
76864            return Z_OK;
76865            /* If flush != Z_NO_FLUSH && avail_out == 0, the next call
76866             * of deflate should use the same flush parameter to make sure
76867             * that the flush is complete. So we don't have to output an
76868             * empty block here, this will be done at next call. This also
76869             * ensures that for a very small output buffer, we emit at most
76870             * one empty block.
76871             */
76872          }
76873
76874          if (bstate === BS_BLOCK_DONE) {
76875            if (flush === Z_PARTIAL_FLUSH) {
76876              trees._tr_align(s);
76877            } else if (flush !== Z_BLOCK) {
76878              /* FULL_FLUSH or SYNC_FLUSH */
76879              trees._tr_stored_block(s, 0, 0, false);
76880              /* For a full flush, this empty block will be recognized
76881               * as a special marker by inflate_sync().
76882               */
76883
76884
76885              if (flush === Z_FULL_FLUSH) {
76886                /*** CLEAR_HASH(s); ***/
76887
76888                /* forget history */
76889                zero(s.head); // Fill with NIL (= 0);
76890
76891                if (s.lookahead === 0) {
76892                  s.strstart = 0;
76893                  s.block_start = 0;
76894                  s.insert = 0;
76895                }
76896              }
76897            }
76898
76899            flush_pending(strm);
76900
76901            if (strm.avail_out === 0) {
76902              s.last_flush = -1;
76903              /* avoid BUF_ERROR at next call, see above */
76904
76905              return Z_OK;
76906            }
76907          }
76908        } //Assert(strm->avail_out > 0, "bug2");
76909        //if (strm.avail_out <= 0) { throw new Error("bug2");}
76910
76911
76912        if (flush !== Z_FINISH) {
76913          return Z_OK;
76914        }
76915
76916        if (s.wrap <= 0) {
76917          return Z_STREAM_END;
76918        }
76919        /* Write the trailer */
76920
76921
76922        if (s.wrap === 2) {
76923          put_byte(s, strm.adler & 0xff);
76924          put_byte(s, strm.adler >> 8 & 0xff);
76925          put_byte(s, strm.adler >> 16 & 0xff);
76926          put_byte(s, strm.adler >> 24 & 0xff);
76927          put_byte(s, strm.total_in & 0xff);
76928          put_byte(s, strm.total_in >> 8 & 0xff);
76929          put_byte(s, strm.total_in >> 16 & 0xff);
76930          put_byte(s, strm.total_in >> 24 & 0xff);
76931        } else {
76932          putShortMSB(s, strm.adler >>> 16);
76933          putShortMSB(s, strm.adler & 0xffff);
76934        }
76935
76936        flush_pending(strm);
76937        /* If avail_out is zero, the application will call deflate again
76938         * to flush the rest.
76939         */
76940
76941        if (s.wrap > 0) {
76942          s.wrap = -s.wrap;
76943        }
76944        /* write the trailer only once! */
76945
76946
76947        return s.pending !== 0 ? Z_OK : Z_STREAM_END;
76948      }
76949
76950      function deflateEnd(strm) {
76951        var status;
76952
76953        if (!strm
76954        /*== Z_NULL*/
76955        || !strm.state
76956        /*== Z_NULL*/
76957        ) {
76958            return Z_STREAM_ERROR;
76959          }
76960
76961        status = strm.state.status;
76962
76963        if (status !== INIT_STATE && status !== EXTRA_STATE && status !== NAME_STATE && status !== COMMENT_STATE && status !== HCRC_STATE && status !== BUSY_STATE && status !== FINISH_STATE) {
76964          return err(strm, Z_STREAM_ERROR);
76965        }
76966
76967        strm.state = null;
76968        return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK;
76969      }
76970      /* =========================================================================
76971       * Initializes the compression dictionary from the given byte
76972       * sequence without producing any compressed output.
76973       */
76974
76975
76976      function deflateSetDictionary(strm, dictionary) {
76977        var dictLength = dictionary.length;
76978        var s;
76979        var str, n;
76980        var wrap;
76981        var avail;
76982        var next;
76983        var input;
76984        var tmpDict;
76985
76986        if (!strm
76987        /*== Z_NULL*/
76988        || !strm.state
76989        /*== Z_NULL*/
76990        ) {
76991            return Z_STREAM_ERROR;
76992          }
76993
76994        s = strm.state;
76995        wrap = s.wrap;
76996
76997        if (wrap === 2 || wrap === 1 && s.status !== INIT_STATE || s.lookahead) {
76998          return Z_STREAM_ERROR;
76999        }
77000        /* when using zlib wrappers, compute Adler-32 for provided dictionary */
77001
77002
77003        if (wrap === 1) {
77004          /* adler32(strm->adler, dictionary, dictLength); */
77005          strm.adler = adler32(strm.adler, dictionary, dictLength, 0);
77006        }
77007
77008        s.wrap = 0;
77009        /* avoid computing Adler-32 in read_buf */
77010
77011        /* if dictionary would fill window, just replace the history */
77012
77013        if (dictLength >= s.w_size) {
77014          if (wrap === 0) {
77015            /* already empty otherwise */
77016
77017            /*** CLEAR_HASH(s); ***/
77018            zero(s.head); // Fill with NIL (= 0);
77019
77020            s.strstart = 0;
77021            s.block_start = 0;
77022            s.insert = 0;
77023          }
77024          /* use the tail */
77025          // dictionary = dictionary.slice(dictLength - s.w_size);
77026
77027
77028          tmpDict = new utils.Buf8(s.w_size);
77029          utils.arraySet(tmpDict, dictionary, dictLength - s.w_size, s.w_size, 0);
77030          dictionary = tmpDict;
77031          dictLength = s.w_size;
77032        }
77033        /* insert dictionary into window and hash */
77034
77035
77036        avail = strm.avail_in;
77037        next = strm.next_in;
77038        input = strm.input;
77039        strm.avail_in = dictLength;
77040        strm.next_in = 0;
77041        strm.input = dictionary;
77042        fill_window(s);
77043
77044        while (s.lookahead >= MIN_MATCH) {
77045          str = s.strstart;
77046          n = s.lookahead - (MIN_MATCH - 1);
77047
77048          do {
77049            /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */
77050            s.ins_h = (s.ins_h << s.hash_shift ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;
77051            s.prev[str & s.w_mask] = s.head[s.ins_h];
77052            s.head[s.ins_h] = str;
77053            str++;
77054          } while (--n);
77055
77056          s.strstart = str;
77057          s.lookahead = MIN_MATCH - 1;
77058          fill_window(s);
77059        }
77060
77061        s.strstart += s.lookahead;
77062        s.block_start = s.strstart;
77063        s.insert = s.lookahead;
77064        s.lookahead = 0;
77065        s.match_length = s.prev_length = MIN_MATCH - 1;
77066        s.match_available = 0;
77067        strm.next_in = next;
77068        strm.input = input;
77069        strm.avail_in = avail;
77070        s.wrap = wrap;
77071        return Z_OK;
77072      }
77073
77074      exports.deflateInit = deflateInit;
77075      exports.deflateInit2 = deflateInit2;
77076      exports.deflateReset = deflateReset;
77077      exports.deflateResetKeep = deflateResetKeep;
77078      exports.deflateSetHeader = deflateSetHeader;
77079      exports.deflate = deflate;
77080      exports.deflateEnd = deflateEnd;
77081      exports.deflateSetDictionary = deflateSetDictionary;
77082      exports.deflateInfo = 'pako deflate (from Nodeca project)';
77083      /* Not implemented
77084      exports.deflateBound = deflateBound;
77085      exports.deflateCopy = deflateCopy;
77086      exports.deflateParams = deflateParams;
77087      exports.deflatePending = deflatePending;
77088      exports.deflatePrime = deflatePrime;
77089      exports.deflateTune = deflateTune;
77090      */
77091    }, {
77092      "../utils/common": 419,
77093      "./adler32": 421,
77094      "./crc32": 423,
77095      "./messages": 429,
77096      "./trees": 430
77097    }],
77098    425: [function (require, module, exports) {
77099      'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler
77100      // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
77101      //
77102      // This software is provided 'as-is', without any express or implied
77103      // warranty. In no event will the authors be held liable for any damages
77104      // arising from the use of this software.
77105      //
77106      // Permission is granted to anyone to use this software for any purpose,
77107      // including commercial applications, and to alter it and redistribute it
77108      // freely, subject to the following restrictions:
77109      //
77110      // 1. The origin of this software must not be misrepresented; you must not
77111      //   claim that you wrote the original software. If you use this software
77112      //   in a product, an acknowledgment in the product documentation would be
77113      //   appreciated but is not required.
77114      // 2. Altered source versions must be plainly marked as such, and must not be
77115      //   misrepresented as being the original software.
77116      // 3. This notice may not be removed or altered from any source distribution.
77117
77118      function GZheader() {
77119        /* true if compressed data believed to be text */
77120        this.text = 0;
77121        /* modification time */
77122
77123        this.time = 0;
77124        /* extra flags (not used when writing a gzip file) */
77125
77126        this.xflags = 0;
77127        /* operating system */
77128
77129        this.os = 0;
77130        /* pointer to extra field or Z_NULL if none */
77131
77132        this.extra = null;
77133        /* extra field length (valid if extra != Z_NULL) */
77134
77135        this.extra_len = 0; // Actually, we don't need it in JS,
77136        // but leave for few code modifications
77137        //
77138        // Setup limits is not necessary because in js we should not preallocate memory
77139        // for inflate use constant limit in 65536 bytes
77140        //
77141
77142        /* space at extra (only when reading header) */
77143        // this.extra_max  = 0;
77144
77145        /* pointer to zero-terminated file name or Z_NULL */
77146
77147        this.name = '';
77148        /* space at name (only when reading header) */
77149        // this.name_max   = 0;
77150
77151        /* pointer to zero-terminated comment or Z_NULL */
77152
77153        this.comment = '';
77154        /* space at comment (only when reading header) */
77155        // this.comm_max   = 0;
77156
77157        /* true if there was or will be a header crc */
77158
77159        this.hcrc = 0;
77160        /* true when done reading gzip header (not used when writing a gzip file) */
77161
77162        this.done = false;
77163      }
77164
77165      module.exports = GZheader;
77166    }, {}],
77167    426: [function (require, module, exports) {
77168      'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler
77169      // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
77170      //
77171      // This software is provided 'as-is', without any express or implied
77172      // warranty. In no event will the authors be held liable for any damages
77173      // arising from the use of this software.
77174      //
77175      // Permission is granted to anyone to use this software for any purpose,
77176      // including commercial applications, and to alter it and redistribute it
77177      // freely, subject to the following restrictions:
77178      //
77179      // 1. The origin of this software must not be misrepresented; you must not
77180      //   claim that you wrote the original software. If you use this software
77181      //   in a product, an acknowledgment in the product documentation would be
77182      //   appreciated but is not required.
77183      // 2. Altered source versions must be plainly marked as such, and must not be
77184      //   misrepresented as being the original software.
77185      // 3. This notice may not be removed or altered from any source distribution.
77186      // See state defs from inflate.js
77187
77188      var BAD = 30;
77189      /* got a data error -- remain here until reset */
77190
77191      var TYPE = 12;
77192      /* i: waiting for type bits, including last-flag bit */
77193
77194      /*
77195         Decode literal, length, and distance codes and write out the resulting
77196         literal and match bytes until either not enough input or output is
77197         available, an end-of-block is encountered, or a data error is encountered.
77198         When large enough input and output buffers are supplied to inflate(), for
77199         example, a 16K input buffer and a 64K output buffer, more than 95% of the
77200         inflate execution time is spent in this routine.
77201      
77202         Entry assumptions:
77203      
77204              state.mode === LEN
77205              strm.avail_in >= 6
77206              strm.avail_out >= 258
77207              start >= strm.avail_out
77208              state.bits < 8
77209      
77210         On return, state.mode is one of:
77211      
77212              LEN -- ran out of enough output space or enough available input
77213              TYPE -- reached end of block code, inflate() to interpret next block
77214              BAD -- error in block data
77215      
77216         Notes:
77217      
77218          - The maximum input bits used by a length/distance pair is 15 bits for the
77219            length code, 5 bits for the length extra, 15 bits for the distance code,
77220            and 13 bits for the distance extra.  This totals 48 bits, or six bytes.
77221            Therefore if strm.avail_in >= 6, then there is enough input to avoid
77222            checking for available input while decoding.
77223      
77224          - The maximum bytes that a single length/distance pair can output is 258
77225            bytes, which is the maximum length that can be coded.  inflate_fast()
77226            requires strm.avail_out >= 258 for each loop to avoid checking for
77227            output space.
77228       */
77229
77230      module.exports = function inflate_fast(strm, start) {
77231        var state;
77232
77233        var _in;
77234        /* local strm.input */
77235
77236
77237        var last;
77238        /* have enough input while in < last */
77239
77240        var _out;
77241        /* local strm.output */
77242
77243
77244        var beg;
77245        /* inflate()'s initial strm.output */
77246
77247        var end;
77248        /* while out < end, enough space available */
77249        //#ifdef INFLATE_STRICT
77250
77251        var dmax;
77252        /* maximum distance from zlib header */
77253        //#endif
77254
77255        var wsize;
77256        /* window size or zero if not using window */
77257
77258        var whave;
77259        /* valid bytes in the window */
77260
77261        var wnext;
77262        /* window write index */
77263        // Use `s_window` instead `window`, avoid conflict with instrumentation tools
77264
77265        var s_window;
77266        /* allocated sliding window, if wsize != 0 */
77267
77268        var hold;
77269        /* local strm.hold */
77270
77271        var bits;
77272        /* local strm.bits */
77273
77274        var lcode;
77275        /* local strm.lencode */
77276
77277        var dcode;
vendor: 4,614 bytes, lines 77278-77441
77278        /* local strm.distcode */
77279
77280        var lmask;
77281        /* mask for first level of length codes */
77282
77283        var dmask;
77284        /* mask for first level of distance codes */
77285
77286        var here;
77287        /* retrieved table entry */
77288
77289        var op;
77290        /* code bits, operation, extra bits, or */
77291
77292        /*  window position, window bytes to copy */
77293
77294        var len;
77295        /* match length, unused bytes */
77296
77297        var dist;
77298        /* match distance */
77299
77300        var from;
77301        /* where to copy match from */
77302
77303        var from_source;
77304        var input, output; // JS specific, because we have no pointers
77305
77306        /* copy state to local variables */
77307
77308        state = strm.state; //here = state.here;
77309
77310        _in = strm.next_in;
77311        input = strm.input;
77312        last = _in + (strm.avail_in - 5);
77313        _out = strm.next_out;
77314        output = strm.output;
77315        beg = _out - (start - strm.avail_out);
77316        end = _out + (strm.avail_out - 257); //#ifdef INFLATE_STRICT
77317
77318        dmax = state.dmax; //#endif
77319
77320        wsize = state.wsize;
77321        whave = state.whave;
77322        wnext = state.wnext;
77323        s_window = state.window;
77324        hold = state.hold;
77325        bits = state.bits;
77326        lcode = state.lencode;
77327        dcode = state.distcode;
77328        lmask = (1 << state.lenbits) - 1;
77329        dmask = (1 << state.distbits) - 1;
77330        /* decode literals and length/distances until end-of-block or not enough
77331           input data or output space */
77332
77333        top: do {
77334          if (bits < 15) {
77335            hold += input[_in++] << bits;
77336            bits += 8;
77337            hold += input[_in++] << bits;
77338            bits += 8;
77339          }
77340
77341          here = lcode[hold & lmask];
77342
77343          dolen: for (;;) {
77344            // Goto emulation
77345            op = here >>> 24
77346            /*here.bits*/
77347            ;
77348            hold >>>= op;
77349            bits -= op;
77350            op = here >>> 16 & 0xff
77351            /*here.op*/
77352            ;
77353
77354            if (op === 0) {
77355              /* literal */
77356              //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
77357              //        "inflate:         literal '%c'\n" :
77358              //        "inflate:         literal 0x%02x\n", here.val));
77359              output[_out++] = here & 0xffff
77360              /*here.val*/
77361              ;
77362            } else if (op & 16) {
77363              /* length base */
77364              len = here & 0xffff
77365              /*here.val*/
77366              ;
77367              op &= 15;
77368              /* number of extra bits */
77369
77370              if (op) {
77371                if (bits < op) {
77372                  hold += input[_in++] << bits;
77373                  bits += 8;
77374                }
77375
77376                len += hold & (1 << op) - 1;
77377                hold >>>= op;
77378                bits -= op;
77379              } //Tracevv((stderr, "inflate:         length %u\n", len));
77380
77381
77382              if (bits < 15) {
77383                hold += input[_in++] << bits;
77384                bits += 8;
77385                hold += input[_in++] << bits;
77386                bits += 8;
77387              }
77388
77389              here = dcode[hold & dmask];
77390
77391              dodist: for (;;) {
77392                // goto emulation
77393                op = here >>> 24
77394                /*here.bits*/
77395                ;
77396                hold >>>= op;
77397                bits -= op;
77398                op = here >>> 16 & 0xff
77399                /*here.op*/
77400                ;
77401
77402                if (op & 16) {
77403                  /* distance base */
77404                  dist = here & 0xffff
77405                  /*here.val*/
77406                  ;
77407                  op &= 15;
77408                  /* number of extra bits */
77409
77410                  if (bits < op) {
77411                    hold += input[_in++] << bits;
77412                    bits += 8;
77413
77414                    if (bits < op) {
77415                      hold += input[_in++] << bits;
77416                      bits += 8;
77417                    }
77418                  }
77419
77420                  dist += hold & (1 << op) - 1; //#ifdef INFLATE_STRICT
77421
77422                  if (dist > dmax) {
77423                    strm.msg = 'invalid distance too far back';
77424                    state.mode = BAD;
77425                    break top;
77426                  } //#endif
77427
77428
77429                  hold >>>= op;
77430                  bits -= op; //Tracevv((stderr, "inflate:         distance %u\n", dist));
77431
77432                  op = _out - beg;
77433                  /* max distance in output */
77434
77435                  if (dist > op) {
77436                    /* see if copy from window */
77437                    op = dist - op;
77438                    /* distance back in window */
77439
77440                    if (op > whave) {
77441                      if (state.sane) {
vendor: 5,012 bytes, lines 77442-77579
77442                        strm.msg = 'invalid distance too far back';
77443                        state.mode = BAD;
77444                        break top;
77445                      } // (!) This block is disabled in zlib defaults,
77446                      // don't enable it for binary compatibility
77447                      //#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
77448                      //                if (len <= op - whave) {
77449                      //                  do {
77450                      //                    output[_out++] = 0;
77451                      //                  } while (--len);
77452                      //                  continue top;
77453                      //                }
77454                      //                len -= op - whave;
77455                      //                do {
77456                      //                  output[_out++] = 0;
77457                      //                } while (--op > whave);
77458                      //                if (op === 0) {
77459                      //                  from = _out - dist;
77460                      //                  do {
77461                      //                    output[_out++] = output[from++];
77462                      //                  } while (--len);
77463                      //                  continue top;
77464                      //                }
77465                      //#endif
77466
77467                    }
77468
77469                    from = 0; // window index
77470
77471                    from_source = s_window;
77472
77473                    if (wnext === 0) {
77474                      /* very common case */
77475                      from += wsize - op;
77476
77477                      if (op < len) {
77478                        /* some from window */
77479                        len -= op;
77480
77481                        do {
77482                          output[_out++] = s_window[from++];
77483                        } while (--op);
77484
77485                        from = _out - dist;
77486                        /* rest from output */
77487
77488                        from_source = output;
77489                      }
77490                    } else if (wnext < op) {
77491                      /* wrap around window */
77492                      from += wsize + wnext - op;
77493                      op -= wnext;
77494
77495                      if (op < len) {
77496                        /* some from end of window */
77497                        len -= op;
77498
77499                        do {
77500                          output[_out++] = s_window[from++];
77501                        } while (--op);
77502
77503                        from = 0;
77504
77505                        if (wnext < len) {
77506                          /* some from start of window */
77507                          op = wnext;
77508                          len -= op;
77509
77510                          do {
77511                            output[_out++] = s_window[from++];
77512                          } while (--op);
77513
77514                          from = _out - dist;
77515                          /* rest from output */
77516
77517                          from_source = output;
77518                        }
77519                      }
77520                    } else {
77521                      /* contiguous in window */
77522                      from += wnext - op;
77523
77524                      if (op < len) {
77525                        /* some from window */
77526                        len -= op;
77527
77528                        do {
77529                          output[_out++] = s_window[from++];
77530                        } while (--op);
77531
77532                        from = _out - dist;
77533                        /* rest from output */
77534
77535                        from_source = output;
77536                      }
77537                    }
77538
77539                    while (len > 2) {
77540                      output[_out++] = from_source[from++];
77541                      output[_out++] = from_source[from++];
77542                      output[_out++] = from_source[from++];
77543                      len -= 3;
77544                    }
77545
77546                    if (len) {
77547                      output[_out++] = from_source[from++];
77548
77549                      if (len > 1) {
77550                        output[_out++] = from_source[from++];
77551                      }
77552                    }
77553                  } else {
77554                    from = _out - dist;
77555                    /* copy direct from output */
77556
77557                    do {
77558                      /* minimum length is three */
77559                      output[_out++] = output[from++];
77560                      output[_out++] = output[from++];
77561                      output[_out++] = output[from++];
77562                      len -= 3;
77563                    } while (len > 2);
77564
77565                    if (len) {
77566                      output[_out++] = output[from++];
77567
77568                      if (len > 1) {
77569                        output[_out++] = output[from++];
77570                      }
77571                    }
77572                  }
77573                } else if ((op & 64) === 0) {
77574                  /* 2nd level distance code */
77575                  here = dcode[(here & 0xffff) + (
77576                  /*here.val*/
77577                  hold & (1 << op) - 1)];
77578                  continue dodist;
77579                } else {
vendor: 5,948 bytes, lines 77580-77768
77580                  strm.msg = 'invalid distance code';
77581                  state.mode = BAD;
77582                  break top;
77583                }
77584
77585                break; // need to emulate goto via "continue"
77586              }
77587            } else if ((op & 64) === 0) {
77588              /* 2nd level length code */
77589              here = lcode[(here & 0xffff) + (
77590              /*here.val*/
77591              hold & (1 << op) - 1)];
77592              continue dolen;
77593            } else if (op & 32) {
77594              /* end-of-block */
77595              //Tracevv((stderr, "inflate:         end of block\n"));
77596              state.mode = TYPE;
77597              break top;
77598            } else {
77599              strm.msg = 'invalid literal/length code';
77600              state.mode = BAD;
77601              break top;
77602            }
77603
77604            break; // need to emulate goto via "continue"
77605          }
77606        } while (_in < last && _out < end);
77607        /* return unused bytes (on entry, bits < 8, so in won't go too far back) */
77608
77609
77610        len = bits >> 3;
77611        _in -= len;
77612        bits -= len << 3;
77613        hold &= (1 << bits) - 1;
77614        /* update state and return */
77615
77616        strm.next_in = _in;
77617        strm.next_out = _out;
77618        strm.avail_in = _in < last ? 5 + (last - _in) : 5 - (_in - last);
77619        strm.avail_out = _out < end ? 257 + (end - _out) : 257 - (_out - end);
77620        state.hold = hold;
77621        state.bits = bits;
77622        return;
77623      };
77624    }, {}],
77625    427: [function (require, module, exports) {
77626      'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler
77627      // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
77628      //
77629      // This software is provided 'as-is', without any express or implied
77630      // warranty. In no event will the authors be held liable for any damages
77631      // arising from the use of this software.
77632      //
77633      // Permission is granted to anyone to use this software for any purpose,
77634      // including commercial applications, and to alter it and redistribute it
77635      // freely, subject to the following restrictions:
77636      //
77637      // 1. The origin of this software must not be misrepresented; you must not
77638      //   claim that you wrote the original software. If you use this software
77639      //   in a product, an acknowledgment in the product documentation would be
77640      //   appreciated but is not required.
77641      // 2. Altered source versions must be plainly marked as such, and must not be
77642      //   misrepresented as being the original software.
77643      // 3. This notice may not be removed or altered from any source distribution.
77644
77645      var utils = require('../utils/common');
77646
77647      var adler32 = require('./adler32');
77648
77649      var crc32 = require('./crc32');
77650
77651      var inflate_fast = require('./inffast');
77652
77653      var inflate_table = require('./inftrees');
77654
77655      var CODES = 0;
77656      var LENS = 1;
77657      var DISTS = 2;
77658      /* Public constants ==========================================================*/
77659
77660      /* ===========================================================================*/
77661
77662      /* Allowed flush values; see deflate() and inflate() below for details */
77663      //var Z_NO_FLUSH      = 0;
77664      //var Z_PARTIAL_FLUSH = 1;
77665      //var Z_SYNC_FLUSH    = 2;
77666      //var Z_FULL_FLUSH    = 3;
77667
77668      var Z_FINISH = 4;
77669      var Z_BLOCK = 5;
77670      var Z_TREES = 6;
77671      /* Return codes for the compression/decompression functions. Negative values
77672       * are errors, positive values are used for special but normal events.
77673       */
77674
77675      var Z_OK = 0;
77676      var Z_STREAM_END = 1;
77677      var Z_NEED_DICT = 2; //var Z_ERRNO         = -1;
77678
77679      var Z_STREAM_ERROR = -2;
77680      var Z_DATA_ERROR = -3;
77681      var Z_MEM_ERROR = -4;
77682      var Z_BUF_ERROR = -5; //var Z_VERSION_ERROR = -6;
77683
77684      /* The deflate compression method */
77685
77686      var Z_DEFLATED = 8;
77687      /* STATES ====================================================================*/
77688
77689      /* ===========================================================================*/
77690
77691      var HEAD = 1;
77692      /* i: waiting for magic header */
77693
77694      var FLAGS = 2;
77695      /* i: waiting for method and flags (gzip) */
77696
77697      var TIME = 3;
77698      /* i: waiting for modification time (gzip) */
77699
77700      var OS = 4;
77701      /* i: waiting for extra flags and operating system (gzip) */
77702
77703      var EXLEN = 5;
77704      /* i: waiting for extra length (gzip) */
77705
77706      var EXTRA = 6;
77707      /* i: waiting for extra bytes (gzip) */
77708
77709      var NAME = 7;
77710      /* i: waiting for end of file name (gzip) */
77711
77712      var COMMENT = 8;
77713      /* i: waiting for end of comment (gzip) */
77714
77715      var HCRC = 9;
77716      /* i: waiting for header crc (gzip) */
77717
77718      var DICTID = 10;
77719      /* i: waiting for dictionary check value */
77720
77721      var DICT = 11;
77722      /* waiting for inflateSetDictionary() call */
77723
77724      var TYPE = 12;
77725      /* i: waiting for type bits, including last-flag bit */
77726
77727      var TYPEDO = 13;
77728      /* i: same, but skip check to exit inflate on new block */
77729
77730      var STORED = 14;
77731      /* i: waiting for stored size (length and complement) */
77732
77733      var COPY_ = 15;
77734      /* i/o: same as COPY below, but only first time in */
77735
77736      var COPY = 16;
77737      /* i/o: waiting for input or output to copy stored block */
77738
77739      var TABLE = 17;
77740      /* i: waiting for dynamic block table lengths */
77741
77742      var LENLENS = 18;
77743      /* i: waiting for code length code lengths */
77744
77745      var CODELENS = 19;
77746      /* i: waiting for length/lit and distance code lengths */
77747
77748      var LEN_ = 20;
77749      /* i: same as LEN below, but only first time in */
77750
77751      var LEN = 21;
77752      /* i: waiting for length/lit/eob code */
77753
77754      var LENEXT = 22;
77755      /* i: waiting for length extra bits */
77756
77757      var DIST = 23;
77758      /* i: waiting for distance code */
77759
77760      var DISTEXT = 24;
77761      /* i: waiting for distance extra bits */
77762
77763      var MATCH = 25;
77764      /* o: waiting for output space to copy string */
77765
77766      var LIT = 26;
77767      /* o: waiting for output space to write literal */
77768
vendor: 13,743 bytes, lines 77769-78284
77769      var CHECK = 27;
77770      /* i: waiting for 32-bit check value */
77771
77772      var LENGTH = 28;
77773      /* i: waiting for 32-bit length (gzip) */
77774
77775      var DONE = 29;
77776      /* finished check, done -- remain here until reset */
77777
77778      var BAD = 30;
77779      /* got a data error -- remain here until reset */
77780
77781      var MEM = 31;
77782      /* got an inflate() memory error -- remain here until reset */
77783
77784      var SYNC = 32;
77785      /* looking for synchronization bytes to restart inflate() */
77786
77787      /* ===========================================================================*/
77788
77789      var ENOUGH_LENS = 852;
77790      var ENOUGH_DISTS = 592; //var ENOUGH =  (ENOUGH_LENS+ENOUGH_DISTS);
77791
77792      var MAX_WBITS = 15;
77793      /* 32K LZ77 window */
77794
77795      var DEF_WBITS = MAX_WBITS;
77796
77797      function zswap32(q) {
77798        return (q >>> 24 & 0xff) + (q >>> 8 & 0xff00) + ((q & 0xff00) << 8) + ((q & 0xff) << 24);
77799      }
77800
77801      function InflateState() {
77802        this.mode = 0;
77803        /* current inflate mode */
77804
77805        this.last = false;
77806        /* true if processing last block */
77807
77808        this.wrap = 0;
77809        /* bit 0 true for zlib, bit 1 true for gzip */
77810
77811        this.havedict = false;
77812        /* true if dictionary provided */
77813
77814        this.flags = 0;
77815        /* gzip header method and flags (0 if zlib) */
77816
77817        this.dmax = 0;
77818        /* zlib header max distance (INFLATE_STRICT) */
77819
77820        this.check = 0;
77821        /* protected copy of check value */
77822
77823        this.total = 0;
77824        /* protected copy of output count */
77825        // TODO: may be {}
77826
77827        this.head = null;
77828        /* where to save gzip header information */
77829
77830        /* sliding window */
77831
77832        this.wbits = 0;
77833        /* log base 2 of requested window size */
77834
77835        this.wsize = 0;
77836        /* window size or zero if not using window */
77837
77838        this.whave = 0;
77839        /* valid bytes in the window */
77840
77841        this.wnext = 0;
77842        /* window write index */
77843
77844        this.window = null;
77845        /* allocated sliding window, if needed */
77846
77847        /* bit accumulator */
77848
77849        this.hold = 0;
77850        /* input bit accumulator */
77851
77852        this.bits = 0;
77853        /* number of bits in "in" */
77854
77855        /* for string and stored block copying */
77856
77857        this.length = 0;
77858        /* literal or length of data to copy */
77859
77860        this.offset = 0;
77861        /* distance back to copy string from */
77862
77863        /* for table and code decoding */
77864
77865        this.extra = 0;
77866        /* extra bits needed */
77867
77868        /* fixed and dynamic code tables */
77869
77870        this.lencode = null;
77871        /* starting table for length/literal codes */
77872
77873        this.distcode = null;
77874        /* starting table for distance codes */
77875
77876        this.lenbits = 0;
77877        /* index bits for lencode */
77878
77879        this.distbits = 0;
77880        /* index bits for distcode */
77881
77882        /* dynamic table building */
77883
77884        this.ncode = 0;
77885        /* number of code length code lengths */
77886
77887        this.nlen = 0;
77888        /* number of length code lengths */
77889
77890        this.ndist = 0;
77891        /* number of distance code lengths */
77892
77893        this.have = 0;
77894        /* number of code lengths in lens[] */
77895
77896        this.next = null;
77897        /* next available space in codes[] */
77898
77899        this.lens = new utils.Buf16(320);
77900        /* temporary storage for code lengths */
77901
77902        this.work = new utils.Buf16(288);
77903        /* work area for code table building */
77904
77905        /*
77906         because we don't have pointers in js, we use lencode and distcode directly
77907         as buffers so we don't need codes
77908        */
77909        //this.codes = new utils.Buf32(ENOUGH);       /* space for code tables */
77910
77911        this.lendyn = null;
77912        /* dynamic table for length/literal codes (JS specific) */
77913
77914        this.distdyn = null;
77915        /* dynamic table for distance codes (JS specific) */
77916
77917        this.sane = 0;
77918        /* if false, allow invalid distance too far */
77919
77920        this.back = 0;
77921        /* bits back of last unprocessed length/lit */
77922
77923        this.was = 0;
77924        /* initial length of match */
77925      }
77926
77927      function inflateResetKeep(strm) {
77928        var state;
77929
77930        if (!strm || !strm.state) {
77931          return Z_STREAM_ERROR;
77932        }
77933
77934        state = strm.state;
77935        strm.total_in = strm.total_out = state.total = 0;
77936        strm.msg = '';
77937        /*Z_NULL*/
77938
77939        if (state.wrap) {
77940          /* to support ill-conceived Java test suite */
77941          strm.adler = state.wrap & 1;
77942        }
77943
77944        state.mode = HEAD;
77945        state.last = 0;
77946        state.havedict = 0;
77947        state.dmax = 32768;
77948        state.head = null
77949        /*Z_NULL*/
77950        ;
77951        state.hold = 0;
77952        state.bits = 0; //state.lencode = state.distcode = state.next = state.codes;
77953
77954        state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS);
77955        state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS);
77956        state.sane = 1;
77957        state.back = -1; //Tracev((stderr, "inflate: reset\n"));
77958
77959        return Z_OK;
77960      }
77961
77962      function inflateReset(strm) {
77963        var state;
77964
77965        if (!strm || !strm.state) {
77966          return Z_STREAM_ERROR;
77967        }
77968
77969        state = strm.state;
77970        state.wsize = 0;
77971        state.whave = 0;
77972        state.wnext = 0;
77973        return inflateResetKeep(strm);
77974      }
77975
77976      function inflateReset2(strm, windowBits) {
77977        var wrap;
77978        var state;
77979        /* get the state */
77980
77981        if (!strm || !strm.state) {
77982          return Z_STREAM_ERROR;
77983        }
77984
77985        state = strm.state;
77986        /* extract wrap request from windowBits parameter */
77987
77988        if (windowBits < 0) {
77989          wrap = 0;
77990          windowBits = -windowBits;
77991        } else {
77992          wrap = (windowBits >> 4) + 1;
77993
77994          if (windowBits < 48) {
77995            windowBits &= 15;
77996          }
77997        }
77998        /* set number of window bits, free window if different */
77999
78000
78001        if (windowBits && (windowBits < 8 || windowBits > 15)) {
78002          return Z_STREAM_ERROR;
78003        }
78004
78005        if (state.window !== null && state.wbits !== windowBits) {
78006          state.window = null;
78007        }
78008        /* update state and reset the rest of it */
78009
78010
78011        state.wrap = wrap;
78012        state.wbits = windowBits;
78013        return inflateReset(strm);
78014      }
78015
78016      function inflateInit2(strm, windowBits) {
78017        var ret;
78018        var state;
78019
78020        if (!strm) {
78021          return Z_STREAM_ERROR;
78022        } //strm.msg = Z_NULL;                 /* in case we return an error */
78023
78024
78025        state = new InflateState(); //if (state === Z_NULL) return Z_MEM_ERROR;
78026        //Tracev((stderr, "inflate: allocated\n"));
78027
78028        strm.state = state;
78029        state.window = null
78030        /*Z_NULL*/
78031        ;
78032        ret = inflateReset2(strm, windowBits);
78033
78034        if (ret !== Z_OK) {
78035          strm.state = null
78036          /*Z_NULL*/
78037          ;
78038        }
78039
78040        return ret;
78041      }
78042
78043      function inflateInit(strm) {
78044        return inflateInit2(strm, DEF_WBITS);
78045      }
78046      /*
78047       Return state with length and distance decoding tables and index sizes set to
78048       fixed code decoding.  Normally this returns fixed tables from inffixed.h.
78049       If BUILDFIXED is defined, then instead this routine builds the tables the
78050       first time it's called, and returns those tables the first time and
78051       thereafter.  This reduces the size of the code by about 2K bytes, in
78052       exchange for a little execution time.  However, BUILDFIXED should not be
78053       used for threaded applications, since the rewriting of the tables and virgin
78054       may not be thread-safe.
78055       */
78056
78057
78058      var virgin = true;
78059      var lenfix, distfix; // We have no pointers in JS, so keep tables separate
78060
78061      function fixedtables(state) {
78062        /* build fixed huffman tables if first call (may not be thread safe) */
78063        if (virgin) {
78064          var sym;
78065          lenfix = new utils.Buf32(512);
78066          distfix = new utils.Buf32(32);
78067          /* literal/length table */
78068
78069          sym = 0;
78070
78071          while (sym < 144) {
78072            state.lens[sym++] = 8;
78073          }
78074
78075          while (sym < 256) {
78076            state.lens[sym++] = 9;
78077          }
78078
78079          while (sym < 280) {
78080            state.lens[sym++] = 7;
78081          }
78082
78083          while (sym < 288) {
78084            state.lens[sym++] = 8;
78085          }
78086
78087          inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, {
78088            bits: 9
78089          });
78090          /* distance table */
78091
78092          sym = 0;
78093
78094          while (sym < 32) {
78095            state.lens[sym++] = 5;
78096          }
78097
78098          inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, {
78099            bits: 5
78100          });
78101          /* do this just once */
78102
78103          virgin = false;
78104        }
78105
78106        state.lencode = lenfix;
78107        state.lenbits = 9;
78108        state.distcode = distfix;
78109        state.distbits = 5;
78110      }
78111      /*
78112       Update the window with the last wsize (normally 32K) bytes written before
78113       returning.  If window does not exist yet, create it.  This is only called
78114       when a window is already in use, or when output has been written during this
78115       inflate call, but the end of the deflate stream has not been reached yet.
78116       It is also called to create a window for dictionary data when a dictionary
78117       is loaded.
78118      
78119       Providing output buffers larger than 32K to inflate() should provide a speed
78120       advantage, since only the last 32K of output is copied to the sliding window
78121       upon return from inflate(), and since all distances after the first 32K of
78122       output will fall in the output data, making match copies simpler and faster.
78123       The advantage may be dependent on the size of the processor's data caches.
78124       */
78125
78126
78127      function updatewindow(strm, src, end, copy) {
78128        var dist;
78129        var state = strm.state;
78130        /* if it hasn't been done already, allocate space for the window */
78131
78132        if (state.window === null) {
78133          state.wsize = 1 << state.wbits;
78134          state.wnext = 0;
78135          state.whave = 0;
78136          state.window = new utils.Buf8(state.wsize);
78137        }
78138        /* copy state->wsize or less output bytes into the circular window */
78139
78140
78141        if (copy >= state.wsize) {
78142          utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0);
78143          state.wnext = 0;
78144          state.whave = state.wsize;
78145        } else {
78146          dist = state.wsize - state.wnext;
78147
78148          if (dist > copy) {
78149            dist = copy;
78150          } //zmemcpy(state->window + state->wnext, end - copy, dist);
78151
78152
78153          utils.arraySet(state.window, src, end - copy, dist, state.wnext);
78154          copy -= dist;
78155
78156          if (copy) {
78157            //zmemcpy(state->window, end - copy, copy);
78158            utils.arraySet(state.window, src, end - copy, copy, 0);
78159            state.wnext = copy;
78160            state.whave = state.wsize;
78161          } else {
78162            state.wnext += dist;
78163
78164            if (state.wnext === state.wsize) {
78165              state.wnext = 0;
78166            }
78167
78168            if (state.whave < state.wsize) {
78169              state.whave += dist;
78170            }
78171          }
78172        }
78173
78174        return 0;
78175      }
78176
78177      function inflate(strm, flush) {
78178        var state;
78179        var input, output; // input/output buffers
78180
78181        var next;
78182        /* next input INDEX */
78183
78184        var put;
78185        /* next output INDEX */
78186
78187        var have, left;
78188        /* available input and output */
78189
78190        var hold;
78191        /* bit buffer */
78192
78193        var bits;
78194        /* bits in bit buffer */
78195
78196        var _in, _out;
78197        /* save starting available input and output */
78198
78199
78200        var copy;
78201        /* number of stored or match bytes to copy */
78202
78203        var from;
78204        /* where to copy match bytes from */
78205
78206        var from_source;
78207        var here = 0;
78208        /* current decoding table entry */
78209
78210        var here_bits, here_op, here_val; // paked "here" denormalized (JS specific)
78211        //var last;                   /* parent table entry */
78212
78213        var last_bits, last_op, last_val; // paked "last" denormalized (JS specific)
78214
78215        var len;
78216        /* length to copy for repeats, bits to drop */
78217
78218        var ret;
78219        /* return code */
78220
78221        var hbuf = new utils.Buf8(4);
78222        /* buffer for gzip header crc calculation */
78223
78224        var opts;
78225        var n; // temporary var for NEED_BITS
78226
78227        var order =
78228        /* permutation of code lengths */
78229        [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15];
78230
78231        if (!strm || !strm.state || !strm.output || !strm.input && strm.avail_in !== 0) {
78232          return Z_STREAM_ERROR;
78233        }
78234
78235        state = strm.state;
78236
78237        if (state.mode === TYPE) {
78238          state.mode = TYPEDO;
78239        }
78240        /* skip check */
78241        //--- LOAD() ---
78242
78243
78244        put = strm.next_out;
78245        output = strm.output;
78246        left = strm.avail_out;
78247        next = strm.next_in;
78248        input = strm.input;
78249        have = strm.avail_in;
78250        hold = state.hold;
78251        bits = state.bits; //---
78252
78253        _in = have;
78254        _out = left;
78255        ret = Z_OK;
78256
78257        inf_leave: // goto emulation
78258        for (;;) {
78259          switch (state.mode) {
78260            case HEAD:
78261              if (state.wrap === 0) {
78262                state.mode = TYPEDO;
78263                break;
78264              } //=== NEEDBITS(16);
78265
78266
78267              while (bits < 16) {
78268                if (have === 0) {
78269                  break inf_leave;
78270                }
78271
78272                have--;
78273                hold += input[next++] << bits;
78274                bits += 8;
78275              } //===//
78276
78277
78278              if (state.wrap & 2 && hold === 0x8b1f) {
78279                /* gzip header */
78280                state.check = 0
78281                /*crc32(0L, Z_NULL, 0)*/
78282                ; //=== CRC2(state.check, hold);
78283
78284                hbuf[0] = hold & 0xff;
vendor: 17,888 bytes, lines 78285-78939
78285                hbuf[1] = hold >>> 8 & 0xff;
78286                state.check = crc32(state.check, hbuf, 2, 0); //===//
78287                //=== INITBITS();
78288
78289                hold = 0;
78290                bits = 0; //===//
78291
78292                state.mode = FLAGS;
78293                break;
78294              }
78295
78296              state.flags = 0;
78297              /* expect zlib header */
78298
78299              if (state.head) {
78300                state.head.done = false;
78301              }
78302
78303              if (!(state.wrap & 1) ||
78304              /* check if zlib header allowed */
78305              (((hold & 0xff) <<
78306              /*BITS(8)*/
78307              8) + (hold >> 8)) % 31) {
78308                strm.msg = 'incorrect header check';
78309                state.mode = BAD;
78310                break;
78311              }
78312
78313              if ((hold & 0x0f) !==
78314              /*BITS(4)*/
78315              Z_DEFLATED) {
78316                strm.msg = 'unknown compression method';
78317                state.mode = BAD;
78318                break;
78319              } //--- DROPBITS(4) ---//
78320
78321
78322              hold >>>= 4;
78323              bits -= 4; //---//
78324
78325              len = (hold & 0x0f) +
78326              /*BITS(4)*/
78327              8;
78328
78329              if (state.wbits === 0) {
78330                state.wbits = len;
78331              } else if (len > state.wbits) {
78332                strm.msg = 'invalid window size';
78333                state.mode = BAD;
78334                break;
78335              }
78336
78337              state.dmax = 1 << len; //Tracev((stderr, "inflate:   zlib header ok\n"));
78338
78339              strm.adler = state.check = 1
78340              /*adler32(0L, Z_NULL, 0)*/
78341              ;
78342              state.mode = hold & 0x200 ? DICTID : TYPE; //=== INITBITS();
78343
78344              hold = 0;
78345              bits = 0; //===//
78346
78347              break;
78348
78349            case FLAGS:
78350              //=== NEEDBITS(16); */
78351              while (bits < 16) {
78352                if (have === 0) {
78353                  break inf_leave;
78354                }
78355
78356                have--;
78357                hold += input[next++] << bits;
78358                bits += 8;
78359              } //===//
78360
78361
78362              state.flags = hold;
78363
78364              if ((state.flags & 0xff) !== Z_DEFLATED) {
78365                strm.msg = 'unknown compression method';
78366                state.mode = BAD;
78367                break;
78368              }
78369
78370              if (state.flags & 0xe000) {
78371                strm.msg = 'unknown header flags set';
78372                state.mode = BAD;
78373                break;
78374              }
78375
78376              if (state.head) {
78377                state.head.text = hold >> 8 & 1;
78378              }
78379
78380              if (state.flags & 0x0200) {
78381                //=== CRC2(state.check, hold);
78382                hbuf[0] = hold & 0xff;
78383                hbuf[1] = hold >>> 8 & 0xff;
78384                state.check = crc32(state.check, hbuf, 2, 0); //===//
78385              } //=== INITBITS();
78386
78387
78388              hold = 0;
78389              bits = 0; //===//
78390
78391              state.mode = TIME;
78392
78393            /* falls through */
78394
78395            case TIME:
78396              //=== NEEDBITS(32); */
78397              while (bits < 32) {
78398                if (have === 0) {
78399                  break inf_leave;
78400                }
78401
78402                have--;
78403                hold += input[next++] << bits;
78404                bits += 8;
78405              } //===//
78406
78407
78408              if (state.head) {
78409                state.head.time = hold;
78410              }
78411
78412              if (state.flags & 0x0200) {
78413                //=== CRC4(state.check, hold)
78414                hbuf[0] = hold & 0xff;
78415                hbuf[1] = hold >>> 8 & 0xff;
78416                hbuf[2] = hold >>> 16 & 0xff;
78417                hbuf[3] = hold >>> 24 & 0xff;
78418                state.check = crc32(state.check, hbuf, 4, 0); //===
78419              } //=== INITBITS();
78420
78421
78422              hold = 0;
78423              bits = 0; //===//
78424
78425              state.mode = OS;
78426
78427            /* falls through */
78428
78429            case OS:
78430              //=== NEEDBITS(16); */
78431              while (bits < 16) {
78432                if (have === 0) {
78433                  break inf_leave;
78434                }
78435
78436                have--;
78437                hold += input[next++] << bits;
78438                bits += 8;
78439              } //===//
78440
78441
78442              if (state.head) {
78443                state.head.xflags = hold & 0xff;
78444                state.head.os = hold >> 8;
78445              }
78446
78447              if (state.flags & 0x0200) {
78448                //=== CRC2(state.check, hold);
78449                hbuf[0] = hold & 0xff;
78450                hbuf[1] = hold >>> 8 & 0xff;
78451                state.check = crc32(state.check, hbuf, 2, 0); //===//
78452              } //=== INITBITS();
78453
78454
78455              hold = 0;
78456              bits = 0; //===//
78457
78458              state.mode = EXLEN;
78459
78460            /* falls through */
78461
78462            case EXLEN:
78463              if (state.flags & 0x0400) {
78464                //=== NEEDBITS(16); */
78465                while (bits < 16) {
78466                  if (have === 0) {
78467                    break inf_leave;
78468                  }
78469
78470                  have--;
78471                  hold += input[next++] << bits;
78472                  bits += 8;
78473                } //===//
78474
78475
78476                state.length = hold;
78477
78478                if (state.head) {
78479                  state.head.extra_len = hold;
78480                }
78481
78482                if (state.flags & 0x0200) {
78483                  //=== CRC2(state.check, hold);
78484                  hbuf[0] = hold & 0xff;
78485                  hbuf[1] = hold >>> 8 & 0xff;
78486                  state.check = crc32(state.check, hbuf, 2, 0); //===//
78487                } //=== INITBITS();
78488
78489
78490                hold = 0;
78491                bits = 0; //===//
78492              } else if (state.head) {
78493                state.head.extra = null
78494                /*Z_NULL*/
78495                ;
78496              }
78497
78498              state.mode = EXTRA;
78499
78500            /* falls through */
78501
78502            case EXTRA:
78503              if (state.flags & 0x0400) {
78504                copy = state.length;
78505
78506                if (copy > have) {
78507                  copy = have;
78508                }
78509
78510                if (copy) {
78511                  if (state.head) {
78512                    len = state.head.extra_len - state.length;
78513
78514                    if (!state.head.extra) {
78515                      // Use untyped array for more convenient processing later
78516                      state.head.extra = new Array(state.head.extra_len);
78517                    }
78518
78519                    utils.arraySet(state.head.extra, input, next, // extra field is limited to 65536 bytes
78520                    // - no need for additional size check
78521                    copy,
78522                    /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/
78523                    len); //zmemcpy(state.head.extra + len, next,
78524                    //        len + copy > state.head.extra_max ?
78525                    //        state.head.extra_max - len : copy);
78526                  }
78527
78528                  if (state.flags & 0x0200) {
78529                    state.check = crc32(state.check, input, copy, next);
78530                  }
78531
78532                  have -= copy;
78533                  next += copy;
78534                  state.length -= copy;
78535                }
78536
78537                if (state.length) {
78538                  break inf_leave;
78539                }
78540              }
78541
78542              state.length = 0;
78543              state.mode = NAME;
78544
78545            /* falls through */
78546
78547            case NAME:
78548              if (state.flags & 0x0800) {
78549                if (have === 0) {
78550                  break inf_leave;
78551                }
78552
78553                copy = 0;
78554
78555                do {
78556                  // TODO: 2 or 1 bytes?
78557                  len = input[next + copy++];
78558                  /* use constant limit because in js we should not preallocate memory */
78559
78560                  if (state.head && len && state.length < 65536
78561                  /*state.head.name_max*/
78562                  ) {
78563                    state.head.name += String.fromCharCode(len);
78564                  }
78565                } while (len && copy < have);
78566
78567                if (state.flags & 0x0200) {
78568                  state.check = crc32(state.check, input, copy, next);
78569                }
78570
78571                have -= copy;
78572                next += copy;
78573
78574                if (len) {
78575                  break inf_leave;
78576                }
78577              } else if (state.head) {
78578                state.head.name = null;
78579              }
78580
78581              state.length = 0;
78582              state.mode = COMMENT;
78583
78584            /* falls through */
78585
78586            case COMMENT:
78587              if (state.flags & 0x1000) {
78588                if (have === 0) {
78589                  break inf_leave;
78590                }
78591
78592                copy = 0;
78593
78594                do {
78595                  len = input[next + copy++];
78596                  /* use constant limit because in js we should not preallocate memory */
78597
78598                  if (state.head && len && state.length < 65536
78599                  /*state.head.comm_max*/
78600                  ) {
78601                    state.head.comment += String.fromCharCode(len);
78602                  }
78603                } while (len && copy < have);
78604
78605                if (state.flags & 0x0200) {
78606                  state.check = crc32(state.check, input, copy, next);
78607                }
78608
78609                have -= copy;
78610                next += copy;
78611
78612                if (len) {
78613                  break inf_leave;
78614                }
78615              } else if (state.head) {
78616                state.head.comment = null;
78617              }
78618
78619              state.mode = HCRC;
78620
78621            /* falls through */
78622
78623            case HCRC:
78624              if (state.flags & 0x0200) {
78625                //=== NEEDBITS(16); */
78626                while (bits < 16) {
78627                  if (have === 0) {
78628                    break inf_leave;
78629                  }
78630
78631                  have--;
78632                  hold += input[next++] << bits;
78633                  bits += 8;
78634                } //===//
78635
78636
78637                if (hold !== (state.check & 0xffff)) {
78638                  strm.msg = 'header crc mismatch';
78639                  state.mode = BAD;
78640                  break;
78641                } //=== INITBITS();
78642
78643
78644                hold = 0;
78645                bits = 0; //===//
78646              }
78647
78648              if (state.head) {
78649                state.head.hcrc = state.flags >> 9 & 1;
78650                state.head.done = true;
78651              }
78652
78653              strm.adler = state.check = 0;
78654              state.mode = TYPE;
78655              break;
78656
78657            case DICTID:
78658              //=== NEEDBITS(32); */
78659              while (bits < 32) {
78660                if (have === 0) {
78661                  break inf_leave;
78662                }
78663
78664                have--;
78665                hold += input[next++] << bits;
78666                bits += 8;
78667              } //===//
78668
78669
78670              strm.adler = state.check = zswap32(hold); //=== INITBITS();
78671
78672              hold = 0;
78673              bits = 0; //===//
78674
78675              state.mode = DICT;
78676
78677            /* falls through */
78678
78679            case DICT:
78680              if (state.havedict === 0) {
78681                //--- RESTORE() ---
78682                strm.next_out = put;
78683                strm.avail_out = left;
78684                strm.next_in = next;
78685                strm.avail_in = have;
78686                state.hold = hold;
78687                state.bits = bits; //---
78688
78689                return Z_NEED_DICT;
78690              }
78691
78692              strm.adler = state.check = 1
78693              /*adler32(0L, Z_NULL, 0)*/
78694              ;
78695              state.mode = TYPE;
78696
78697            /* falls through */
78698
78699            case TYPE:
78700              if (flush === Z_BLOCK || flush === Z_TREES) {
78701                break inf_leave;
78702              }
78703
78704            /* falls through */
78705
78706            case TYPEDO:
78707              if (state.last) {
78708                //--- BYTEBITS() ---//
78709                hold >>>= bits & 7;
78710                bits -= bits & 7; //---//
78711
78712                state.mode = CHECK;
78713                break;
78714              } //=== NEEDBITS(3); */
78715
78716
78717              while (bits < 3) {
78718                if (have === 0) {
78719                  break inf_leave;
78720                }
78721
78722                have--;
78723                hold += input[next++] << bits;
78724                bits += 8;
78725              } //===//
78726
78727
78728              state.last = hold & 0x01
78729              /*BITS(1)*/
78730              ; //--- DROPBITS(1) ---//
78731
78732              hold >>>= 1;
78733              bits -= 1; //---//
78734
78735              switch (hold & 0x03) {
78736                /*BITS(2)*/
78737                case 0:
78738                  /* stored block */
78739                  //Tracev((stderr, "inflate:     stored block%s\n",
78740                  //        state.last ? " (last)" : ""));
78741                  state.mode = STORED;
78742                  break;
78743
78744                case 1:
78745                  /* fixed block */
78746                  fixedtables(state); //Tracev((stderr, "inflate:     fixed codes block%s\n",
78747                  //        state.last ? " (last)" : ""));
78748
78749                  state.mode = LEN_;
78750                  /* decode codes */
78751
78752                  if (flush === Z_TREES) {
78753                    //--- DROPBITS(2) ---//
78754                    hold >>>= 2;
78755                    bits -= 2; //---//
78756
78757                    break inf_leave;
78758                  }
78759
78760                  break;
78761
78762                case 2:
78763                  /* dynamic block */
78764                  //Tracev((stderr, "inflate:     dynamic codes block%s\n",
78765                  //        state.last ? " (last)" : ""));
78766                  state.mode = TABLE;
78767                  break;
78768
78769                case 3:
78770                  strm.msg = 'invalid block type';
78771                  state.mode = BAD;
78772              } //--- DROPBITS(2) ---//
78773
78774
78775              hold >>>= 2;
78776              bits -= 2; //---//
78777
78778              break;
78779
78780            case STORED:
78781              //--- BYTEBITS() ---// /* go to byte boundary */
78782              hold >>>= bits & 7;
78783              bits -= bits & 7; //---//
78784              //=== NEEDBITS(32); */
78785
78786              while (bits < 32) {
78787                if (have === 0) {
78788                  break inf_leave;
78789                }
78790
78791                have--;
78792                hold += input[next++] << bits;
78793                bits += 8;
78794              } //===//
78795
78796
78797              if ((hold & 0xffff) !== (hold >>> 16 ^ 0xffff)) {
78798                strm.msg = 'invalid stored block lengths';
78799                state.mode = BAD;
78800                break;
78801              }
78802
78803              state.length = hold & 0xffff; //Tracev((stderr, "inflate:       stored length %u\n",
78804              //        state.length));
78805              //=== INITBITS();
78806
78807              hold = 0;
78808              bits = 0; //===//
78809
78810              state.mode = COPY_;
78811
78812              if (flush === Z_TREES) {
78813                break inf_leave;
78814              }
78815
78816            /* falls through */
78817
78818            case COPY_:
78819              state.mode = COPY;
78820
78821            /* falls through */
78822
78823            case COPY:
78824              copy = state.length;
78825
78826              if (copy) {
78827                if (copy > have) {
78828                  copy = have;
78829                }
78830
78831                if (copy > left) {
78832                  copy = left;
78833                }
78834
78835                if (copy === 0) {
78836                  break inf_leave;
78837                } //--- zmemcpy(put, next, copy); ---
78838
78839
78840                utils.arraySet(output, input, next, copy, put); //---//
78841
78842                have -= copy;
78843                next += copy;
78844                left -= copy;
78845                put += copy;
78846                state.length -= copy;
78847                break;
78848              } //Tracev((stderr, "inflate:       stored end\n"));
78849
78850
78851              state.mode = TYPE;
78852              break;
78853
78854            case TABLE:
78855              //=== NEEDBITS(14); */
78856              while (bits < 14) {
78857                if (have === 0) {
78858                  break inf_leave;
78859                }
78860
78861                have--;
78862                hold += input[next++] << bits;
78863                bits += 8;
78864              } //===//
78865
78866
78867              state.nlen = (hold & 0x1f) +
78868              /*BITS(5)*/
78869              257; //--- DROPBITS(5) ---//
78870
78871              hold >>>= 5;
78872              bits -= 5; //---//
78873
78874              state.ndist = (hold & 0x1f) +
78875              /*BITS(5)*/
78876              1; //--- DROPBITS(5) ---//
78877
78878              hold >>>= 5;
78879              bits -= 5; //---//
78880
78881              state.ncode = (hold & 0x0f) +
78882              /*BITS(4)*/
78883              4; //--- DROPBITS(4) ---//
78884
78885              hold >>>= 4;
78886              bits -= 4; //---//
78887              //#ifndef PKZIP_BUG_WORKAROUND
78888
78889              if (state.nlen > 286 || state.ndist > 30) {
78890                strm.msg = 'too many length or distance symbols';
78891                state.mode = BAD;
78892                break;
78893              } //#endif
78894              //Tracev((stderr, "inflate:       table sizes ok\n"));
78895
78896
78897              state.have = 0;
78898              state.mode = LENLENS;
78899
78900            /* falls through */
78901
78902            case LENLENS:
78903              while (state.have < state.ncode) {
78904                //=== NEEDBITS(3);
78905                while (bits < 3) {
78906                  if (have === 0) {
78907                    break inf_leave;
78908                  }
78909
78910                  have--;
78911                  hold += input[next++] << bits;
78912                  bits += 8;
78913                } //===//
78914
78915
78916                state.lens[order[state.have++]] = hold & 0x07; //BITS(3);
78917                //--- DROPBITS(3) ---//
78918
78919                hold >>>= 3;
78920                bits -= 3; //---//
78921              }
78922
78923              while (state.have < 19) {
78924                state.lens[order[state.have++]] = 0;
78925              } // We have separate tables & no pointers. 2 commented lines below not needed.
78926              //state.next = state.codes;
78927              //state.lencode = state.next;
78928              // Switch to use dynamic table
78929
78930
78931              state.lencode = state.lendyn;
78932              state.lenbits = 7;
78933              opts = {
78934                bits: state.lenbits
78935              };
78936              ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts);
78937              state.lenbits = opts.bits;
78938
78939              if (ret) {
vendor: 14,208 bytes, lines 78940-79419
78940                strm.msg = 'invalid code lengths set';
78941                state.mode = BAD;
78942                break;
78943              } //Tracev((stderr, "inflate:       code lengths ok\n"));
78944
78945
78946              state.have = 0;
78947              state.mode = CODELENS;
78948
78949            /* falls through */
78950
78951            case CODELENS:
78952              while (state.have < state.nlen + state.ndist) {
78953                for (;;) {
78954                  here = state.lencode[hold & (1 << state.lenbits) - 1];
78955                  /*BITS(state.lenbits)*/
78956
78957                  here_bits = here >>> 24;
78958                  here_op = here >>> 16 & 0xff;
78959                  here_val = here & 0xffff;
78960
78961                  if (here_bits <= bits) {
78962                    break;
78963                  } //--- PULLBYTE() ---//
78964
78965
78966                  if (have === 0) {
78967                    break inf_leave;
78968                  }
78969
78970                  have--;
78971                  hold += input[next++] << bits;
78972                  bits += 8; //---//
78973                }
78974
78975                if (here_val < 16) {
78976                  //--- DROPBITS(here.bits) ---//
78977                  hold >>>= here_bits;
78978                  bits -= here_bits; //---//
78979
78980                  state.lens[state.have++] = here_val;
78981                } else {
78982                  if (here_val === 16) {
78983                    //=== NEEDBITS(here.bits + 2);
78984                    n = here_bits + 2;
78985
78986                    while (bits < n) {
78987                      if (have === 0) {
78988                        break inf_leave;
78989                      }
78990
78991                      have--;
78992                      hold += input[next++] << bits;
78993                      bits += 8;
78994                    } //===//
78995                    //--- DROPBITS(here.bits) ---//
78996
78997
78998                    hold >>>= here_bits;
78999                    bits -= here_bits; //---//
79000
79001                    if (state.have === 0) {
79002                      strm.msg = 'invalid bit length repeat';
79003                      state.mode = BAD;
79004                      break;
79005                    }
79006
79007                    len = state.lens[state.have - 1];
79008                    copy = 3 + (hold & 0x03); //BITS(2);
79009                    //--- DROPBITS(2) ---//
79010
79011                    hold >>>= 2;
79012                    bits -= 2; //---//
79013                  } else if (here_val === 17) {
79014                    //=== NEEDBITS(here.bits + 3);
79015                    n = here_bits + 3;
79016
79017                    while (bits < n) {
79018                      if (have === 0) {
79019                        break inf_leave;
79020                      }
79021
79022                      have--;
79023                      hold += input[next++] << bits;
79024                      bits += 8;
79025                    } //===//
79026                    //--- DROPBITS(here.bits) ---//
79027
79028
79029                    hold >>>= here_bits;
79030                    bits -= here_bits; //---//
79031
79032                    len = 0;
79033                    copy = 3 + (hold & 0x07); //BITS(3);
79034                    //--- DROPBITS(3) ---//
79035
79036                    hold >>>= 3;
79037                    bits -= 3; //---//
79038                  } else {
79039                    //=== NEEDBITS(here.bits + 7);
79040                    n = here_bits + 7;
79041
79042                    while (bits < n) {
79043                      if (have === 0) {
79044                        break inf_leave;
79045                      }
79046
79047                      have--;
79048                      hold += input[next++] << bits;
79049                      bits += 8;
79050                    } //===//
79051                    //--- DROPBITS(here.bits) ---//
79052
79053
79054                    hold >>>= here_bits;
79055                    bits -= here_bits; //---//
79056
79057                    len = 0;
79058                    copy = 11 + (hold & 0x7f); //BITS(7);
79059                    //--- DROPBITS(7) ---//
79060
79061                    hold >>>= 7;
79062                    bits -= 7; //---//
79063                  }
79064
79065                  if (state.have + copy > state.nlen + state.ndist) {
79066                    strm.msg = 'invalid bit length repeat';
79067                    state.mode = BAD;
79068                    break;
79069                  }
79070
79071                  while (copy--) {
79072                    state.lens[state.have++] = len;
79073                  }
79074                }
79075              }
79076              /* handle error breaks in while */
79077
79078
79079              if (state.mode === BAD) {
79080                break;
79081              }
79082              /* check for end-of-block code (better have one) */
79083
79084
79085              if (state.lens[256] === 0) {
79086                strm.msg = 'invalid code -- missing end-of-block';
79087                state.mode = BAD;
79088                break;
79089              }
79090              /* build code tables -- note: do not change the lenbits or distbits
79091                 values here (9 and 6) without reading the comments in inftrees.h
79092                 concerning the ENOUGH constants, which depend on those values */
79093
79094
79095              state.lenbits = 9;
79096              opts = {
79097                bits: state.lenbits
79098              };
79099              ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts); // We have separate tables & no pointers. 2 commented lines below not needed.
79100              // state.next_index = opts.table_index;
79101
79102              state.lenbits = opts.bits; // state.lencode = state.next;
79103
79104              if (ret) {
79105                strm.msg = 'invalid literal/lengths set';
79106                state.mode = BAD;
79107                break;
79108              }
79109
79110              state.distbits = 6; //state.distcode.copy(state.codes);
79111              // Switch to use dynamic table
79112
79113              state.distcode = state.distdyn;
79114              opts = {
79115                bits: state.distbits
79116              };
79117              ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts); // We have separate tables & no pointers. 2 commented lines below not needed.
79118              // state.next_index = opts.table_index;
79119
79120              state.distbits = opts.bits; // state.distcode = state.next;
79121
79122              if (ret) {
79123                strm.msg = 'invalid distances set';
79124                state.mode = BAD;
79125                break;
79126              } //Tracev((stderr, 'inflate:       codes ok\n'));
79127
79128
79129              state.mode = LEN_;
79130
79131              if (flush === Z_TREES) {
79132                break inf_leave;
79133              }
79134
79135            /* falls through */
79136
79137            case LEN_:
79138              state.mode = LEN;
79139
79140            /* falls through */
79141
79142            case LEN:
79143              if (have >= 6 && left >= 258) {
79144                //--- RESTORE() ---
79145                strm.next_out = put;
79146                strm.avail_out = left;
79147                strm.next_in = next;
79148                strm.avail_in = have;
79149                state.hold = hold;
79150                state.bits = bits; //---
79151
79152                inflate_fast(strm, _out); //--- LOAD() ---
79153
79154                put = strm.next_out;
79155                output = strm.output;
79156                left = strm.avail_out;
79157                next = strm.next_in;
79158                input = strm.input;
79159                have = strm.avail_in;
79160                hold = state.hold;
79161                bits = state.bits; //---
79162
79163                if (state.mode === TYPE) {
79164                  state.back = -1;
79165                }
79166
79167                break;
79168              }
79169
79170              state.back = 0;
79171
79172              for (;;) {
79173                here = state.lencode[hold & (1 << state.lenbits) - 1];
79174                /*BITS(state.lenbits)*/
79175
79176                here_bits = here >>> 24;
79177                here_op = here >>> 16 & 0xff;
79178                here_val = here & 0xffff;
79179
79180                if (here_bits <= bits) {
79181                  break;
79182                } //--- PULLBYTE() ---//
79183
79184
79185                if (have === 0) {
79186                  break inf_leave;
79187                }
79188
79189                have--;
79190                hold += input[next++] << bits;
79191                bits += 8; //---//
79192              }
79193
79194              if (here_op && (here_op & 0xf0) === 0) {
79195                last_bits = here_bits;
79196                last_op = here_op;
79197                last_val = here_val;
79198
79199                for (;;) {
79200                  here = state.lencode[last_val + ((hold & (1 << last_bits + last_op) - 1) >>
79201                  /*BITS(last.bits + last.op)*/
79202                  last_bits)];
79203                  here_bits = here >>> 24;
79204                  here_op = here >>> 16 & 0xff;
79205                  here_val = here & 0xffff;
79206
79207                  if (last_bits + here_bits <= bits) {
79208                    break;
79209                  } //--- PULLBYTE() ---//
79210
79211
79212                  if (have === 0) {
79213                    break inf_leave;
79214                  }
79215
79216                  have--;
79217                  hold += input[next++] << bits;
79218                  bits += 8; //---//
79219                } //--- DROPBITS(last.bits) ---//
79220
79221
79222                hold >>>= last_bits;
79223                bits -= last_bits; //---//
79224
79225                state.back += last_bits;
79226              } //--- DROPBITS(here.bits) ---//
79227
79228
79229              hold >>>= here_bits;
79230              bits -= here_bits; //---//
79231
79232              state.back += here_bits;
79233              state.length = here_val;
79234
79235              if (here_op === 0) {
79236                //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
79237                //        "inflate:         literal '%c'\n" :
79238                //        "inflate:         literal 0x%02x\n", here.val));
79239                state.mode = LIT;
79240                break;
79241              }
79242
79243              if (here_op & 32) {
79244                //Tracevv((stderr, "inflate:         end of block\n"));
79245                state.back = -1;
79246                state.mode = TYPE;
79247                break;
79248              }
79249
79250              if (here_op & 64) {
79251                strm.msg = 'invalid literal/length code';
79252                state.mode = BAD;
79253                break;
79254              }
79255
79256              state.extra = here_op & 15;
79257              state.mode = LENEXT;
79258
79259            /* falls through */
79260
79261            case LENEXT:
79262              if (state.extra) {
79263                //=== NEEDBITS(state.extra);
79264                n = state.extra;
79265
79266                while (bits < n) {
79267                  if (have === 0) {
79268                    break inf_leave;
79269                  }
79270
79271                  have--;
79272                  hold += input[next++] << bits;
79273                  bits += 8;
79274                } //===//
79275
79276
79277                state.length += hold & (1 << state.extra) - 1
79278                /*BITS(state.extra)*/
79279                ; //--- DROPBITS(state.extra) ---//
79280
79281                hold >>>= state.extra;
79282                bits -= state.extra; //---//
79283
79284                state.back += state.extra;
79285              } //Tracevv((stderr, "inflate:         length %u\n", state.length));
79286
79287
79288              state.was = state.length;
79289              state.mode = DIST;
79290
79291            /* falls through */
79292
79293            case DIST:
79294              for (;;) {
79295                here = state.distcode[hold & (1 << state.distbits) - 1];
79296                /*BITS(state.distbits)*/
79297
79298                here_bits = here >>> 24;
79299                here_op = here >>> 16 & 0xff;
79300                here_val = here & 0xffff;
79301
79302                if (here_bits <= bits) {
79303                  break;
79304                } //--- PULLBYTE() ---//
79305
79306
79307                if (have === 0) {
79308                  break inf_leave;
79309                }
79310
79311                have--;
79312                hold += input[next++] << bits;
79313                bits += 8; //---//
79314              }
79315
79316              if ((here_op & 0xf0) === 0) {
79317                last_bits = here_bits;
79318                last_op = here_op;
79319                last_val = here_val;
79320
79321                for (;;) {
79322                  here = state.distcode[last_val + ((hold & (1 << last_bits + last_op) - 1) >>
79323                  /*BITS(last.bits + last.op)*/
79324                  last_bits)];
79325                  here_bits = here >>> 24;
79326                  here_op = here >>> 16 & 0xff;
79327                  here_val = here & 0xffff;
79328
79329                  if (last_bits + here_bits <= bits) {
79330                    break;
79331                  } //--- PULLBYTE() ---//
79332
79333
79334                  if (have === 0) {
79335                    break inf_leave;
79336                  }
79337
79338                  have--;
79339                  hold += input[next++] << bits;
79340                  bits += 8; //---//
79341                } //--- DROPBITS(last.bits) ---//
79342
79343
79344                hold >>>= last_bits;
79345                bits -= last_bits; //---//
79346
79347                state.back += last_bits;
79348              } //--- DROPBITS(here.bits) ---//
79349
79350
79351              hold >>>= here_bits;
79352              bits -= here_bits; //---//
79353
79354              state.back += here_bits;
79355
79356              if (here_op & 64) {
79357                strm.msg = 'invalid distance code';
79358                state.mode = BAD;
79359                break;
79360              }
79361
79362              state.offset = here_val;
79363              state.extra = here_op & 15;
79364              state.mode = DISTEXT;
79365
79366            /* falls through */
79367
79368            case DISTEXT:
79369              if (state.extra) {
79370                //=== NEEDBITS(state.extra);
79371                n = state.extra;
79372
79373                while (bits < n) {
79374                  if (have === 0) {
79375                    break inf_leave;
79376                  }
79377
79378                  have--;
79379                  hold += input[next++] << bits;
79380                  bits += 8;
79381                } //===//
79382
79383
79384                state.offset += hold & (1 << state.extra) - 1
79385                /*BITS(state.extra)*/
79386                ; //--- DROPBITS(state.extra) ---//
79387
79388                hold >>>= state.extra;
79389                bits -= state.extra; //---//
79390
79391                state.back += state.extra;
79392              } //#ifdef INFLATE_STRICT
79393
79394
79395              if (state.offset > state.dmax) {
79396                strm.msg = 'invalid distance too far back';
79397                state.mode = BAD;
79398                break;
79399              } //#endif
79400              //Tracevv((stderr, "inflate:         distance %u\n", state.offset));
79401
79402
79403              state.mode = MATCH;
79404
79405            /* falls through */
79406
79407            case MATCH:
79408              if (left === 0) {
79409                break inf_leave;
79410              }
79411
79412              copy = _out - left;
79413
79414              if (state.offset > copy) {
79415                /* copy from window */
79416                copy = state.offset - copy;
79417
79418                if (copy > state.whave) {
79419                  if (state.sane) {
vendor: 6,243 bytes, lines 79420-79616
79420                    strm.msg = 'invalid distance too far back';
79421                    state.mode = BAD;
79422                    break;
79423                  } // (!) This block is disabled in zlib defaults,
79424                  // don't enable it for binary compatibility
79425                  //#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
79426                  //          Trace((stderr, "inflate.c too far\n"));
79427                  //          copy -= state.whave;
79428                  //          if (copy > state.length) { copy = state.length; }
79429                  //          if (copy > left) { copy = left; }
79430                  //          left -= copy;
79431                  //          state.length -= copy;
79432                  //          do {
79433                  //            output[put++] = 0;
79434                  //          } while (--copy);
79435                  //          if (state.length === 0) { state.mode = LEN; }
79436                  //          break;
79437                  //#endif
79438
79439                }
79440
79441                if (copy > state.wnext) {
79442                  copy -= state.wnext;
79443                  from = state.wsize - copy;
79444                } else {
79445                  from = state.wnext - copy;
79446                }
79447
79448                if (copy > state.length) {
79449                  copy = state.length;
79450                }
79451
79452                from_source = state.window;
79453              } else {
79454                /* copy from output */
79455                from_source = output;
79456                from = put - state.offset;
79457                copy = state.length;
79458              }
79459
79460              if (copy > left) {
79461                copy = left;
79462              }
79463
79464              left -= copy;
79465              state.length -= copy;
79466
79467              do {
79468                output[put++] = from_source[from++];
79469              } while (--copy);
79470
79471              if (state.length === 0) {
79472                state.mode = LEN;
79473              }
79474
79475              break;
79476
79477            case LIT:
79478              if (left === 0) {
79479                break inf_leave;
79480              }
79481
79482              output[put++] = state.length;
79483              left--;
79484              state.mode = LEN;
79485              break;
79486
79487            case CHECK:
79488              if (state.wrap) {
79489                //=== NEEDBITS(32);
79490                while (bits < 32) {
79491                  if (have === 0) {
79492                    break inf_leave;
79493                  }
79494
79495                  have--; // Use '|' instead of '+' to make sure that result is signed
79496
79497                  hold |= input[next++] << bits;
79498                  bits += 8;
79499                } //===//
79500
79501
79502                _out -= left;
79503                strm.total_out += _out;
79504                state.total += _out;
79505
79506                if (_out) {
79507                  strm.adler = state.check =
79508                  /*UPDATE(state.check, put - _out, _out);*/
79509                  state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out);
79510                }
79511
79512                _out = left; // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too
79513
79514                if ((state.flags ? hold : zswap32(hold)) !== state.check) {
79515                  strm.msg = 'incorrect data check';
79516                  state.mode = BAD;
79517                  break;
79518                } //=== INITBITS();
79519
79520
79521                hold = 0;
79522                bits = 0; //===//
79523                //Tracev((stderr, "inflate:   check matches trailer\n"));
79524              }
79525
79526              state.mode = LENGTH;
79527
79528            /* falls through */
79529
79530            case LENGTH:
79531              if (state.wrap && state.flags) {
79532                //=== NEEDBITS(32);
79533                while (bits < 32) {
79534                  if (have === 0) {
79535                    break inf_leave;
79536                  }
79537
79538                  have--;
79539                  hold += input[next++] << bits;
79540                  bits += 8;
79541                } //===//
79542
79543
79544                if (hold !== (state.total & 0xffffffff)) {
79545                  strm.msg = 'incorrect length check';
79546                  state.mode = BAD;
79547                  break;
79548                } //=== INITBITS();
79549
79550
79551                hold = 0;
79552                bits = 0; //===//
79553                //Tracev((stderr, "inflate:   length matches trailer\n"));
79554              }
79555
79556              state.mode = DONE;
79557
79558            /* falls through */
79559
79560            case DONE:
79561              ret = Z_STREAM_END;
79562              break inf_leave;
79563
79564            case BAD:
79565              ret = Z_DATA_ERROR;
79566              break inf_leave;
79567
79568            case MEM:
79569              return Z_MEM_ERROR;
79570
79571            case SYNC:
79572            /* falls through */
79573
79574            default:
79575              return Z_STREAM_ERROR;
79576          }
79577        } // inf_leave <- here is real place for "goto inf_leave", emulated via "break inf_leave"
79578
79579        /*
79580           Return from inflate(), updating the total counts and the check value.
79581           If there was no progress during the inflate() call, return a buffer
79582           error.  Call updatewindow() to create and/or update the window state.
79583           Note: a memory error from inflate() is non-recoverable.
79584         */
79585        //--- RESTORE() ---
79586
79587
79588        strm.next_out = put;
79589        strm.avail_out = left;
79590        strm.next_in = next;
79591        strm.avail_in = have;
79592        state.hold = hold;
79593        state.bits = bits; //---
79594
79595        if (state.wsize || _out !== strm.avail_out && state.mode < BAD && (state.mode < CHECK || flush !== Z_FINISH)) {
79596          if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) {
79597            state.mode = MEM;
79598            return Z_MEM_ERROR;
79599          }
79600        }
79601
79602        _in -= strm.avail_in;
79603        _out -= strm.avail_out;
79604        strm.total_in += _in;
79605        strm.total_out += _out;
79606        state.total += _out;
79607
79608        if (state.wrap && _out) {
79609          strm.adler = state.check =
79610          /*UPDATE(state.check, strm.next_out - _out, _out);*/
79611          state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out);
79612        }
79613
79614        strm.data_type = state.bits + (state.last ? 64 : 0) + (state.mode === TYPE ? 128 : 0) + (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0);
79615
79616        if ((_in === 0 && _out === 0 || flush === Z_FINISH) && ret === Z_OK) {
vendor: 8,581 bytes, lines 79617-79868
79617          ret = Z_BUF_ERROR;
79618        }
79619
79620        return ret;
79621      }
79622
79623      function inflateEnd(strm) {
79624        if (!strm || !strm.state
79625        /*|| strm->zfree == (free_func)0*/
79626        ) {
79627            return Z_STREAM_ERROR;
79628          }
79629
79630        var state = strm.state;
79631
79632        if (state.window) {
79633          state.window = null;
79634        }
79635
79636        strm.state = null;
79637        return Z_OK;
79638      }
79639
79640      function inflateGetHeader(strm, head) {
79641        var state;
79642        /* check state */
79643
79644        if (!strm || !strm.state) {
79645          return Z_STREAM_ERROR;
79646        }
79647
79648        state = strm.state;
79649
79650        if ((state.wrap & 2) === 0) {
79651          return Z_STREAM_ERROR;
79652        }
79653        /* save header structure */
79654
79655
79656        state.head = head;
79657        head.done = false;
79658        return Z_OK;
79659      }
79660
79661      function inflateSetDictionary(strm, dictionary) {
79662        var dictLength = dictionary.length;
79663        var state;
79664        var dictid;
79665        var ret;
79666        /* check state */
79667
79668        if (!strm
79669        /* == Z_NULL */
79670        || !strm.state
79671        /* == Z_NULL */
79672        ) {
79673            return Z_STREAM_ERROR;
79674          }
79675
79676        state = strm.state;
79677
79678        if (state.wrap !== 0 && state.mode !== DICT) {
79679          return Z_STREAM_ERROR;
79680        }
79681        /* check for correct dictionary identifier */
79682
79683
79684        if (state.mode === DICT) {
79685          dictid = 1;
79686          /* adler32(0, null, 0)*/
79687
79688          /* dictid = adler32(dictid, dictionary, dictLength); */
79689
79690          dictid = adler32(dictid, dictionary, dictLength, 0);
79691
79692          if (dictid !== state.check) {
79693            return Z_DATA_ERROR;
79694          }
79695        }
79696        /* copy dictionary to window using updatewindow(), which will amend the
79697         existing dictionary if appropriate */
79698
79699
79700        ret = updatewindow(strm, dictionary, dictLength, dictLength);
79701
79702        if (ret) {
79703          state.mode = MEM;
79704          return Z_MEM_ERROR;
79705        }
79706
79707        state.havedict = 1; // Tracev((stderr, "inflate:   dictionary set\n"));
79708
79709        return Z_OK;
79710      }
79711
79712      exports.inflateReset = inflateReset;
79713      exports.inflateReset2 = inflateReset2;
79714      exports.inflateResetKeep = inflateResetKeep;
79715      exports.inflateInit = inflateInit;
79716      exports.inflateInit2 = inflateInit2;
79717      exports.inflate = inflate;
79718      exports.inflateEnd = inflateEnd;
79719      exports.inflateGetHeader = inflateGetHeader;
79720      exports.inflateSetDictionary = inflateSetDictionary;
79721      exports.inflateInfo = 'pako inflate (from Nodeca project)';
79722      /* Not implemented
79723      exports.inflateCopy = inflateCopy;
79724      exports.inflateGetDictionary = inflateGetDictionary;
79725      exports.inflateMark = inflateMark;
79726      exports.inflatePrime = inflatePrime;
79727      exports.inflateSync = inflateSync;
79728      exports.inflateSyncPoint = inflateSyncPoint;
79729      exports.inflateUndermine = inflateUndermine;
79730      */
79731    }, {
79732      "../utils/common": 419,
79733      "./adler32": 421,
79734      "./crc32": 423,
79735      "./inffast": 426,
79736      "./inftrees": 428
79737    }],
79738    428: [function (require, module, exports) {
79739      'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler
79740      // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
79741      //
79742      // This software is provided 'as-is', without any express or implied
79743      // warranty. In no event will the authors be held liable for any damages
79744      // arising from the use of this software.
79745      //
79746      // Permission is granted to anyone to use this software for any purpose,
79747      // including commercial applications, and to alter it and redistribute it
79748      // freely, subject to the following restrictions:
79749      //
79750      // 1. The origin of this software must not be misrepresented; you must not
79751      //   claim that you wrote the original software. If you use this software
79752      //   in a product, an acknowledgment in the product documentation would be
79753      //   appreciated but is not required.
79754      // 2. Altered source versions must be plainly marked as such, and must not be
79755      //   misrepresented as being the original software.
79756      // 3. This notice may not be removed or altered from any source distribution.
79757
79758      var utils = require('../utils/common');
79759
79760      var MAXBITS = 15;
79761      var ENOUGH_LENS = 852;
79762      var ENOUGH_DISTS = 592; //var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);
79763
79764      var CODES = 0;
79765      var LENS = 1;
79766      var DISTS = 2;
79767      var lbase = [
79768      /* Length codes 257..285 base */
79769      3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0];
79770      var lext = [
79771      /* Length codes 257..285 extra */
79772      16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78];
79773      var dbase = [
79774      /* Distance codes 0..29 base */
79775      1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 0, 0];
79776      var dext = [
79777      /* Distance codes 0..29 extra */
79778      16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 64, 64];
79779
79780      module.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts) {
79781        var bits = opts.bits; //here = opts.here; /* table entry for duplication */
79782
79783        var len = 0;
79784        /* a code's length in bits */
79785
79786        var sym = 0;
79787        /* index of code symbols */
79788
79789        var min = 0,
79790            max = 0;
79791        /* minimum and maximum code lengths */
79792
79793        var root = 0;
79794        /* number of index bits for root table */
79795
79796        var curr = 0;
79797        /* number of index bits for current table */
79798
79799        var drop = 0;
79800        /* code bits to drop for sub-table */
79801
79802        var left = 0;
79803        /* number of prefix codes available */
79804
79805        var used = 0;
79806        /* code entries in table used */
79807
79808        var huff = 0;
79809        /* Huffman code */
79810
79811        var incr;
79812        /* for incrementing code, index */
79813
79814        var fill;
79815        /* index for replicating entries */
79816
79817        var low;
79818        /* low bits for current root entry */
79819
79820        var mask;
79821        /* mask for low root bits */
79822
79823        var next;
79824        /* next available space in table */
79825
79826        var base = null;
79827        /* base value table to use */
79828
79829        var base_index = 0; //  var shoextra;    /* extra bits table to use */
79830
79831        var end;
79832        /* use base and extra for symbol > end */
79833
79834        var count = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1];    /* number of codes of each length */
79835
79836        var offs = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1];     /* offsets in table for each length */
79837
79838        var extra = null;
79839        var extra_index = 0;
79840        var here_bits, here_op, here_val;
79841        /*
79842         Process a set of code lengths to create a canonical Huffman code.  The
79843         code lengths are lens[0..codes-1].  Each length corresponds to the
79844         symbols 0..codes-1.  The Huffman code is generated by first sorting the
79845         symbols by length from short to long, and retaining the symbol order
79846         for codes with equal lengths.  Then the code starts with all zero bits
79847         for the first code of the shortest length, and the codes are integer
79848         increments for the same length, and zeros are appended as the length
79849         increases.  For the deflate format, these bits are stored backwards
79850         from their more natural integer increment ordering, and so when the
79851         decoding tables are built in the large loop below, the integer codes
79852         are incremented backwards.
79853          This routine assumes, but does not check, that all of the entries in
79854         lens[] are in the range 0..MAXBITS.  The caller must assure this.
79855         1..MAXBITS is interpreted as that code length.  zero means that that
79856         symbol does not occur in this code.
79857          The codes are sorted by computing a count of codes for each length,
79858         creating from that a table of starting indices for each length in the
79859         sorted table, and then entering the symbols in order in the sorted
79860         table.  The sorted table is work[], with that space being provided by
79861         the caller.
79862          The length counts are used for other purposes as well, i.e. finding
79863         the minimum and maximum length codes, determining if there are any
79864         codes at all, checking for a valid set of lengths, and looking ahead
79865         at length counts to determine sub-table sizes when building the
79866         decoding tables.
79867         */
79868
vendor: 9,977 bytes, lines 79869-80193
79869        /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */
79870
79871        for (len = 0; len <= MAXBITS; len++) {
79872          count[len] = 0;
79873        }
79874
79875        for (sym = 0; sym < codes; sym++) {
79876          count[lens[lens_index + sym]]++;
79877        }
79878        /* bound code lengths, force root to be within code lengths */
79879
79880
79881        root = bits;
79882
79883        for (max = MAXBITS; max >= 1; max--) {
79884          if (count[max] !== 0) {
79885            break;
79886          }
79887        }
79888
79889        if (root > max) {
79890          root = max;
79891        }
79892
79893        if (max === 0) {
79894          /* no symbols to code at all */
79895          //table.op[opts.table_index] = 64;  //here.op = (var char)64;    /* invalid code marker */
79896          //table.bits[opts.table_index] = 1;   //here.bits = (var char)1;
79897          //table.val[opts.table_index++] = 0;   //here.val = (var short)0;
79898          table[table_index++] = 1 << 24 | 64 << 16 | 0; //table.op[opts.table_index] = 64;
79899          //table.bits[opts.table_index] = 1;
79900          //table.val[opts.table_index++] = 0;
79901
79902          table[table_index++] = 1 << 24 | 64 << 16 | 0;
79903          opts.bits = 1;
79904          return 0;
79905          /* no symbols, but wait for decoding to report error */
79906        }
79907
79908        for (min = 1; min < max; min++) {
79909          if (count[min] !== 0) {
79910            break;
79911          }
79912        }
79913
79914        if (root < min) {
79915          root = min;
79916        }
79917        /* check for an over-subscribed or incomplete set of lengths */
79918
79919
79920        left = 1;
79921
79922        for (len = 1; len <= MAXBITS; len++) {
79923          left <<= 1;
79924          left -= count[len];
79925
79926          if (left < 0) {
79927            return -1;
79928          }
79929          /* over-subscribed */
79930
79931        }
79932
79933        if (left > 0 && (type === CODES || max !== 1)) {
79934          return -1;
79935          /* incomplete set */
79936        }
79937        /* generate offsets into symbol table for each length for sorting */
79938
79939
79940        offs[1] = 0;
79941
79942        for (len = 1; len < MAXBITS; len++) {
79943          offs[len + 1] = offs[len] + count[len];
79944        }
79945        /* sort symbols by length, by symbol order within each length */
79946
79947
79948        for (sym = 0; sym < codes; sym++) {
79949          if (lens[lens_index + sym] !== 0) {
79950            work[offs[lens[lens_index + sym]]++] = sym;
79951          }
79952        }
79953        /*
79954         Create and fill in decoding tables.  In this loop, the table being
79955         filled is at next and has curr index bits.  The code being used is huff
79956         with length len.  That code is converted to an index by dropping drop
79957         bits off of the bottom.  For codes where len is less than drop + curr,
79958         those top drop + curr - len bits are incremented through all values to
79959         fill the table with replicated entries.
79960          root is the number of index bits for the root table.  When len exceeds
79961         root, sub-tables are created pointed to by the root entry with an index
79962         of the low root bits of huff.  This is saved in low to check for when a
79963         new sub-table should be started.  drop is zero when the root table is
79964         being filled, and drop is root when sub-tables are being filled.
79965          When a new sub-table is needed, it is necessary to look ahead in the
79966         code lengths to determine what size sub-table is needed.  The length
79967         counts are used for this, and so count[] is decremented as codes are
79968         entered in the tables.
79969          used keeps track of how many table entries have been allocated from the
79970         provided *table space.  It is checked for LENS and DIST tables against
79971         the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in
79972         the initial root table size constants.  See the comments in inftrees.h
79973         for more information.
79974          sym increments through all symbols, and the loop terminates when
79975         all codes of length max, i.e. all codes, have been processed.  This
79976         routine permits incomplete codes, so another loop after this one fills
79977         in the rest of the decoding tables with invalid code markers.
79978         */
79979
79980        /* set up for code type */
79981        // poor man optimization - use if-else instead of switch,
79982        // to avoid deopts in old v8
79983
79984
79985        if (type === CODES) {
79986          base = extra = work;
79987          /* dummy value--not used */
79988
79989          end = 19;
79990        } else if (type === LENS) {
79991          base = lbase;
79992          base_index -= 257;
79993          extra = lext;
79994          extra_index -= 257;
79995          end = 256;
79996        } else {
79997          /* DISTS */
79998          base = dbase;
79999          extra = dext;
80000          end = -1;
80001        }
80002        /* initialize opts for loop */
80003
80004
80005        huff = 0;
80006        /* starting code */
80007
80008        sym = 0;
80009        /* starting code symbol */
80010
80011        len = min;
80012        /* starting code length */
80013
80014        next = table_index;
80015        /* current table to fill in */
80016
80017        curr = root;
80018        /* current table index bits */
80019
80020        drop = 0;
80021        /* current bits to drop from code for index */
80022
80023        low = -1;
80024        /* trigger new sub-table when len > root */
80025
80026        used = 1 << root;
80027        /* use root table entries */
80028
80029        mask = used - 1;
80030        /* mask for comparing low */
80031
80032        /* check available table space */
80033
80034        if (type === LENS && used > ENOUGH_LENS || type === DISTS && used > ENOUGH_DISTS) {
80035          return 1;
80036        }
80037        /* process all codes and make table entries */
80038
80039
80040        for (;;) {
80041          /* create table entry */
80042          here_bits = len - drop;
80043
80044          if (work[sym] < end) {
80045            here_op = 0;
80046            here_val = work[sym];
80047          } else if (work[sym] > end) {
80048            here_op = extra[extra_index + work[sym]];
80049            here_val = base[base_index + work[sym]];
80050          } else {
80051            here_op = 32 + 64;
80052            /* end of block */
80053
80054            here_val = 0;
80055          }
80056          /* replicate for those indices with low len bits equal to huff */
80057
80058
80059          incr = 1 << len - drop;
80060          fill = 1 << curr;
80061          min = fill;
80062          /* save offset to next table */
80063
80064          do {
80065            fill -= incr;
80066            table[next + (huff >> drop) + fill] = here_bits << 24 | here_op << 16 | here_val | 0;
80067          } while (fill !== 0);
80068          /* backwards increment the len-bit code huff */
80069
80070
80071          incr = 1 << len - 1;
80072
80073          while (huff & incr) {
80074            incr >>= 1;
80075          }
80076
80077          if (incr !== 0) {
80078            huff &= incr - 1;
80079            huff += incr;
80080          } else {
80081            huff = 0;
80082          }
80083          /* go to next symbol, update count, len */
80084
80085
80086          sym++;
80087
80088          if (--count[len] === 0) {
80089            if (len === max) {
80090              break;
80091            }
80092
80093            len = lens[lens_index + work[sym]];
80094          }
80095          /* create new sub-table if needed */
80096
80097
80098          if (len > root && (huff & mask) !== low) {
80099            /* if first time, transition to sub-tables */
80100            if (drop === 0) {
80101              drop = root;
80102            }
80103            /* increment past last table */
80104
80105
80106            next += min;
80107            /* here min is 1 << curr */
80108
80109            /* determine length of next table */
80110
80111            curr = len - drop;
80112            left = 1 << curr;
80113
80114            while (curr + drop < max) {
80115              left -= count[curr + drop];
80116
80117              if (left <= 0) {
80118                break;
80119              }
80120
80121              curr++;
80122              left <<= 1;
80123            }
80124            /* check for enough space */
80125
80126
80127            used += 1 << curr;
80128
80129            if (type === LENS && used > ENOUGH_LENS || type === DISTS && used > ENOUGH_DISTS) {
80130              return 1;
80131            }
80132            /* point entry in root table to sub-table */
80133
80134
80135            low = huff & mask;
80136            /*table.op[low] = curr;
80137            table.bits[low] = root;
80138            table.val[low] = next - opts.table_index;*/
80139
80140            table[low] = root << 24 | curr << 16 | next - table_index | 0;
80141          }
80142        }
80143        /* fill in remaining table entry if code is incomplete (guaranteed to have
80144         at most one remaining entry, since if the code is incomplete, the
80145         maximum code length that was allowed to get this far is one bit) */
80146
80147
80148        if (huff !== 0) {
80149          //table.op[next + huff] = 64;            /* invalid code marker */
80150          //table.bits[next + huff] = len - drop;
80151          //table.val[next + huff] = 0;
80152          table[next + huff] = len - drop << 24 | 64 << 16 | 0;
80153        }
80154        /* set return parameters */
80155        //opts.table_index += used;
80156
80157
80158        opts.bits = root;
80159        return 0;
80160      };
80161    }, {
80162      "../utils/common": 419
80163    }],
80164    429: [function (require, module, exports) {
80165      'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler
80166      // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
80167      //
80168      // This software is provided 'as-is', without any express or implied
80169      // warranty. In no event will the authors be held liable for any damages
80170      // arising from the use of this software.
80171      //
80172      // Permission is granted to anyone to use this software for any purpose,
80173      // including commercial applications, and to alter it and redistribute it
80174      // freely, subject to the following restrictions:
80175      //
80176      // 1. The origin of this software must not be misrepresented; you must not
80177      //   claim that you wrote the original software. If you use this software
80178      //   in a product, an acknowledgment in the product documentation would be
80179      //   appreciated but is not required.
80180      // 2. Altered source versions must be plainly marked as such, and must not be
80181      //   misrepresented as being the original software.
80182      // 3. This notice may not be removed or altered from any source distribution.
80183
80184      module.exports = {
80185        2: 'need dictionary',
80186
80187        /* Z_NEED_DICT       2  */
80188        1: 'stream end',
80189
80190        /* Z_STREAM_END      1  */
80191        0: '',
80192
80193        /* Z_OK              0  */
vendor: 8,010 bytes, lines 80194-80430
80194        '-1': 'file error',
80195
80196        /* Z_ERRNO         (-1) */
80197        '-2': 'stream error',
80198
80199        /* Z_STREAM_ERROR  (-2) */
80200        '-3': 'data error',
80201
80202        /* Z_DATA_ERROR    (-3) */
80203        '-4': 'insufficient memory',
80204
80205        /* Z_MEM_ERROR     (-4) */
80206        '-5': 'buffer error',
80207
80208        /* Z_BUF_ERROR     (-5) */
80209        '-6': 'incompatible version'
80210        /* Z_VERSION_ERROR (-6) */
80211
80212      };
80213    }, {}],
80214    430: [function (require, module, exports) {
80215      'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler
80216      // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
80217      //
80218      // This software is provided 'as-is', without any express or implied
80219      // warranty. In no event will the authors be held liable for any damages
80220      // arising from the use of this software.
80221      //
80222      // Permission is granted to anyone to use this software for any purpose,
80223      // including commercial applications, and to alter it and redistribute it
80224      // freely, subject to the following restrictions:
80225      //
80226      // 1. The origin of this software must not be misrepresented; you must not
80227      //   claim that you wrote the original software. If you use this software
80228      //   in a product, an acknowledgment in the product documentation would be
80229      //   appreciated but is not required.
80230      // 2. Altered source versions must be plainly marked as such, and must not be
80231      //   misrepresented as being the original software.
80232      // 3. This notice may not be removed or altered from any source distribution.
80233
80234      /* eslint-disable space-unary-ops */
80235
80236      var utils = require('../utils/common');
80237      /* Public constants ==========================================================*/
80238
80239      /* ===========================================================================*/
80240      //var Z_FILTERED          = 1;
80241      //var Z_HUFFMAN_ONLY      = 2;
80242      //var Z_RLE               = 3;
80243
80244
80245      var Z_FIXED = 4; //var Z_DEFAULT_STRATEGY  = 0;
80246
80247      /* Possible values of the data_type field (though see inflate()) */
80248
80249      var Z_BINARY = 0;
80250      var Z_TEXT = 1; //var Z_ASCII             = 1; // = Z_TEXT
80251
80252      var Z_UNKNOWN = 2;
80253      /*============================================================================*/
80254
80255      function zero(buf) {
80256        var len = buf.length;
80257
80258        while (--len >= 0) {
80259          buf[len] = 0;
80260        }
80261      } // From zutil.h
80262
80263
80264      var STORED_BLOCK = 0;
80265      var STATIC_TREES = 1;
80266      var DYN_TREES = 2;
80267      /* The three kinds of block type */
80268
80269      var MIN_MATCH = 3;
80270      var MAX_MATCH = 258;
80271      /* The minimum and maximum match lengths */
80272      // From deflate.h
80273
80274      /* ===========================================================================
80275       * Internal compression state.
80276       */
80277
80278      var LENGTH_CODES = 29;
80279      /* number of length codes, not counting the special END_BLOCK code */
80280
80281      var LITERALS = 256;
80282      /* number of literal bytes 0..255 */
80283
80284      var L_CODES = LITERALS + 1 + LENGTH_CODES;
80285      /* number of Literal or Length codes, including the END_BLOCK code */
80286
80287      var D_CODES = 30;
80288      /* number of distance codes */
80289
80290      var BL_CODES = 19;
80291      /* number of codes used to transfer the bit lengths */
80292
80293      var HEAP_SIZE = 2 * L_CODES + 1;
80294      /* maximum heap size */
80295
80296      var MAX_BITS = 15;
80297      /* All codes must not exceed MAX_BITS bits */
80298
80299      var Buf_size = 16;
80300      /* size of bit buffer in bi_buf */
80301
80302      /* ===========================================================================
80303       * Constants
80304       */
80305
80306      var MAX_BL_BITS = 7;
80307      /* Bit length codes must not exceed MAX_BL_BITS bits */
80308
80309      var END_BLOCK = 256;
80310      /* end of block literal code */
80311
80312      var REP_3_6 = 16;
80313      /* repeat previous bit length 3-6 times (2 bits of repeat count) */
80314
80315      var REPZ_3_10 = 17;
80316      /* repeat a zero length 3-10 times  (3 bits of repeat count) */
80317
80318      var REPZ_11_138 = 18;
80319      /* repeat a zero length 11-138 times  (7 bits of repeat count) */
80320
80321      /* eslint-disable comma-spacing,array-bracket-spacing */
80322
80323      var extra_lbits =
80324      /* extra bits for each length code */
80325      [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0];
80326      var extra_dbits =
80327      /* extra bits for each distance code */
80328      [0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13];
80329      var extra_blbits =
80330      /* extra bits for each bit length code */
80331      [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7];
80332      var bl_order = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15];
80333      /* eslint-enable comma-spacing,array-bracket-spacing */
80334
80335      /* The lengths of the bit length codes are sent in order of decreasing
80336       * probability, to avoid transmitting the lengths for unused bit length codes.
80337       */
80338
80339      /* ===========================================================================
80340       * Local data. These are initialized only once.
80341       */
80342      // We pre-fill arrays with 0 to avoid uninitialized gaps
80343
80344      var DIST_CODE_LEN = 512;
80345      /* see definition of array dist_code below */
80346      // !!!! Use flat array instead of structure, Freq = i*2, Len = i*2+1
80347
80348      var static_ltree = new Array((L_CODES + 2) * 2);
80349      zero(static_ltree);
80350      /* The static literal tree. Since the bit lengths are imposed, there is no
80351       * need for the L_CODES extra codes used during heap construction. However
80352       * The codes 286 and 287 are needed to build a canonical tree (see _tr_init
80353       * below).
80354       */
80355
80356      var static_dtree = new Array(D_CODES * 2);
80357      zero(static_dtree);
80358      /* The static distance tree. (Actually a trivial tree since all codes use
80359       * 5 bits.)
80360       */
80361
80362      var _dist_code = new Array(DIST_CODE_LEN);
80363
80364      zero(_dist_code);
80365      /* Distance codes. The first 256 values correspond to the distances
80366       * 3 .. 258, the last 256 values correspond to the top 8 bits of
80367       * the 15 bit distances.
80368       */
80369
80370      var _length_code = new Array(MAX_MATCH - MIN_MATCH + 1);
80371
80372      zero(_length_code);
80373      /* length code for each normalized match length (0 == MIN_MATCH) */
80374
80375      var base_length = new Array(LENGTH_CODES);
80376      zero(base_length);
80377      /* First normalized length for each code (0 = MIN_MATCH) */
80378
80379      var base_dist = new Array(D_CODES);
80380      zero(base_dist);
80381      /* First normalized distance for each code (0 = distance of 1) */
80382
80383      function StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) {
80384        this.static_tree = static_tree;
80385        /* static tree or NULL */
80386
80387        this.extra_bits = extra_bits;
80388        /* extra bits for each code or NULL */
80389
80390        this.extra_base = extra_base;
80391        /* base index for extra_bits */
80392
80393        this.elems = elems;
80394        /* max number of elements in the tree */
80395
80396        this.max_length = max_length;
80397        /* max bit length for the codes */
80398        // show if `static_tree` has data or dummy - needed for monomorphic objects
80399
80400        this.has_stree = static_tree && static_tree.length;
80401      }
80402
80403      var static_l_desc;
80404      var static_d_desc;
80405      var static_bl_desc;
80406
80407      function TreeDesc(dyn_tree, stat_desc) {
80408        this.dyn_tree = dyn_tree;
80409        /* the dynamic tree */
80410
80411        this.max_code = 0;
80412        /* largest code with non zero frequency */
80413
80414        this.stat_desc = stat_desc;
80415        /* the corresponding static tree */
80416      }
80417
80418      function d_code(dist) {
80419        return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)];
80420      }
80421      /* ===========================================================================
80422       * Output a short LSB first on the stream.
80423       * IN assertion: there is enough room in pendingBuf.
80424       */
80425
80426
80427      function put_short(s, w) {
80428        //    put_byte(s, (uch)((w) & 0xff));
80429        //    put_byte(s, (uch)((ush)(w) >> 8));
80430        s.pending_buf[s.pending++] = w & 0xff;
vendor: 5,210 bytes, lines 80431-80617
80431        s.pending_buf[s.pending++] = w >>> 8 & 0xff;
80432      }
80433      /* ===========================================================================
80434       * Send a value on a given number of bits.
80435       * IN assertion: length <= 16 and value fits in length bits.
80436       */
80437
80438
80439      function send_bits(s, value, length) {
80440        if (s.bi_valid > Buf_size - length) {
80441          s.bi_buf |= value << s.bi_valid & 0xffff;
80442          put_short(s, s.bi_buf);
80443          s.bi_buf = value >> Buf_size - s.bi_valid;
80444          s.bi_valid += length - Buf_size;
80445        } else {
80446          s.bi_buf |= value << s.bi_valid & 0xffff;
80447          s.bi_valid += length;
80448        }
80449      }
80450
80451      function send_code(s, c, tree) {
80452        send_bits(s, tree[c * 2]
80453        /*.Code*/
80454        , tree[c * 2 + 1]
80455        /*.Len*/
80456        );
80457      }
80458      /* ===========================================================================
80459       * Reverse the first len bits of a code, using straightforward code (a faster
80460       * method would use a table)
80461       * IN assertion: 1 <= len <= 15
80462       */
80463
80464
80465      function bi_reverse(code, len) {
80466        var res = 0;
80467
80468        do {
80469          res |= code & 1;
80470          code >>>= 1;
80471          res <<= 1;
80472        } while (--len > 0);
80473
80474        return res >>> 1;
80475      }
80476      /* ===========================================================================
80477       * Flush the bit buffer, keeping at most 7 bits in it.
80478       */
80479
80480
80481      function bi_flush(s) {
80482        if (s.bi_valid === 16) {
80483          put_short(s, s.bi_buf);
80484          s.bi_buf = 0;
80485          s.bi_valid = 0;
80486        } else if (s.bi_valid >= 8) {
80487          s.pending_buf[s.pending++] = s.bi_buf & 0xff;
80488          s.bi_buf >>= 8;
80489          s.bi_valid -= 8;
80490        }
80491      }
80492      /* ===========================================================================
80493       * Compute the optimal bit lengths for a tree and update the total bit length
80494       * for the current block.
80495       * IN assertion: the fields freq and dad are set, heap[heap_max] and
80496       *    above are the tree nodes sorted by increasing frequency.
80497       * OUT assertions: the field len is set to the optimal bit length, the
80498       *     array bl_count contains the frequencies for each bit length.
80499       *     The length opt_len is updated; static_len is also updated if stree is
80500       *     not null.
80501       */
80502
80503
80504      function gen_bitlen(s, desc) //    deflate_state *s;
80505      //    tree_desc *desc;    /* the tree descriptor */
80506      {
80507        var tree = desc.dyn_tree;
80508        var max_code = desc.max_code;
80509        var stree = desc.stat_desc.static_tree;
80510        var has_stree = desc.stat_desc.has_stree;
80511        var extra = desc.stat_desc.extra_bits;
80512        var base = desc.stat_desc.extra_base;
80513        var max_length = desc.stat_desc.max_length;
80514        var h;
80515        /* heap index */
80516
80517        var n, m;
80518        /* iterate over the tree elements */
80519
80520        var bits;
80521        /* bit length */
80522
80523        var xbits;
80524        /* extra bits */
80525
80526        var f;
80527        /* frequency */
80528
80529        var overflow = 0;
80530        /* number of elements with bit length too large */
80531
80532        for (bits = 0; bits <= MAX_BITS; bits++) {
80533          s.bl_count[bits] = 0;
80534        }
80535        /* In a first pass, compute the optimal bit lengths (which may
80536         * overflow in the case of the bit length tree).
80537         */
80538
80539
80540        tree[s.heap[s.heap_max] * 2 + 1]
80541        /*.Len*/
80542        = 0;
80543        /* root of the heap */
80544
80545        for (h = s.heap_max + 1; h < HEAP_SIZE; h++) {
80546          n = s.heap[h];
80547          bits = tree[tree[n * 2 + 1]
80548          /*.Dad*/
80549          * 2 + 1]
80550          /*.Len*/
80551          + 1;
80552
80553          if (bits > max_length) {
80554            bits = max_length;
80555            overflow++;
80556          }
80557
80558          tree[n * 2 + 1]
80559          /*.Len*/
80560          = bits;
80561          /* We overwrite tree[n].Dad which is no longer needed */
80562
80563          if (n > max_code) {
80564            continue;
80565          }
80566          /* not a leaf node */
80567
80568
80569          s.bl_count[bits]++;
80570          xbits = 0;
80571
80572          if (n >= base) {
80573            xbits = extra[n - base];
80574          }
80575
80576          f = tree[n * 2]
80577          /*.Freq*/
80578          ;
80579          s.opt_len += f * (bits + xbits);
80580
80581          if (has_stree) {
80582            s.static_len += f * (stree[n * 2 + 1]
80583            /*.Len*/
80584            + xbits);
80585          }
80586        }
80587
80588        if (overflow === 0) {
80589          return;
80590        } // Trace((stderr,"\nbit length overflow\n"));
80591
80592        /* This happens for example on obj2 and pic of the Calgary corpus */
80593
80594        /* Find the first bit length which could increase: */
80595
80596
80597        do {
80598          bits = max_length - 1;
80599
80600          while (s.bl_count[bits] === 0) {
80601            bits--;
80602          }
80603
80604          s.bl_count[bits]--;
80605          /* move one leaf down the tree */
80606
80607          s.bl_count[bits + 1] += 2;
80608          /* move one overflow item as its brother */
80609
80610          s.bl_count[max_length]--;
80611          /* The brother of the overflow item also moves one step up,
80612           * but this does not affect bl_count[max_length]
80613           */
80614
80615          overflow -= 2;
80616        } while (overflow > 0);
80617        /* Now recompute all bit lengths, scanning in increasing frequency.
80618         * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all
80619         * lengths instead of fixing only the wrong ones. This idea is taken
80620         * from 'ar' written by Haruhiko Okumura.)
80621         */
80622
80623
80624        for (bits = max_length; bits !== 0; bits--) {
80625          n = s.bl_count[bits];
80626
80627          while (n !== 0) {
80628            m = s.heap[--h];
80629
80630            if (m > max_code) {
80631              continue;
80632            }
80633
80634            if (tree[m * 2 + 1]
80635            /*.Len*/
80636            !== bits) {
80637              // Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits));
80638              s.opt_len += (bits - tree[m * 2 + 1]
80639              /*.Len*/
80640              ) * tree[m * 2]
80641              /*.Freq*/
80642              ;
80643              tree[m * 2 + 1]
80644              /*.Len*/
80645              = bits;
80646            }
80647
80648            n--;
80649          }
80650        }
80651      }
80652      /* ===========================================================================
80653       * Generate the codes for a given tree and bit counts (which need not be
80654       * optimal).
80655       * IN assertion: the array bl_count contains the bit length statistics for
80656       * the given tree and the field len is set for all tree elements.
80657       * OUT assertion: the field code is set for all tree elements of non
80658       *     zero code length.
80659       */
80660
80661
80662      function gen_codes(tree, max_code, bl_count) //    ct_data *tree;             /* the tree to decorate */
80663      //    int max_code;              /* largest code with non zero frequency */
80664      //    ushf *bl_count;            /* number of codes at each bit length */
80665      {
80666        var next_code = new Array(MAX_BITS + 1);
80667        /* next code value for each bit length */
80668
80669        var code = 0;
80670        /* running code value */
80671
80672        var bits;
80673        /* bit index */
80674
80675        var n;
80676        /* code index */
80677
80678        /* The distribution counts are first used to generate the code values
80679         * without bit reversal.
80680         */
80681
80682        for (bits = 1; bits <= MAX_BITS; bits++) {
80683          next_code[bits] = code = code + bl_count[bits - 1] << 1;
80684        }
80685        /* Check that the bit counts in bl_count are consistent. The last code
80686         * must be all ones.
80687         */
80688        //Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1,
80689        //        "inconsistent bit counts");
80690        //Tracev((stderr,"\ngen_codes: max_code %d ", max_code));
80691
80692
80693        for (n = 0; n <= max_code; n++) {
80694          var len = tree[n * 2 + 1]
80695          /*.Len*/
80696          ;
80697
80698          if (len === 0) {
80699            continue;
80700          }
80701          /* Now reverse the bits */
80702
80703
80704          tree[n * 2]
80705          /*.Code*/
80706          = bi_reverse(next_code[len]++, len); //Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ",
80707          //     n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1));
80708        }
80709      }
80710      /* ===========================================================================
80711       * Initialize the various 'constant' tables.
80712       */
80713
80714
80715      function tr_static_init() {
80716        var n;
80717        /* iterates over tree elements */
80718
80719        var bits;
80720        /* bit counter */
80721
80722        var length;
80723        /* length value */
80724
80725        var code;
80726        /* code value */
80727
80728        var dist;
80729        /* distance index */
80730
80731        var bl_count = new Array(MAX_BITS + 1);
80732        /* number of codes at each bit length for an optimal tree */
80733        // do check in _tr_init()
80734        //if (static_init_done) return;
80735
80736        /* For some embedded targets, global variables are not initialized: */
80737
80738        /*#ifdef NO_INIT_GLOBAL_POINTERS
80739          static_l_desc.static_tree = static_ltree;
80740          static_l_desc.extra_bits = extra_lbits;
80741          static_d_desc.static_tree = static_dtree;
80742          static_d_desc.extra_bits = extra_dbits;
80743          static_bl_desc.extra_bits = extra_blbits;
80744        #endif*/
80745
80746        /* Initialize the mapping length (0..255) -> length code (0..28) */
80747
80748        length = 0;
80749
80750        for (code = 0; code < LENGTH_CODES - 1; code++) {
80751          base_length[code] = length;
80752
80753          for (n = 0; n < 1 << extra_lbits[code]; n++) {
80754            _length_code[length++] = code;
80755          }
80756        } //Assert (length == 256, "tr_static_init: length != 256");
80757
80758        /* Note that the length 255 (match length 258) can be represented
80759         * in two different ways: code 284 + 5 bits or code 285, so we
80760         * overwrite length_code[255] to use the best encoding:
80761         */
80762
80763
80764        _length_code[length - 1] = code;
80765        /* Initialize the mapping dist (0..32K) -> dist code (0..29) */
80766
80767        dist = 0;
80768
80769        for (code = 0;
vendor: 32,203 bytes, lines 80769-81789
80769 code < 16; code++) {
80770          base_dist[code] = dist;
80771
80772          for (n = 0; n < 1 << extra_dbits[code]; n++) {
80773            _dist_code[dist++] = code;
80774          }
80775        } //Assert (dist == 256, "tr_static_init: dist != 256");
80776
80777
80778        dist >>= 7;
80779        /* from now on, all distances are divided by 128 */
80780
80781        for (; code < D_CODES; code++) {
80782          base_dist[code] = dist << 7;
80783
80784          for (n = 0; n < 1 << extra_dbits[code] - 7; n++) {
80785            _dist_code[256 + dist++] = code;
80786          }
80787        } //Assert (dist == 256, "tr_static_init: 256+dist != 512");
80788
80789        /* Construct the codes of the static literal tree */
80790
80791
80792        for (bits = 0; bits <= MAX_BITS; bits++) {
80793          bl_count[bits] = 0;
80794        }
80795
80796        n = 0;
80797
80798        while (n <= 143) {
80799          static_ltree[n * 2 + 1]
80800          /*.Len*/
80801          = 8;
80802          n++;
80803          bl_count[8]++;
80804        }
80805
80806        while (n <= 255) {
80807          static_ltree[n * 2 + 1]
80808          /*.Len*/
80809          = 9;
80810          n++;
80811          bl_count[9]++;
80812        }
80813
80814        while (n <= 279) {
80815          static_ltree[n * 2 + 1]
80816          /*.Len*/
80817          = 7;
80818          n++;
80819          bl_count[7]++;
80820        }
80821
80822        while (n <= 287) {
80823          static_ltree[n * 2 + 1]
80824          /*.Len*/
80825          = 8;
80826          n++;
80827          bl_count[8]++;
80828        }
80829        /* Codes 286 and 287 do not exist, but we must include them in the
80830         * tree construction to get a canonical Huffman tree (longest code
80831         * all ones)
80832         */
80833
80834
80835        gen_codes(static_ltree, L_CODES + 1, bl_count);
80836        /* The static distance tree is trivial: */
80837
80838        for (n = 0; n < D_CODES; n++) {
80839          static_dtree[n * 2 + 1]
80840          /*.Len*/
80841          = 5;
80842          static_dtree[n * 2]
80843          /*.Code*/
80844          = bi_reverse(n, 5);
80845        } // Now data ready and we can init static trees
80846
80847
80848        static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS);
80849        static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS);
80850        static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS); //static_init_done = true;
80851      }
80852      /* ===========================================================================
80853       * Initialize a new block.
80854       */
80855
80856
80857      function init_block(s) {
80858        var n;
80859        /* iterates over tree elements */
80860
80861        /* Initialize the trees. */
80862
80863        for (n = 0; n < L_CODES; n++) {
80864          s.dyn_ltree[n * 2]
80865          /*.Freq*/
80866          = 0;
80867        }
80868
80869        for (n = 0; n < D_CODES; n++) {
80870          s.dyn_dtree[n * 2]
80871          /*.Freq*/
80872          = 0;
80873        }
80874
80875        for (n = 0; n < BL_CODES; n++) {
80876          s.bl_tree[n * 2]
80877          /*.Freq*/
80878          = 0;
80879        }
80880
80881        s.dyn_ltree[END_BLOCK * 2]
80882        /*.Freq*/
80883        = 1;
80884        s.opt_len = s.static_len = 0;
80885        s.last_lit = s.matches = 0;
80886      }
80887      /* ===========================================================================
80888       * Flush the bit buffer and align the output on a byte boundary
80889       */
80890
80891
80892      function bi_windup(s) {
80893        if (s.bi_valid > 8) {
80894          put_short(s, s.bi_buf);
80895        } else if (s.bi_valid > 0) {
80896          //put_byte(s, (Byte)s->bi_buf);
80897          s.pending_buf[s.pending++] = s.bi_buf;
80898        }
80899
80900        s.bi_buf = 0;
80901        s.bi_valid = 0;
80902      }
80903      /* ===========================================================================
80904       * Copy a stored block, storing first the length and its
80905       * one's complement if requested.
80906       */
80907
80908
80909      function copy_block(s, buf, len, header) //DeflateState *s;
80910      //charf    *buf;    /* the input data */
80911      //unsigned len;     /* its length */
80912      //int      header;  /* true if block header must be written */
80913      {
80914        bi_windup(s);
80915        /* align on byte boundary */
80916
80917        if (header) {
80918          put_short(s, len);
80919          put_short(s, ~len);
80920        } //  while (len--) {
80921        //    put_byte(s, *buf++);
80922        //  }
80923
80924
80925        utils.arraySet(s.pending_buf, s.window, buf, len, s.pending);
80926        s.pending += len;
80927      }
80928      /* ===========================================================================
80929       * Compares to subtrees, using the tree depth as tie breaker when
80930       * the subtrees have equal frequency. This minimizes the worst case length.
80931       */
80932
80933
80934      function smaller(tree, n, m, depth) {
80935        var _n2 = n * 2;
80936
80937        var _m2 = m * 2;
80938
80939        return tree[_n2]
80940        /*.Freq*/
80941        < tree[_m2]
80942        /*.Freq*/
80943        || tree[_n2]
80944        /*.Freq*/
80945        === tree[_m2]
80946        /*.Freq*/
80947        && depth[n] <= depth[m];
80948      }
80949      /* ===========================================================================
80950       * Restore the heap property by moving down the tree starting at node k,
80951       * exchanging a node with the smallest of its two sons if necessary, stopping
80952       * when the heap property is re-established (each father smaller than its
80953       * two sons).
80954       */
80955
80956
80957      function pqdownheap(s, tree, k) //    deflate_state *s;
80958      //    ct_data *tree;  /* the tree to restore */
80959      //    int k;               /* node to move down */
80960      {
80961        var v = s.heap[k];
80962        var j = k << 1;
80963        /* left son of k */
80964
80965        while (j <= s.heap_len) {
80966          /* Set j to the smallest of the two sons: */
80967          if (j < s.heap_len && smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) {
80968            j++;
80969          }
80970          /* Exit if v is smaller than both sons */
80971
80972
80973          if (smaller(tree, v, s.heap[j], s.depth)) {
80974            break;
80975          }
80976          /* Exchange v with the smallest son */
80977
80978
80979          s.heap[k] = s.heap[j];
80980          k = j;
80981          /* And continue down the tree, setting j to the left son of k */
80982
80983          j <<= 1;
80984        }
80985
80986        s.heap[k] = v;
80987      } // inlined manually
80988      // var SMALLEST = 1;
80989
80990      /* ===========================================================================
80991       * Send the block data compressed using the given Huffman trees
80992       */
80993
80994
80995      function compress_block(s, ltree, dtree) //    deflate_state *s;
80996      //    const ct_data *ltree; /* literal tree */
80997      //    const ct_data *dtree; /* distance tree */
80998      {
80999        var dist;
81000        /* distance of matched string */
81001
81002        var lc;
81003        /* match length or unmatched char (if dist == 0) */
81004
81005        var lx = 0;
81006        /* running index in l_buf */
81007
81008        var code;
81009        /* the code to send */
81010
81011        var extra;
81012        /* number of extra bits to send */
81013
81014        if (s.last_lit !== 0) {
81015          do {
81016            dist = s.pending_buf[s.d_buf + lx * 2] << 8 | s.pending_buf[s.d_buf + lx * 2 + 1];
81017            lc = s.pending_buf[s.l_buf + lx];
81018            lx++;
81019
81020            if (dist === 0) {
81021              send_code(s, lc, ltree);
81022              /* send a literal byte */
81023              //Tracecv(isgraph(lc), (stderr," '%c' ", lc));
81024            } else {
81025              /* Here, lc is the match length - MIN_MATCH */
81026              code = _length_code[lc];
81027              send_code(s, code + LITERALS + 1, ltree);
81028              /* send the length code */
81029
81030              extra = extra_lbits[code];
81031
81032              if (extra !== 0) {
81033                lc -= base_length[code];
81034                send_bits(s, lc, extra);
81035                /* send the extra length bits */
81036              }
81037
81038              dist--;
81039              /* dist is now the match distance - 1 */
81040
81041              code = d_code(dist); //Assert (code < D_CODES, "bad d_code");
81042
81043              send_code(s, code, dtree);
81044              /* send the distance code */
81045
81046              extra = extra_dbits[code];
81047
81048              if (extra !== 0) {
81049                dist -= base_dist[code];
81050                send_bits(s, dist, extra);
81051                /* send the extra distance bits */
81052              }
81053            }
81054            /* literal or match pair ? */
81055
81056            /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */
81057            //Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,
81058            //       "pendingBuf overflow");
81059
81060          } while (lx < s.last_lit);
81061        }
81062
81063        send_code(s, END_BLOCK, ltree);
81064      }
81065      /* ===========================================================================
81066       * Construct one Huffman tree and assigns the code bit strings and lengths.
81067       * Update the total bit length for the current block.
81068       * IN assertion: the field freq is set for all tree elements.
81069       * OUT assertions: the fields len and code are set to the optimal bit length
81070       *     and corresponding code. The length opt_len is updated; static_len is
81071       *     also updated if stree is not null. The field max_code is set.
81072       */
81073
81074
81075      function build_tree(s, desc) //    deflate_state *s;
81076      //    tree_desc *desc; /* the tree descriptor */
81077      {
81078        var tree = desc.dyn_tree;
81079        var stree = desc.stat_desc.static_tree;
81080        var has_stree = desc.stat_desc.has_stree;
81081        var elems = desc.stat_desc.elems;
81082        var n, m;
81083        /* iterate over heap elements */
81084
81085        var max_code = -1;
81086        /* largest code with non zero frequency */
81087
81088        var node;
81089        /* new node being created */
81090
81091        /* Construct the initial heap, with least frequent element in
81092         * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].
81093         * heap[0] is not used.
81094         */
81095
81096        s.heap_len = 0;
81097        s.heap_max = HEAP_SIZE;
81098
81099        for (n = 0; n < elems; n++) {
81100          if (tree[n * 2]
81101          /*.Freq*/
81102          !== 0) {
81103            s.heap[++s.heap_len] = max_code = n;
81104            s.depth[n] = 0;
81105          } else {
81106            tree[n * 2 + 1]
81107            /*.Len*/
81108            = 0;
81109          }
81110        }
81111        /* The pkzip format requires that at least one distance code exists,
81112         * and that at least one bit should be sent even if there is only one
81113         * possible code. So to avoid special checks later on we force at least
81114         * two codes of non zero frequency.
81115         */
81116
81117
81118        while (s.heap_len < 2) {
81119          node = s.heap[++s.heap_len] = max_code < 2 ? ++max_code : 0;
81120          tree[node * 2]
81121          /*.Freq*/
81122          = 1;
81123          s.depth[node] = 0;
81124          s.opt_len--;
81125
81126          if (has_stree) {
81127            s.static_len -= stree[node * 2 + 1]
81128            /*.Len*/
81129            ;
81130          }
81131          /* node is 0 or 1 so it does not have extra bits */
81132
81133        }
81134
81135        desc.max_code = max_code;
81136        /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,
81137         * establish sub-heaps of increasing lengths:
81138         */
81139
81140        for (n = s.heap_len >> 1
81141        /*int /2*/
81142        ; n >= 1; n--) {
81143          pqdownheap(s, tree, n);
81144        }
81145        /* Construct the Huffman tree by repeatedly combining the least two
81146         * frequent nodes.
81147         */
81148
81149
81150        node = elems;
81151        /* next internal node of the tree */
81152
81153        do {
81154          //pqremove(s, tree, n);  /* n = node of least frequency */
81155
81156          /*** pqremove ***/
81157          n = s.heap[1
81158          /*SMALLEST*/
81159          ];
81160          s.heap[1
81161          /*SMALLEST*/
81162          ] = s.heap[s.heap_len--];
81163          pqdownheap(s, tree, 1
81164          /*SMALLEST*/
81165          );
81166          /***/
81167
81168          m = s.heap[1
81169          /*SMALLEST*/
81170          ];
81171          /* m = node of next least frequency */
81172
81173          s.heap[--s.heap_max] = n;
81174          /* keep the nodes sorted by frequency */
81175
81176          s.heap[--s.heap_max] = m;
81177          /* Create a new node father of n and m */
81178
81179          tree[node * 2]
81180          /*.Freq*/
81181          = tree[n * 2]
81182          /*.Freq*/
81183          + tree[m * 2]
81184          /*.Freq*/
81185          ;
81186          s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1;
81187          tree[n * 2 + 1]
81188          /*.Dad*/
81189          = tree[m * 2 + 1]
81190          /*.Dad*/
81191          = node;
81192          /* and insert the new node in the heap */
81193
81194          s.heap[1
81195          /*SMALLEST*/
81196          ] = node++;
81197          pqdownheap(s, tree, 1
81198          /*SMALLEST*/
81199          );
81200        } while (s.heap_len >= 2);
81201
81202        s.heap[--s.heap_max] = s.heap[1
81203        /*SMALLEST*/
81204        ];
81205        /* At this point, the fields freq and dad are set. We can now
81206         * generate the bit lengths.
81207         */
81208
81209        gen_bitlen(s, desc);
81210        /* The field len is now set, we can generate the bit codes */
81211
81212        gen_codes(tree, max_code, s.bl_count);
81213      }
81214      /* ===========================================================================
81215       * Scan a literal or distance tree to determine the frequencies of the codes
81216       * in the bit length tree.
81217       */
81218
81219
81220      function scan_tree(s, tree, max_code) //    deflate_state *s;
81221      //    ct_data *tree;   /* the tree to be scanned */
81222      //    int max_code;    /* and its largest code of non zero frequency */
81223      {
81224        var n;
81225        /* iterates over all tree elements */
81226
81227        var prevlen = -1;
81228        /* last emitted length */
81229
81230        var curlen;
81231        /* length of current code */
81232
81233        var nextlen = tree[0 * 2 + 1]
81234        /*.Len*/
81235        ;
81236        /* length of next code */
81237
81238        var count = 0;
81239        /* repeat count of the current code */
81240
81241        var max_count = 7;
81242        /* max repeat count */
81243
81244        var min_count = 4;
81245        /* min repeat count */
81246
81247        if (nextlen === 0) {
81248          max_count = 138;
81249          min_count = 3;
81250        }
81251
81252        tree[(max_code + 1) * 2 + 1]
81253        /*.Len*/
81254        = 0xffff;
81255        /* guard */
81256
81257        for (n = 0; n <= max_code; n++) {
81258          curlen = nextlen;
81259          nextlen = tree[(n + 1) * 2 + 1]
81260          /*.Len*/
81261          ;
81262
81263          if (++count < max_count && curlen === nextlen) {
81264            continue;
81265          } else if (count < min_count) {
81266            s.bl_tree[curlen * 2]
81267            /*.Freq*/
81268            += count;
81269          } else if (curlen !== 0) {
81270            if (curlen !== prevlen) {
81271              s.bl_tree[curlen * 2] /*.Freq*/++;
81272            }
81273
81274            s.bl_tree[REP_3_6 * 2] /*.Freq*/++;
81275          } else if (count <= 10) {
81276            s.bl_tree[REPZ_3_10 * 2] /*.Freq*/++;
81277          } else {
81278            s.bl_tree[REPZ_11_138 * 2] /*.Freq*/++;
81279          }
81280
81281          count = 0;
81282          prevlen = curlen;
81283
81284          if (nextlen === 0) {
81285            max_count = 138;
81286            min_count = 3;
81287          } else if (curlen === nextlen) {
81288            max_count = 6;
81289            min_count = 3;
81290          } else {
81291            max_count = 7;
81292            min_count = 4;
81293          }
81294        }
81295      }
81296      /* ===========================================================================
81297       * Send a literal or distance tree in compressed form, using the codes in
81298       * bl_tree.
81299       */
81300
81301
81302      function send_tree(s, tree, max_code) //    deflate_state *s;
81303      //    ct_data *tree; /* the tree to be scanned */
81304      //    int max_code;       /* and its largest code of non zero frequency */
81305      {
81306        var n;
81307        /* iterates over all tree elements */
81308
81309        var prevlen = -1;
81310        /* last emitted length */
81311
81312        var curlen;
81313        /* length of current code */
81314
81315        var nextlen = tree[0 * 2 + 1]
81316        /*.Len*/
81317        ;
81318        /* length of next code */
81319
81320        var count = 0;
81321        /* repeat count of the current code */
81322
81323        var max_count = 7;
81324        /* max repeat count */
81325
81326        var min_count = 4;
81327        /* min repeat count */
81328
81329        /* tree[max_code+1].Len = -1; */
81330
81331        /* guard already set */
81332
81333        if (nextlen === 0) {
81334          max_count = 138;
81335          min_count = 3;
81336        }
81337
81338        for (n = 0; n <= max_code; n++) {
81339          curlen = nextlen;
81340          nextlen = tree[(n + 1) * 2 + 1]
81341          /*.Len*/
81342          ;
81343
81344          if (++count < max_count && curlen === nextlen) {
81345            continue;
81346          } else if (count < min_count) {
81347            do {
81348              send_code(s, curlen, s.bl_tree);
81349            } while (--count !== 0);
81350          } else if (curlen !== 0) {
81351            if (curlen !== prevlen) {
81352              send_code(s, curlen, s.bl_tree);
81353              count--;
81354            } //Assert(count >= 3 && count <= 6, " 3_6?");
81355
81356
81357            send_code(s, REP_3_6, s.bl_tree);
81358            send_bits(s, count - 3, 2);
81359          } else if (count <= 10) {
81360            send_code(s, REPZ_3_10, s.bl_tree);
81361            send_bits(s, count - 3, 3);
81362          } else {
81363            send_code(s, REPZ_11_138, s.bl_tree);
81364            send_bits(s, count - 11, 7);
81365          }
81366
81367          count = 0;
81368          prevlen = curlen;
81369
81370          if (nextlen === 0) {
81371            max_count = 138;
81372            min_count = 3;
81373          } else if (curlen === nextlen) {
81374            max_count = 6;
81375            min_count = 3;
81376          } else {
81377            max_count = 7;
81378            min_count = 4;
81379          }
81380        }
81381      }
81382      /* ===========================================================================
81383       * Construct the Huffman tree for the bit lengths and return the index in
81384       * bl_order of the last bit length code to send.
81385       */
81386
81387
81388      function build_bl_tree(s) {
81389        var max_blindex;
81390        /* index of last bit length code of non zero freq */
81391
81392        /* Determine the bit length frequencies for literal and distance trees */
81393
81394        scan_tree(s, s.dyn_ltree, s.l_desc.max_code);
81395        scan_tree(s, s.dyn_dtree, s.d_desc.max_code);
81396        /* Build the bit length tree: */
81397
81398        build_tree(s, s.bl_desc);
81399        /* opt_len now includes the length of the tree representations, except
81400         * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.
81401         */
81402
81403        /* Determine the number of bit length codes to send. The pkzip format
81404         * requires that at least 4 bit length codes be sent. (appnote.txt says
81405         * 3 but the actual value used is 4.)
81406         */
81407
81408        for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) {
81409          if (s.bl_tree[bl_order[max_blindex] * 2 + 1]
81410          /*.Len*/
81411          !== 0) {
81412            break;
81413          }
81414        }
81415        /* Update opt_len to include the bit length tree and counts */
81416
81417
81418        s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4; //Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld",
81419        //        s->opt_len, s->static_len));
81420
81421        return max_blindex;
81422      }
81423      /* ===========================================================================
81424       * Send the header for a block using dynamic Huffman trees: the counts, the
81425       * lengths of the bit length codes, the literal tree and the distance tree.
81426       * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.
81427       */
81428
81429
81430      function send_all_trees(s, lcodes, dcodes, blcodes) //    deflate_state *s;
81431      //    int lcodes, dcodes, blcodes; /* number of codes for each tree */
81432      {
81433        var rank;
81434        /* index in bl_order */
81435        //Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes");
81436        //Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,
81437        //        "too many codes");
81438        //Tracev((stderr, "\nbl counts: "));
81439
81440        send_bits(s, lcodes - 257, 5);
81441        /* not +255 as stated in appnote.txt */
81442
81443        send_bits(s, dcodes - 1, 5);
81444        send_bits(s, blcodes - 4, 4);
81445        /* not -3 as stated in appnote.txt */
81446
81447        for (rank = 0; rank < blcodes; rank++) {
81448          //Tracev((stderr, "\nbl code %2d ", bl_order[rank]));
81449          send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1]
81450          /*.Len*/
81451          , 3);
81452        } //Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent));
81453
81454
81455        send_tree(s, s.dyn_ltree, lcodes - 1);
81456        /* literal tree */
81457        //Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent));
81458
81459        send_tree(s, s.dyn_dtree, dcodes - 1);
81460        /* distance tree */
81461        //Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent));
81462      }
81463      /* ===========================================================================
81464       * Check if the data type is TEXT or BINARY, using the following algorithm:
81465       * - TEXT if the two conditions below are satisfied:
81466       *    a) There are no non-portable control characters belonging to the
81467       *       "black list" (0..6, 14..25, 28..31).
81468       *    b) There is at least one printable character belonging to the
81469       *       "white list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255).
81470       * - BINARY otherwise.
81471       * - The following partially-portable control characters form a
81472       *   "gray list" that is ignored in this detection algorithm:
81473       *   (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}).
81474       * IN assertion: the fields Freq of dyn_ltree are set.
81475       */
81476
81477
81478      function detect_data_type(s) {
81479        /* black_mask is the bit mask of black-listed bytes
81480         * set bits 0..6, 14..25, and 28..31
81481         * 0xf3ffc07f = binary 11110011111111111100000001111111
81482         */
81483        var black_mask = 0xf3ffc07f;
81484        var n;
81485        /* Check for non-textual ("black-listed") bytes. */
81486
81487        for (n = 0; n <= 31; n++, black_mask >>>= 1) {
81488          if (black_mask & 1 && s.dyn_ltree[n * 2]
81489          /*.Freq*/
81490          !== 0) {
81491            return Z_BINARY;
81492          }
81493        }
81494        /* Check for textual ("white-listed") bytes. */
81495
81496
81497        if (s.dyn_ltree[9 * 2]
81498        /*.Freq*/
81499        !== 0 || s.dyn_ltree[10 * 2]
81500        /*.Freq*/
81501        !== 0 || s.dyn_ltree[13 * 2]
81502        /*.Freq*/
81503        !== 0) {
81504          return Z_TEXT;
81505        }
81506
81507        for (n = 32; n < LITERALS; n++) {
81508          if (s.dyn_ltree[n * 2]
81509          /*.Freq*/
81510          !== 0) {
81511            return Z_TEXT;
81512          }
81513        }
81514        /* There are no "black-listed" or "white-listed" bytes:
81515         * this stream either is empty or has tolerated ("gray-listed") bytes only.
81516         */
81517
81518
81519        return Z_BINARY;
81520      }
81521
81522      var static_init_done = false;
81523      /* ===========================================================================
81524       * Initialize the tree data structures for a new zlib stream.
81525       */
81526
81527      function _tr_init(s) {
81528        if (!static_init_done) {
81529          tr_static_init();
81530          static_init_done = true;
81531        }
81532
81533        s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc);
81534        s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc);
81535        s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc);
81536        s.bi_buf = 0;
81537        s.bi_valid = 0;
81538        /* Initialize the first block of the first file: */
81539
81540        init_block(s);
81541      }
81542      /* ===========================================================================
81543       * Send a stored block
81544       */
81545
81546
81547      function _tr_stored_block(s, buf, stored_len, last) //DeflateState *s;
81548      //charf *buf;       /* input block */
81549      //ulg stored_len;   /* length of input block */
81550      //int last;         /* one if this is the last block for a file */
81551      {
81552        send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3);
81553        /* send block type */
81554
81555        copy_block(s, buf, stored_len, true);
81556        /* with header */
81557      }
81558      /* ===========================================================================
81559       * Send one empty static block to give enough lookahead for inflate.
81560       * This takes 10 bits, of which 7 may remain in the bit buffer.
81561       */
81562
81563
81564      function _tr_align(s) {
81565        send_bits(s, STATIC_TREES << 1, 3);
81566        send_code(s, END_BLOCK, static_ltree);
81567        bi_flush(s);
81568      }
81569      /* ===========================================================================
81570       * Determine the best encoding for the current block: dynamic trees, static
81571       * trees or store, and output the encoded block to the zip file.
81572       */
81573
81574
81575      function _tr_flush_block(s, buf, stored_len, last) //DeflateState *s;
81576      //charf *buf;       /* input block, or NULL if too old */
81577      //ulg stored_len;   /* length of input block */
81578      //int last;         /* one if this is the last block for a file */
81579      {
81580        var opt_lenb, static_lenb;
81581        /* opt_len and static_len in bytes */
81582
81583        var max_blindex = 0;
81584        /* index of last bit length code of non zero freq */
81585
81586        /* Build the Huffman trees unless a stored block is forced */
81587
81588        if (s.level > 0) {
81589          /* Check if the file is binary or text */
81590          if (s.strm.data_type === Z_UNKNOWN) {
81591            s.strm.data_type = detect_data_type(s);
81592          }
81593          /* Construct the literal and distance trees */
81594
81595
81596          build_tree(s, s.l_desc); // Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len,
81597          //        s->static_len));
81598
81599          build_tree(s, s.d_desc); // Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len,
81600          //        s->static_len));
81601
81602          /* At this point, opt_len and static_len are the total bit lengths of
81603           * the compressed block data, excluding the tree representations.
81604           */
81605
81606          /* Build the bit length tree for the above two trees, and get the index
81607           * in bl_order of the last bit length code to send.
81608           */
81609
81610          max_blindex = build_bl_tree(s);
81611          /* Determine the best encoding. Compute the block lengths in bytes. */
81612
81613          opt_lenb = s.opt_len + 3 + 7 >>> 3;
81614          static_lenb = s.static_len + 3 + 7 >>> 3; // Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ",
81615          //        opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
81616          //        s->last_lit));
81617
81618          if (static_lenb <= opt_lenb) {
81619            opt_lenb = static_lenb;
81620          }
81621        } else {
81622          // Assert(buf != (char*)0, "lost buf");
81623          opt_lenb = static_lenb = stored_len + 5;
81624          /* force a stored block */
81625        }
81626
81627        if (stored_len + 4 <= opt_lenb && buf !== -1) {
81628          /* 4: two words for the lengths */
81629
81630          /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.
81631           * Otherwise we can't have processed more than WSIZE input bytes since
81632           * the last block flush, because compression would have been
81633           * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to
81634           * transform a block into a stored block.
81635           */
81636          _tr_stored_block(s, buf, stored_len, last);
81637        } else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) {
81638          send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3);
81639          compress_block(s, static_ltree, static_dtree);
81640        } else {
81641          send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3);
81642          send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1);
81643          compress_block(s, s.dyn_ltree, s.dyn_dtree);
81644        } // Assert (s->compressed_len == s->bits_sent, "bad compressed size");
81645
81646        /* The above check is made mod 2^32, for files larger than 512 MB
81647         * and uLong implemented on 32 bits.
81648         */
81649
81650
81651        init_block(s);
81652
81653        if (last) {
81654          bi_windup(s);
81655        } // Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3,
81656        //       s->compressed_len-7*last));
81657
81658      }
81659      /* ===========================================================================
81660       * Save the match info and tally the frequency counts. Return true if
81661       * the current block must be flushed.
81662       */
81663
81664
81665      function _tr_tally(s, dist, lc) //    deflate_state *s;
81666      //    unsigned dist;  /* distance of matched string */
81667      //    unsigned lc;    /* match length-MIN_MATCH or unmatched char (if dist==0) */
81668      {
81669        //var out_length, in_length, dcode;
81670        s.pending_buf[s.d_buf + s.last_lit * 2] = dist >>> 8 & 0xff;
81671        s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 0xff;
81672        s.pending_buf[s.l_buf + s.last_lit] = lc & 0xff;
81673        s.last_lit++;
81674
81675        if (dist === 0) {
81676          /* lc is the unmatched char */
81677          s.dyn_ltree[lc * 2] /*.Freq*/++;
81678        } else {
81679          s.matches++;
81680          /* Here, lc is the match length - MIN_MATCH */
81681
81682          dist--;
81683          /* dist = match distance - 1 */
81684          //Assert((ush)dist < (ush)MAX_DIST(s) &&
81685          //       (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&
81686          //       (ush)d_code(dist) < (ush)D_CODES,  "_tr_tally: bad match");
81687
81688          s.dyn_ltree[(_length_code[lc] + LITERALS + 1) * 2] /*.Freq*/++;
81689          s.dyn_dtree[d_code(dist) * 2] /*.Freq*/++;
81690        } // (!) This block is disabled in zlib defaults,
81691        // don't enable it for binary compatibility
81692        //#ifdef TRUNCATE_BLOCK
81693        //  /* Try to guess if it is profitable to stop the current block here */
81694        //  if ((s.last_lit & 0x1fff) === 0 && s.level > 2) {
81695        //    /* Compute an upper bound for the compressed length */
81696        //    out_length = s.last_lit*8;
81697        //    in_length = s.strstart - s.block_start;
81698        //
81699        //    for (dcode = 0; dcode < D_CODES; dcode++) {
81700        //      out_length += s.dyn_dtree[dcode*2]/*.Freq*/ * (5 + extra_dbits[dcode]);
81701        //    }
81702        //    out_length >>>= 3;
81703        //    //Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ",
81704        //    //       s->last_lit, in_length, out_length,
81705        //    //       100L - out_length*100L/in_length));
81706        //    if (s.matches < (s.last_lit>>1)/*int /2*/ && out_length < (in_length>>1)/*int /2*/) {
81707        //      return true;
81708        //    }
81709        //  }
81710        //#endif
81711
81712
81713        return s.last_lit === s.lit_bufsize - 1;
81714        /* We avoid equality with lit_bufsize because of wraparound at 64K
81715         * on 16 bit machines and because stored blocks are restricted to
81716         * 64K-1 bytes.
81717         */
81718      }
81719
81720      exports._tr_init = _tr_init;
81721      exports._tr_stored_block = _tr_stored_block;
81722      exports._tr_flush_block = _tr_flush_block;
81723      exports._tr_tally = _tr_tally;
81724      exports._tr_align = _tr_align;
81725    }, {
81726      "../utils/common": 419
81727    }],
81728    431: [function (require, module, exports) {
81729      'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler
81730      // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
81731      //
81732      // This software is provided 'as-is', without any express or implied
81733      // warranty. In no event will the authors be held liable for any damages
81734      // arising from the use of this software.
81735      //
81736      // Permission is granted to anyone to use this software for any purpose,
81737      // including commercial applications, and to alter it and redistribute it
81738      // freely, subject to the following restrictions:
81739      //
81740      // 1. The origin of this software must not be misrepresented; you must not
81741      //   claim that you wrote the original software. If you use this software
81742      //   in a product, an acknowledgment in the product documentation would be
81743      //   appreciated but is not required.
81744      // 2. Altered source versions must be plainly marked as such, and must not be
81745      //   misrepresented as being the original software.
81746      // 3. This notice may not be removed or altered from any source distribution.
81747
81748      function ZStream() {
81749        /* next input byte */
81750        this.input = null; // JS specific, because we have no pointers
81751
81752        this.next_in = 0;
81753        /* number of bytes available at input */
81754
81755        this.avail_in = 0;
81756        /* total number of input bytes read so far */
81757
81758        this.total_in = 0;
81759        /* next output byte should be put there */
81760
81761        this.output = null; // JS specific, because we have no pointers
81762
81763        this.next_out = 0;
81764        /* remaining free space at output */
81765
81766        this.avail_out = 0;
81767        /* total number of bytes output so far */
81768
81769        this.total_out = 0;
81770        /* last error message, NULL if no error */
81771
81772        this.msg = ''
81773        /*Z_NULL*/
81774        ;
81775        /* not visible by applications */
81776
81777        this.state = null;
81778        /* best guess about the data type: binary or text */
81779
81780        this.data_type = 2
81781        /*Z_UNKNOWN*/
81782        ;
81783        /* adler32 value of the uncompressed data */
81784
81785        this.adler = 0;
81786      }
81787
81788      module.exports = ZStream;
81789    }, {}],
vendor: 12,463 bytes, lines 81790-82084
81790    432: [function (require, module, exports) {
81791      module.exports = {
81792        "2.16.840.1.101.3.4.1.1": "aes-128-ecb",
81793        "2.16.840.1.101.3.4.1.2": "aes-128-cbc",
81794        "2.16.840.1.101.3.4.1.3": "aes-128-ofb",
81795        "2.16.840.1.101.3.4.1.4": "aes-128-cfb",
81796        "2.16.840.1.101.3.4.1.21": "aes-192-ecb",
81797        "2.16.840.1.101.3.4.1.22": "aes-192-cbc",
81798        "2.16.840.1.101.3.4.1.23": "aes-192-ofb",
81799        "2.16.840.1.101.3.4.1.24": "aes-192-cfb",
81800        "2.16.840.1.101.3.4.1.41": "aes-256-ecb",
81801        "2.16.840.1.101.3.4.1.42": "aes-256-cbc",
81802        "2.16.840.1.101.3.4.1.43": "aes-256-ofb",
81803        "2.16.840.1.101.3.4.1.44": "aes-256-cfb"
81804      };
81805    }, {}],
81806    433: [function (require, module, exports) {
81807      // from https://github.com/indutny/self-signed/blob/gh-pages/lib/asn1.js
81808      // Fedor, you are amazing.
81809      'use strict';
81810
81811      var asn1 = require('asn1.js');
81812
81813      exports.certificate = require('./certificate');
81814      var RSAPrivateKey = asn1.define('RSAPrivateKey', function () {
81815        this.seq().obj(this.key('version').int(), this.key('modulus').int(), this.key('publicExponent').int(), this.key('privateExponent').int(), this.key('prime1').int(), this.key('prime2').int(), this.key('exponent1').int(), this.key('exponent2').int(), this.key('coefficient').int());
81816      });
81817      exports.RSAPrivateKey = RSAPrivateKey;
81818      var RSAPublicKey = asn1.define('RSAPublicKey', function () {
81819        this.seq().obj(this.key('modulus').int(), this.key('publicExponent').int());
81820      });
81821      exports.RSAPublicKey = RSAPublicKey;
81822      var PublicKey = asn1.define('SubjectPublicKeyInfo', function () {
81823        this.seq().obj(this.key('algorithm').use(AlgorithmIdentifier), this.key('subjectPublicKey').bitstr());
81824      });
81825      exports.PublicKey = PublicKey;
81826      var AlgorithmIdentifier = asn1.define('AlgorithmIdentifier', function () {
81827        this.seq().obj(this.key('algorithm').objid(), this.key('none').null_().optional(), this.key('curve').objid().optional(), this.key('params').seq().obj(this.key('p').int(), this.key('q').int(), this.key('g').int()).optional());
81828      });
81829      var PrivateKeyInfo = asn1.define('PrivateKeyInfo', function () {
81830        this.seq().obj(this.key('version').int(), this.key('algorithm').use(AlgorithmIdentifier), this.key('subjectPrivateKey').octstr());
81831      });
81832      exports.PrivateKey = PrivateKeyInfo;
81833      var EncryptedPrivateKeyInfo = asn1.define('EncryptedPrivateKeyInfo', function () {
81834        this.seq().obj(this.key('algorithm').seq().obj(this.key('id').objid(), this.key('decrypt').seq().obj(this.key('kde').seq().obj(this.key('id').objid(), this.key('kdeparams').seq().obj(this.key('salt').octstr(), this.key('iters').int())), this.key('cipher').seq().obj(this.key('algo').objid(), this.key('iv').octstr()))), this.key('subjectPrivateKey').octstr());
81835      });
81836      exports.EncryptedPrivateKey = EncryptedPrivateKeyInfo;
81837      var DSAPrivateKey = asn1.define('DSAPrivateKey', function () {
81838        this.seq().obj(this.key('version').int(), this.key('p').int(), this.key('q').int(), this.key('g').int(), this.key('pub_key').int(), this.key('priv_key').int());
81839      });
81840      exports.DSAPrivateKey = DSAPrivateKey;
81841      exports.DSAparam = asn1.define('DSAparam', function () {
81842        this.int();
81843      });
81844      var ECPrivateKey = asn1.define('ECPrivateKey', function () {
81845        this.seq().obj(this.key('version').int(), this.key('privateKey').octstr(), this.key('parameters').optional().explicit(0).use(ECParameters), this.key('publicKey').optional().explicit(1).bitstr());
81846      });
81847      exports.ECPrivateKey = ECPrivateKey;
81848      var ECParameters = asn1.define('ECParameters', function () {
81849        this.choice({
81850          namedCurve: this.objid()
81851        });
81852      });
81853      exports.signature = asn1.define('signature', function () {
81854        this.seq().obj(this.key('r').int(), this.key('s').int());
81855      });
81856    }, {
81857      "./certificate": 434,
81858      "asn1.js": 165
81859    }],
81860    434: [function (require, module, exports) {
81861      // from https://github.com/Rantanen/node-dtls/blob/25a7dc861bda38cfeac93a723500eea4f0ac2e86/Certificate.js
81862      // thanks to @Rantanen
81863      'use strict';
81864
81865      var asn = require('asn1.js');
81866
81867      var Time = asn.define('Time', function () {
81868        this.choice({
81869          utcTime: this.utctime(),
81870          generalTime: this.gentime()
81871        });
81872      });
81873      var AttributeTypeValue = asn.define('AttributeTypeValue', function () {
81874        this.seq().obj(this.key('type').objid(), this.key('value').any());
81875      });
81876      var AlgorithmIdentifier = asn.define('AlgorithmIdentifier', function () {
81877        this.seq().obj(this.key('algorithm').objid(), this.key('parameters').optional(), this.key('curve').objid().optional());
81878      });
81879      var SubjectPublicKeyInfo = asn.define('SubjectPublicKeyInfo', function () {
81880        this.seq().obj(this.key('algorithm').use(AlgorithmIdentifier), this.key('subjectPublicKey').bitstr());
81881      });
81882      var RelativeDistinguishedName = asn.define('RelativeDistinguishedName', function () {
81883        this.setof(AttributeTypeValue);
81884      });
81885      var RDNSequence = asn.define('RDNSequence', function () {
81886        this.seqof(RelativeDistinguishedName);
81887      });
81888      var Name = asn.define('Name', function () {
81889        this.choice({
81890          rdnSequence: this.use(RDNSequence)
81891        });
81892      });
81893      var Validity = asn.define('Validity', function () {
81894        this.seq().obj(this.key('notBefore').use(Time), this.key('notAfter').use(Time));
81895      });
81896      var Extension = asn.define('Extension', function () {
81897        this.seq().obj(this.key('extnID').objid(), this.key('critical').bool().def(false), this.key('extnValue').octstr());
81898      });
81899      var TBSCertificate = asn.define('TBSCertificate', function () {
81900        this.seq().obj(this.key('version').explicit(0).int().optional(), this.key('serialNumber').int(), this.key('signature').use(AlgorithmIdentifier), this.key('issuer').use(Name), this.key('validity').use(Validity), this.key('subject').use(Name), this.key('subjectPublicKeyInfo').use(SubjectPublicKeyInfo), this.key('issuerUniqueID').implicit(1).bitstr().optional(), this.key('subjectUniqueID').implicit(2).bitstr().optional(), this.key('extensions').explicit(3).seqof(Extension).optional());
81901      });
81902      var X509Certificate = asn.define('X509Certificate', function () {
81903        this.seq().obj(this.key('tbsCertificate').use(TBSCertificate), this.key('signatureAlgorithm').use(AlgorithmIdentifier), this.key('signatureValue').bitstr());
81904      });
81905      module.exports = X509Certificate;
81906    }, {
81907      "asn1.js": 165
81908    }],
81909    435: [function (require, module, exports) {
81910      // adapted from https://github.com/apatil/pemstrip
81911      var findProc = /Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r\+\/\=]+)[\n\r]+/m;
81912      var startRegex = /^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m;
81913      var fullRegex = /^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r\+\/\=]+)-----END \1-----$/m;
81914
81915      var evp = require('evp_bytestokey');
81916
81917      var ciphers = require('browserify-aes');
81918
81919      var Buffer = require('safe-buffer').Buffer;
81920
81921      module.exports = function (okey, password) {
81922        var key = okey.toString();
81923        var match = key.match(findProc);
81924        var decrypted;
81925
81926        if (!match) {
81927          var match2 = key.match(fullRegex);
81928          decrypted = new Buffer(match2[2].replace(/[\r\n]/g, ''), 'base64');
81929        } else {
81930          var suite = 'aes' + match[1];
81931          var iv = Buffer.from(match[2], 'hex');
81932          var cipherText = Buffer.from(match[3].replace(/[\r\n]/g, ''), 'base64');
81933          var cipherKey = evp(password, iv.slice(0, 8), parseInt(match[1], 10)).key;
81934          var out = [];
81935          var cipher = ciphers.createDecipheriv(suite, cipherKey, iv);
81936          out.push(cipher.update(cipherText));
81937          out.push(cipher.final());
81938          decrypted = Buffer.concat(out);
81939        }
81940
81941        var tag = key.match(startRegex)[1];
81942        return {
81943          tag: tag,
81944          data: decrypted
81945        };
81946      };
81947    }, {
81948      "browserify-aes": 186,
81949      "evp_bytestokey": 345,
81950      "safe-buffer": 470
81951    }],
81952    436: [function (require, module, exports) {
81953      var asn1 = require('./asn1');
81954
81955      var aesid = require('./aesid.json');
81956
81957      var fixProc = require('./fixProc');
81958
81959      var ciphers = require('browserify-aes');
81960
81961      var compat = require('pbkdf2');
81962
81963      var Buffer = require('safe-buffer').Buffer;
81964
81965      module.exports = parseKeys;
81966
81967      function parseKeys(buffer) {
81968        var password;
81969
81970        if (_typeof2(buffer) === 'object' && !Buffer.isBuffer(buffer)) {
81971          password = buffer.passphrase;
81972          buffer = buffer.key;
81973        }
81974
81975        if (typeof buffer === 'string') {
81976          buffer = Buffer.from(buffer);
81977        }
81978
81979        var stripped = fixProc(buffer, password);
81980        var type = stripped.tag;
81981        var data = stripped.data;
81982        var subtype, ndata;
81983
81984        switch (type) {
81985          case 'CERTIFICATE':
81986            ndata = asn1.certificate.decode(data, 'der').tbsCertificate.subjectPublicKeyInfo;
81987          // falls through
81988
81989          case 'PUBLIC KEY':
81990            if (!ndata) {
81991              ndata = asn1.PublicKey.decode(data, 'der');
81992            }
81993
81994            subtype = ndata.algorithm.algorithm.join('.');
81995
81996            switch (subtype) {
81997              case '1.2.840.113549.1.1.1':
81998                return asn1.RSAPublicKey.decode(ndata.subjectPublicKey.data, 'der');
81999
82000              case '1.2.840.10045.2.1':
82001                ndata.subjectPrivateKey = ndata.subjectPublicKey;
82002                return {
82003                  type: 'ec',
82004                  data: ndata
82005                };
82006
82007              case '1.2.840.10040.4.1':
82008                ndata.algorithm.params.pub_key = asn1.DSAparam.decode(ndata.subjectPublicKey.data, 'der');
82009                return {
82010                  type: 'dsa',
82011                  data: ndata.algorithm.params
82012                };
82013
82014              default:
82015                throw new Error('unknown key id ' + subtype);
82016            }
82017
82018            throw new Error('unknown key type ' + type);
82019
82020          case 'ENCRYPTED PRIVATE KEY':
82021            data = asn1.EncryptedPrivateKey.decode(data, 'der');
82022            data = decrypt(data, password);
82023          // falls through
82024
82025          case 'PRIVATE KEY':
82026            ndata = asn1.PrivateKey.decode(data, 'der');
82027            subtype = ndata.algorithm.algorithm.join('.');
82028
82029            switch (subtype) {
82030              case '1.2.840.113549.1.1.1':
82031                return asn1.RSAPrivateKey.decode(ndata.subjectPrivateKey, 'der');
82032
82033              case '1.2.840.10045.2.1':
82034                return {
82035                  curve: ndata.algorithm.curve,
82036                  privateKey: asn1.ECPrivateKey.decode(ndata.subjectPrivateKey, 'der').privateKey
82037                };
82038
82039              case '1.2.840.10040.4.1':
82040                ndata.algorithm.params.priv_key = asn1.DSAparam.decode(ndata.subjectPrivateKey, 'der');
82041                return {
82042                  type: 'dsa',
82043                  params: ndata.algorithm.params
82044                };
82045
82046              default:
82047                throw new Error('unknown key id ' + subtype);
82048            }
82049
82050            throw new Error('unknown key type ' + type);
82051
82052          case 'RSA PUBLIC KEY':
82053            return asn1.RSAPublicKey.decode(data, 'der');
82054
82055          case 'RSA PRIVATE KEY':
82056            return asn1.RSAPrivateKey.decode(data, 'der');
82057
82058          case 'DSA PRIVATE KEY':
82059            return {
82060              type: 'dsa',
82061              params: asn1.DSAPrivateKey.decode(data, 'der')
82062            };
82063
82064          case 'EC PRIVATE KEY':
82065            data = asn1.ECPrivateKey.decode(data, 'der');
82066            return {
82067              curve: data.parameters.value,
82068              privateKey: data.privateKey
82069            };
82070
82071          default:
82072            throw new Error('unknown key type ' + type);
82073        }
82074      }
82075
82076      parseKeys.signature = asn1.signature;
82077
82078      function decrypt(data, password) {
82079        var salt = data.algorithm.decrypt.kde.kdeparams.salt;
82080        var iters = parseInt(data.algorithm.decrypt.kde.kdeparams.iters.toString(), 10);
82081        var algo = aesid[data.algorithm.decrypt.cipher.algo.join('.')];
82082        var iv = data.algorithm.decrypt.cipher.iv;
82083        var cipherText = data.subjectPrivateKey;
82084        var keylen = parseInt(algo.split('-')[1], 10) / 8;
82085        var key = compat.pbkdf2Sync(password, salt, iters, keylen, 'sha1');
82086        var cipher = ciphers.createDecipheriv(algo, key, iv);
82087        var out = [];
82088        out.push(cipher.update(cipherText));
82089        out.push(cipher.final());
82090        return Buffer.concat(out);
82091      }
82092    }, {
82093      "./aesid.json": 432,
82094      "./asn1": 433,
82095      "./fixProc": 435,
82096      "browserify-aes": 186,
82097      "pbkdf2": 437,
82098      "safe-buffer": 470
82099    }],
82100    437: [function (require, module, exports) {
82101      exports.pbkdf2 = require('./lib/async');
82102      exports.pbkdf2Sync = require('./lib/sync');
82103    }, {
82104      "./lib/async": 438,
82105      "./lib/sync": 441
82106    }],
82107    438: [function (require, module, exports) {
82108      (function (process, global) {
82109        var checkParameters = require('./precondition');
82110
82111        var defaultEncoding = require('./default-encoding');
82112
82113        var sync = require('./sync');
82114
82115        var Buffer = require('safe-buffer').Buffer;
82116
82117        var ZERO_BUF;
82118        var subtle = global.crypto && global.crypto.subtle;
82119        var toBrowser = {
82120          'sha': 'SHA-1',
82121          'sha-1': 'SHA-1',
82122          'sha1': 'SHA-1',
82123          'sha256': 'SHA-256',
82124          'sha-256': 'SHA-256',
82125          'sha384': 'SHA-384',
82126          'sha-384': 'SHA-384',
82127          'sha-512': 'SHA-512',
82128          'sha512': 'SHA-512'
82129        };
82130        var checks = [];
82131
82132        function checkNative(algo) {
82133          if (global.process && !global.process.browser) {
82134            return Promise.resolve(false);
82135          }
82136
82137          if (!subtle || !subtle.importKey || !subtle.deriveBits) {
82138            return Promise.resolve(false);
82139          }
82140
82141          if (checks[algo] !== undefined) {
82142            return checks[algo];
82143          }
82144
82145          ZERO_BUF = ZERO_BUF || Buffer.alloc(8);
82146          var prom = browserPbkdf2(ZERO_BUF, ZERO_BUF, 10, 128, algo).then(function () {
82147            return true;
82148          }).catch(function () {
82149            return false;
82150          });
82151          checks[algo] = prom;
82152          return prom;
82153        }
82154
82155        function browserPbkdf2(password, salt, iterations, length, algo) {
82156          return subtle.importKey('raw', password, {
82157            name: 'PBKDF2'
82158          }, false, ['deriveBits']).then(function (key) {
82159            return subtle.deriveBits({
82160              name: 'PBKDF2',
82161              salt: salt,
82162              iterations: iterations,
82163              hash: {
82164                name: algo
82165              }
82166            }, key, length << 3);
82167          }).then(function (res) {
82168            return Buffer.from(res);
82169          });
82170        }
82171
82172        function resolvePromise(promise, callback) {
82173          promise.then(function (out) {
82174            process.nextTick(function () {
82175              callback(null, out);
82176            });
82177          }, function (e) {
82178            process.nextTick(function () {
82179              callback(e);
82180            });
82181          });
82182        }
82183
82184        module.exports = function (password, salt, iterations, keylen, digest, callback) {
82185          if (typeof digest === 'function') {
82186            callback = digest;
82187            digest = undefined;
82188          }
82189
82190          digest = digest || 'sha1';
82191          var algo = toBrowser[digest.toLowerCase()];
82192
82193          if (!algo || typeof global.Promise !== 'function') {
82194            return process.nextTick(function () {
82195              var out;
82196
82197              try {
82198                out = sync(password, salt, iterations, keylen, digest);
82199              } catch (e) {
82200                return callback(e);
82201              }
82202
82203              callback(null, out);
82204            });
82205          }
82206
82207          checkParameters(password, salt, iterations, keylen);
82208          if (typeof callback !== 'function') throw new Error('No callback provided to pbkdf2');
82209          if (!Buffer.isBuffer(password)) password = Buffer.from(password, defaultEncoding);
82210          if (!Buffer.isBuffer(salt)) salt = Buffer.from(salt, defaultEncoding);
82211          resolvePromise(checkNative(algo).then(function (resp) {
82212            if (resp) return browserPbkdf2(password, salt, iterations, keylen, algo);
82213            return sync(password, salt, iterations, keylen, digest);
82214          }), callback);
82215        };
82216      }).call(this, require('_process'), typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
82217    }, {
82218      "./default-encoding": 439,
82219      "./precondition": 440,
82220      "./sync": 441,
82221      "_process": 443,
82222      "safe-buffer": 470
82223    }],
82224    439: [function (require, module, exports) {
82225      (function (process) {
82226        var defaultEncoding;
82227        /* istanbul ignore next */
82228
82229        if (process.browser) {
82230          defaultEncoding = 'utf-8';
82231        } else {
82232          var pVersionMajor = parseInt(process.version.split('.')[0].slice(1), 10);
82233          defaultEncoding = pVersionMajor >= 6 ? 'utf-8' : 'binary';
82234        }
82235
82236        module.exports = defaultEncoding;
82237      }).call(this, require('_process'));
82238    }, {
82239      "_process": 443
82240    }],
82241    440: [function (require, module, exports) {
82242      (function (Buffer) {
82243        var MAX_ALLOC = Math.pow(2, 30) - 1; // default in iojs
82244
82245        function checkBuffer(buf, name) {
82246          if (typeof buf !== 'string' && !Buffer.isBuffer(buf)) {
82247            throw new TypeError(name + ' must be a buffer or string');
82248          }
82249        }
82250
82251        module.exports = function (password, salt, iterations, keylen) {
82252          checkBuffer(password, 'Password');
82253          checkBuffer(salt, 'Salt');
82254
82255          if (typeof iterations !== 'number') {
82256            throw new TypeError('Iterations not a number');
82257          }
82258
82259          if (iterations < 0) {
82260            throw new TypeError('Bad iterations');
82261          }
82262
82263          if (typeof keylen !== 'number') {
82264            throw new TypeError('Key length not a number');
82265          }
82266
82267          if (keylen < 0 || keylen > MAX_ALLOC || keylen !== keylen) {
82268            /* eslint no-self-compare: 0 */
82269            throw new TypeError('Bad key length');
82270          }
82271        };
82272      }).call(this, {
82273        "isBuffer": require("../../is-buffer/index.js")
82274      });
82275    }, {
82276      "../../is-buffer/index.js": 365
82277    }],
82278    441: [function (require, module, exports) {
82279      var md5 = require('create-hash/md5');
82280
82281      var RIPEMD160 = require('ripemd160');
82282
82283      var sha = require('sha.js');
82284
82285      var checkParameters = require('./precondition');
82286
82287      var defaultEncoding = require('./default-encoding');
82288
82289      var Buffer = require('safe-buffer').Buffer;
82290
82291      var ZEROS = Buffer.alloc(128);
82292      var sizes = {
82293        md5: 16,
82294        sha1: 20,
82295        sha224: 28,
82296        sha256: 32,
82297        sha384: 48,
82298        sha512: 64,
82299        rmd160: 20,
82300        ripemd160: 20
82301      };
82302
82303      function Hmac(alg, key, saltLen) {
82304        var hash = getDigest(alg);
82305        var blocksize = alg === 'sha512' || alg === 'sha384' ? 128 : 64;
82306
82307        if (key.length > blocksize) {
82308          key = hash(key);
82309        } else if (key.length < blocksize) {
82310          key = Buffer.concat([key, ZEROS], blocksize);
82311        }
82312
82313        var ipad = Buffer.allocUnsafe(blocksize + sizes[alg]);
82314        var opad = Buffer.allocUnsafe(blocksize + sizes[alg]);
82315
82316        for (var i = 0; i < blocksize; i++) {
82317          ipad[i] = key[i] ^ 0x36;
82318          opad[i] = key[i] ^ 0x5C;
82319        }
82320
82321        var ipad1 = Buffer.allocUnsafe(blocksize + saltLen + 4);
82322        ipad.copy(ipad1, 0, 0, blocksize);
82323        this.ipad1 = ipad1;
82324        this.ipad2 = ipad;
82325        this.opad = opad;
82326        this.alg = alg;
82327        this.blocksize = blocksize;
82328        this.hash = hash;
82329        this.size = sizes[alg];
82330      }
82331
82332      Hmac.prototype.run = function (data, ipad) {
82333        data.copy(ipad, this.blocksize);
82334        var h = this.hash(ipad);
82335        h.copy(this.opad, this.blocksize);
82336        return this.hash(this.opad);
82337      };
82338
82339      function getDigest(alg) {
82340        function shaFunc(data) {
82341          return sha(alg).update(data).digest();
82342        }
82343
82344        function rmd160Func(data) {
82345          return new RIPEMD160().update(data).digest();
82346        }
82347
82348        if (alg === 'rmd160' || alg === 'ripemd160') return rmd160Func;
82349        if (alg === 'md5') return md5;
82350        return shaFunc;
82351      }
82352
82353      function pbkdf2(password, salt, iterations, keylen, digest) {
82354        checkParameters(password, salt, iterations, keylen);
82355        if (!Buffer.isBuffer(password)) password = Buffer.from(password, defaultEncoding);
82356        if (!Buffer.isBuffer(salt)) salt = Buffer.from(salt, defaultEncoding);
82357        digest = digest || 'sha1';
82358        var hmac = new Hmac(digest, password, salt.length);
82359        var DK = Buffer.allocUnsafe(keylen);
82360        var block1 = Buffer.allocUnsafe(salt.length + 4);
82361        salt.copy(block1, 0, 0, salt.length);
82362        var destPos = 0;
82363        var hLen = sizes[digest];
vendor: 5,915 bytes, lines 82364-82546
82364        var l = Math.ceil(keylen / hLen);
82365
82366        for (var i = 1; i <= l; i++) {
82367          block1.writeUInt32BE(i, salt.length);
82368          var T = hmac.run(block1, hmac.ipad1);
82369          var U = T;
82370
82371          for (var j = 1; j < iterations; j++) {
82372            U = hmac.run(U, hmac.ipad2);
82373
82374            for (var k = 0; k < hLen; k++) {
82375              T[k] ^= U[k];
82376            }
82377          }
82378
82379          T.copy(DK, destPos);
82380          destPos += hLen;
82381        }
82382
82383        return DK;
82384      }
82385
82386      module.exports = pbkdf2;
82387    }, {
82388      "./default-encoding": 439,
82389      "./precondition": 440,
82390      "create-hash/md5": 309,
82391      "ripemd160": 469,
82392      "safe-buffer": 470,
82393      "sha.js": 474
82394    }],
82395    442: [function (require, module, exports) {
82396      (function (process) {
82397        'use strict';
82398
82399        if (typeof process === 'undefined' || !process.version || process.version.indexOf('v0.') === 0 || process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {
82400          module.exports = {
82401            nextTick: nextTick
82402          };
82403        } else {
82404          module.exports = process;
82405        }
82406
82407        function nextTick(fn, arg1, arg2, arg3) {
82408          if (typeof fn !== 'function') {
82409            throw new TypeError('"callback" argument must be a function');
82410          }
82411
82412          var len = arguments.length;
82413          var args, i;
82414
82415          switch (len) {
82416            case 0:
82417            case 1:
82418              return process.nextTick(fn);
82419
82420            case 2:
82421              return process.nextTick(function afterTickOne() {
82422                fn.call(null, arg1);
82423              });
82424
82425            case 3:
82426              return process.nextTick(function afterTickTwo() {
82427                fn.call(null, arg1, arg2);
82428              });
82429
82430            case 4:
82431              return process.nextTick(function afterTickThree() {
82432                fn.call(null, arg1, arg2, arg3);
82433              });
82434
82435            default:
82436              args = new Array(len - 1);
82437              i = 0;
82438
82439              while (i < args.length) {
82440                args[i++] = arguments[i];
82441              }
82442
82443              return process.nextTick(function afterTick() {
82444                fn.apply(null, args);
82445              });
82446          }
82447        }
82448      }).call(this, require('_process'));
82449    }, {
82450      "_process": 443
82451    }],
82452    443: [function (require, module, exports) {
82453      // shim for using process in browser
82454      var process = module.exports = {}; // cached from whatever global is present so that test runners that stub it
82455      // don't break things.  But we need to wrap it in a try catch in case it is
82456      // wrapped in strict mode code which doesn't define any globals.  It's inside a
82457      // function because try/catches deoptimize in certain engines.
82458
82459      var cachedSetTimeout;
82460      var cachedClearTimeout;
82461
82462      function defaultSetTimout() {
82463        throw new Error('setTimeout has not been defined');
82464      }
82465
82466      function defaultClearTimeout() {
82467        throw new Error('clearTimeout has not been defined');
82468      }
82469
82470      (function () {
82471        try {
82472          if (typeof setTimeout === 'function') {
82473            cachedSetTimeout = setTimeout;
82474          } else {
82475            cachedSetTimeout = defaultSetTimout;
82476          }
82477        } catch (e) {
82478          cachedSetTimeout = defaultSetTimout;
82479        }
82480
82481        try {
82482          if (typeof clearTimeout === 'function') {
82483            cachedClearTimeout = clearTimeout;
82484          } else {
82485            cachedClearTimeout = defaultClearTimeout;
82486          }
82487        } catch (e) {
82488          cachedClearTimeout = defaultClearTimeout;
82489        }
82490      })();
82491
82492      function runTimeout(fun) {
82493        if (cachedSetTimeout === setTimeout) {
82494          //normal enviroments in sane situations
82495          return setTimeout(fun, 0);
82496        } // if setTimeout wasn't available but was latter defined
82497
82498
82499        if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
82500          cachedSetTimeout = setTimeout;
82501          return setTimeout(fun, 0);
82502        }
82503
82504        try {
82505          // when when somebody has screwed with setTimeout but no I.E. maddness
82506          return cachedSetTimeout(fun, 0);
82507        } catch (e) {
82508          try {
82509            // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
82510            return cachedSetTimeout.call(null, fun, 0);
82511          } catch (e) {
82512            // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
82513            return cachedSetTimeout.call(this, fun, 0);
82514          }
82515        }
82516      }
82517
82518      function runClearTimeout(marker) {
82519        if (cachedClearTimeout === clearTimeout) {
82520          //normal enviroments in sane situations
82521          return clearTimeout(marker);
82522        } // if clearTimeout wasn't available but was latter defined
82523
82524
82525        if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
82526          cachedClearTimeout = clearTimeout;
82527          return clearTimeout(marker);
82528        }
82529
82530        try {
82531          // when when somebody has screwed with setTimeout but no I.E. maddness
82532          return cachedClearTimeout(marker);
82533        } catch (e) {
82534          try {
82535            // When we are in I.E. but the script has been evaled so I.E. doesn't  trust the global object when called normally
82536            return cachedClearTimeout.call(null, marker);
82537          } catch (e) {
82538            // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
82539            // Some versions of I.E. have different rules for clearTimeout vs setTimeout
82540            return cachedClearTimeout.call(this, marker);
82541          }
82542        }
82543      }
82544
82545      var queue = [];
82546      var draining = false;
vendor: 10,201 bytes, lines 82547-82970
82547      var currentQueue;
82548      var queueIndex = -1;
82549
82550      function cleanUpNextTick() {
82551        if (!draining || !currentQueue) {
82552          return;
82553        }
82554
82555        draining = false;
82556
82557        if (currentQueue.length) {
82558          queue = currentQueue.concat(queue);
82559        } else {
82560          queueIndex = -1;
82561        }
82562
82563        if (queue.length) {
82564          drainQueue();
82565        }
82566      }
82567
82568      function drainQueue() {
82569        if (draining) {
82570          return;
82571        }
82572
82573        var timeout = runTimeout(cleanUpNextTick);
82574        draining = true;
82575        var len = queue.length;
82576
82577        while (len) {
82578          currentQueue = queue;
82579          queue = [];
82580
82581          while (++queueIndex < len) {
82582            if (currentQueue) {
82583              currentQueue[queueIndex].run();
82584            }
82585          }
82586
82587          queueIndex = -1;
82588          len = queue.length;
82589        }
82590
82591        currentQueue = null;
82592        draining = false;
82593        runClearTimeout(timeout);
82594      }
82595
82596      process.nextTick = function (fun) {
82597        var args = new Array(arguments.length - 1);
82598
82599        if (arguments.length > 1) {
82600          for (var i = 1; i < arguments.length; i++) {
82601            args[i - 1] = arguments[i];
82602          }
82603        }
82604
82605        queue.push(new Item(fun, args));
82606
82607        if (queue.length === 1 && !draining) {
82608          runTimeout(drainQueue);
82609        }
82610      }; // v8 likes predictible objects
82611
82612
82613      function Item(fun, array) {
82614        this.fun = fun;
82615        this.array = array;
82616      }
82617
82618      Item.prototype.run = function () {
82619        this.fun.apply(null, this.array);
82620      };
82621
82622      process.title = 'browser';
82623      process.browser = true;
82624      process.env = {};
82625      process.argv = [];
82626      process.version = ''; // empty string to avoid regexp issues
82627
82628      process.versions = {};
82629
82630      function noop() {}
82631
82632      process.on = noop;
82633      process.addListener = noop;
82634      process.once = noop;
82635      process.off = noop;
82636      process.removeListener = noop;
82637      process.removeAllListeners = noop;
82638      process.emit = noop;
82639      process.prependListener = noop;
82640      process.prependOnceListener = noop;
82641
82642      process.listeners = function (name) {
82643        return [];
82644      };
82645
82646      process.binding = function (name) {
82647        throw new Error('process.binding is not supported');
82648      };
82649
82650      process.cwd = function () {
82651        return '/';
82652      };
82653
82654      process.chdir = function (dir) {
82655        throw new Error('process.chdir is not supported');
82656      };
82657
82658      process.umask = function () {
82659        return 0;
82660      };
82661    }, {}],
82662    444: [function (require, module, exports) {
82663      exports.publicEncrypt = require('./publicEncrypt');
82664      exports.privateDecrypt = require('./privateDecrypt');
82665
82666      exports.privateEncrypt = function privateEncrypt(key, buf) {
82667        return exports.publicEncrypt(key, buf, true);
82668      };
82669
82670      exports.publicDecrypt = function publicDecrypt(key, buf) {
82671        return exports.privateDecrypt(key, buf, true);
82672      };
82673    }, {
82674      "./privateDecrypt": 447,
82675      "./publicEncrypt": 448
82676    }],
82677    445: [function (require, module, exports) {
82678      var createHash = require('create-hash');
82679
82680      var Buffer = require('safe-buffer').Buffer;
82681
82682      module.exports = function (seed, len) {
82683        var t = Buffer.alloc(0);
82684        var i = 0;
82685        var c;
82686
82687        while (t.length < len) {
82688          c = i2ops(i++);
82689          t = Buffer.concat([t, createHash('sha1').update(seed).update(c).digest()]);
82690        }
82691
82692        return t.slice(0, len);
82693      };
82694
82695      function i2ops(c) {
82696        var out = Buffer.allocUnsafe(4);
82697        out.writeUInt32BE(c, 0);
82698        return out;
82699      }
82700    }, {
82701      "create-hash": 308,
82702      "safe-buffer": 470
82703    }],
82704    446: [function (require, module, exports) {
82705      arguments[4][179][0].apply(exports, arguments);
82706    }, {
82707      "buffer": 183,
82708      "dup": 179
82709    }],
82710    447: [function (require, module, exports) {
82711      var parseKeys = require('parse-asn1');
82712
82713      var mgf = require('./mgf');
82714
82715      var xor = require('./xor');
82716
82717      var BN = require('bn.js');
82718
82719      var crt = require('browserify-rsa');
82720
82721      var createHash = require('create-hash');
82722
82723      var withPublic = require('./withPublic');
82724
82725      var Buffer = require('safe-buffer').Buffer;
82726
82727      module.exports = function privateDecrypt(privateKey, enc, reverse) {
82728        var padding;
82729
82730        if (privateKey.padding) {
82731          padding = privateKey.padding;
82732        } else if (reverse) {
82733          padding = 1;
82734        } else {
82735          padding = 4;
82736        }
82737
82738        var key = parseKeys(privateKey);
82739        var k = key.modulus.byteLength();
82740
82741        if (enc.length > k || new BN(enc).cmp(key.modulus) >= 0) {
82742          throw new Error('decryption error');
82743        }
82744
82745        var msg;
82746
82747        if (reverse) {
82748          msg = withPublic(new BN(enc), key);
82749        } else {
82750          msg = crt(enc, key);
82751        }
82752
82753        var zBuffer = Buffer.alloc(k - msg.length);
82754        msg = Buffer.concat([zBuffer, msg], k);
82755
82756        if (padding === 4) {
82757          return oaep(key, msg);
82758        } else if (padding === 1) {
82759          return pkcs1(key, msg, reverse);
82760        } else if (padding === 3) {
82761          return msg;
82762        } else {
82763          throw new Error('unknown padding');
82764        }
82765      };
82766
82767      function oaep(key, msg) {
82768        var k = key.modulus.byteLength();
82769        var iHash = createHash('sha1').update(Buffer.alloc(0)).digest();
82770        var hLen = iHash.length;
82771
82772        if (msg[0] !== 0) {
82773          throw new Error('decryption error');
82774        }
82775
82776        var maskedSeed = msg.slice(1, hLen + 1);
82777        var maskedDb = msg.slice(hLen + 1);
82778        var seed = xor(maskedSeed, mgf(maskedDb, hLen));
82779        var db = xor(maskedDb, mgf(seed, k - hLen - 1));
82780
82781        if (compare(iHash, db.slice(0, hLen))) {
82782          throw new Error('decryption error');
82783        }
82784
82785        var i = hLen;
82786
82787        while (db[i] === 0) {
82788          i++;
82789        }
82790
82791        if (db[i++] !== 1) {
82792          throw new Error('decryption error');
82793        }
82794
82795        return db.slice(i);
82796      }
82797
82798      function pkcs1(key, msg, reverse) {
82799        var p1 = msg.slice(0, 2);
82800        var i = 2;
82801        var status = 0;
82802
82803        while (msg[i++] !== 0) {
82804          if (i >= msg.length) {
82805            status++;
82806            break;
82807          }
82808        }
82809
82810        var ps = msg.slice(2, i - 1);
82811
82812        if (p1.toString('hex') !== '0002' && !reverse || p1.toString('hex') !== '0001' && reverse) {
82813          status++;
82814        }
82815
82816        if (ps.length < 8) {
82817          status++;
82818        }
82819
82820        if (status) {
82821          throw new Error('decryption error');
82822        }
82823
82824        return msg.slice(i);
82825      }
82826
82827      function compare(a, b) {
82828        a = Buffer.from(a);
82829        b = Buffer.from(b);
82830        var dif = 0;
82831        var len = a.length;
82832
82833        if (a.length !== b.length) {
82834          dif++;
82835          len = Math.min(a.length, b.length);
82836        }
82837
82838        var i = -1;
82839
82840        while (++i < len) {
82841          dif += a[i] ^ b[i];
82842        }
82843
82844        return dif;
82845      }
82846    }, {
82847      "./mgf": 445,
82848      "./withPublic": 449,
82849      "./xor": 450,
82850      "bn.js": 446,
82851      "browserify-rsa": 204,
82852      "create-hash": 308,
82853      "parse-asn1": 436,
82854      "safe-buffer": 470
82855    }],
82856    448: [function (require, module, exports) {
82857      var parseKeys = require('parse-asn1');
82858
82859      var randomBytes = require('randombytes');
82860
82861      var createHash = require('create-hash');
82862
82863      var mgf = require('./mgf');
82864
82865      var xor = require('./xor');
82866
82867      var BN = require('bn.js');
82868
82869      var withPublic = require('./withPublic');
82870
82871      var crt = require('browserify-rsa');
82872
82873      var Buffer = require('safe-buffer').Buffer;
82874
82875      module.exports = function publicEncrypt(publicKey, msg, reverse) {
82876        var padding;
82877
82878        if (publicKey.padding) {
82879          padding = publicKey.padding;
82880        } else if (reverse) {
82881          padding = 1;
82882        } else {
82883          padding = 4;
82884        }
82885
82886        var key = parseKeys(publicKey);
82887        var paddedMsg;
82888
82889        if (padding === 4) {
82890          paddedMsg = oaep(key, msg);
82891        } else if (padding === 1) {
82892          paddedMsg = pkcs1(key, msg, reverse);
82893        } else if (padding === 3) {
82894          paddedMsg = new BN(msg);
82895
82896          if (paddedMsg.cmp(key.modulus) >= 0) {
82897            throw new Error('data too long for modulus');
82898          }
82899        } else {
82900          throw new Error('unknown padding');
82901        }
82902
82903        if (reverse) {
82904          return crt(paddedMsg, key);
82905        } else {
82906          return withPublic(paddedMsg, key);
82907        }
82908      };
82909
82910      function oaep(key, msg) {
82911        var k = key.modulus.byteLength();
82912        var mLen = msg.length;
82913        var iHash = createHash('sha1').update(Buffer.alloc(0)).digest();
82914        var hLen = iHash.length;
82915        var hLen2 = 2 * hLen;
82916
82917        if (mLen > k - hLen2 - 2) {
82918          throw new Error('message too long');
82919        }
82920
82921        var ps = Buffer.alloc(k - mLen - hLen2 - 2);
82922        var dblen = k - hLen - 1;
82923        var seed = randomBytes(hLen);
82924        var maskedDb = xor(Buffer.concat([iHash, ps, Buffer.alloc(1, 1), msg], dblen), mgf(seed, dblen));
82925        var maskedSeed = xor(seed, mgf(maskedDb, hLen));
82926        return new BN(Buffer.concat([Buffer.alloc(1), maskedSeed, maskedDb], k));
82927      }
82928
82929      function pkcs1(key, msg, reverse) {
82930        var mLen = msg.length;
82931        var k = key.modulus.byteLength();
82932
82933        if (mLen > k - 11) {
82934          throw new Error('message too long');
82935        }
82936
82937        var ps;
82938
82939        if (reverse) {
82940          ps = Buffer.alloc(k - mLen - 3, 0xff);
82941        } else {
82942          ps = nonZero(k - mLen - 3);
82943        }
82944
82945        return new BN(Buffer.concat([Buffer.from([0, reverse ? 1 : 2]), ps, Buffer.alloc(1), msg], k));
82946      }
82947
82948      function nonZero(len) {
82949        var out = Buffer.allocUnsafe(len);
82950        var i = 0;
82951        var cache = randomBytes(len * 2);
82952        var cur = 0;
82953        var num;
82954
82955        while (i < len) {
82956          if (cur === cache.length) {
82957            cache = randomBytes(len * 2);
82958            cur = 0;
82959          }
82960
82961          num = cache[cur++];
82962
82963          if (num) {
82964            out[i++] = num;
82965          }
82966        }
82967
82968        return out;
82969      }
82970    }, {
vendor: 4,545 bytes, lines 82971-83105
82971      "./mgf": 445,
82972      "./withPublic": 449,
82973      "./xor": 450,
82974      "bn.js": 446,
82975      "browserify-rsa": 204,
82976      "create-hash": 308,
82977      "parse-asn1": 436,
82978      "randombytes": 451,
82979      "safe-buffer": 470
82980    }],
82981    449: [function (require, module, exports) {
82982      var BN = require('bn.js');
82983
82984      var Buffer = require('safe-buffer').Buffer;
82985
82986      function withPublic(paddedMsg, key) {
82987        return Buffer.from(paddedMsg.toRed(BN.mont(key.modulus)).redPow(new BN(key.publicExponent)).fromRed().toArray());
82988      }
82989
82990      module.exports = withPublic;
82991    }, {
82992      "bn.js": 446,
82993      "safe-buffer": 470
82994    }],
82995    450: [function (require, module, exports) {
82996      module.exports = function xor(a, b) {
82997        var len = a.length;
82998        var i = -1;
82999
83000        while (++i < len) {
83001          a[i] ^= b[i];
83002        }
83003
83004        return a;
83005      };
83006    }, {}],
83007    451: [function (require, module, exports) {
83008      (function (process, global) {
83009        'use strict'; // limit of Crypto.getRandomValues()
83010        // https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues
83011
83012        var MAX_BYTES = 65536; // Node supports requesting up to this number of bytes
83013        // https://github.com/nodejs/node/blob/master/lib/internal/crypto/random.js#L48
83014
83015        var MAX_UINT32 = 4294967295;
83016
83017        function oldBrowser() {
83018          throw new Error('Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11');
83019        }
83020
83021        var Buffer = require('safe-buffer').Buffer;
83022
83023        var crypto = global.crypto || global.msCrypto;
83024
83025        if (crypto && crypto.getRandomValues) {
83026          module.exports = randomBytes;
83027        } else {
83028          module.exports = oldBrowser;
83029        }
83030
83031        function randomBytes(size, cb) {
83032          // phantomjs needs to throw
83033          if (size > MAX_UINT32) throw new RangeError('requested too many random bytes');
83034          var bytes = Buffer.allocUnsafe(size);
83035
83036          if (size > 0) {
83037            // getRandomValues fails on IE if size == 0
83038            if (size > MAX_BYTES) {
83039              // this is the max bytes crypto.getRandomValues
83040              // can do at once see https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues
83041              for (var generated = 0; generated < size; generated += MAX_BYTES) {
83042                // buffer.slice automatically checks if the end is past the end of
83043                // the buffer so we don't have to here
83044                crypto.getRandomValues(bytes.slice(generated, generated + MAX_BYTES));
83045              }
83046            } else {
83047              crypto.getRandomValues(bytes);
83048            }
83049          }
83050
83051          if (typeof cb === 'function') {
83052            return process.nextTick(function () {
83053              cb(null, bytes);
83054            });
83055          }
83056
83057          return bytes;
83058        }
83059      }).call(this, require('_process'), typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
83060    }, {
83061      "_process": 443,
83062      "safe-buffer": 470
83063    }],
83064    452: [function (require, module, exports) {
83065      (function (process, global) {
83066        'use strict';
83067
83068        function oldBrowser() {
83069          throw new Error('secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11');
83070        }
83071
83072        var safeBuffer = require('safe-buffer');
83073
83074        var randombytes = require('randombytes');
83075
83076        var Buffer = safeBuffer.Buffer;
83077        var kBufferMaxLength = safeBuffer.kMaxLength;
83078        var crypto = global.crypto || global.msCrypto;
83079        var kMaxUint32 = Math.pow(2, 32) - 1;
83080
83081        function assertOffset(offset, length) {
83082          if (typeof offset !== 'number' || offset !== offset) {
83083            // eslint-disable-line no-self-compare
83084            throw new TypeError('offset must be a number');
83085          }
83086
83087          if (offset > kMaxUint32 || offset < 0) {
83088            throw new TypeError('offset must be a uint32');
83089          }
83090
83091          if (offset > kBufferMaxLength || offset > length) {
83092            throw new RangeError('offset out of range');
83093          }
83094        }
83095
83096        function assertSize(size, offset, length) {
83097          if (typeof size !== 'number' || size !== size) {
83098            // eslint-disable-line no-self-compare
83099            throw new TypeError('size must be a number');
83100          }
83101
83102          if (size > kMaxUint32 || size < 0) {
83103            throw new TypeError('size must be a uint32');
83104          }
83105
vendor: 5,427 bytes, lines 83106-83273
83106          if (size + offset > length || size > kBufferMaxLength) {
83107            throw new RangeError('buffer too small');
83108          }
83109        }
83110
83111        if (crypto && crypto.getRandomValues || !process.browser) {
83112          exports.randomFill = randomFill;
83113          exports.randomFillSync = randomFillSync;
83114        } else {
83115          exports.randomFill = oldBrowser;
83116          exports.randomFillSync = oldBrowser;
83117        }
83118
83119        function randomFill(buf, offset, size, cb) {
83120          if (!Buffer.isBuffer(buf) && !(buf instanceof global.Uint8Array)) {
83121            throw new TypeError('"buf" argument must be a Buffer or Uint8Array');
83122          }
83123
83124          if (typeof offset === 'function') {
83125            cb = offset;
83126            offset = 0;
83127            size = buf.length;
83128          } else if (typeof size === 'function') {
83129            cb = size;
83130            size = buf.length - offset;
83131          } else if (typeof cb !== 'function') {
83132            throw new TypeError('"cb" argument must be a function');
83133          }
83134
83135          assertOffset(offset, buf.length);
83136          assertSize(size, offset, buf.length);
83137          return actualFill(buf, offset, size, cb);
83138        }
83139
83140        function actualFill(buf, offset, size, cb) {
83141          if (process.browser) {
83142            var ourBuf = buf.buffer;
83143            var uint = new Uint8Array(ourBuf, offset, size);
83144            crypto.getRandomValues(uint);
83145
83146            if (cb) {
83147              process.nextTick(function () {
83148                cb(null, buf);
83149              });
83150              return;
83151            }
83152
83153            return buf;
83154          }
83155
83156          if (cb) {
83157            randombytes(size, function (err, bytes) {
83158              if (err) {
83159                return cb(err);
83160              }
83161
83162              bytes.copy(buf, offset);
83163              cb(null, buf);
83164            });
83165            return;
83166          }
83167
83168          var bytes = randombytes(size);
83169          bytes.copy(buf, offset);
83170          return buf;
83171        }
83172
83173        function randomFillSync(buf, offset, size) {
83174          if (typeof offset === 'undefined') {
83175            offset = 0;
83176          }
83177
83178          if (!Buffer.isBuffer(buf) && !(buf instanceof global.Uint8Array)) {
83179            throw new TypeError('"buf" argument must be a Buffer or Uint8Array');
83180          }
83181
83182          assertOffset(offset, buf.length);
83183          if (size === undefined) size = buf.length - offset;
83184          assertSize(size, offset, buf.length);
83185          return actualFill(buf, offset, size);
83186        }
83187      }).call(this, require('_process'), typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
83188    }, {
83189      "_process": 443,
83190      "randombytes": 451,
83191      "safe-buffer": 470
83192    }],
83193    453: [function (require, module, exports) {
83194      'use strict';
83195
83196      function _inheritsLoose(subClass, superClass) {
83197        subClass.prototype = Object.create(superClass.prototype);
83198        subClass.prototype.constructor = subClass;
83199        subClass.__proto__ = superClass;
83200      }
83201
83202      var codes = {};
83203
83204      function createErrorType(code, message, Base) {
83205        if (!Base) {
83206          Base = Error;
83207        }
83208
83209        function getMessage(arg1, arg2, arg3) {
83210          if (typeof message === 'string') {
83211            return message;
83212          } else {
83213            return message(arg1, arg2, arg3);
83214          }
83215        }
83216
83217        var NodeError = /*#__PURE__*/function (_Base) {
83218          _inheritsLoose(NodeError, _Base);
83219
83220          function NodeError(arg1, arg2, arg3) {
83221            return _Base.call(this, getMessage(arg1, arg2, arg3)) || this;
83222          }
83223
83224          return NodeError;
83225        }(Base);
83226
83227        NodeError.prototype.name = Base.name;
83228        NodeError.prototype.code = code;
83229        codes[code] = NodeError;
83230      } // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js
83231
83232
83233      function oneOf(expected, thing) {
83234        if (Array.isArray(expected)) {
83235          var len = expected.length;
83236          expected = expected.map(function (i) {
83237            return String(i);
83238          });
83239
83240          if (len > 2) {
83241            return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(', '), ", or ") + expected[len - 1];
83242          } else if (len === 2) {
83243            return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]);
83244          } else {
83245            return "of ".concat(thing, " ").concat(expected[0]);
83246          }
83247        } else {
83248          return "of ".concat(thing, " ").concat(String(expected));
83249        }
83250      } // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith
83251
83252
83253      function startsWith(str, search, pos) {
83254        return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;
83255      } // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith
83256
83257
83258      function endsWith(str, search, this_len) {
83259        if (this_len === undefined || this_len > str.length) {
83260          this_len = str.length;
83261        }
83262
83263        return str.substring(this_len - search.length, this_len) === search;
83264      } // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes
83265
83266
83267      function includes(str, search, start) {
83268        if (typeof start !== 'number') {
83269          start = 0;
83270        }
83271
83272        if (start + search.length > str.length) {
83273          return false;
vendor: 4,923 bytes, lines 83274-83390
83274        } else {
83275          return str.indexOf(search, start) !== -1;
83276        }
83277      }
83278
83279      createErrorType('ERR_INVALID_OPT_VALUE', function (name, value) {
83280        return 'The value "' + value + '" is invalid for option "' + name + '"';
83281      }, TypeError);
83282      createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) {
83283        // determiner: 'must be' or 'must not be'
83284        var determiner;
83285
83286        if (typeof expected === 'string' && startsWith(expected, 'not ')) {
83287          determiner = 'must not be';
83288          expected = expected.replace(/^not /, '');
83289        } else {
83290          determiner = 'must be';
83291        }
83292
83293        var msg;
83294
83295        if (endsWith(name, ' argument')) {
83296          // For cases like 'first argument'
83297          msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, 'type'));
83298        } else {
83299          var type = includes(name, '.') ? 'property' : 'argument';
83300          msg = "The \"".concat(name, "\" ").concat(type, " ").concat(determiner, " ").concat(oneOf(expected, 'type'));
83301        }
83302
83303        msg += ". Received type ".concat(_typeof2(actual));
83304        return msg;
83305      }, TypeError);
83306      createErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF');
83307      createErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) {
83308        return 'The ' + name + ' method is not implemented';
83309      });
83310      createErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close');
83311      createErrorType('ERR_STREAM_DESTROYED', function (name) {
83312        return 'Cannot call ' + name + ' after a stream was destroyed';
83313      });
83314      createErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times');
83315      createErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable');
83316      createErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end');
83317      createErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError);
83318      createErrorType('ERR_UNKNOWN_ENCODING', function (arg) {
83319        return 'Unknown encoding: ' + arg;
83320      }, TypeError);
83321      createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event');
83322      module.exports.codes = codes;
83323    }, {}],
83324    454: [function (require, module, exports) {
83325      (function (process) {
83326        // Copyright Joyent, Inc. and other Node contributors.
83327        //
83328        // Permission is hereby granted, free of charge, to any person obtaining a
83329        // copy of this software and associated documentation files (the
83330        // "Software"), to deal in the Software without restriction, including
83331        // without limitation the rights to use, copy, modify, merge, publish,
83332        // distribute, sublicense, and/or sell copies of the Software, and to permit
83333        // persons to whom the Software is furnished to do so, subject to the
83334        // following conditions:
83335        //
83336        // The above copyright notice and this permission notice shall be included
83337        // in all copies or substantial portions of the Software.
83338        //
83339        // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
83340        // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
83341        // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
83342        // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
83343        // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
83344        // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
83345        // USE OR OTHER DEALINGS IN THE SOFTWARE.
83346        // a duplex stream is just a stream that is both readable and writable.
83347        // Since JS doesn't have multiple prototypal inheritance, this class
83348        // prototypally inherits from Readable, and then parasitically from
83349        // Writable.
83350        'use strict';
83351        /*<replacement>*/
83352
83353        var objectKeys = Object.keys || function (obj) {
83354          var keys = [];
83355
83356          for (var key in obj) {
83357            keys.push(key);
83358          }
83359
83360          return keys;
83361        };
83362        /*</replacement>*/
83363
83364
83365        module.exports = Duplex;
83366
83367        var Readable = require('./_stream_readable');
83368
83369        var Writable = require('./_stream_writable');
83370
83371        require('inherits')(Duplex, Readable);
83372
83373        {
83374          // Allow the keys array to be GC'ed.
83375          var keys = objectKeys(Writable.prototype);
83376
83377          for (var v = 0; v < keys.length; v++) {
83378            var method = keys[v];
83379            if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
83380          }
83381        }
83382
83383        function Duplex(options) {
83384          if (!(this instanceof Duplex)) return new Duplex(options);
83385          Readable.call(this, options);
83386          Writable.call(this, options);
83387          this.allowHalfOpen = true;
83388
83389          if (options) {
83390            if (options.readable === false) this.readable = false;
vendor: 4,768 bytes, lines 83391-83512
83391            if (options.writable === false) this.writable = false;
83392
83393            if (options.allowHalfOpen === false) {
83394              this.allowHalfOpen = false;
83395              this.once('end', onend);
83396            }
83397          }
83398        }
83399
83400        Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
83401          // making it explicit this property is not enumerable
83402          // because otherwise some prototype manipulation in
83403          // userland will fail
83404          enumerable: false,
83405          get: function get() {
83406            return this._writableState.highWaterMark;
83407          }
83408        });
83409        Object.defineProperty(Duplex.prototype, 'writableBuffer', {
83410          // making it explicit this property is not enumerable
83411          // because otherwise some prototype manipulation in
83412          // userland will fail
83413          enumerable: false,
83414          get: function get() {
83415            return this._writableState && this._writableState.getBuffer();
83416          }
83417        });
83418        Object.defineProperty(Duplex.prototype, 'writableLength', {
83419          // making it explicit this property is not enumerable
83420          // because otherwise some prototype manipulation in
83421          // userland will fail
83422          enumerable: false,
83423          get: function get() {
83424            return this._writableState.length;
83425          }
83426        }); // the no-half-open enforcer
83427
83428        function onend() {
83429          // If the writable side ended, then we're ok.
83430          if (this._writableState.ended) return; // no more data can be written.
83431          // But allow more writes to happen in this tick.
83432
83433          process.nextTick(onEndNT, this);
83434        }
83435
83436        function onEndNT(self) {
83437          self.end();
83438        }
83439
83440        Object.defineProperty(Duplex.prototype, 'destroyed', {
83441          // making it explicit this property is not enumerable
83442          // because otherwise some prototype manipulation in
83443          // userland will fail
83444          enumerable: false,
83445          get: function get() {
83446            if (this._readableState === undefined || this._writableState === undefined) {
83447              return false;
83448            }
83449
83450            return this._readableState.destroyed && this._writableState.destroyed;
83451          },
83452          set: function set(value) {
83453            // we ignore the value if the stream
83454            // has not been initialized yet
83455            if (this._readableState === undefined || this._writableState === undefined) {
83456              return;
83457            } // backward compatibility, the user is explicitly
83458            // managing destroyed
83459
83460
83461            this._readableState.destroyed = value;
83462            this._writableState.destroyed = value;
83463          }
83464        });
83465      }).call(this, require('_process'));
83466    }, {
83467      "./_stream_readable": 456,
83468      "./_stream_writable": 458,
83469      "_process": 443,
83470      "inherits": 364
83471    }],
83472    455: [function (require, module, exports) {
83473      // Copyright Joyent, Inc. and other Node contributors.
83474      //
83475      // Permission is hereby granted, free of charge, to any person obtaining a
83476      // copy of this software and associated documentation files (the
83477      // "Software"), to deal in the Software without restriction, including
83478      // without limitation the rights to use, copy, modify, merge, publish,
83479      // distribute, sublicense, and/or sell copies of the Software, and to permit
83480      // persons to whom the Software is furnished to do so, subject to the
83481      // following conditions:
83482      //
83483      // The above copyright notice and this permission notice shall be included
83484      // in all copies or substantial portions of the Software.
83485      //
83486      // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
83487      // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
83488      // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
83489      // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
83490      // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
83491      // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
83492      // USE OR OTHER DEALINGS IN THE SOFTWARE.
83493      // a passthrough stream.
83494      // basically just the most minimal sort of Transform stream.
83495      // Every written chunk gets output as-is.
83496      'use strict';
83497
83498      module.exports = PassThrough;
83499
83500      var Transform = require('./_stream_transform');
83501
83502      require('inherits')(PassThrough, Transform);
83503
83504      function PassThrough(options) {
83505        if (!(this instanceof PassThrough)) return new PassThrough(options);
83506        Transform.call(this, options);
83507      }
83508
83509      PassThrough.prototype._transform = function (chunk, encoding, cb) {
83510        cb(null, chunk);
83511      };
83512    }, {
vendor: 4,347 bytes, lines 83513-83620
83513      "./_stream_transform": 457,
83514      "inherits": 364
83515    }],
83516    456: [function (require, module, exports) {
83517      (function (process, global) {
83518        // Copyright Joyent, Inc. and other Node contributors.
83519        //
83520        // Permission is hereby granted, free of charge, to any person obtaining a
83521        // copy of this software and associated documentation files (the
83522        // "Software"), to deal in the Software without restriction, including
83523        // without limitation the rights to use, copy, modify, merge, publish,
83524        // distribute, sublicense, and/or sell copies of the Software, and to permit
83525        // persons to whom the Software is furnished to do so, subject to the
83526        // following conditions:
83527        //
83528        // The above copyright notice and this permission notice shall be included
83529        // in all copies or substantial portions of the Software.
83530        //
83531        // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
83532        // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
83533        // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
83534        // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
83535        // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
83536        // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
83537        // USE OR OTHER DEALINGS IN THE SOFTWARE.
83538        'use strict';
83539
83540        module.exports = Readable;
83541        /*<replacement>*/
83542
83543        var Duplex;
83544        /*</replacement>*/
83545
83546        Readable.ReadableState = ReadableState;
83547        /*<replacement>*/
83548
83549        var EE = require('events').EventEmitter;
83550
83551        var EElistenerCount = function EElistenerCount(emitter, type) {
83552          return emitter.listeners(type).length;
83553        };
83554        /*</replacement>*/
83555
83556        /*<replacement>*/
83557
83558
83559        var Stream = require('./internal/streams/stream');
83560        /*</replacement>*/
83561
83562
83563        var Buffer = require('buffer').Buffer;
83564
83565        var OurUint8Array = global.Uint8Array || function () {};
83566
83567        function _uint8ArrayToBuffer(chunk) {
83568          return Buffer.from(chunk);
83569        }
83570
83571        function _isUint8Array(obj) {
83572          return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
83573        }
83574        /*<replacement>*/
83575
83576
83577        var debugUtil = require('util');
83578
83579        var debug;
83580
83581        if (debugUtil && debugUtil.debuglog) {
83582          debug = debugUtil.debuglog('stream');
83583        } else {
83584          debug = function debug() {};
83585        }
83586        /*</replacement>*/
83587
83588
83589        var BufferList = require('./internal/streams/buffer_list');
83590
83591        var destroyImpl = require('./internal/streams/destroy');
83592
83593        var _require = require('./internal/streams/state'),
83594            getHighWaterMark = _require.getHighWaterMark;
83595
83596        var _require$codes = require('../errors').codes,
83597            ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
83598            ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF,
83599            ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
83600            ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; // Lazy loaded to improve the startup performance.
83601
83602
83603        var StringDecoder;
83604        var createReadableStreamAsyncIterator;
83605        var from;
83606
83607        require('inherits')(Readable, Stream);
83608
83609        var errorOrDestroy = destroyImpl.errorOrDestroy;
83610        var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];
83611
83612        function prependListener(emitter, event, fn) {
83613          // Sadly this is not cacheable as some libraries bundle their own
83614          // event emitter implementation with them.
83615          if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); // This is a hack to make sure that our error handler is attached before any
83616          // userland ones.  NEVER DO THIS. This is here only because this code needs
83617          // to continue to work with older versions of Node.js that do not include
83618          // the prependListener() method. The goal is to eventually remove this hack.
83619
83620          if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);
vendor: 10,061 bytes, lines 83620-83867
83620else emitter._events[event] = [fn, emitter._events[event]];
83621        }
83622
83623        function ReadableState(options, stream, isDuplex) {
83624          Duplex = Duplex || require('./_stream_duplex');
83625          options = options || {}; // Duplex streams are both readable and writable, but share
83626          // the same options object.
83627          // However, some cases require setting options to different
83628          // values for the readable and the writable sides of the duplex stream.
83629          // These options can be provided separately as readableXXX and writableXXX.
83630
83631          if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag. Used to make read(n) ignore n and to
83632          // make all the buffer merging and length checks go away
83633
83634          this.objectMode = !!options.objectMode;
83635          if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; // the point at which it stops calling _read() to fill the buffer
83636          // Note: 0 is a valid value, means "don't call _read preemptively ever"
83637
83638          this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex); // A linked list is used to store data chunks instead of an array because the
83639          // linked list can remove elements from the beginning faster than
83640          // array.shift()
83641
83642          this.buffer = new BufferList();
83643          this.length = 0;
83644          this.pipes = null;
83645          this.pipesCount = 0;
83646          this.flowing = null;
83647          this.ended = false;
83648          this.endEmitted = false;
83649          this.reading = false; // a flag to be able to tell if the event 'readable'/'data' is emitted
83650          // immediately, or on a later tick.  We set this to true at first, because
83651          // any actions that shouldn't happen until "later" should generally also
83652          // not happen before the first read call.
83653
83654          this.sync = true; // whenever we return null, then we set a flag to say
83655          // that we're awaiting a 'readable' event emission.
83656
83657          this.needReadable = false;
83658          this.emittedReadable = false;
83659          this.readableListening = false;
83660          this.resumeScheduled = false;
83661          this.paused = true; // Should close be emitted on destroy. Defaults to true.
83662
83663          this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'end' (and potentially 'finish')
83664
83665          this.autoDestroy = !!options.autoDestroy; // has it been destroyed
83666
83667          this.destroyed = false; // Crypto is kind of old and crusty.  Historically, its default string
83668          // encoding is 'binary' so we have to make this configurable.
83669          // Everything else in the universe uses 'utf8', though.
83670
83671          this.defaultEncoding = options.defaultEncoding || 'utf8'; // the number of writers that are awaiting a drain event in .pipe()s
83672
83673          this.awaitDrain = 0; // if true, a maybeReadMore has been scheduled
83674
83675          this.readingMore = false;
83676          this.decoder = null;
83677          this.encoding = null;
83678
83679          if (options.encoding) {
83680            if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
83681            this.decoder = new StringDecoder(options.encoding);
83682            this.encoding = options.encoding;
83683          }
83684        }
83685
83686        function Readable(options) {
83687          Duplex = Duplex || require('./_stream_duplex');
83688          if (!(this instanceof Readable)) return new Readable(options); // Checking for a Stream.Duplex instance is faster here instead of inside
83689          // the ReadableState constructor, at least with V8 6.5
83690
83691          var isDuplex = this instanceof Duplex;
83692          this._readableState = new ReadableState(options, this, isDuplex); // legacy
83693
83694          this.readable = true;
83695
83696          if (options) {
83697            if (typeof options.read === 'function') this._read = options.read;
83698            if (typeof options.destroy === 'function') this._destroy = options.destroy;
83699          }
83700
83701          Stream.call(this);
83702        }
83703
83704        Object.defineProperty(Readable.prototype, 'destroyed', {
83705          // making it explicit this property is not enumerable
83706          // because otherwise some prototype manipulation in
83707          // userland will fail
83708          enumerable: false,
83709          get: function get() {
83710            if (this._readableState === undefined) {
83711              return false;
83712            }
83713
83714            return this._readableState.destroyed;
83715          },
83716          set: function set(value) {
83717            // we ignore the value if the stream
83718            // has not been initialized yet
83719            if (!this._readableState) {
83720              return;
83721            } // backward compatibility, the user is explicitly
83722            // managing destroyed
83723
83724
83725            this._readableState.destroyed = value;
83726          }
83727        });
83728        Readable.prototype.destroy = destroyImpl.destroy;
83729        Readable.prototype._undestroy = destroyImpl.undestroy;
83730
83731        Readable.prototype._destroy = function (err, cb) {
83732          cb(err);
83733        }; // Manually shove something into the read() buffer.
83734        // This returns true if the highWaterMark has not been hit yet,
83735        // similar to how Writable.write() returns true if you should
83736        // write() some more.
83737
83738
83739        Readable.prototype.push = function (chunk, encoding) {
83740          var state = this._readableState;
83741          var skipChunkCheck;
83742
83743          if (!state.objectMode) {
83744            if (typeof chunk === 'string') {
83745              encoding = encoding || state.defaultEncoding;
83746
83747              if (encoding !== state.encoding) {
83748                chunk = Buffer.from(chunk, encoding);
83749                encoding = '';
83750              }
83751
83752              skipChunkCheck = true;
83753            }
83754          } else {
83755            skipChunkCheck = true;
83756          }
83757
83758          return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
83759        }; // Unshift should *always* be something directly out of read()
83760
83761
83762        Readable.prototype.unshift = function (chunk) {
83763          return readableAddChunk(this, chunk, null, true, false);
83764        };
83765
83766        function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
83767          debug('readableAddChunk', chunk);
83768          var state = stream._readableState;
83769
83770          if (chunk === null) {
83771            state.reading = false;
83772            onEofChunk(stream, state);
83773          } else {
83774            var er;
83775            if (!skipChunkCheck) er = chunkInvalid(state, chunk);
83776
83777            if (er) {
83778              errorOrDestroy(stream, er);
83779            } else if (state.objectMode || chunk && chunk.length > 0) {
83780              if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {
83781                chunk = _uint8ArrayToBuffer(chunk);
83782              }
83783
83784              if (addToFront) {
83785                if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());else addChunk(stream, state, chunk, true);
83786              } else if (state.ended) {
83787                errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF());
83788              } else if (state.destroyed) {
83789                return false;
83790              } else {
83791                state.reading = false;
83792
83793                if (state.decoder && !encoding) {
83794                  chunk = state.decoder.write(chunk);
83795                  if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);
83796                } else {
83797                  addChunk(stream, state, chunk, false);
83798                }
83799              }
83800            } else if (!addToFront) {
83801              state.reading = false;
83802              maybeReadMore(stream, state);
83803            }
83804          } // We can push more data if we are below the highWaterMark.
83805          // Also, if we have no data yet, we can stand some more bytes.
83806          // This is to work around cases where hwm=0, such as the repl.
83807
83808
83809          return !state.ended && (state.length < state.highWaterMark || state.length === 0);
83810        }
83811
83812        function addChunk(stream, state, chunk, addToFront) {
83813          if (state.flowing && state.length === 0 && !state.sync) {
83814            state.awaitDrain = 0;
83815            stream.emit('data', chunk);
83816          } else {
83817            // update the buffer info.
83818            state.length += state.objectMode ? 1 : chunk.length;
83819            if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);
83820            if (state.needReadable) emitReadable(stream);
83821          }
83822
83823          maybeReadMore(stream, state);
83824        }
83825
83826        function chunkInvalid(state, chunk) {
83827          var er;
83828
83829          if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
83830            er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk);
83831          }
83832
83833          return er;
83834        }
83835
83836        Readable.prototype.isPaused = function () {
83837          return this._readableState.flowing === false;
83838        }; // backwards compatibility.
83839
83840
83841        Readable.prototype.setEncoding = function (enc) {
83842          if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
83843          var decoder = new StringDecoder(enc);
83844          this._readableState.decoder = decoder; // If setEncoding(null), decoder.encoding equals utf8
83845
83846          this._readableState.encoding = this._readableState.decoder.encoding; // Iterate over current buffer to convert already stored Buffers:
83847
83848          var p = this._readableState.buffer.head;
83849          var content = '';
83850
83851          while (p !== null) {
83852            content += decoder.write(p.data);
83853            p = p.next;
83854          }
83855
83856          this._readableState.buffer.clear();
83857
83858          if (content !== '') this._readableState.buffer.push(content);
83859          this._readableState.length = content.length;
83860          return this;
83861        }; // Don't raise the hwm > 1GB
83862
83863
83864        var MAX_HWM = 0x40000000;
83865
83866        function computeNewHighWaterMark(n) {
83867          if (n >= MAX_HWM) {
vendor: 15,691 bytes, lines 83868-84263
83868            // TODO(ronag): Throw ERR_VALUE_OUT_OF_RANGE.
83869            n = MAX_HWM;
83870          } else {
83871            // Get the next highest power of 2 to prevent increasing hwm excessively in
83872            // tiny amounts
83873            n--;
83874            n |= n >>> 1;
83875            n |= n >>> 2;
83876            n |= n >>> 4;
83877            n |= n >>> 8;
83878            n |= n >>> 16;
83879            n++;
83880          }
83881
83882          return n;
83883        } // This function is designed to be inlinable, so please take care when making
83884        // changes to the function body.
83885
83886
83887        function howMuchToRead(n, state) {
83888          if (n <= 0 || state.length === 0 && state.ended) return 0;
83889          if (state.objectMode) return 1;
83890
83891          if (n !== n) {
83892            // Only flow one buffer at a time
83893            if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
83894          } // If we're asking for more than the current hwm, then raise the hwm.
83895
83896
83897          if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
83898          if (n <= state.length) return n; // Don't have enough
83899
83900          if (!state.ended) {
83901            state.needReadable = true;
83902            return 0;
83903          }
83904
83905          return state.length;
83906        } // you can override either this method, or the async _read(n) below.
83907
83908
83909        Readable.prototype.read = function (n) {
83910          debug('read', n);
83911          n = parseInt(n, 10);
83912          var state = this._readableState;
83913          var nOrig = n;
83914          if (n !== 0) state.emittedReadable = false; // if we're doing read(0) to trigger a readable event, but we
83915          // already have a bunch of data in the buffer, then just trigger
83916          // the 'readable' event and move on.
83917
83918          if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) {
83919            debug('read: emitReadable', state.length, state.ended);
83920            if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
83921            return null;
83922          }
83923
83924          n = howMuchToRead(n, state); // if we've ended, and we're now clear, then finish it up.
83925
83926          if (n === 0 && state.ended) {
83927            if (state.length === 0) endReadable(this);
83928            return null;
83929          } // All the actual chunk generation logic needs to be
83930          // *below* the call to _read.  The reason is that in certain
83931          // synthetic stream cases, such as passthrough streams, _read
83932          // may be a completely synchronous operation which may change
83933          // the state of the read buffer, providing enough data when
83934          // before there was *not* enough.
83935          //
83936          // So, the steps are:
83937          // 1. Figure out what the state of things will be after we do
83938          // a read from the buffer.
83939          //
83940          // 2. If that resulting state will trigger a _read, then call _read.
83941          // Note that this may be asynchronous, or synchronous.  Yes, it is
83942          // deeply ugly to write APIs this way, but that still doesn't mean
83943          // that the Readable class should behave improperly, as streams are
83944          // designed to be sync/async agnostic.
83945          // Take note if the _read call is sync or async (ie, if the read call
83946          // has returned yet), so that we know whether or not it's safe to emit
83947          // 'readable' etc.
83948          //
83949          // 3. Actually pull the requested chunks out of the buffer and return.
83950          // if we need a readable event, then we need to do some reading.
83951
83952
83953          var doRead = state.needReadable;
83954          debug('need readable', doRead); // if we currently have less than the highWaterMark, then also read some
83955
83956          if (state.length === 0 || state.length - n < state.highWaterMark) {
83957            doRead = true;
83958            debug('length less than watermark', doRead);
83959          } // however, if we've ended, then there's no point, and if we're already
83960          // reading, then it's unnecessary.
83961
83962
83963          if (state.ended || state.reading) {
83964            doRead = false;
83965            debug('reading or ended', doRead);
83966          } else if (doRead) {
83967            debug('do read');
83968            state.reading = true;
83969            state.sync = true; // if the length is currently zero, then we *need* a readable event.
83970
83971            if (state.length === 0) state.needReadable = true; // call internal read method
83972
83973            this._read(state.highWaterMark);
83974
83975            state.sync = false; // If _read pushed data synchronously, then `reading` will be false,
83976            // and we need to re-evaluate how much data we can return to the user.
83977
83978            if (!state.reading) n = howMuchToRead(nOrig, state);
83979          }
83980
83981          var ret;
83982          if (n > 0) ret = fromList(n, state);else ret = null;
83983
83984          if (ret === null) {
83985            state.needReadable = state.length <= state.highWaterMark;
83986            n = 0;
83987          } else {
83988            state.length -= n;
83989            state.awaitDrain = 0;
83990          }
83991
83992          if (state.length === 0) {
83993            // If we have nothing in the buffer, then we want to know
83994            // as soon as we *do* get something into the buffer.
83995            if (!state.ended) state.needReadable = true; // If we tried to read() past the EOF, then emit end on the next tick.
83996
83997            if (nOrig !== n && state.ended) endReadable(this);
83998          }
83999
84000          if (ret !== null) this.emit('data', ret);
84001          return ret;
84002        };
84003
84004        function onEofChunk(stream, state) {
84005          debug('onEofChunk');
84006          if (state.ended) return;
84007
84008          if (state.decoder) {
84009            var chunk = state.decoder.end();
84010
84011            if (chunk && chunk.length) {
84012              state.buffer.push(chunk);
84013              state.length += state.objectMode ? 1 : chunk.length;
84014            }
84015          }
84016
84017          state.ended = true;
84018
84019          if (state.sync) {
84020            // if we are sync, wait until next tick to emit the data.
84021            // Otherwise we risk emitting data in the flow()
84022            // the readable code triggers during a read() call
84023            emitReadable(stream);
84024          } else {
84025            // emit 'readable' now to make sure it gets picked up.
84026            state.needReadable = false;
84027
84028            if (!state.emittedReadable) {
84029              state.emittedReadable = true;
84030              emitReadable_(stream);
84031            }
84032          }
84033        } // Don't emit readable right away in sync mode, because this can trigger
84034        // another read() call => stack overflow.  This way, it might trigger
84035        // a nextTick recursion warning, but that's not so bad.
84036
84037
84038        function emitReadable(stream) {
84039          var state = stream._readableState;
84040          debug('emitReadable', state.needReadable, state.emittedReadable);
84041          state.needReadable = false;
84042
84043          if (!state.emittedReadable) {
84044            debug('emitReadable', state.flowing);
84045            state.emittedReadable = true;
84046            process.nextTick(emitReadable_, stream);
84047          }
84048        }
84049
84050        function emitReadable_(stream) {
84051          var state = stream._readableState;
84052          debug('emitReadable_', state.destroyed, state.length, state.ended);
84053
84054          if (!state.destroyed && (state.length || state.ended)) {
84055            stream.emit('readable');
84056            state.emittedReadable = false;
84057          } // The stream needs another readable event if
84058          // 1. It is not flowing, as the flow mechanism will take
84059          //    care of it.
84060          // 2. It is not ended.
84061          // 3. It is below the highWaterMark, so we can schedule
84062          //    another readable later.
84063
84064
84065          state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark;
84066          flow(stream);
84067        } // at this point, the user has presumably seen the 'readable' event,
84068        // and called read() to consume some data.  that may have triggered
84069        // in turn another _read(n) call, in which case reading = true if
84070        // it's in progress.
84071        // However, if we're not ended, or reading, and the length < hwm,
84072        // then go ahead and try to read some more preemptively.
84073
84074
84075        function maybeReadMore(stream, state) {
84076          if (!state.readingMore) {
84077            state.readingMore = true;
84078            process.nextTick(maybeReadMore_, stream, state);
84079          }
84080        }
84081
84082        function maybeReadMore_(stream, state) {
84083          // Attempt to read more data if we should.
84084          //
84085          // The conditions for reading more data are (one of):
84086          // - Not enough data buffered (state.length < state.highWaterMark). The loop
84087          //   is responsible for filling the buffer with enough data if such data
84088          //   is available. If highWaterMark is 0 and we are not in the flowing mode
84089          //   we should _not_ attempt to buffer any extra data. We'll get more data
84090          //   when the stream consumer calls read() instead.
84091          // - No data in the buffer, and the stream is in flowing mode. In this mode
84092          //   the loop below is responsible for ensuring read() is called. Failing to
84093          //   call read here would abort the flow and there's no other mechanism for
84094          //   continuing the flow if the stream consumer has just subscribed to the
84095          //   'data' event.
84096          //
84097          // In addition to the above conditions to keep reading data, the following
84098          // conditions prevent the data from being read:
84099          // - The stream has ended (state.ended).
84100          // - There is already a pending 'read' operation (state.reading). This is a
84101          //   case where the the stream has called the implementation defined _read()
84102          //   method, but they are processing the call asynchronously and have _not_
84103          //   called push() with new data. In this case we skip performing more
84104          //   read()s. The execution ends in this method again after the _read() ends
84105          //   up calling push() with more data.
84106          while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) {
84107            var len = state.length;
84108            debug('maybeReadMore read 0');
84109            stream.read(0);
84110            if (len === state.length) // didn't get any data, stop spinning.
84111              break;
84112          }
84113
84114          state.readingMore = false;
84115        } // abstract method.  to be overridden in specific implementation classes.
84116        // call cb(er, data) where data is <= n in length.
84117        // for virtual (non-string, non-buffer) streams, "length" is somewhat
84118        // arbitrary, and perhaps not very meaningful.
84119
84120
84121        Readable.prototype._read = function (n) {
84122          errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED('_read()'));
84123        };
84124
84125        Readable.prototype.pipe = function (dest, pipeOpts) {
84126          var src = this;
84127          var state = this._readableState;
84128
84129          switch (state.pipesCount) {
84130            case 0:
84131              state.pipes = dest;
84132              break;
84133
84134            case 1:
84135              state.pipes = [state.pipes, dest];
84136              break;
84137
84138            default:
84139              state.pipes.push(dest);
84140              break;
84141          }
84142
84143          state.pipesCount += 1;
84144          debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
84145          var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
84146          var endFn = doEnd ? onend : unpipe;
84147          if (state.endEmitted) process.nextTick(endFn);else src.once('end', endFn);
84148          dest.on('unpipe', onunpipe);
84149
84150          function onunpipe(readable, unpipeInfo) {
84151            debug('onunpipe');
84152
84153            if (readable === src) {
84154              if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
84155                unpipeInfo.hasUnpiped = true;
84156                cleanup();
84157              }
84158            }
84159          }
84160
84161          function onend() {
84162            debug('onend');
84163            dest.end();
84164          } // when the dest drains, it reduces the awaitDrain counter
84165          // on the source.  This would be more elegant with a .once()
84166          // handler in flow(), but adding and removing repeatedly is
84167          // too slow.
84168
84169
84170          var ondrain = pipeOnDrain(src);
84171          dest.on('drain', ondrain);
84172          var cleanedUp = false;
84173
84174          function cleanup() {
84175            debug('cleanup'); // cleanup event handlers once the pipe is broken
84176
84177            dest.removeListener('close', onclose);
84178            dest.removeListener('finish', onfinish);
84179            dest.removeListener('drain', ondrain);
84180            dest.removeListener('error', onerror);
84181            dest.removeListener('unpipe', onunpipe);
84182            src.removeListener('end', onend);
84183            src.removeListener('end', unpipe);
84184            src.removeListener('data', ondata);
84185            cleanedUp = true; // if the reader is waiting for a drain event from this
84186            // specific writer, then it would cause it to never start
84187            // flowing again.
84188            // So, if this is awaiting a drain, then we just call it now.
84189            // If we don't know, then assume that we are waiting for one.
84190
84191            if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
84192          }
84193
84194          src.on('data', ondata);
84195
84196          function ondata(chunk) {
84197            debug('ondata');
84198            var ret = dest.write(chunk);
84199            debug('dest.write', ret);
84200
84201            if (ret === false) {
84202              // If the user unpiped during `dest.write()`, it is possible
84203              // to get stuck in a permanently paused state if that write
84204              // also returned false.
84205              // => Check whether `dest` is still a piping destination.
84206              if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
84207                debug('false write response, pause', state.awaitDrain);
84208                state.awaitDrain++;
84209              }
84210
84211              src.pause();
84212            }
84213          } // if the dest has an error, then stop piping into it.
84214          // however, don't suppress the throwing behavior for this.
84215
84216
84217          function onerror(er) {
84218            debug('onerror', er);
84219            unpipe();
84220            dest.removeListener('error', onerror);
84221            if (EElistenerCount(dest, 'error') === 0) errorOrDestroy(dest, er);
84222          } // Make sure our error handler is attached before userland ones.
84223
84224
84225          prependListener(dest, 'error', onerror); // Both close and finish should trigger unpipe, but only once.
84226
84227          function onclose() {
84228            dest.removeListener('finish', onfinish);
84229            unpipe();
84230          }
84231
84232          dest.once('close', onclose);
84233
84234          function onfinish() {
84235            debug('onfinish');
84236            dest.removeListener('close', onclose);
84237            unpipe();
84238          }
84239
84240          dest.once('finish', onfinish);
84241
84242          function unpipe() {
84243            debug('unpipe');
84244            src.unpipe(dest);
84245          } // tell the dest that it's being piped to
84246
84247
84248          dest.emit('pipe', src); // start the flow if it hasn't been started already.
84249
84250          if (!state.flowing) {
84251            debug('pipe resume');
84252            src.resume();
84253          }
84254
84255          return dest;
84256        };
84257
84258        function pipeOnDrain(src) {
84259          return function pipeOnDrainFunctionResult() {
84260            var state = src._readableState;
84261            debug('pipeOnDrain', state.awaitDrain);
84262            if (state.awaitDrain) state.awaitDrain--;
84263
vendor: 5,518 bytes, lines 84264-84415
84264            if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
84265              state.flowing = true;
84266              flow(src);
84267            }
84268          };
84269        }
84270
84271        Readable.prototype.unpipe = function (dest) {
84272          var state = this._readableState;
84273          var unpipeInfo = {
84274            hasUnpiped: false
84275          }; // if we're not piping anywhere, then do nothing.
84276
84277          if (state.pipesCount === 0) return this; // just one destination.  most common case.
84278
84279          if (state.pipesCount === 1) {
84280            // passed in one, but it's not the right one.
84281            if (dest && dest !== state.pipes) return this;
84282            if (!dest) dest = state.pipes; // got a match.
84283
84284            state.pipes = null;
84285            state.pipesCount = 0;
84286            state.flowing = false;
84287            if (dest) dest.emit('unpipe', this, unpipeInfo);
84288            return this;
84289          } // slow case. multiple pipe destinations.
84290
84291
84292          if (!dest) {
84293            // remove all.
84294            var dests = state.pipes;
84295            var len = state.pipesCount;
84296            state.pipes = null;
84297            state.pipesCount = 0;
84298            state.flowing = false;
84299
84300            for (var i = 0; i < len; i++) {
84301              dests[i].emit('unpipe', this, {
84302                hasUnpiped: false
84303              });
84304            }
84305
84306            return this;
84307          } // try to find the right one.
84308
84309
84310          var index = indexOf(state.pipes, dest);
84311          if (index === -1) return this;
84312          state.pipes.splice(index, 1);
84313          state.pipesCount -= 1;
84314          if (state.pipesCount === 1) state.pipes = state.pipes[0];
84315          dest.emit('unpipe', this, unpipeInfo);
84316          return this;
84317        }; // set up data events if they are asked for
84318        // Ensure readable listeners eventually get something
84319
84320
84321        Readable.prototype.on = function (ev, fn) {
84322          var res = Stream.prototype.on.call(this, ev, fn);
84323          var state = this._readableState;
84324
84325          if (ev === 'data') {
84326            // update readableListening so that resume() may be a no-op
84327            // a few lines down. This is needed to support once('readable').
84328            state.readableListening = this.listenerCount('readable') > 0; // Try start flowing on next tick if stream isn't explicitly paused
84329
84330            if (state.flowing !== false) this.resume();
84331          } else if (ev === 'readable') {
84332            if (!state.endEmitted && !state.readableListening) {
84333              state.readableListening = state.needReadable = true;
84334              state.flowing = false;
84335              state.emittedReadable = false;
84336              debug('on readable', state.length, state.reading);
84337
84338              if (state.length) {
84339                emitReadable(this);
84340              } else if (!state.reading) {
84341                process.nextTick(nReadingNextTick, this);
84342              }
84343            }
84344          }
84345
84346          return res;
84347        };
84348
84349        Readable.prototype.addListener = Readable.prototype.on;
84350
84351        Readable.prototype.removeListener = function (ev, fn) {
84352          var res = Stream.prototype.removeListener.call(this, ev, fn);
84353
84354          if (ev === 'readable') {
84355            // We need to check if there is someone still listening to
84356            // readable and reset the state. However this needs to happen
84357            // after readable has been emitted but before I/O (nextTick) to
84358            // support once('readable', fn) cycles. This means that calling
84359            // resume within the same tick will have no
84360            // effect.
84361            process.nextTick(updateReadableListening, this);
84362          }
84363
84364          return res;
84365        };
84366
84367        Readable.prototype.removeAllListeners = function (ev) {
84368          var res = Stream.prototype.removeAllListeners.apply(this, arguments);
84369
84370          if (ev === 'readable' || ev === undefined) {
84371            // We need to check if there is someone still listening to
84372            // readable and reset the state. However this needs to happen
84373            // after readable has been emitted but before I/O (nextTick) to
84374            // support once('readable', fn) cycles. This means that calling
84375            // resume within the same tick will have no
84376            // effect.
84377            process.nextTick(updateReadableListening, this);
84378          }
84379
84380          return res;
84381        };
84382
84383        function updateReadableListening(self) {
84384          var state = self._readableState;
84385          state.readableListening = self.listenerCount('readable') > 0;
84386
84387          if (state.resumeScheduled && !state.paused) {
84388            // flowing needs to be set to true now, otherwise
84389            // the upcoming resume will not flow.
84390            state.flowing = true; // crude way to check if we should resume
84391          } else if (self.listenerCount('data') > 0) {
84392            self.resume();
84393          }
84394        }
84395
84396        function nReadingNextTick(self) {
84397          debug('readable nexttick read 0');
84398          self.read(0);
84399        } // pause() and resume() are remnants of the legacy readable stream API
84400        // If the user uses them, then switch into old mode.
84401
84402
84403        Readable.prototype.resume = function () {
84404          var state = this._readableState;
84405
84406          if (!state.flowing) {
84407            debug('resume'); // we flow only if there is no one listening
84408            // for readable, but we still have to call
84409            // resume()
84410
84411            state.flowing = !state.readableListening;
84412            resume(this, state);
84413          }
84414
84415          state.paused = false;
vendor: 6,777 bytes, lines 84416-84610
84416          return this;
84417        };
84418
84419        function resume(stream, state) {
84420          if (!state.resumeScheduled) {
84421            state.resumeScheduled = true;
84422            process.nextTick(resume_, stream, state);
84423          }
84424        }
84425
84426        function resume_(stream, state) {
84427          debug('resume', state.reading);
84428
84429          if (!state.reading) {
84430            stream.read(0);
84431          }
84432
84433          state.resumeScheduled = false;
84434          stream.emit('resume');
84435          flow(stream);
84436          if (state.flowing && !state.reading) stream.read(0);
84437        }
84438
84439        Readable.prototype.pause = function () {
84440          debug('call pause flowing=%j', this._readableState.flowing);
84441
84442          if (this._readableState.flowing !== false) {
84443            debug('pause');
84444            this._readableState.flowing = false;
84445            this.emit('pause');
84446          }
84447
84448          this._readableState.paused = true;
84449          return this;
84450        };
84451
84452        function flow(stream) {
84453          var state = stream._readableState;
84454          debug('flow', state.flowing);
84455
84456          while (state.flowing && stream.read() !== null) {
84457            ;
84458          }
84459        } // wrap an old-style stream as the async data source.
84460        // This is *not* part of the readable stream interface.
84461        // It is an ugly unfortunate mess of history.
84462
84463
84464        Readable.prototype.wrap = function (stream) {
84465          var _this = this;
84466
84467          var state = this._readableState;
84468          var paused = false;
84469          stream.on('end', function () {
84470            debug('wrapped end');
84471
84472            if (state.decoder && !state.ended) {
84473              var chunk = state.decoder.end();
84474              if (chunk && chunk.length) _this.push(chunk);
84475            }
84476
84477            _this.push(null);
84478          });
84479          stream.on('data', function (chunk) {
84480            debug('wrapped data');
84481            if (state.decoder) chunk = state.decoder.write(chunk); // don't skip over falsy values in objectMode
84482
84483            if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
84484
84485            var ret = _this.push(chunk);
84486
84487            if (!ret) {
84488              paused = true;
84489              stream.pause();
84490            }
84491          }); // proxy all the other methods.
84492          // important when wrapping filters and duplexes.
84493
84494          for (var i in stream) {
84495            if (this[i] === undefined && typeof stream[i] === 'function') {
84496              this[i] = function methodWrap(method) {
84497                return function methodWrapReturnFunction() {
84498                  return stream[method].apply(stream, arguments);
84499                };
84500              }(i);
84501            }
84502          } // proxy certain important events.
84503
84504
84505          for (var n = 0; n < kProxyEvents.length; n++) {
84506            stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
84507          } // when we try to consume some more bytes, simply unpause the
84508          // underlying stream.
84509
84510
84511          this._read = function (n) {
84512            debug('wrapped _read', n);
84513
84514            if (paused) {
84515              paused = false;
84516              stream.resume();
84517            }
84518          };
84519
84520          return this;
84521        };
84522
84523        if (typeof Symbol === 'function') {
84524          Readable.prototype[Symbol.asyncIterator] = function () {
84525            if (createReadableStreamAsyncIterator === undefined) {
84526              createReadableStreamAsyncIterator = require('./internal/streams/async_iterator');
84527            }
84528
84529            return createReadableStreamAsyncIterator(this);
84530          };
84531        }
84532
84533        Object.defineProperty(Readable.prototype, 'readableHighWaterMark', {
84534          // making it explicit this property is not enumerable
84535          // because otherwise some prototype manipulation in
84536          // userland will fail
84537          enumerable: false,
84538          get: function get() {
84539            return this._readableState.highWaterMark;
84540          }
84541        });
84542        Object.defineProperty(Readable.prototype, 'readableBuffer', {
84543          // making it explicit this property is not enumerable
84544          // because otherwise some prototype manipulation in
84545          // userland will fail
84546          enumerable: false,
84547          get: function get() {
84548            return this._readableState && this._readableState.buffer;
84549          }
84550        });
84551        Object.defineProperty(Readable.prototype, 'readableFlowing', {
84552          // making it explicit this property is not enumerable
84553          // because otherwise some prototype manipulation in
84554          // userland will fail
84555          enumerable: false,
84556          get: function get() {
84557            return this._readableState.flowing;
84558          },
84559          set: function set(state) {
84560            if (this._readableState) {
84561              this._readableState.flowing = state;
84562            }
84563          }
84564        }); // exposed for testing purposes only.
84565
84566        Readable._fromList = fromList;
84567        Object.defineProperty(Readable.prototype, 'readableLength', {
84568          // making it explicit this property is not enumerable
84569          // because otherwise some prototype manipulation in
84570          // userland will fail
84571          enumerable: false,
84572          get: function get() {
84573            return this._readableState.length;
84574          }
84575        }); // Pluck off n bytes from an array of buffers.
84576        // Length is the combined lengths of all the buffers in the list.
84577        // This function is designed to be inlinable, so please take care when making
84578        // changes to the function body.
84579
84580        function fromList(n, state) {
84581          // nothing buffered
84582          if (state.length === 0) return null;
84583          var ret;
84584          if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
84585            // read it all, truncate the list
84586            if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.first();else ret = state.buffer.concat(state.length);
84587            state.buffer.clear();
84588          } else {
84589            // read part of list
84590            ret = state.buffer.consume(n, state.decoder);
84591          }
84592          return ret;
84593        }
84594
84595        function endReadable(stream) {
84596          var state = stream._readableState;
84597          debug('endReadable', state.endEmitted);
84598
84599          if (!state.endEmitted) {
84600            state.ended = true;
84601            process.nextTick(endReadableNT, state, stream);
84602          }
84603        }
84604
84605        function endReadableNT(state, stream) {
84606          debug('endReadableNT', state.endEmitted, state.length); // Check that we didn't get one last unshift.
84607
84608          if (!state.endEmitted && state.length === 0) {
84609            state.endEmitted = true;
84610            stream.readable = false;
vendor: 5,501 bytes, lines 84611-84725
84611            stream.emit('end');
84612
84613            if (state.autoDestroy) {
84614              // In case of duplex streams we need a way to detect
84615              // if the writable side is ready for autoDestroy as well
84616              var wState = stream._writableState;
84617
84618              if (!wState || wState.autoDestroy && wState.finished) {
84619                stream.destroy();
84620              }
84621            }
84622          }
84623        }
84624
84625        if (typeof Symbol === 'function') {
84626          Readable.from = function (iterable, opts) {
84627            if (from === undefined) {
84628              from = require('./internal/streams/from');
84629            }
84630
84631            return from(Readable, iterable, opts);
84632          };
84633        }
84634
84635        function indexOf(xs, x) {
84636          for (var i = 0, l = xs.length; i < l; i++) {
84637            if (xs[i] === x) return i;
84638          }
84639
84640          return -1;
84641        }
84642      }).call(this, require('_process'), typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
84643    }, {
84644      "../errors": 453,
84645      "./_stream_duplex": 454,
84646      "./internal/streams/async_iterator": 459,
84647      "./internal/streams/buffer_list": 460,
84648      "./internal/streams/destroy": 461,
84649      "./internal/streams/from": 463,
84650      "./internal/streams/state": 465,
84651      "./internal/streams/stream": 466,
84652      "_process": 443,
84653      "buffer": 214,
84654      "events": 344,
84655      "inherits": 364,
84656      "string_decoder/": 495,
84657      "util": 183
84658    }],
84659    457: [function (require, module, exports) {
84660      // Copyright Joyent, Inc. and other Node contributors.
84661      //
84662      // Permission is hereby granted, free of charge, to any person obtaining a
84663      // copy of this software and associated documentation files (the
84664      // "Software"), to deal in the Software without restriction, including
84665      // without limitation the rights to use, copy, modify, merge, publish,
84666      // distribute, sublicense, and/or sell copies of the Software, and to permit
84667      // persons to whom the Software is furnished to do so, subject to the
84668      // following conditions:
84669      //
84670      // The above copyright notice and this permission notice shall be included
84671      // in all copies or substantial portions of the Software.
84672      //
84673      // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
84674      // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
84675      // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
84676      // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
84677      // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
84678      // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
84679      // USE OR OTHER DEALINGS IN THE SOFTWARE.
84680      // a transform stream is a readable/writable stream where you do
84681      // something with the data.  Sometimes it's called a "filter",
84682      // but that's not a great name for it, since that implies a thing where
84683      // some bits pass through, and others are simply ignored.  (That would
84684      // be a valid example of a transform, of course.)
84685      //
84686      // While the output is causally related to the input, it's not a
84687      // necessarily symmetric or synchronous transformation.  For example,
84688      // a zlib stream might take multiple plain-text writes(), and then
84689      // emit a single compressed chunk some time in the future.
84690      //
84691      // Here's how this works:
84692      //
84693      // The Transform stream has all the aspects of the readable and writable
84694      // stream classes.  When you write(chunk), that calls _write(chunk,cb)
84695      // internally, and returns false if there's a lot of pending writes
84696      // buffered up.  When you call read(), that calls _read(n) until
84697      // there's enough pending readable data buffered up.
84698      //
84699      // In a transform stream, the written data is placed in a buffer.  When
84700      // _read(n) is called, it transforms the queued up data, calling the
84701      // buffered _write cb's as it consumes chunks.  If consuming a single
84702      // written chunk would result in multiple output chunks, then the first
84703      // outputted bit calls the readcb, and subsequent chunks just go into
84704      // the read buffer, and will cause it to emit 'readable' if necessary.
84705      //
84706      // This way, back-pressure is actually determined by the reading side,
84707      // since _read has to be called to start processing a new chunk.  However,
84708      // a pathological inflate type of transform can cause excessive buffering
84709      // here.  For example, imagine a stream where every byte of input is
84710      // interpreted as an integer from 0-255, and then results in that many
84711      // bytes of output.  Writing the 4 bytes {ff,ff,ff,ff} would result in
84712      // 1kb of data being output.  In this case, you could write a very small
84713      // amount of input, and end up with a very large amount of output.  In
84714      // such a pathological inflating mechanism, there'd be no way to tell
84715      // the system to stop doing the transform.  A single 4MB write could
84716      // cause the system to run out of memory.
84717      //
84718      // However, even in such a pathological case, only a single written chunk
84719      // would be consumed, and then the rest would wait (un-transformed) until
84720      // the results of the previous transformed chunk were consumed.
84721      'use strict';
84722
84723      module.exports = Transform;
84724
84725      var _require$codes = require('../errors').codes,
vendor: 4,806 bytes, lines 84726-84856
84726          ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
84727          ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,
84728          ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING,
84729          ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;
84730
84731      var Duplex = require('./_stream_duplex');
84732
84733      require('inherits')(Transform, Duplex);
84734
84735      function afterTransform(er, data) {
84736        var ts = this._transformState;
84737        ts.transforming = false;
84738        var cb = ts.writecb;
84739
84740        if (cb === null) {
84741          return this.emit('error', new ERR_MULTIPLE_CALLBACK());
84742        }
84743
84744        ts.writechunk = null;
84745        ts.writecb = null;
84746        if (data != null) // single equals check for both `null` and `undefined`
84747          this.push(data);
84748        cb(er);
84749        var rs = this._readableState;
84750        rs.reading = false;
84751
84752        if (rs.needReadable || rs.length < rs.highWaterMark) {
84753          this._read(rs.highWaterMark);
84754        }
84755      }
84756
84757      function Transform(options) {
84758        if (!(this instanceof Transform)) return new Transform(options);
84759        Duplex.call(this, options);
84760        this._transformState = {
84761          afterTransform: afterTransform.bind(this),
84762          needTransform: false,
84763          transforming: false,
84764          writecb: null,
84765          writechunk: null,
84766          writeencoding: null
84767        }; // start out asking for a readable event once data is transformed.
84768
84769        this._readableState.needReadable = true; // we have implemented the _read method, and done the other things
84770        // that Readable wants before the first _read call, so unset the
84771        // sync guard flag.
84772
84773        this._readableState.sync = false;
84774
84775        if (options) {
84776          if (typeof options.transform === 'function') this._transform = options.transform;
84777          if (typeof options.flush === 'function') this._flush = options.flush;
84778        } // When the writable side finishes, then flush out anything remaining.
84779
84780
84781        this.on('prefinish', prefinish);
84782      }
84783
84784      function prefinish() {
84785        var _this = this;
84786
84787        if (typeof this._flush === 'function' && !this._readableState.destroyed) {
84788          this._flush(function (er, data) {
84789            done(_this, er, data);
84790          });
84791        } else {
84792          done(this, null, null);
84793        }
84794      }
84795
84796      Transform.prototype.push = function (chunk, encoding) {
84797        this._transformState.needTransform = false;
84798        return Duplex.prototype.push.call(this, chunk, encoding);
84799      }; // This is the part where you do stuff!
84800      // override this function in implementation classes.
84801      // 'chunk' is an input chunk.
84802      //
84803      // Call `push(newChunk)` to pass along transformed output
84804      // to the readable side.  You may call 'push' zero or more times.
84805      //
84806      // Call `cb(err)` when you are done with this chunk.  If you pass
84807      // an error, then that'll put the hurt on the whole operation.  If you
84808      // never call cb(), then you'll never get another chunk.
84809
84810
84811      Transform.prototype._transform = function (chunk, encoding, cb) {
84812        cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()'));
84813      };
84814
84815      Transform.prototype._write = function (chunk, encoding, cb) {
84816        var ts = this._transformState;
84817        ts.writecb = cb;
84818        ts.writechunk = chunk;
84819        ts.writeencoding = encoding;
84820
84821        if (!ts.transforming) {
84822          var rs = this._readableState;
84823          if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
84824        }
84825      }; // Doesn't matter what the args are here.
84826      // _transform does all the work.
84827      // That we got here means that the readable side wants more data.
84828
84829
84830      Transform.prototype._read = function (n) {
84831        var ts = this._transformState;
84832
84833        if (ts.writechunk !== null && !ts.transforming) {
84834          ts.transforming = true;
84835
84836          this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
84837        } else {
84838          // mark that we need a transform, so that any data that comes in
84839          // will get processed, now that we've asked for it.
84840          ts.needTransform = true;
84841        }
84842      };
84843
84844      Transform.prototype._destroy = function (err, cb) {
84845        Duplex.prototype._destroy.call(this, err, function (err2) {
84846          cb(err2);
84847        });
84848      };
84849
84850      function done(stream, er, data) {
84851        if (er) return stream.emit('error', er);
84852        if (data != null) // single equals check for both `null` and `undefined`
84853          stream.push(data); // TODO(BridgeAR): Write a test for these two error cases
84854        // if there's nothing in the write buffer, then that means
84855        // that nothing more will ever be provided
84856
vendor: 6,620 bytes, lines 84857-85015
84857        if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0();
84858        if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();
84859        return stream.push(null);
84860      }
84861    }, {
84862      "../errors": 453,
84863      "./_stream_duplex": 454,
84864      "inherits": 364
84865    }],
84866    458: [function (require, module, exports) {
84867      (function (process, global) {
84868        // Copyright Joyent, Inc. and other Node contributors.
84869        //
84870        // Permission is hereby granted, free of charge, to any person obtaining a
84871        // copy of this software and associated documentation files (the
84872        // "Software"), to deal in the Software without restriction, including
84873        // without limitation the rights to use, copy, modify, merge, publish,
84874        // distribute, sublicense, and/or sell copies of the Software, and to permit
84875        // persons to whom the Software is furnished to do so, subject to the
84876        // following conditions:
84877        //
84878        // The above copyright notice and this permission notice shall be included
84879        // in all copies or substantial portions of the Software.
84880        //
84881        // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
84882        // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
84883        // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
84884        // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
84885        // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
84886        // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
84887        // USE OR OTHER DEALINGS IN THE SOFTWARE.
84888        // A bit simpler than readable streams.
84889        // Implement an async ._write(chunk, encoding, cb), and it'll handle all
84890        // the drain event emission and buffering.
84891        'use strict';
84892
84893        module.exports = Writable;
84894        /* <replacement> */
84895
84896        function WriteReq(chunk, encoding, cb) {
84897          this.chunk = chunk;
84898          this.encoding = encoding;
84899          this.callback = cb;
84900          this.next = null;
84901        } // It seems a linked list but it is not
84902        // there will be only 2 of these for each stream
84903
84904
84905        function CorkedRequest(state) {
84906          var _this = this;
84907
84908          this.next = null;
84909          this.entry = null;
84910
84911          this.finish = function () {
84912            onCorkedFinish(_this, state);
84913          };
84914        }
84915        /* </replacement> */
84916
84917        /*<replacement>*/
84918
84919
84920        var Duplex;
84921        /*</replacement>*/
84922
84923        Writable.WritableState = WritableState;
84924        /*<replacement>*/
84925
84926        var internalUtil = {
84927          deprecate: require('util-deprecate')
84928        };
84929        /*</replacement>*/
84930
84931        /*<replacement>*/
84932
84933        var Stream = require('./internal/streams/stream');
84934        /*</replacement>*/
84935
84936
84937        var Buffer = require('buffer').Buffer;
84938
84939        var OurUint8Array = global.Uint8Array || function () {};
84940
84941        function _uint8ArrayToBuffer(chunk) {
84942          return Buffer.from(chunk);
84943        }
84944
84945        function _isUint8Array(obj) {
84946          return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
84947        }
84948
84949        var destroyImpl = require('./internal/streams/destroy');
84950
84951        var _require = require('./internal/streams/state'),
84952            getHighWaterMark = _require.getHighWaterMark;
84953
84954        var _require$codes = require('../errors').codes,
84955            ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
84956            ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
84957            ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,
84958            ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE,
84959            ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED,
84960            ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES,
84961            ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END,
84962            ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING;
84963
84964        var errorOrDestroy = destroyImpl.errorOrDestroy;
84965
84966        require('inherits')(Writable, Stream);
84967
84968        function nop() {}
84969
84970        function WritableState(options, stream, isDuplex) {
84971          Duplex = Duplex || require('./_stream_duplex');
84972          options = options || {}; // Duplex streams are both readable and writable, but share
84973          // the same options object.
84974          // However, some cases require setting options to different
84975          // values for the readable and the writable sides of the duplex stream,
84976          // e.g. options.readableObjectMode vs. options.writableObjectMode, etc.
84977
84978          if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag to indicate whether or not this stream
84979          // contains buffers or objects.
84980
84981          this.objectMode = !!options.objectMode;
84982          if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; // the point at which write() starts returning false
84983          // Note: 0 is a valid value, means that we always return false if
84984          // the entire buffer is not flushed immediately on write()
84985
84986          this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex); // if _final has been called
84987
84988          this.finalCalled = false; // drain event flag.
84989
84990          this.needDrain = false; // at the start of calling end()
84991
84992          this.ending = false; // when end() has been called, and returned
84993
84994          this.ended = false; // when 'finish' is emitted
84995
84996          this.finished = false; // has it been destroyed
84997
84998          this.destroyed = false; // should we decode strings into buffers before passing to _write?
84999          // this is here so that some node-core streams can optimize string
85000          // handling at a lower level.
85001
85002          var noDecode = options.decodeStrings === false;
85003          this.decodeStrings = !noDecode; // Crypto is kind of old and crusty.  Historically, its default string
85004          // encoding is 'binary' so we have to make this configurable.
85005          // Everything else in the universe uses 'utf8', though.
85006
85007          this.defaultEncoding = options.defaultEncoding || 'utf8'; // not an actual buffer we keep track of, but a measurement
85008          // of how much we're waiting to get pushed to some underlying
85009          // socket or file.
85010
85011          this.length = 0; // a flag to see when we're in the middle of a write.
85012
85013          this.writing = false; // when true all writes will be buffered until .uncork() call
85014
85015          this.corked = 0;
vendor: 15,366 bytes, lines 85015-85409
85015 // a flag to be able to tell if the onwrite cb is called immediately,
85016          // or on a later tick.  We set this to true at first, because any
85017          // actions that shouldn't happen until "later" should generally also
85018          // not happen before the first write call.
85019
85020          this.sync = true; // a flag to know if we're processing previously buffered items, which
85021          // may call the _write() callback in the same tick, so that we don't
85022          // end up in an overlapped onwrite situation.
85023
85024          this.bufferProcessing = false; // the callback that's passed to _write(chunk,cb)
85025
85026          this.onwrite = function (er) {
85027            onwrite(stream, er);
85028          }; // the callback that the user supplies to write(chunk,encoding,cb)
85029
85030
85031          this.writecb = null; // the amount that is being written when _write is called.
85032
85033          this.writelen = 0;
85034          this.bufferedRequest = null;
85035          this.lastBufferedRequest = null; // number of pending user-supplied write callbacks
85036          // this must be 0 before 'finish' can be emitted
85037
85038          this.pendingcb = 0; // emit prefinish if the only thing we're waiting for is _write cbs
85039          // This is relevant for synchronous Transform streams
85040
85041          this.prefinished = false; // True if the error was already emitted and should not be thrown again
85042
85043          this.errorEmitted = false; // Should close be emitted on destroy. Defaults to true.
85044
85045          this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'finish' (and potentially 'end')
85046
85047          this.autoDestroy = !!options.autoDestroy; // count buffered requests
85048
85049          this.bufferedRequestCount = 0; // allocate the first CorkedRequest, there is always
85050          // one allocated and free to use, and we maintain at most two
85051
85052          this.corkedRequestsFree = new CorkedRequest(this);
85053        }
85054
85055        WritableState.prototype.getBuffer = function getBuffer() {
85056          var current = this.bufferedRequest;
85057          var out = [];
85058
85059          while (current) {
85060            out.push(current);
85061            current = current.next;
85062          }
85063
85064          return out;
85065        };
85066
85067        (function () {
85068          try {
85069            Object.defineProperty(WritableState.prototype, 'buffer', {
85070              get: internalUtil.deprecate(function writableStateBufferGetter() {
85071                return this.getBuffer();
85072              }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')
85073            });
85074          } catch (_) {}
85075        })(); // Test _writableState for inheritance to account for Duplex streams,
85076        // whose prototype chain only points to Readable.
85077
85078
85079        var realHasInstance;
85080
85081        if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {
85082          realHasInstance = Function.prototype[Symbol.hasInstance];
85083          Object.defineProperty(Writable, Symbol.hasInstance, {
85084            value: function value(object) {
85085              if (realHasInstance.call(this, object)) return true;
85086              if (this !== Writable) return false;
85087              return object && object._writableState instanceof WritableState;
85088            }
85089          });
85090        } else {
85091          realHasInstance = function realHasInstance(object) {
85092            return object instanceof this;
85093          };
85094        }
85095
85096        function Writable(options) {
85097          Duplex = Duplex || require('./_stream_duplex'); // Writable ctor is applied to Duplexes, too.
85098          // `realHasInstance` is necessary because using plain `instanceof`
85099          // would return false, as no `_writableState` property is attached.
85100          // Trying to use the custom `instanceof` for Writable here will also break the
85101          // Node.js LazyTransform implementation, which has a non-trivial getter for
85102          // `_writableState` that would lead to infinite recursion.
85103          // Checking for a Stream.Duplex instance is faster here instead of inside
85104          // the WritableState constructor, at least with V8 6.5
85105
85106          var isDuplex = this instanceof Duplex;
85107          if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options);
85108          this._writableState = new WritableState(options, this, isDuplex); // legacy.
85109
85110          this.writable = true;
85111
85112          if (options) {
85113            if (typeof options.write === 'function') this._write = options.write;
85114            if (typeof options.writev === 'function') this._writev = options.writev;
85115            if (typeof options.destroy === 'function') this._destroy = options.destroy;
85116            if (typeof options.final === 'function') this._final = options.final;
85117          }
85118
85119          Stream.call(this);
85120        } // Otherwise people can pipe Writable streams, which is just wrong.
85121
85122
85123        Writable.prototype.pipe = function () {
85124          errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE());
85125        };
85126
85127        function writeAfterEnd(stream, cb) {
85128          var er = new ERR_STREAM_WRITE_AFTER_END(); // TODO: defer error events consistently everywhere, not just the cb
85129
85130          errorOrDestroy(stream, er);
85131          process.nextTick(cb, er);
85132        } // Checks that a user-supplied chunk is valid, especially for the particular
85133        // mode the stream is in. Currently this means that `null` is never accepted
85134        // and undefined/non-string values are only allowed in object mode.
85135
85136
85137        function validChunk(stream, state, chunk, cb) {
85138          var er;
85139
85140          if (chunk === null) {
85141            er = new ERR_STREAM_NULL_VALUES();
85142          } else if (typeof chunk !== 'string' && !state.objectMode) {
85143            er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk);
85144          }
85145
85146          if (er) {
85147            errorOrDestroy(stream, er);
85148            process.nextTick(cb, er);
85149            return false;
85150          }
85151
85152          return true;
85153        }
85154
85155        Writable.prototype.write = function (chunk, encoding, cb) {
85156          var state = this._writableState;
85157          var ret = false;
85158
85159          var isBuf = !state.objectMode && _isUint8Array(chunk);
85160
85161          if (isBuf && !Buffer.isBuffer(chunk)) {
85162            chunk = _uint8ArrayToBuffer(chunk);
85163          }
85164
85165          if (typeof encoding === 'function') {
85166            cb = encoding;
85167            encoding = null;
85168          }
85169
85170          if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
85171          if (typeof cb !== 'function') cb = nop;
85172          if (state.ending) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {
85173            state.pendingcb++;
85174            ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
85175          }
85176          return ret;
85177        };
85178
85179        Writable.prototype.cork = function () {
85180          this._writableState.corked++;
85181        };
85182
85183        Writable.prototype.uncork = function () {
85184          var state = this._writableState;
85185
85186          if (state.corked) {
85187            state.corked--;
85188            if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
85189          }
85190        };
85191
85192        Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
85193          // node::ParseEncoding() requires lower case.
85194          if (typeof encoding === 'string') encoding = encoding.toLowerCase();
85195          if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new ERR_UNKNOWN_ENCODING(encoding);
85196          this._writableState.defaultEncoding = encoding;
85197          return this;
85198        };
85199
85200        Object.defineProperty(Writable.prototype, 'writableBuffer', {
85201          // making it explicit this property is not enumerable
85202          // because otherwise some prototype manipulation in
85203          // userland will fail
85204          enumerable: false,
85205          get: function get() {
85206            return this._writableState && this._writableState.getBuffer();
85207          }
85208        });
85209
85210        function decodeChunk(state, chunk, encoding) {
85211          if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
85212            chunk = Buffer.from(chunk, encoding);
85213          }
85214
85215          return chunk;
85216        }
85217
85218        Object.defineProperty(Writable.prototype, 'writableHighWaterMark', {
85219          // making it explicit this property is not enumerable
85220          // because otherwise some prototype manipulation in
85221          // userland will fail
85222          enumerable: false,
85223          get: function get() {
85224            return this._writableState.highWaterMark;
85225          }
85226        }); // if we're already writing something, then just put this
85227        // in the queue, and wait our turn.  Otherwise, call _write
85228        // If we return false, then we need a drain event, so set that flag.
85229
85230        function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
85231          if (!isBuf) {
85232            var newChunk = decodeChunk(state, chunk, encoding);
85233
85234            if (chunk !== newChunk) {
85235              isBuf = true;
85236              encoding = 'buffer';
85237              chunk = newChunk;
85238            }
85239          }
85240
85241          var len = state.objectMode ? 1 : chunk.length;
85242          state.length += len;
85243          var ret = state.length < state.highWaterMark; // we must ensure that previous needDrain will not be reset to false.
85244
85245          if (!ret) state.needDrain = true;
85246
85247          if (state.writing || state.corked) {
85248            var last = state.lastBufferedRequest;
85249            state.lastBufferedRequest = {
85250              chunk: chunk,
85251              encoding: encoding,
85252              isBuf: isBuf,
85253              callback: cb,
85254              next: null
85255            };
85256
85257            if (last) {
85258              last.next = state.lastBufferedRequest;
85259            } else {
85260              state.bufferedRequest = state.lastBufferedRequest;
85261            }
85262
85263            state.bufferedRequestCount += 1;
85264          } else {
85265            doWrite(stream, state, false, len, chunk, encoding, cb);
85266          }
85267
85268          return ret;
85269        }
85270
85271        function doWrite(stream, state, writev, len, chunk, encoding, cb) {
85272          state.writelen = len;
85273          state.writecb = cb;
85274          state.writing = true;
85275          state.sync = true;
85276          if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
85277          state.sync = false;
85278        }
85279
85280        function onwriteError(stream, state, sync, er, cb) {
85281          --state.pendingcb;
85282
85283          if (sync) {
85284            // defer the callback if we are being called synchronously
85285            // to avoid piling up things on the stack
85286            process.nextTick(cb, er); // this can emit finish, and it will always happen
85287            // after error
85288
85289            process.nextTick(finishMaybe, stream, state);
85290            stream._writableState.errorEmitted = true;
85291            errorOrDestroy(stream, er);
85292          } else {
85293            // the caller expect this to happen before if
85294            // it is async
85295            cb(er);
85296            stream._writableState.errorEmitted = true;
85297            errorOrDestroy(stream, er); // this can emit finish, but finish must
85298            // always follow error
85299
85300            finishMaybe(stream, state);
85301          }
85302        }
85303
85304        function onwriteStateUpdate(state) {
85305          state.writing = false;
85306          state.writecb = null;
85307          state.length -= state.writelen;
85308          state.writelen = 0;
85309        }
85310
85311        function onwrite(stream, er) {
85312          var state = stream._writableState;
85313          var sync = state.sync;
85314          var cb = state.writecb;
85315          if (typeof cb !== 'function') throw new ERR_MULTIPLE_CALLBACK();
85316          onwriteStateUpdate(state);
85317          if (er) onwriteError(stream, state, sync, er, cb);else {
85318            // Check if we're actually ready to finish, but don't emit yet
85319            var finished = needFinish(state) || stream.destroyed;
85320
85321            if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
85322              clearBuffer(stream, state);
85323            }
85324
85325            if (sync) {
85326              process.nextTick(afterWrite, stream, state, finished, cb);
85327            } else {
85328              afterWrite(stream, state, finished, cb);
85329            }
85330          }
85331        }
85332
85333        function afterWrite(stream, state, finished, cb) {
85334          if (!finished) onwriteDrain(stream, state);
85335          state.pendingcb--;
85336          cb();
85337          finishMaybe(stream, state);
85338        } // Must force callback to be called on nextTick, so that we don't
85339        // emit 'drain' before the write() consumer gets the 'false' return
85340        // value, and has a chance to attach a 'drain' listener.
85341
85342
85343        function onwriteDrain(stream, state) {
85344          if (state.length === 0 && state.needDrain) {
85345            state.needDrain = false;
85346            stream.emit('drain');
85347          }
85348        } // if there's something in the buffer waiting, then process it
85349
85350
85351        function clearBuffer(stream, state) {
85352          state.bufferProcessing = true;
85353          var entry = state.bufferedRequest;
85354
85355          if (stream._writev && entry && entry.next) {
85356            // Fast case, write everything using _writev()
85357            var l = state.bufferedRequestCount;
85358            var buffer = new Array(l);
85359            var holder = state.corkedRequestsFree;
85360            holder.entry = entry;
85361            var count = 0;
85362            var allBuffers = true;
85363
85364            while (entry) {
85365              buffer[count] = entry;
85366              if (!entry.isBuf) allBuffers = false;
85367              entry = entry.next;
85368              count += 1;
85369            }
85370
85371            buffer.allBuffers = allBuffers;
85372            doWrite(stream, state, true, state.length, buffer, '', holder.finish); // doWrite is almost always async, defer these to save a bit of time
85373            // as the hot path ends with doWrite
85374
85375            state.pendingcb++;
85376            state.lastBufferedRequest = null;
85377
85378            if (holder.next) {
85379              state.corkedRequestsFree = holder.next;
85380              holder.next = null;
85381            } else {
85382              state.corkedRequestsFree = new CorkedRequest(state);
85383            }
85384
85385            state.bufferedRequestCount = 0;
85386          } else {
85387            // Slow case, write chunks one-by-one
85388            while (entry) {
85389              var chunk = entry.chunk;
85390              var encoding = entry.encoding;
85391              var cb = entry.callback;
85392              var len = state.objectMode ? 1 : chunk.length;
85393              doWrite(stream, state, false, len, chunk, encoding, cb);
85394              entry = entry.next;
85395              state.bufferedRequestCount--; // if we didn't call the onwrite immediately, then
85396              // it means that we need to wait until it does.
85397              // also, that means that the chunk and cb are currently
85398              // being processed, so move the buffer counter past them.
85399
85400              if (state.writing) {
85401                break;
85402              }
85403            }
85404
85405            if (entry === null) state.lastBufferedRequest = null;
85406          }
85407
85408          state.bufferedRequest = entry;
85409          state.bufferProcessing = false;
vendor: 4,794 bytes, lines 85410-85566
85410        }
85411
85412        Writable.prototype._write = function (chunk, encoding, cb) {
85413          cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()'));
85414        };
85415
85416        Writable.prototype._writev = null;
85417
85418        Writable.prototype.end = function (chunk, encoding, cb) {
85419          var state = this._writableState;
85420
85421          if (typeof chunk === 'function') {
85422            cb = chunk;
85423            chunk = null;
85424            encoding = null;
85425          } else if (typeof encoding === 'function') {
85426            cb = encoding;
85427            encoding = null;
85428          }
85429
85430          if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); // .end() fully uncorks
85431
85432          if (state.corked) {
85433            state.corked = 1;
85434            this.uncork();
85435          } // ignore unnecessary end() calls.
85436
85437
85438          if (!state.ending) endWritable(this, state, cb);
85439          return this;
85440        };
85441
85442        Object.defineProperty(Writable.prototype, 'writableLength', {
85443          // making it explicit this property is not enumerable
85444          // because otherwise some prototype manipulation in
85445          // userland will fail
85446          enumerable: false,
85447          get: function get() {
85448            return this._writableState.length;
85449          }
85450        });
85451
85452        function needFinish(state) {
85453          return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
85454        }
85455
85456        function callFinal(stream, state) {
85457          stream._final(function (err) {
85458            state.pendingcb--;
85459
85460            if (err) {
85461              errorOrDestroy(stream, err);
85462            }
85463
85464            state.prefinished = true;
85465            stream.emit('prefinish');
85466            finishMaybe(stream, state);
85467          });
85468        }
85469
85470        function prefinish(stream, state) {
85471          if (!state.prefinished && !state.finalCalled) {
85472            if (typeof stream._final === 'function' && !state.destroyed) {
85473              state.pendingcb++;
85474              state.finalCalled = true;
85475              process.nextTick(callFinal, stream, state);
85476            } else {
85477              state.prefinished = true;
85478              stream.emit('prefinish');
85479            }
85480          }
85481        }
85482
85483        function finishMaybe(stream, state) {
85484          var need = needFinish(state);
85485
85486          if (need) {
85487            prefinish(stream, state);
85488
85489            if (state.pendingcb === 0) {
85490              state.finished = true;
85491              stream.emit('finish');
85492
85493              if (state.autoDestroy) {
85494                // In case of duplex streams we need a way to detect
85495                // if the readable side is ready for autoDestroy as well
85496                var rState = stream._readableState;
85497
85498                if (!rState || rState.autoDestroy && rState.endEmitted) {
85499                  stream.destroy();
85500                }
85501              }
85502            }
85503          }
85504
85505          return need;
85506        }
85507
85508        function endWritable(stream, state, cb) {
85509          state.ending = true;
85510          finishMaybe(stream, state);
85511
85512          if (cb) {
85513            if (state.finished) process.nextTick(cb);else stream.once('finish', cb);
85514          }
85515
85516          state.ended = true;
85517          stream.writable = false;
85518        }
85519
85520        function onCorkedFinish(corkReq, state, err) {
85521          var entry = corkReq.entry;
85522          corkReq.entry = null;
85523
85524          while (entry) {
85525            var cb = entry.callback;
85526            state.pendingcb--;
85527            cb(err);
85528            entry = entry.next;
85529          } // reuse the free corkReq.
85530
85531
85532          state.corkedRequestsFree.next = corkReq;
85533        }
85534
85535        Object.defineProperty(Writable.prototype, 'destroyed', {
85536          // making it explicit this property is not enumerable
85537          // because otherwise some prototype manipulation in
85538          // userland will fail
85539          enumerable: false,
85540          get: function get() {
85541            if (this._writableState === undefined) {
85542              return false;
85543            }
85544
85545            return this._writableState.destroyed;
85546          },
85547          set: function set(value) {
85548            // we ignore the value if the stream
85549            // has not been initialized yet
85550            if (!this._writableState) {
85551              return;
85552            } // backward compatibility, the user is explicitly
85553            // managing destroyed
85554
85555
85556            this._writableState.destroyed = value;
85557          }
85558        });
85559        Writable.prototype.destroy = destroyImpl.destroy;
85560        Writable.prototype._undestroy = destroyImpl.undestroy;
85561
85562        Writable.prototype._destroy = function (err, cb) {
85563          cb(err);
85564        };
85565      }).call(this, require('_process'), typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
85566    }, {
vendor: 15,877 bytes, lines 85567-86072
85567      "../errors": 453,
85568      "./_stream_duplex": 454,
85569      "./internal/streams/destroy": 461,
85570      "./internal/streams/state": 465,
85571      "./internal/streams/stream": 466,
85572      "_process": 443,
85573      "buffer": 214,
85574      "inherits": 364,
85575      "util-deprecate": 497
85576    }],
85577    459: [function (require, module, exports) {
85578      (function (process) {
85579        'use strict';
85580
85581        var _Object$setPrototypeO;
85582
85583        function _defineProperty(obj, key, value) {
85584          if (key in obj) {
85585            Object.defineProperty(obj, key, {
85586              value: value,
85587              enumerable: true,
85588              configurable: true,
85589              writable: true
85590            });
85591          } else {
85592            obj[key] = value;
85593          }
85594
85595          return obj;
85596        }
85597
85598        var finished = require('./end-of-stream');
85599
85600        var kLastResolve = Symbol('lastResolve');
85601        var kLastReject = Symbol('lastReject');
85602        var kError = Symbol('error');
85603        var kEnded = Symbol('ended');
85604        var kLastPromise = Symbol('lastPromise');
85605        var kHandlePromise = Symbol('handlePromise');
85606        var kStream = Symbol('stream');
85607
85608        function createIterResult(value, done) {
85609          return {
85610            value: value,
85611            done: done
85612          };
85613        }
85614
85615        function readAndResolve(iter) {
85616          var resolve = iter[kLastResolve];
85617
85618          if (resolve !== null) {
85619            var data = iter[kStream].read(); // we defer if data is null
85620            // we can be expecting either 'end' or
85621            // 'error'
85622
85623            if (data !== null) {
85624              iter[kLastPromise] = null;
85625              iter[kLastResolve] = null;
85626              iter[kLastReject] = null;
85627              resolve(createIterResult(data, false));
85628            }
85629          }
85630        }
85631
85632        function onReadable(iter) {
85633          // we wait for the next tick, because it might
85634          // emit an error with process.nextTick
85635          process.nextTick(readAndResolve, iter);
85636        }
85637
85638        function wrapForNext(lastPromise, iter) {
85639          return function (resolve, reject) {
85640            lastPromise.then(function () {
85641              if (iter[kEnded]) {
85642                resolve(createIterResult(undefined, true));
85643                return;
85644              }
85645
85646              iter[kHandlePromise](resolve, reject);
85647            }, reject);
85648          };
85649        }
85650
85651        var AsyncIteratorPrototype = Object.getPrototypeOf(function () {});
85652        var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = {
85653          get stream() {
85654            return this[kStream];
85655          },
85656
85657          next: function next() {
85658            var _this = this; // if we have detected an error in the meanwhile
85659            // reject straight away
85660
85661
85662            var error = this[kError];
85663
85664            if (error !== null) {
85665              return Promise.reject(error);
85666            }
85667
85668            if (this[kEnded]) {
85669              return Promise.resolve(createIterResult(undefined, true));
85670            }
85671
85672            if (this[kStream].destroyed) {
85673              // We need to defer via nextTick because if .destroy(err) is
85674              // called, the error will be emitted via nextTick, and
85675              // we cannot guarantee that there is no error lingering around
85676              // waiting to be emitted.
85677              return new Promise(function (resolve, reject) {
85678                process.nextTick(function () {
85679                  if (_this[kError]) {
85680                    reject(_this[kError]);
85681                  } else {
85682                    resolve(createIterResult(undefined, true));
85683                  }
85684                });
85685              });
85686            } // if we have multiple next() calls
85687            // we will wait for the previous Promise to finish
85688            // this logic is optimized to support for await loops,
85689            // where next() is only called once at a time
85690
85691
85692            var lastPromise = this[kLastPromise];
85693            var promise;
85694
85695            if (lastPromise) {
85696              promise = new Promise(wrapForNext(lastPromise, this));
85697            } else {
85698              // fast path needed to support multiple this.push()
85699              // without triggering the next() queue
85700              var data = this[kStream].read();
85701
85702              if (data !== null) {
85703                return Promise.resolve(createIterResult(data, false));
85704              }
85705
85706              promise = new Promise(this[kHandlePromise]);
85707            }
85708
85709            this[kLastPromise] = promise;
85710            return promise;
85711          }
85712        }, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function () {
85713          return this;
85714        }), _defineProperty(_Object$setPrototypeO, "return", function _return() {
85715          var _this2 = this; // destroy(err, cb) is a private API
85716          // we can guarantee we have that here, because we control the
85717          // Readable class this is attached to
85718
85719
85720          return new Promise(function (resolve, reject) {
85721            _this2[kStream].destroy(null, function (err) {
85722              if (err) {
85723                reject(err);
85724                return;
85725              }
85726
85727              resolve(createIterResult(undefined, true));
85728            });
85729          });
85730        }), _Object$setPrototypeO), AsyncIteratorPrototype);
85731
85732        var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) {
85733          var _Object$create;
85734
85735          var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, {
85736            value: stream,
85737            writable: true
85738          }), _defineProperty(_Object$create, kLastResolve, {
85739            value: null,
85740            writable: true
85741          }), _defineProperty(_Object$create, kLastReject, {
85742            value: null,
85743            writable: true
85744          }), _defineProperty(_Object$create, kError, {
85745            value: null,
85746            writable: true
85747          }), _defineProperty(_Object$create, kEnded, {
85748            value: stream._readableState.endEmitted,
85749            writable: true
85750          }), _defineProperty(_Object$create, kHandlePromise, {
85751            value: function value(resolve, reject) {
85752              var data = iterator[kStream].read();
85753
85754              if (data) {
85755                iterator[kLastPromise] = null;
85756                iterator[kLastResolve] = null;
85757                iterator[kLastReject] = null;
85758                resolve(createIterResult(data, false));
85759              } else {
85760                iterator[kLastResolve] = resolve;
85761                iterator[kLastReject] = reject;
85762              }
85763            },
85764            writable: true
85765          }), _Object$create));
85766          iterator[kLastPromise] = null;
85767          finished(stream, function (err) {
85768            if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') {
85769              var reject = iterator[kLastReject]; // reject if we are waiting for data in the Promise
85770              // returned by next() and store the error
85771
85772              if (reject !== null) {
85773                iterator[kLastPromise] = null;
85774                iterator[kLastResolve] = null;
85775                iterator[kLastReject] = null;
85776                reject(err);
85777              }
85778
85779              iterator[kError] = err;
85780              return;
85781            }
85782
85783            var resolve = iterator[kLastResolve];
85784
85785            if (resolve !== null) {
85786              iterator[kLastPromise] = null;
85787              iterator[kLastResolve] = null;
85788              iterator[kLastReject] = null;
85789              resolve(createIterResult(undefined, true));
85790            }
85791
85792            iterator[kEnded] = true;
85793          });
85794          stream.on('readable', onReadable.bind(null, iterator));
85795          return iterator;
85796        };
85797
85798        module.exports = createReadableStreamAsyncIterator;
85799      }).call(this, require('_process'));
85800    }, {
85801      "./end-of-stream": 462,
85802      "_process": 443
85803    }],
85804    460: [function (require, module, exports) {
85805      'use strict';
85806
85807      function ownKeys(object, enumerableOnly) {
85808        var keys = Object.keys(object);
85809
85810        if (Object.getOwnPropertySymbols) {
85811          var symbols = Object.getOwnPropertySymbols(object);
85812          if (enumerableOnly) symbols = symbols.filter(function (sym) {
85813            return Object.getOwnPropertyDescriptor(object, sym).enumerable;
85814          });
85815          keys.push.apply(keys, symbols);
85816        }
85817
85818        return keys;
85819      }
85820
85821      function _objectSpread(target) {
85822        for (var i = 1; i < arguments.length; i++) {
85823          var source = arguments[i] != null ? arguments[i] : {};
85824
85825          if (i % 2) {
85826            ownKeys(Object(source), true).forEach(function (key) {
85827              _defineProperty(target, key, source[key]);
85828            });
85829          } else if (Object.getOwnPropertyDescriptors) {
85830            Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
85831          } else {
85832            ownKeys(Object(source)).forEach(function (key) {
85833              Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
85834            });
85835          }
85836        }
85837
85838        return target;
85839      }
85840
85841      function _defineProperty(obj, key, value) {
85842        if (key in obj) {
85843          Object.defineProperty(obj, key, {
85844            value: value,
85845            enumerable: true,
85846            configurable: true,
85847            writable: true
85848          });
85849        } else {
85850          obj[key] = value;
85851        }
85852
85853        return obj;
85854      }
85855
85856      function _classCallCheck(instance, Constructor) {
85857        if (!(instance instanceof Constructor)) {
85858          throw new TypeError("Cannot call a class as a function");
85859        }
85860      }
85861
85862      function _defineProperties(target, props) {
85863        for (var i = 0; i < props.length; i++) {
85864          var descriptor = props[i];
85865          descriptor.enumerable = descriptor.enumerable || false;
85866          descriptor.configurable = true;
85867          if ("value" in descriptor) descriptor.writable = true;
85868          Object.defineProperty(target, descriptor.key, descriptor);
85869        }
85870      }
85871
85872      function _createClass(Constructor, protoProps, staticProps) {
85873        if (protoProps) _defineProperties(Constructor.prototype, protoProps);
85874        if (staticProps) _defineProperties(Constructor, staticProps);
85875        return Constructor;
85876      }
85877
85878      var _require = require('buffer'),
85879          Buffer = _require.Buffer;
85880
85881      var _require2 = require('util'),
85882          inspect = _require2.inspect;
85883
85884      var custom = inspect && inspect.custom || 'inspect';
85885
85886      function copyBuffer(src, target, offset) {
85887        Buffer.prototype.copy.call(src, target, offset);
85888      }
85889
85890      module.exports = /*#__PURE__*/function () {
85891        function BufferList() {
85892          _classCallCheck(this, BufferList);
85893
85894          this.head = null;
85895          this.tail = null;
85896          this.length = 0;
85897        }
85898
85899        _createClass(BufferList, [{
85900          key: "push",
85901          value: function push(v) {
85902            var entry = {
85903              data: v,
85904              next: null
85905            };
85906            if (this.length > 0) this.tail.next = entry;else this.head = entry;
85907            this.tail = entry;
85908            ++this.length;
85909          }
85910        }, {
85911          key: "unshift",
85912          value: function unshift(v) {
85913            var entry = {
85914              data: v,
85915              next: this.head
85916            };
85917            if (this.length === 0) this.tail = entry;
85918            this.head = entry;
85919            ++this.length;
85920          }
85921        }, {
85922          key: "shift",
85923          value: function shift() {
85924            if (this.length === 0) return;
85925            var ret = this.head.data;
85926            if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
85927            --this.length;
85928            return ret;
85929          }
85930        }, {
85931          key: "clear",
85932          value: function clear() {
85933            this.head = this.tail = null;
85934            this.length = 0;
85935          }
85936        }, {
85937          key: "join",
85938          value: function join(s) {
85939            if (this.length === 0) return '';
85940            var p = this.head;
85941            var ret = '' + p.data;
85942
85943            while (p = p.next) {
85944              ret += s + p.data;
85945            }
85946
85947            return ret;
85948          }
85949        }, {
85950          key: "concat",
85951          value: function concat(n) {
85952            if (this.length === 0) return Buffer.alloc(0);
85953            var ret = Buffer.allocUnsafe(n >>> 0);
85954            var p = this.head;
85955            var i = 0;
85956
85957            while (p) {
85958              copyBuffer(p.data, ret, i);
85959              i += p.data.length;
85960              p = p.next;
85961            }
85962
85963            return ret;
85964          } // Consumes a specified amount of bytes or characters from the buffered data.
85965
85966        }, {
85967          key: "consume",
85968          value: function consume(n, hasStrings) {
85969            var ret;
85970
85971            if (n < this.head.data.length) {
85972              // `slice` is the same for buffers and strings.
85973              ret = this.head.data.slice(0, n);
85974              this.head.data = this.head.data.slice(n);
85975            } else if (n === this.head.data.length) {
85976              // First chunk is a perfect match.
85977              ret = this.shift();
85978            } else {
85979              // Result spans more than one buffer.
85980              ret = hasStrings ? this._getString(n) : this._getBuffer(n);
85981            }
85982
85983            return ret;
85984          }
85985        }, {
85986          key: "first",
85987          value: function first() {
85988            return this.head.data;
85989          } // Consumes a specified amount of characters from the buffered data.
85990
85991        }, {
85992          key: "_getString",
85993          value: function _getString(n) {
85994            var p = this.head;
85995            var c = 1;
85996            var ret = p.data;
85997            n -= ret.length;
85998
85999            while (p = p.next) {
86000              var str = p.data;
86001              var nb = n > str.length ? str.length : n;
86002              if (nb === str.length) ret += str;else ret += str.slice(0, n);
86003              n -= nb;
86004
86005              if (n === 0) {
86006                if (nb === str.length) {
86007                  ++c;
86008                  if (p.next) this.head = p.next;else this.head = this.tail = null;
86009                } else {
86010                  this.head = p;
86011                  p.data = str.slice(nb);
86012                }
86013
86014                break;
86015              }
86016
86017              ++c;
86018            }
86019
86020            this.length -= c;
86021            return ret;
86022          } // Consumes a specified amount of bytes from the buffered data.
86023
86024        }, {
86025          key: "_getBuffer",
86026          value: function _getBuffer(n) {
86027            var ret = Buffer.allocUnsafe(n);
86028            var p = this.head;
86029            var c = 1;
86030            p.data.copy(ret);
86031            n -= p.data.length;
86032
86033            while (p = p.next) {
86034              var buf = p.data;
86035              var nb = n > buf.length ? buf.length : n;
86036              buf.copy(ret, ret.length - n, 0, nb);
86037              n -= nb;
86038
86039              if (n === 0) {
86040                if (nb === buf.length) {
86041                  ++c;
86042                  if (p.next) this.head = p.next;else this.head = this.tail = null;
86043                } else {
86044                  this.head = p;
86045                  p.data = buf.slice(nb);
86046                }
86047
86048                break;
86049              }
86050
86051              ++c;
86052            }
86053
86054            this.length -= c;
86055            return ret;
86056          } // Make sure the linked list only shows the minimal necessary information.
86057
86058        }, {
86059          key: custom,
86060          value: function value(_, options) {
86061            return inspect(this, _objectSpread({}, options, {
86062              // Only inspect one level.
86063              depth: 0,
86064              // It should not recurse.
86065              customInspect: false
86066            }));
86067          }
86068        }]);
86069
86070        return BufferList;
86071      }();
86072    }, {
vendor: 8,889 bytes, lines 86073-86331
86073      "buffer": 214,
86074      "util": 183
86075    }],
86076    461: [function (require, module, exports) {
86077      (function (process) {
86078        'use strict'; // undocumented cb() API, needed for core, not for public API
86079
86080        function destroy(err, cb) {
86081          var _this = this;
86082
86083          var readableDestroyed = this._readableState && this._readableState.destroyed;
86084          var writableDestroyed = this._writableState && this._writableState.destroyed;
86085
86086          if (readableDestroyed || writableDestroyed) {
86087            if (cb) {
86088              cb(err);
86089            } else if (err) {
86090              if (!this._writableState) {
86091                process.nextTick(emitErrorNT, this, err);
86092              } else if (!this._writableState.errorEmitted) {
86093                this._writableState.errorEmitted = true;
86094                process.nextTick(emitErrorNT, this, err);
86095              }
86096            }
86097
86098            return this;
86099          } // we set destroyed to true before firing error callbacks in order
86100          // to make it re-entrance safe in case destroy() is called within callbacks
86101
86102
86103          if (this._readableState) {
86104            this._readableState.destroyed = true;
86105          } // if this is a duplex stream mark the writable part as destroyed as well
86106
86107
86108          if (this._writableState) {
86109            this._writableState.destroyed = true;
86110          }
86111
86112          this._destroy(err || null, function (err) {
86113            if (!cb && err) {
86114              if (!_this._writableState) {
86115                process.nextTick(emitErrorAndCloseNT, _this, err);
86116              } else if (!_this._writableState.errorEmitted) {
86117                _this._writableState.errorEmitted = true;
86118                process.nextTick(emitErrorAndCloseNT, _this, err);
86119              } else {
86120                process.nextTick(emitCloseNT, _this);
86121              }
86122            } else if (cb) {
86123              process.nextTick(emitCloseNT, _this);
86124              cb(err);
86125            } else {
86126              process.nextTick(emitCloseNT, _this);
86127            }
86128          });
86129
86130          return this;
86131        }
86132
86133        function emitErrorAndCloseNT(self, err) {
86134          emitErrorNT(self, err);
86135          emitCloseNT(self);
86136        }
86137
86138        function emitCloseNT(self) {
86139          if (self._writableState && !self._writableState.emitClose) return;
86140          if (self._readableState && !self._readableState.emitClose) return;
86141          self.emit('close');
86142        }
86143
86144        function undestroy() {
86145          if (this._readableState) {
86146            this._readableState.destroyed = false;
86147            this._readableState.reading = false;
86148            this._readableState.ended = false;
86149            this._readableState.endEmitted = false;
86150          }
86151
86152          if (this._writableState) {
86153            this._writableState.destroyed = false;
86154            this._writableState.ended = false;
86155            this._writableState.ending = false;
86156            this._writableState.finalCalled = false;
86157            this._writableState.prefinished = false;
86158            this._writableState.finished = false;
86159            this._writableState.errorEmitted = false;
86160          }
86161        }
86162
86163        function emitErrorNT(self, err) {
86164          self.emit('error', err);
86165        }
86166
86167        function errorOrDestroy(stream, err) {
86168          // We have tests that rely on errors being emitted
86169          // in the same tick, so changing this is semver major.
86170          // For now when you opt-in to autoDestroy we allow
86171          // the error to be emitted nextTick. In a future
86172          // semver major update we should change the default to this.
86173          var rState = stream._readableState;
86174          var wState = stream._writableState;
86175          if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err);
86176        }
86177
86178        module.exports = {
86179          destroy: destroy,
86180          undestroy: undestroy,
86181          errorOrDestroy: errorOrDestroy
86182        };
86183      }).call(this, require('_process'));
86184    }, {
86185      "_process": 443
86186    }],
86187    462: [function (require, module, exports) {
86188      // Ported from https://github.com/mafintosh/end-of-stream with
86189      // permission from the author, Mathias Buus (@mafintosh).
86190      'use strict';
86191
86192      var ERR_STREAM_PREMATURE_CLOSE = require('../../../errors').codes.ERR_STREAM_PREMATURE_CLOSE;
86193
86194      function once(callback) {
86195        var called = false;
86196        return function () {
86197          if (called) return;
86198          called = true;
86199
86200          for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
86201            args[_key] = arguments[_key];
86202          }
86203
86204          callback.apply(this, args);
86205        };
86206      }
86207
86208      function noop() {}
86209
86210      function isRequest(stream) {
86211        return stream.setHeader && typeof stream.abort === 'function';
86212      }
86213
86214      function eos(stream, opts, callback) {
86215        if (typeof opts === 'function') return eos(stream, null, opts);
86216        if (!opts) opts = {};
86217        callback = once(callback || noop);
86218        var readable = opts.readable || opts.readable !== false && stream.readable;
86219        var writable = opts.writable || opts.writable !== false && stream.writable;
86220
86221        var onlegacyfinish = function onlegacyfinish() {
86222          if (!stream.writable) onfinish();
86223        };
86224
86225        var writableEnded = stream._writableState && stream._writableState.finished;
86226
86227        var onfinish = function onfinish() {
86228          writable = false;
86229          writableEnded = true;
86230          if (!readable) callback.call(stream);
86231        };
86232
86233        var readableEnded = stream._readableState && stream._readableState.endEmitted;
86234
86235        var onend = function onend() {
86236          readable = false;
86237          readableEnded = true;
86238          if (!writable) callback.call(stream);
86239        };
86240
86241        var onerror = function onerror(err) {
86242          callback.call(stream, err);
86243        };
86244
86245        var onclose = function onclose() {
86246          var err;
86247
86248          if (readable && !readableEnded) {
86249            if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();
86250            return callback.call(stream, err);
86251          }
86252
86253          if (writable && !writableEnded) {
86254            if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();
86255            return callback.call(stream, err);
86256          }
86257        };
86258
86259        var onrequest = function onrequest() {
86260          stream.req.on('finish', onfinish);
86261        };
86262
86263        if (isRequest(stream)) {
86264          stream.on('complete', onfinish);
86265          stream.on('abort', onclose);
86266          if (stream.req) onrequest();else stream.on('request', onrequest);
86267        } else if (writable && !stream._writableState) {
86268          // legacy streams
86269          stream.on('end', onlegacyfinish);
86270          stream.on('close', onlegacyfinish);
86271        }
86272
86273        stream.on('end', onend);
86274        stream.on('finish', onfinish);
86275        if (opts.error !== false) stream.on('error', onerror);
86276        stream.on('close', onclose);
86277        return function () {
86278          stream.removeListener('complete', onfinish);
86279          stream.removeListener('abort', onclose);
86280          stream.removeListener('request', onrequest);
86281          if (stream.req) stream.req.removeListener('finish', onfinish);
86282          stream.removeListener('end', onlegacyfinish);
86283          stream.removeListener('close', onlegacyfinish);
86284          stream.removeListener('finish', onfinish);
86285          stream.removeListener('end', onend);
86286          stream.removeListener('error', onerror);
86287          stream.removeListener('close', onclose);
86288        };
86289      }
86290
86291      module.exports = eos;
86292    }, {
86293      "../../../errors": 453
86294    }],
86295    463: [function (require, module, exports) {
86296      module.exports = function () {
86297        throw new Error('Readable.from is not available in the browser');
86298      };
86299    }, {}],
86300    464: [function (require, module, exports) {
86301      // Ported from https://github.com/mafintosh/pump with
86302      // permission from the author, Mathias Buus (@mafintosh).
86303      'use strict';
86304
86305      var eos;
86306
86307      function once(callback) {
86308        var called = false;
86309        return function () {
86310          if (called) return;
86311          called = true;
86312          callback.apply(void 0, arguments);
86313        };
86314      }
86315
86316      var _require$codes = require('../../../errors').codes,
86317          ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS,
86318          ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;
86319
86320      function noop(err) {
86321        // Rethrow the error if it exists to avoid swallowing it
86322        if (err) throw err;
86323      }
86324
86325      function isRequest(stream) {
86326        return stream.setHeader && typeof stream.abort === 'function';
86327      }
86328
86329      function destroyer(stream, reading, writing, callback) {
86330        callback = once(callback);
86331        var closed = false;
vendor: 4,072 bytes, lines 86332-86456
86332        stream.on('close', function () {
86333          closed = true;
86334        });
86335        if (eos === undefined) eos = require('./end-of-stream');
86336        eos(stream, {
86337          readable: reading,
86338          writable: writing
86339        }, function (err) {
86340          if (err) return callback(err);
86341          closed = true;
86342          callback();
86343        });
86344        var destroyed = false;
86345        return function (err) {
86346          if (closed) return;
86347          if (destroyed) return;
86348          destroyed = true; // request.destroy just do .end - .abort is what we want
86349
86350          if (isRequest(stream)) return stream.abort();
86351          if (typeof stream.destroy === 'function') return stream.destroy();
86352          callback(err || new ERR_STREAM_DESTROYED('pipe'));
86353        };
86354      }
86355
86356      function call(fn) {
86357        fn();
86358      }
86359
86360      function pipe(from, to) {
86361        return from.pipe(to);
86362      }
86363
86364      function popCallback(streams) {
86365        if (!streams.length) return noop;
86366        if (typeof streams[streams.length - 1] !== 'function') return noop;
86367        return streams.pop();
86368      }
86369
86370      function pipeline() {
86371        for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) {
86372          streams[_key] = arguments[_key];
86373        }
86374
86375        var callback = popCallback(streams);
86376        if (Array.isArray(streams[0])) streams = streams[0];
86377
86378        if (streams.length < 2) {
86379          throw new ERR_MISSING_ARGS('streams');
86380        }
86381
86382        var error;
86383        var destroys = streams.map(function (stream, i) {
86384          var reading = i < streams.length - 1;
86385          var writing = i > 0;
86386          return destroyer(stream, reading, writing, function (err) {
86387            if (!error) error = err;
86388            if (err) destroys.forEach(call);
86389            if (reading) return;
86390            destroys.forEach(call);
86391            callback(error);
86392          });
86393        });
86394        return streams.reduce(pipe);
86395      }
86396
86397      module.exports = pipeline;
86398    }, {
86399      "../../../errors": 453,
86400      "./end-of-stream": 462
86401    }],
86402    465: [function (require, module, exports) {
86403      'use strict';
86404
86405      var ERR_INVALID_OPT_VALUE = require('../../../errors').codes.ERR_INVALID_OPT_VALUE;
86406
86407      function highWaterMarkFrom(options, isDuplex, duplexKey) {
86408        return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;
86409      }
86410
86411      function getHighWaterMark(state, options, duplexKey, isDuplex) {
86412        var hwm = highWaterMarkFrom(options, isDuplex, duplexKey);
86413
86414        if (hwm != null) {
86415          if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {
86416            var name = isDuplex ? duplexKey : 'highWaterMark';
86417            throw new ERR_INVALID_OPT_VALUE(name, hwm);
86418          }
86419
86420          return Math.floor(hwm);
86421        } // Default value
86422
86423
86424        return state.objectMode ? 16 : 16 * 1024;
86425      }
86426
86427      module.exports = {
86428        getHighWaterMark: getHighWaterMark
86429      };
86430    }, {
86431      "../../../errors": 453
86432    }],
86433    466: [function (require, module, exports) {
86434      module.exports = require('events').EventEmitter;
86435    }, {
86436      "events": 344
86437    }],
86438    467: [function (require, module, exports) {
86439      exports = module.exports = require('./lib/_stream_readable.js');
86440      exports.Stream = exports;
86441      exports.Readable = exports;
86442      exports.Writable = require('./lib/_stream_writable.js');
86443      exports.Duplex = require('./lib/_stream_duplex.js');
86444      exports.Transform = require('./lib/_stream_transform.js');
86445      exports.PassThrough = require('./lib/_stream_passthrough.js');
86446      exports.finished = require('./lib/internal/streams/end-of-stream.js');
86447      exports.pipeline = require('./lib/internal/streams/pipeline.js');
86448    }, {
86449      "./lib/_stream_duplex.js": 454,
86450      "./lib/_stream_passthrough.js": 455,
86451      "./lib/_stream_readable.js": 456,
86452      "./lib/_stream_transform.js": 457,
86453      "./lib/_stream_writable.js": 458,
86454      "./lib/internal/streams/end-of-stream.js": 462,
86455      "./lib/internal/streams/pipeline.js": 464
86456    }],
vendor: 5,050 bytes, lines 86457-86564
86457    468: [function (require, module, exports) {
86458      /**
86459       * Copyright (c) 2014-present, Facebook, Inc.
86460       *
86461       * This source code is licensed under the MIT license found in the
86462       * LICENSE file in the root directory of this source tree.
86463       */
86464      var runtime = function (exports) {
86465        "use strict";
86466
86467        var Op = Object.prototype;
86468        var hasOwn = Op.hasOwnProperty;
86469        var undefined; // More compressible than void 0.
86470
86471        var $Symbol = typeof Symbol === "function" ? Symbol : {};
86472        var iteratorSymbol = $Symbol.iterator || "@@iterator";
86473        var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
86474        var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
86475
86476        function wrap(innerFn, outerFn, self, tryLocsList) {
86477          // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
86478          var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
86479          var generator = Object.create(protoGenerator.prototype);
86480          var context = new Context(tryLocsList || []); // The ._invoke method unifies the implementations of the .next,
86481          // .throw, and .return methods.
86482
86483          generator._invoke = makeInvokeMethod(innerFn, self, context);
86484          return generator;
86485        }
86486
86487        exports.wrap = wrap; // Try/catch helper to minimize deoptimizations. Returns a completion
86488        // record like context.tryEntries[i].completion. This interface could
86489        // have been (and was previously) designed to take a closure to be
86490        // invoked without arguments, but in all the cases we care about we
86491        // already have an existing method we want to call, so there's no need
86492        // to create a new function object. We can even get away with assuming
86493        // the method takes exactly one argument, since that happens to be true
86494        // in every case, so we don't have to touch the arguments object. The
86495        // only additional allocation required is the completion record, which
86496        // has a stable shape and so hopefully should be cheap to allocate.
86497
86498        function tryCatch(fn, obj, arg) {
86499          try {
86500            return {
86501              type: "normal",
86502              arg: fn.call(obj, arg)
86503            };
86504          } catch (err) {
86505            return {
86506              type: "throw",
86507              arg: err
86508            };
86509          }
86510        }
86511
86512        var GenStateSuspendedStart = "suspendedStart";
86513        var GenStateSuspendedYield = "suspendedYield";
86514        var GenStateExecuting = "executing";
86515        var GenStateCompleted = "completed"; // Returning this object from the innerFn has the same effect as
86516        // breaking out of the dispatch switch statement.
86517
86518        var ContinueSentinel = {}; // Dummy constructor functions that we use as the .constructor and
86519        // .constructor.prototype properties for functions that return Generator
86520        // objects. For full spec compliance, you may wish to configure your
86521        // minifier not to mangle the names of these two functions.
86522
86523        function Generator() {}
86524
86525        function GeneratorFunction() {}
86526
86527        function GeneratorFunctionPrototype() {} // This is a polyfill for %IteratorPrototype% for environments that
86528        // don't natively support it.
86529
86530
86531        var IteratorPrototype = {};
86532
86533        IteratorPrototype[iteratorSymbol] = function () {
86534          return this;
86535        };
86536
86537        var getProto = Object.getPrototypeOf;
86538        var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
86539
86540        if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
86541          // This environment has a native %IteratorPrototype%; use it instead
86542          // of the polyfill.
86543          IteratorPrototype = NativeIteratorPrototype;
86544        }
86545
86546        var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
86547        GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
86548        GeneratorFunctionPrototype.constructor = GeneratorFunction;
86549        GeneratorFunctionPrototype[toStringTagSymbol] = GeneratorFunction.displayName = "GeneratorFunction"; // Helper for defining the .next, .throw, and .return methods of the
86550        // Iterator interface in terms of a single ._invoke method.
86551
86552        function defineIteratorMethods(prototype) {
86553          ["next", "throw", "return"].forEach(function (method) {
86554            prototype[method] = function (arg) {
86555              return this._invoke(method, arg);
86556            };
86557          });
86558        }
86559
86560        exports.isGeneratorFunction = function (genFun) {
86561          var ctor = typeof genFun === "function" && genFun.constructor;
86562          return ctor ? ctor === GeneratorFunction || // For the native GeneratorFunction constructor, the best we can
86563          // do is to check its .name property.
86564          (ctor.displayName || ctor.name) === "GeneratorFunction" : false;
vendor: 8,666 bytes, lines 86565-86771
86565        };
86566
86567        exports.mark = function (genFun) {
86568          if (Object.setPrototypeOf) {
86569            Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
86570          } else {
86571            genFun.__proto__ = GeneratorFunctionPrototype;
86572
86573            if (!(toStringTagSymbol in genFun)) {
86574              genFun[toStringTagSymbol] = "GeneratorFunction";
86575            }
86576          }
86577
86578          genFun.prototype = Object.create(Gp);
86579          return genFun;
86580        }; // Within the body of any async function, `await x` is transformed to
86581        // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
86582        // `hasOwn.call(value, "__await")` to determine if the yielded value is
86583        // meant to be awaited.
86584
86585
86586        exports.awrap = function (arg) {
86587          return {
86588            __await: arg
86589          };
86590        };
86591
86592        function AsyncIterator(generator, PromiseImpl) {
86593          function invoke(method, arg, resolve, reject) {
86594            var record = tryCatch(generator[method], generator, arg);
86595
86596            if (record.type === "throw") {
86597              reject(record.arg);
86598            } else {
86599              var result = record.arg;
86600              var value = result.value;
86601
86602              if (value && _typeof2(value) === "object" && hasOwn.call(value, "__await")) {
86603                return PromiseImpl.resolve(value.__await).then(function (value) {
86604                  invoke("next", value, resolve, reject);
86605                }, function (err) {
86606                  invoke("throw", err, resolve, reject);
86607                });
86608              }
86609
86610              return PromiseImpl.resolve(value).then(function (unwrapped) {
86611                // When a yielded Promise is resolved, its final value becomes
86612                // the .value of the Promise<{value,done}> result for the
86613                // current iteration.
86614                result.value = unwrapped;
86615                resolve(result);
86616              }, function (error) {
86617                // If a rejected Promise was yielded, throw the rejection back
86618                // into the async generator function so it can be handled there.
86619                return invoke("throw", error, resolve, reject);
86620              });
86621            }
86622          }
86623
86624          var previousPromise;
86625
86626          function enqueue(method, arg) {
86627            function callInvokeWithMethodAndArg() {
86628              return new PromiseImpl(function (resolve, reject) {
86629                invoke(method, arg, resolve, reject);
86630              });
86631            }
86632
86633            return previousPromise = // If enqueue has been called before, then we want to wait until
86634            // all previous Promises have been resolved before calling invoke,
86635            // so that results are always delivered in the correct order. If
86636            // enqueue has not been called before, then it is important to
86637            // call invoke immediately, without waiting on a callback to fire,
86638            // so that the async generator function has the opportunity to do
86639            // any necessary setup in a predictable way. This predictability
86640            // is why the Promise constructor synchronously invokes its
86641            // executor callback, and why async functions synchronously
86642            // execute code before the first await. Since we implement simple
86643            // async functions in terms of async generators, it is especially
86644            // important to get this right, even though it requires care.
86645            previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, // Avoid propagating failures to Promises returned by later
86646            // invocations of the iterator.
86647            callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
86648          } // Define the unified helper method that is used to implement .next,
86649          // .throw, and .return (see defineIteratorMethods).
86650
86651
86652          this._invoke = enqueue;
86653        }
86654
86655        defineIteratorMethods(AsyncIterator.prototype);
86656
86657        AsyncIterator.prototype[asyncIteratorSymbol] = function () {
86658          return this;
86659        };
86660
86661        exports.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of
86662        // AsyncIterator objects; they just return a Promise for the value of
86663        // the final result produced by the iterator.
86664
86665        exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
86666          if (PromiseImpl === void 0) PromiseImpl = Promise;
86667          var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
86668          return exports.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator.
86669          : iter.next().then(function (result) {
86670            return result.done ? result.value : iter.next();
86671          });
86672        };
86673
86674        function makeInvokeMethod(innerFn, self, context) {
86675          var state = GenStateSuspendedStart;
86676          return function invoke(method, arg) {
86677            if (state === GenStateExecuting) {
86678              throw new Error("Generator is already running");
86679            }
86680
86681            if (state === GenStateCompleted) {
86682              if (method === "throw") {
86683                throw arg;
86684              } // Be forgiving, per 25.3.3.3.3 of the spec:
86685              // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
86686
86687
86688              return doneResult();
86689            }
86690
86691            context.method = method;
86692            context.arg = arg;
86693
86694            while (true) {
86695              var delegate = context.delegate;
86696
86697              if (delegate) {
86698                var delegateResult = maybeInvokeDelegate(delegate, context);
86699
86700                if (delegateResult) {
86701                  if (delegateResult === ContinueSentinel) continue;
86702                  return delegateResult;
86703                }
86704              }
86705
86706              if (context.method === "next") {
86707                // Setting context._sent for legacy support of Babel's
86708                // function.sent implementation.
86709                context.sent = context._sent = context.arg;
86710              } else if (context.method === "throw") {
86711                if (state === GenStateSuspendedStart) {
86712                  state = GenStateCompleted;
86713                  throw context.arg;
86714                }
86715
86716                context.dispatchException(context.arg);
86717              } else if (context.method === "return") {
86718                context.abrupt("return", context.arg);
86719              }
86720
86721              state = GenStateExecuting;
86722              var record = tryCatch(innerFn, self, context);
86723
86724              if (record.type === "normal") {
86725                // If an exception is thrown from innerFn, we leave state ===
86726                // GenStateExecuting and loop back for another invocation.
86727                state = context.done ? GenStateCompleted : GenStateSuspendedYield;
86728
86729                if (record.arg === ContinueSentinel) {
86730                  continue;
86731                }
86732
86733                return {
86734                  value: record.arg,
86735                  done: context.done
86736                };
86737              } else if (record.type === "throw") {
86738                state = GenStateCompleted; // Dispatch the exception by looping back around to the
86739                // context.dispatchException(context.arg) call above.
86740
86741                context.method = "throw";
86742                context.arg = record.arg;
86743              }
86744            }
86745          };
86746        } // Call delegate.iterator[context.method](context.arg) and handle the
86747        // result, either by returning a { value, done } result from the
86748        // delegate iterator, or by modifying context.method and context.arg,
86749        // setting context.delegate to null, and returning the ContinueSentinel.
86750
86751
86752        function maybeInvokeDelegate(delegate, context) {
86753          var method = delegate.iterator[context.method];
86754
86755          if (method === undefined) {
86756            // A .throw or .return when the delegate iterator has no .throw
86757            // method always terminates the yield* loop.
86758            context.delegate = null;
86759
86760            if (context.method === "throw") {
86761              // Note: ["return"] must be used for ES3 parsing compatibility.
86762              if (delegate.iterator["return"]) {
86763                // If the delegate iterator has a return method, give it a
86764                // chance to clean up.
86765                context.method = "return";
86766                context.arg = undefined;
86767                maybeInvokeDelegate(delegate, context);
86768
86769                if (context.method === "throw") {
86770                  // If maybeInvokeDelegate(context) changed context.method from
86771                  // "return" to "throw", let that override the TypeError below.
vendor: 4,261 bytes, lines 86772-86896
86772                  return ContinueSentinel;
86773                }
86774              }
86775
86776              context.method = "throw";
86777              context.arg = new TypeError("The iterator does not provide a 'throw' method");
86778            }
86779
86780            return ContinueSentinel;
86781          }
86782
86783          var record = tryCatch(method, delegate.iterator, context.arg);
86784
86785          if (record.type === "throw") {
86786            context.method = "throw";
86787            context.arg = record.arg;
86788            context.delegate = null;
86789            return ContinueSentinel;
86790          }
86791
86792          var info = record.arg;
86793
86794          if (!info) {
86795            context.method = "throw";
86796            context.arg = new TypeError("iterator result is not an object");
86797            context.delegate = null;
86798            return ContinueSentinel;
86799          }
86800
86801          if (info.done) {
86802            // Assign the result of the finished delegate to the temporary
86803            // variable specified by delegate.resultName (see delegateYield).
86804            context[delegate.resultName] = info.value; // Resume execution at the desired location (see delegateYield).
86805
86806            context.next = delegate.nextLoc; // If context.method was "throw" but the delegate handled the
86807            // exception, let the outer generator proceed normally. If
86808            // context.method was "next", forget context.arg since it has been
86809            // "consumed" by the delegate iterator. If context.method was
86810            // "return", allow the original .return call to continue in the
86811            // outer generator.
86812
86813            if (context.method !== "return") {
86814              context.method = "next";
86815              context.arg = undefined;
86816            }
86817          } else {
86818            // Re-yield the result returned by the delegate method.
86819            return info;
86820          } // The delegate iterator is finished, so forget it and continue with
86821          // the outer generator.
86822
86823
86824          context.delegate = null;
86825          return ContinueSentinel;
86826        } // Define Generator.prototype.{next,throw,return} in terms of the
86827        // unified ._invoke helper method.
86828
86829
86830        defineIteratorMethods(Gp);
86831        Gp[toStringTagSymbol] = "Generator"; // A Generator should always return itself as the iterator object when the
86832        // @@iterator function is called on it. Some browsers' implementations of the
86833        // iterator prototype chain incorrectly implement this, causing the Generator
86834        // object to not be returned from this call. This ensures that doesn't happen.
86835        // See https://github.com/facebook/regenerator/issues/274 for more details.
86836
86837        Gp[iteratorSymbol] = function () {
86838          return this;
86839        };
86840
86841        Gp.toString = function () {
86842          return "[object Generator]";
86843        };
86844
86845        function pushTryEntry(locs) {
86846          var entry = {
86847            tryLoc: locs[0]
86848          };
86849
86850          if (1 in locs) {
86851            entry.catchLoc = locs[1];
86852          }
86853
86854          if (2 in locs) {
86855            entry.finallyLoc = locs[2];
86856            entry.afterLoc = locs[3];
86857          }
86858
86859          this.tryEntries.push(entry);
86860        }
86861
86862        function resetTryEntry(entry) {
86863          var record = entry.completion || {};
86864          record.type = "normal";
86865          delete record.arg;
86866          entry.completion = record;
86867        }
86868
86869        function Context(tryLocsList) {
86870          // The root entry object (effectively a try statement without a catch
86871          // or a finally block) gives us a place to store values thrown from
86872          // locations where there is no enclosing try statement.
86873          this.tryEntries = [{
86874            tryLoc: "root"
86875          }];
86876          tryLocsList.forEach(pushTryEntry, this);
86877          this.reset(true);
86878        }
86879
86880        exports.keys = function (object) {
86881          var keys = [];
86882
86883          for (var key in object) {
86884            keys.push(key);
86885          }
86886
86887          keys.reverse(); // Rather than returning an object with a next method, we keep
86888          // things simple and return the next function itself.
86889
86890          return function next() {
86891            while (keys.length) {
86892              var key = keys.pop();
86893
86894              if (key in object) {
86895                next.value = key;
86896                next.done = false;
vendor: 9,321 bytes, lines 86897-87159
86897                return next;
86898              }
86899            } // To avoid creating an additional object, we just hang the .value
86900            // and .done properties off the next function object itself. This
86901            // also ensures that the minifier will not anonymize the function.
86902
86903
86904            next.done = true;
86905            return next;
86906          };
86907        };
86908
86909        function values(iterable) {
86910          if (iterable) {
86911            var iteratorMethod = iterable[iteratorSymbol];
86912
86913            if (iteratorMethod) {
86914              return iteratorMethod.call(iterable);
86915            }
86916
86917            if (typeof iterable.next === "function") {
86918              return iterable;
86919            }
86920
86921            if (!isNaN(iterable.length)) {
86922              var i = -1,
86923                  next = function next() {
86924                while (++i < iterable.length) {
86925                  if (hasOwn.call(iterable, i)) {
86926                    next.value = iterable[i];
86927                    next.done = false;
86928                    return next;
86929                  }
86930                }
86931
86932                next.value = undefined;
86933                next.done = true;
86934                return next;
86935              };
86936
86937              return next.next = next;
86938            }
86939          } // Return an iterator with no values.
86940
86941
86942          return {
86943            next: doneResult
86944          };
86945        }
86946
86947        exports.values = values;
86948
86949        function doneResult() {
86950          return {
86951            value: undefined,
86952            done: true
86953          };
86954        }
86955
86956        Context.prototype = {
86957          constructor: Context,
86958          reset: function reset(skipTempReset) {
86959            this.prev = 0;
86960            this.next = 0; // Resetting context._sent for legacy support of Babel's
86961            // function.sent implementation.
86962
86963            this.sent = this._sent = undefined;
86964            this.done = false;
86965            this.delegate = null;
86966            this.method = "next";
86967            this.arg = undefined;
86968            this.tryEntries.forEach(resetTryEntry);
86969
86970            if (!skipTempReset) {
86971              for (var name in this) {
86972                // Not sure about the optimal order of these conditions:
86973                if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
86974                  this[name] = undefined;
86975                }
86976              }
86977            }
86978          },
86979          stop: function stop() {
86980            this.done = true;
86981            var rootEntry = this.tryEntries[0];
86982            var rootRecord = rootEntry.completion;
86983
86984            if (rootRecord.type === "throw") {
86985              throw rootRecord.arg;
86986            }
86987
86988            return this.rval;
86989          },
86990          dispatchException: function dispatchException(exception) {
86991            if (this.done) {
86992              throw exception;
86993            }
86994
86995            var context = this;
86996
86997            function handle(loc, caught) {
86998              record.type = "throw";
86999              record.arg = exception;
87000              context.next = loc;
87001
87002              if (caught) {
87003                // If the dispatched exception was caught by a catch block,
87004                // then let that catch block handle the exception normally.
87005                context.method = "next";
87006                context.arg = undefined;
87007              }
87008
87009              return !!caught;
87010            }
87011
87012            for (var i = this.tryEntries.length - 1; i >= 0; --i) {
87013              var entry = this.tryEntries[i];
87014              var record = entry.completion;
87015
87016              if (entry.tryLoc === "root") {
87017                // Exception thrown outside of any try block that could handle
87018                // it, so set the completion value of the entire function to
87019                // throw the exception.
87020                return handle("end");
87021              }
87022
87023              if (entry.tryLoc <= this.prev) {
87024                var hasCatch = hasOwn.call(entry, "catchLoc");
87025                var hasFinally = hasOwn.call(entry, "finallyLoc");
87026
87027                if (hasCatch && hasFinally) {
87028                  if (this.prev < entry.catchLoc) {
87029                    return handle(entry.catchLoc, true);
87030                  } else if (this.prev < entry.finallyLoc) {
87031                    return handle(entry.finallyLoc);
87032                  }
87033                } else if (hasCatch) {
87034                  if (this.prev < entry.catchLoc) {
87035                    return handle(entry.catchLoc, true);
87036                  }
87037                } else if (hasFinally) {
87038                  if (this.prev < entry.finallyLoc) {
87039                    return handle(entry.finallyLoc);
87040                  }
87041                } else {
87042                  throw new Error("try statement without catch or finally");
87043                }
87044              }
87045            }
87046          },
87047          abrupt: function abrupt(type, arg) {
87048            for (var i = this.tryEntries.length - 1; i >= 0; --i) {
87049              var entry = this.tryEntries[i];
87050
87051              if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
87052                var finallyEntry = entry;
87053                break;
87054              }
87055            }
87056
87057            if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
87058              // Ignore the finally entry if control is not jumping to a
87059              // location outside the try/catch block.
87060              finallyEntry = null;
87061            }
87062
87063            var record = finallyEntry ? finallyEntry.completion : {};
87064            record.type = type;
87065            record.arg = arg;
87066
87067            if (finallyEntry) {
87068              this.method = "next";
87069              this.next = finallyEntry.finallyLoc;
87070              return ContinueSentinel;
87071            }
87072
87073            return this.complete(record);
87074          },
87075          complete: function complete(record, afterLoc) {
87076            if (record.type === "throw") {
87077              throw record.arg;
87078            }
87079
87080            if (record.type === "break" || record.type === "continue") {
87081              this.next = record.arg;
87082            } else if (record.type === "return") {
87083              this.rval = this.arg = record.arg;
87084              this.method = "return";
87085              this.next = "end";
87086            } else if (record.type === "normal" && afterLoc) {
87087              this.next = afterLoc;
87088            }
87089
87090            return ContinueSentinel;
87091          },
87092          finish: function finish(finallyLoc) {
87093            for (var i = this.tryEntries.length - 1; i >= 0; --i) {
87094              var entry = this.tryEntries[i];
87095
87096              if (entry.finallyLoc === finallyLoc) {
87097                this.complete(entry.completion, entry.afterLoc);
87098                resetTryEntry(entry);
87099                return ContinueSentinel;
87100              }
87101            }
87102          },
87103          "catch": function _catch(tryLoc) {
87104            for (var i = this.tryEntries.length - 1; i >= 0; --i) {
87105              var entry = this.tryEntries[i];
87106
87107              if (entry.tryLoc === tryLoc) {
87108                var record = entry.completion;
87109
87110                if (record.type === "throw") {
87111                  var thrown = record.arg;
87112                  resetTryEntry(entry);
87113                }
87114
87115                return thrown;
87116              }
87117            } // The context.catch method must only be called with a location
87118            // argument that corresponds to a known catch block.
87119
87120
87121            throw new Error("illegal catch attempt");
87122          },
87123          delegateYield: function delegateYield(iterable, resultName, nextLoc) {
87124            this.delegate = {
87125              iterator: values(iterable),
87126              resultName: resultName,
87127              nextLoc: nextLoc
87128            };
87129
87130            if (this.method === "next") {
87131              // Deliberately forget the last sent value so that we don't
87132              // accidentally pass it on to the delegate.
87133              this.arg = undefined;
87134            }
87135
87136            return ContinueSentinel;
87137          }
87138        }; // Regardless of whether this script is executing as a CommonJS module
87139        // or not, return the runtime object so that we can declare the variable
87140        // regeneratorRuntime in the outer scope, which allows this module to be
87141        // injected easily by `bin/regenerator --include-runtime script.js`.
87142
87143        return exports;
87144      }( // If this script is executing as a CommonJS module, use module.exports
87145      // as the regeneratorRuntime namespace. Otherwise create a new empty
87146      // object. Either way, the resulting object will be used to initialize
87147      // the regeneratorRuntime variable at the top of this file.
87148      _typeof2(module) === "object" ? module.exports : {});
87149
87150      try {
87151        regeneratorRuntime = runtime;
87152      } catch (accidentalStrictMode) {
87153        // This module should not be running in strict mode, so the above
87154        // assignment should always work unless something is misconfigured. Just
87155        // in case runtime.js accidentally runs in strict mode, we can escape
87156        // strict mode using a global Function call. This could conceivably fail
87157        // if a Content Security Policy forbids using Function, but in that case
87158        // the proper solution is to fix the accidental strict mode problem. If
87159        // you've misconfigured your bundler to force strict mode and applied a
vendor: 91,827 bytes, lines 87160-89918
87160        // CSP to forbid Function, and you're not willing to fix either of those
87161        // problems, please detail your unique predicament in a GitHub issue.
87162        Function("r", "regeneratorRuntime = r")(runtime);
87163      }
87164    }, {}],
87165    469: [function (require, module, exports) {
87166      'use strict';
87167
87168      var Buffer = require('buffer').Buffer;
87169
87170      var inherits = require('inherits');
87171
87172      var HashBase = require('hash-base');
87173
87174      var ARRAY16 = new Array(16);
87175      var zl = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13];
87176      var zr = [5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11];
87177      var sl = [11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6];
87178      var sr = [8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11];
87179      var hl = [0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e];
87180      var hr = [0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000];
87181
87182      function RIPEMD160() {
87183        HashBase.call(this, 64); // state
87184
87185        this._a = 0x67452301;
87186        this._b = 0xefcdab89;
87187        this._c = 0x98badcfe;
87188        this._d = 0x10325476;
87189        this._e = 0xc3d2e1f0;
87190      }
87191
87192      inherits(RIPEMD160, HashBase);
87193
87194      RIPEMD160.prototype._update = function () {
87195        var words = ARRAY16;
87196
87197        for (var j = 0; j < 16; ++j) {
87198          words[j] = this._block.readInt32LE(j * 4);
87199        }
87200
87201        var al = this._a | 0;
87202        var bl = this._b | 0;
87203        var cl = this._c | 0;
87204        var dl = this._d | 0;
87205        var el = this._e | 0;
87206        var ar = this._a | 0;
87207        var br = this._b | 0;
87208        var cr = this._c | 0;
87209        var dr = this._d | 0;
87210        var er = this._e | 0; // computation
87211
87212        for (var i = 0; i < 80; i += 1) {
87213          var tl;
87214          var tr;
87215
87216          if (i < 16) {
87217            tl = fn1(al, bl, cl, dl, el, words[zl[i]], hl[0], sl[i]);
87218            tr = fn5(ar, br, cr, dr, er, words[zr[i]], hr[0], sr[i]);
87219          } else if (i < 32) {
87220            tl = fn2(al, bl, cl, dl, el, words[zl[i]], hl[1], sl[i]);
87221            tr = fn4(ar, br, cr, dr, er, words[zr[i]], hr[1], sr[i]);
87222          } else if (i < 48) {
87223            tl = fn3(al, bl, cl, dl, el, words[zl[i]], hl[2], sl[i]);
87224            tr = fn3(ar, br, cr, dr, er, words[zr[i]], hr[2], sr[i]);
87225          } else if (i < 64) {
87226            tl = fn4(al, bl, cl, dl, el, words[zl[i]], hl[3], sl[i]);
87227            tr = fn2(ar, br, cr, dr, er, words[zr[i]], hr[3], sr[i]);
87228          } else {
87229            // if (i<80) {
87230            tl = fn5(al, bl, cl, dl, el, words[zl[i]], hl[4], sl[i]);
87231            tr = fn1(ar, br, cr, dr, er, words[zr[i]], hr[4], sr[i]);
87232          }
87233
87234          al = el;
87235          el = dl;
87236          dl = rotl(cl, 10);
87237          cl = bl;
87238          bl = tl;
87239          ar = er;
87240          er = dr;
87241          dr = rotl(cr, 10);
87242          cr = br;
87243          br = tr;
87244        } // update state
87245
87246
87247        var t = this._b + cl + dr | 0;
87248        this._b = this._c + dl + er | 0;
87249        this._c = this._d + el + ar | 0;
87250        this._d = this._e + al + br | 0;
87251        this._e = this._a + bl + cr | 0;
87252        this._a = t;
87253      };
87254
87255      RIPEMD160.prototype._digest = function () {
87256        // create padding and handle blocks
87257        this._block[this._blockOffset++] = 0x80;
87258
87259        if (this._blockOffset > 56) {
87260          this._block.fill(0, this._blockOffset, 64);
87261
87262          this._update();
87263
87264          this._blockOffset = 0;
87265        }
87266
87267        this._block.fill(0, this._blockOffset, 56);
87268
87269        this._block.writeUInt32LE(this._length[0], 56);
87270
87271        this._block.writeUInt32LE(this._length[1], 60);
87272
87273        this._update(); // produce result
87274
87275
87276        var buffer = Buffer.alloc ? Buffer.alloc(20) : new Buffer(20);
87277        buffer.writeInt32LE(this._a, 0);
87278        buffer.writeInt32LE(this._b, 4);
87279        buffer.writeInt32LE(this._c, 8);
87280        buffer.writeInt32LE(this._d, 12);
87281        buffer.writeInt32LE(this._e, 16);
87282        return buffer;
87283      };
87284
87285      function rotl(x, n) {
87286        return x << n | x >>> 32 - n;
87287      }
87288
87289      function fn1(a, b, c, d, e, m, k, s) {
87290        return rotl(a + (b ^ c ^ d) + m + k | 0, s) + e | 0;
87291      }
87292
87293      function fn2(a, b, c, d, e, m, k, s) {
87294        return rotl(a + (b & c | ~b & d) + m + k | 0, s) + e | 0;
87295      }
87296
87297      function fn3(a, b, c, d, e, m, k, s) {
87298        return rotl(a + ((b | ~c) ^ d) + m + k | 0, s) + e | 0;
87299      }
87300
87301      function fn4(a, b, c, d, e, m, k, s) {
87302        return rotl(a + (b & d | c & ~d) + m + k | 0, s) + e | 0;
87303      }
87304
87305      function fn5(a, b, c, d, e, m, k, s) {
87306        return rotl(a + (b ^ (c | ~d)) + m + k | 0, s) + e | 0;
87307      }
87308
87309      module.exports = RIPEMD160;
87310    }, {
87311      "buffer": 214,
87312      "hash-base": 347,
87313      "inherits": 364
87314    }],
87315    470: [function (require, module, exports) {
87316      /* eslint-disable node/no-deprecated-api */
87317      var buffer = require('buffer');
87318
87319      var Buffer = buffer.Buffer; // alternative to using Object.keys for old browsers
87320
87321      function copyProps(src, dst) {
87322        for (var key in src) {
87323          dst[key] = src[key];
87324        }
87325      }
87326
87327      if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
87328        module.exports = buffer;
87329      } else {
87330        // Copy properties from require('buffer')
87331        copyProps(buffer, exports);
87332        exports.Buffer = SafeBuffer;
87333      }
87334
87335      function SafeBuffer(arg, encodingOrOffset, length) {
87336        return Buffer(arg, encodingOrOffset, length);
87337      } // Copy static methods from Buffer
87338
87339
87340      copyProps(Buffer, SafeBuffer);
87341
87342      SafeBuffer.from = function (arg, encodingOrOffset, length) {
87343        if (typeof arg === 'number') {
87344          throw new TypeError('Argument must not be a number');
87345        }
87346
87347        return Buffer(arg, encodingOrOffset, length);
87348      };
87349
87350      SafeBuffer.alloc = function (size, fill, encoding) {
87351        if (typeof size !== 'number') {
87352          throw new TypeError('Argument must be a number');
87353        }
87354
87355        var buf = Buffer(size);
87356
87357        if (fill !== undefined) {
87358          if (typeof encoding === 'string') {
87359            buf.fill(fill, encoding);
87360          } else {
87361            buf.fill(fill);
87362          }
87363        } else {
87364          buf.fill(0);
87365        }
87366
87367        return buf;
87368      };
87369
87370      SafeBuffer.allocUnsafe = function (size) {
87371        if (typeof size !== 'number') {
87372          throw new TypeError('Argument must be a number');
87373        }
87374
87375        return Buffer(size);
87376      };
87377
87378      SafeBuffer.allocUnsafeSlow = function (size) {
87379        if (typeof size !== 'number') {
87380          throw new TypeError('Argument must be a number');
87381        }
87382
87383        return buffer.SlowBuffer(size);
87384      };
87385    }, {
87386      "buffer": 214
87387    }],
87388    471: [function (require, module, exports) {
87389      "use strict";
87390
87391      Object.defineProperty(exports, "__esModule", {
87392        value: true
87393      });
87394
87395      var ed5 = require("xmlchars/xml/1.0/ed5");
87396
87397      var ed2 = require("xmlchars/xml/1.1/ed2");
87398
87399      var NSed3 = require("xmlchars/xmlns/1.0/ed3");
87400
87401      var isS = ed5.isS;
87402      var isChar10 = ed5.isChar;
87403      var isNameStartChar = ed5.isNameStartChar;
87404      var isNameChar = ed5.isNameChar;
87405      var S_LIST = ed5.S_LIST;
87406      var NAME_RE = ed5.NAME_RE;
87407      var isChar11 = ed2.isChar;
87408      var isNCNameStartChar = NSed3.isNCNameStartChar;
87409      var isNCNameChar = NSed3.isNCNameChar;
87410      var NC_NAME_RE = NSed3.NC_NAME_RE;
87411      var XML_NAMESPACE = "http://www.w3.org/XML/1998/namespace";
87412      var XMLNS_NAMESPACE = "http://www.w3.org/2000/xmlns/";
87413      var rootNS = {
87414        // eslint-disable-next-line @typescript-eslint/no-explicit-any
87415        __proto__: null,
87416        xml: XML_NAMESPACE,
87417        xmlns: XMLNS_NAMESPACE
87418      };
87419      var XML_ENTITIES = {
87420        // eslint-disable-next-line @typescript-eslint/no-explicit-any
87421        __proto__: null,
87422        amp: "&",
87423        gt: ">",
87424        lt: "<",
87425        quot: "\"",
87426        apos: "'"
87427      }; // EOC: end-of-chunk
87428
87429      var EOC = -1;
87430      var NL_LIKE = -2;
87431      var S_BEGIN = 0; // Initial state.
87432
87433      var S_BEGIN_WHITESPACE = 1; // leading whitespace
87434
87435      var S_DOCTYPE = 2; // <!DOCTYPE
87436
87437      var S_DOCTYPE_QUOTE = 3; // <!DOCTYPE "//blah
87438
87439      var S_DTD = 4; // <!DOCTYPE "//blah" [ ...
87440
87441      var S_DTD_QUOTED = 5; // <!DOCTYPE "//blah" [ "foo
87442
87443      var S_DTD_OPEN_WAKA = 6;
87444      var S_DTD_OPEN_WAKA_BANG = 7;
87445      var S_DTD_COMMENT = 8; // <!--
87446
87447      var S_DTD_COMMENT_ENDING = 9; // <!-- blah -
87448
87449      var S_DTD_COMMENT_ENDED = 10; // <!-- blah --
87450
87451      var S_DTD_PI = 11; // <?
87452
87453      var S_DTD_PI_ENDING = 12; // <?hi "there" ?
87454
87455      var S_TEXT = 13; // general stuff
87456
87457      var S_ENTITY = 14; // &amp and such
87458
87459      var S_OPEN_WAKA = 15; // <
87460
87461      var S_OPEN_WAKA_BANG = 16; // <!...
87462
87463      var S_COMMENT = 17; // <!--
87464
87465      var S_COMMENT_ENDING = 18; // <!-- blah -
87466
87467      var S_COMMENT_ENDED = 19; // <!-- blah --
87468
87469      var S_CDATA = 20; // <![CDATA[ something
87470
87471      var S_CDATA_ENDING = 21; // ]
87472
87473      var S_CDATA_ENDING_2 = 22; // ]]
87474
87475      var S_PI_FIRST_CHAR = 23; // <?hi, first char
87476
87477      var S_PI_REST = 24; // <?hi, rest of the name
87478
87479      var S_PI_BODY = 25; // <?hi there
87480
87481      var S_PI_ENDING = 26; // <?hi "there" ?
87482
87483      var S_XML_DECL_NAME_START = 27; // <?xml
87484
87485      var S_XML_DECL_NAME = 28; // <?xml foo
87486
87487      var S_XML_DECL_EQ = 29; // <?xml foo=
87488
87489      var S_XML_DECL_VALUE_START = 30; // <?xml foo=
87490
87491      var S_XML_DECL_VALUE = 31; // <?xml foo="bar"
87492
87493      var S_XML_DECL_SEPARATOR = 32; // <?xml foo="bar"
87494
87495      var S_XML_DECL_ENDING = 33; // <?xml ... ?
87496
87497      var S_OPEN_TAG = 34; // <strong
87498
87499      var S_OPEN_TAG_SLASH = 35; // <strong /
87500
87501      var S_ATTRIB = 36; // <a
87502
87503      var S_ATTRIB_NAME = 37; // <a foo
87504
87505      var S_ATTRIB_NAME_SAW_WHITE = 38; // <a foo _
87506
87507      var S_ATTRIB_VALUE = 39; // <a foo=
87508
87509      var S_ATTRIB_VALUE_QUOTED = 40; // <a foo="bar
87510
87511      var S_ATTRIB_VALUE_CLOSED = 41; // <a foo="bar"
87512
87513      var S_ATTRIB_VALUE_UNQUOTED = 42; // <a foo=bar
87514
87515      var S_CLOSE_TAG = 43; // </a
87516
87517      var S_CLOSE_TAG_SAW_WHITE = 44; // </a   >
87518
87519      var TAB = 9;
87520      var NL = 0xA;
87521      var CR = 0xD;
87522      var SPACE = 0x20;
87523      var BANG = 0x21;
87524      var DQUOTE = 0x22;
87525      var AMP = 0x26;
87526      var SQUOTE = 0x27;
87527      var MINUS = 0x2D;
87528      var FORWARD_SLASH = 0x2F;
87529      var SEMICOLON = 0x3B;
87530      var LESS = 0x3C;
87531      var EQUAL = 0x3D;
87532      var GREATER = 0x3E;
87533      var QUESTION = 0x3F;
87534      var OPEN_BRACKET = 0x5B;
87535      var CLOSE_BRACKET = 0x5D;
87536      var NEL = 0x85;
87537      var LS = 0x2028; // Line Separator
87538
87539      var isQuote = function isQuote(c) {
87540        return c === DQUOTE || c === SQUOTE;
87541      };
87542
87543      var QUOTES = [DQUOTE, SQUOTE];
87544      var DOCTYPE_TERMINATOR = [].concat(QUOTES, [OPEN_BRACKET, GREATER]);
87545      var DTD_TERMINATOR = [].concat(QUOTES, [LESS, CLOSE_BRACKET]);
87546      var XML_DECL_NAME_TERMINATOR = [EQUAL, QUESTION].concat(_toConsumableArray2(S_LIST));
87547      var ATTRIB_VALUE_UNQUOTED_TERMINATOR = [].concat(_toConsumableArray2(S_LIST), [GREATER, AMP, LESS]);
87548
87549      function nsPairCheck(parser, prefix, uri) {
87550        switch (prefix) {
87551          case "xml":
87552            if (uri !== XML_NAMESPACE) {
87553              parser.fail("xml prefix must be bound to ".concat(XML_NAMESPACE, "."));
87554            }
87555
87556            break;
87557
87558          case "xmlns":
87559            if (uri !== XMLNS_NAMESPACE) {
87560              parser.fail("xmlns prefix must be bound to ".concat(XMLNS_NAMESPACE, "."));
87561            }
87562
87563            break;
87564
87565          default:
87566        }
87567
87568        switch (uri) {
87569          case XMLNS_NAMESPACE:
87570            parser.fail(prefix === "" ? "the default namespace may not be set to ".concat(uri, ".") : "may not assign a prefix (even \"xmlns\") to the URI ".concat(XMLNS_NAMESPACE, "."));
87571            break;
87572
87573          case XML_NAMESPACE:
87574            switch (prefix) {
87575              case "xml":
87576                // Assinging the XML namespace to "xml" is fine.
87577                break;
87578
87579              case "":
87580                parser.fail("the default namespace may not be set to ".concat(uri, "."));
87581                break;
87582
87583              default:
87584                parser.fail("may not assign the xml namespace to another prefix.");
87585            }
87586
87587            break;
87588
87589          default:
87590        }
87591      }
87592
87593      function nsMappingCheck(parser, mapping) {
87594        for (var _i4 = 0, _Object$keys = Object.keys(mapping); _i4 < _Object$keys.length; _i4++) {
87595          var local = _Object$keys[_i4];
87596          nsPairCheck(parser, local, mapping[local]);
87597        }
87598      }
87599
87600      var isNCName = function isNCName(name) {
87601        return NC_NAME_RE.test(name);
87602      };
87603
87604      var isName = function isName(name) {
87605        return NAME_RE.test(name);
87606      };
87607
87608      var FORBIDDEN_START = 0;
87609      var FORBIDDEN_BRACKET = 1;
87610      var FORBIDDEN_BRACKET_BRACKET = 2;
87611      /**
87612       * The list of supported events.
87613       */
87614
87615      exports.EVENTS = ["xmldecl", "text", "processinginstruction", "doctype", "comment", "opentagstart", "attribute", "opentag", "closetag", "cdata", "error", "end", "ready"];
87616      var EVENT_NAME_TO_HANDLER_NAME = {
87617        xmldecl: "xmldeclHandler",
87618        text: "textHandler",
87619        processinginstruction: "piHandler",
87620        doctype: "doctypeHandler",
87621        comment: "commentHandler",
87622        opentagstart: "openTagStartHandler",
87623        attribute: "attributeHandler",
87624        opentag: "openTagHandler",
87625        closetag: "closeTagHandler",
87626        cdata: "cdataHandler",
87627        error: "errorHandler",
87628        end: "endHandler",
87629        ready: "readyHandler"
87630      };
87631
87632      var SaxesParser = /*#__PURE__*/function () {
87633        /**
87634         * @param opt The parser options.
87635         */
87636        function SaxesParser(opt) {
87637          _classCallCheck2(this, SaxesParser);
87638
87639          this.opt = opt !== null && opt !== void 0 ? opt : {};
87640          this.fragmentOpt = !!this.opt.fragment;
87641          var xmlnsOpt = this.xmlnsOpt = !!this.opt.xmlns;
87642          this.trackPosition = this.opt.position !== false;
87643          this.fileName = this.opt.fileName;
87644
87645          if (xmlnsOpt) {
87646            // This is the function we use to perform name checks on PIs and entities.
87647            // When namespaces are used, colons are not allowed in PI target names or
87648            // entity names. So the check depends on whether namespaces are used. See:
87649            //
87650            // https://www.w3.org/XML/xml-names-19990114-errata.html
87651            // NE08
87652            //
87653            this.nameStartCheck = isNCNameStartChar;
87654            this.nameCheck = isNCNameChar;
87655            this.isName = isNCName; // eslint-disable-next-line @typescript-eslint/unbound-method
87656
87657            this.processAttribs = this.processAttribsNS; // eslint-disable-next-line @typescript-eslint/unbound-method
87658
87659            this.pushAttrib = this.pushAttribNS; // eslint-disable-next-line @typescript-eslint/no-explicit-any
87660
87661            this.ns = Object.assign({
87662              __proto__: null
87663            }, rootNS);
87664            var additional = this.opt.additionalNamespaces;
87665
87666            if (additional != null) {
87667              nsMappingCheck(this, additional);
87668              Object.assign(this.ns, additional);
87669            }
87670          } else {
87671            this.nameStartCheck = isNameStartChar;
87672            this.nameCheck = isNameChar;
87673            this.isName = isName; // eslint-disable-next-line @typescript-eslint/unbound-method
87674
87675            this.processAttribs = this.processAttribsPlain; // eslint-disable-next-line @typescript-eslint/unbound-method
87676
87677            this.pushAttrib = this.pushAttribPlain;
87678          } //
87679          // The order of the members in this table needs to correspond to the state
87680          // numbers given to the states that correspond to the methods being recorded
87681          // here.
87682          //
87683
87684
87685          this.stateTable = [
87686          /* eslint-disable @typescript-eslint/unbound-method */
87687          this.sBegin, this.sBeginWhitespace, this.sDoctype, this.sDoctypeQuote, this.sDTD, this.sDTDQuoted, this.sDTDOpenWaka, this.sDTDOpenWakaBang, this.sDTDComment, this.sDTDCommentEnding, this.sDTDCommentEnded, this.sDTDPI, this.sDTDPIEnding, this.sText, this.sEntity, this.sOpenWaka, this.sOpenWakaBang, this.sComment, this.sCommentEnding, this.sCommentEnded, this.sCData, this.sCDataEnding, this.sCDataEnding2, this.sPIFirstChar, this.sPIRest, this.sPIBody, this.sPIEnding, this.sXMLDeclNameStart, this.sXMLDeclName, this.sXMLDeclEq, this.sXMLDeclValueStart, this.sXMLDeclValue, this.sXMLDeclSeparator, this.sXMLDeclEnding, this.sOpenTag, this.sOpenTagSlash, this.sAttrib, this.sAttribName, this.sAttribNameSawWhite, this.sAttribValue, this.sAttribValueQuoted, this.sAttribValueClosed, this.sAttribValueUnquoted, this.sCloseTag, this.sCloseTagSawWhite];
87688
87689          this._init();
87690        }
87691        /**
87692         * Indicates whether or not the parser is closed. If ``true``, wait for
87693         * the ``ready`` event to write again.
87694         */
87695
87696
87697        _createClass2(SaxesParser, [{
87698          key: "_init",
87699          value: function _init() {
87700            var _a;
87701
87702            this.openWakaBang = "";
87703            this.text = "";
87704            this.name = "";
87705            this.piTarget = "";
87706            this.entity = "";
87707            this.q = null;
87708            this.tags = [];
87709            this.tag = null;
87710            this.topNS = null;
87711            this.chunk = "";
87712            this.chunkPosition = 0;
87713            this.i = 0;
87714            this.prevI = 0;
87715            this.carriedFromPrevious = undefined;
87716            this.forbiddenState = FORBIDDEN_START;
87717            this.attribList = []; // The logic is organized so as to minimize the need to check
87718            // this.opt.fragment while parsing.
87719
87720            var fragmentOpt = this.fragmentOpt;
87721            this.state = fragmentOpt ? S_TEXT : S_BEGIN; // We want these to be all true if we are dealing with a fragment.
87722
87723            this.reportedTextBeforeRoot = this.reportedTextAfterRoot = this.closedRoot = this.sawRoot = fragmentOpt; // An XML declaration is intially possible only when parsing whole
87724            // documents.
87725
87726            this.xmlDeclPossible = !fragmentOpt;
87727            this.xmlDeclExpects = ["version"];
87728            this.entityReturnState = undefined;
87729            var defaultXMLVersion = this.opt.defaultXMLVersion;
87730
87731            if (defaultXMLVersion === undefined) {
87732              if (this.opt.forceXMLVersion === true) {
87733                throw new Error("forceXMLVersion set but defaultXMLVersion is not set");
87734              }
87735
87736              defaultXMLVersion = "1.0";
87737            }
87738
87739            this.setXMLVersion(defaultXMLVersion);
87740            this.positionAtNewLine = 0;
87741            this.doctype = false;
87742            this._closed = false;
87743            this.xmlDecl = {
87744              version: undefined,
87745              encoding: undefined,
87746              standalone: undefined
87747            };
87748            this.line = 1;
87749            this.column = 0;
87750            this.ENTITIES = Object.create(XML_ENTITIES); // eslint-disable-next-line no-unused-expressions
87751
87752            (_a = this.readyHandler) === null || _a === void 0 ? void 0 : _a.call(this);
87753          }
87754          /**
87755           * The stream position the parser is currently looking at. This field is
87756           * zero-based.
87757           *
87758           * This field is not based on counting Unicode characters but is to be
87759           * interpreted as a plain index into a JavaScript string.
87760           */
87761
87762        }, {
87763          key: "on",
87764
87765          /**
87766           * Set an event listener on an event. The parser supports one handler per
87767           * event type. If you try to set an event handler over an existing handler,
87768           * the old handler is silently overwritten.
87769           *
87770           * @param name The event to listen to.
87771           *
87772           * @param handler The handler to set.
87773           */
87774          value: function on(name, handler) {
87775            // eslint-disable-next-line @typescript-eslint/no-explicit-any
87776            this[EVENT_NAME_TO_HANDLER_NAME[name]] = handler;
87777          }
87778          /**
87779           * Unset an event handler.
87780           *
87781           * @parma name The event to stop listening to.
87782           */
87783
87784        }, {
87785          key: "off",
87786          value: function off(name) {
87787            // eslint-disable-next-line @typescript-eslint/no-explicit-any
87788            this[EVENT_NAME_TO_HANDLER_NAME[name]] = undefined;
87789          }
87790          /**
87791           * Make an error object. The error object will have a message that contains
87792           * the ``fileName`` option passed at the creation of the parser. If position
87793           * tracking was turned on, it will also have line and column number
87794           * information.
87795           *
87796           * @param message The message describing the error to report.
87797           *
87798           * @returns An error object with a properly formatted message.
87799           */
87800
87801        }, {
87802          key: "makeError",
87803          value: function makeError(message) {
87804            var _a;
87805
87806            var msg = (_a = this.fileName) !== null && _a !== void 0 ? _a : "";
87807
87808            if (this.trackPosition) {
87809              if (msg.length > 0) {
87810                msg += ":";
87811              }
87812
87813              msg += "".concat(this.line, ":").concat(this.column);
87814            }
87815
87816            if (msg.length > 0) {
87817              msg += ": ";
87818            }
87819
87820            return new Error(msg + message);
87821          }
87822          /**
87823           * Report a parsing error. This method is made public so that client code may
87824           * check for issues that are outside the scope of this project and can report
87825           * errors.
87826           *
87827           * @param message The error to report.
87828           *
87829           * @returns this
87830           */
87831
87832        }, {
87833          key: "fail",
87834          value: function fail(message) {
87835            var err = this.makeError(message);
87836            var handler = this.errorHandler;
87837
87838            if (handler === undefined) {
87839              throw err;
87840            } else {
87841              handler(err);
87842            }
87843
87844            return this;
87845          }
87846          /**
87847           * Write a XML data to the parser.
87848           *
87849           * @param chunk The XML data to write.
87850           *
87851           * @returns this
87852           */
87853
87854        }, {
87855          key: "write",
87856          value: function write(chunk) {
87857            if (this.closed) {
87858              return this.fail("cannot write after close; assign an onready handler.");
87859            }
87860
87861            var end = false;
87862
87863            if (chunk === null) {
87864              // We cannot return immediately because carriedFromPrevious may need
87865              // processing.
87866              end = true;
87867              chunk = "";
87868            } else if (_typeof2(chunk) === "object") {
87869              chunk = chunk.toString();
87870            } // We checked if performing a pre-decomposition of the string into an array
87871            // of single complete characters (``Array.from(chunk)``) would be faster
87872            // than the current repeated calls to ``charCodeAt``. As of August 2018, it
87873            // isn't. (There may be Node-specific code that would perform faster than
87874            // ``Array.from`` but don't want to be dependent on Node.)
87875
87876
87877            if (this.carriedFromPrevious !== undefined) {
87878              // The previous chunk had char we must carry over.
87879              chunk = "".concat(this.carriedFromPrevious).concat(chunk);
87880              this.carriedFromPrevious = undefined;
87881            }
87882
87883            var limit = chunk.length;
87884            var lastCode = chunk.charCodeAt(limit - 1);
87885
87886            if (!end && ( // A trailing CR or surrogate must be carried over to the next
87887            // chunk.
87888            lastCode === CR || lastCode >= 0xD800 && lastCode <= 0xDBFF)) {
87889              // The chunk ends with a character that must be carried over. We cannot
87890              // know how to handle it until we get the next chunk or the end of the
87891              // stream. So save it for later.
87892              this.carriedFromPrevious = chunk[limit - 1];
87893              limit--;
87894              chunk = chunk.slice(0, limit);
87895            }
87896
87897            var stateTable = this.stateTable;
87898            this.chunk = chunk;
87899            this.i = 0;
87900
87901            while (this.i < limit) {
87902              // eslint-disable-next-line @typescript-eslint/no-explicit-any
87903              stateTable[this.state].call(this);
87904            }
87905
87906            this.chunkPosition += limit;
87907            return end ? this.end() : this;
87908          }
87909          /**
87910           * Close the current stream. Perform final well-formedness checks and reset
87911           * the parser tstate.
87912           *
87913           * @returns this
87914           */
87915
87916        }, {
87917          key: "close",
87918          value: function close() {
87919            return this.write(null);
87920          }
87921          /**
87922           * Get a single code point out of the current chunk. This updates the current
87923           * position if we do position tracking.
87924           *
87925           * This is the algorithm to use for XML 1.0.
87926           *
87927           * @returns The character read.
87928           */
87929
87930        }, {
87931          key: "getCode10",
87932          value: function getCode10() {
87933            var chunk = this.chunk,
87934                i = this.i;
87935            this.prevI = i; // Yes, we do this instead of doing this.i++. Doing it this way, we do not
87936            // read this.i again, which is a bit faster.
87937
87938            this.i = i + 1;
87939
87940            if (i >= chunk.length) {
87941              return EOC;
87942            } // Using charCodeAt and handling the surrogates ourselves is faster
87943            // than using codePointAt.
87944
87945
87946            var code = chunk.charCodeAt(i);
87947            this.column++;
87948
87949            if (code < 0xD800) {
87950              if (code >= SPACE || code === TAB) {
87951                return code;
87952              }
87953
87954              switch (code) {
87955                case NL:
87956                  this.line++;
87957                  this.column = 0;
87958                  this.positionAtNewLine = this.position;
87959                  return NL;
87960
87961                case CR:
87962                  // We may get NaN if we read past the end of the chunk, which is fine.
87963                  if (chunk.charCodeAt(i + 1) === NL) {
87964                    // A \r\n sequence is converted to \n so we have to skip over the
87965                    // next character. We already know it has a size of 1 so ++ is fine
87966                    // here.
87967                    this.i = i + 2;
87968                  } // Otherwise, a \r is just converted to \n, so we don't have to skip
87969                  // ahead.
87970                  // In either case, \r becomes \n.
87971
87972
87973                  this.line++;
87974                  this.column = 0;
87975                  this.positionAtNewLine = this.position;
87976                  return NL_LIKE;
87977
87978                default:
87979                  // If we get here, then code < SPACE and it is not NL CR or TAB.
87980                  this.fail("disallowed character.");
87981                  return code;
87982              }
87983            }
87984
87985            if (code > 0xDBFF) {
87986              // This is a specialized version of isChar10 that takes into account
87987              // that in this context code > 0xDBFF and code <= 0xFFFF. So it does not
87988              // test cases that don't need testing.
87989              if (!(code >= 0xE000 && code <= 0xFFFD)) {
87990                this.fail("disallowed character.");
87991              }
87992
87993              return code;
87994            }
87995
87996            var final = 0x10000 + (code - 0xD800) * 0x400 + (chunk.charCodeAt(i + 1) - 0xDC00);
87997            this.i = i + 2; // This is a specialized version of isChar10 that takes into account that in
87998            // this context necessarily final >= 0x10000.
87999
88000            if (final > 0x10FFFF) {
88001              this.fail("disallowed character.");
88002            }
88003
88004            return final;
88005          }
88006          /**
88007           * Get a single code point out of the current chunk. This updates the current
88008           * position if we do position tracking.
88009           *
88010           * This is the algorithm to use for XML 1.1.
88011           *
88012           * @returns {number} The character read.
88013           */
88014
88015        }, {
88016          key: "getCode11",
88017          value: function getCode11() {
88018            var chunk = this.chunk,
88019                i = this.i;
88020            this.prevI = i; // Yes, we do this instead of doing this.i++. Doing it this way, we do not
88021            // read this.i again, which is a bit faster.
88022
88023            this.i = i + 1;
88024
88025            if (i >= chunk.length) {
88026              return EOC;
88027            } // Using charCodeAt and handling the surrogates ourselves is faster
88028            // than using codePointAt.
88029
88030
88031            var code = chunk.charCodeAt(i);
88032            this.column++;
88033
88034            if (code < 0xD800) {
88035              if (code > 0x1F && code < 0x7F || code > 0x9F && code !== LS || code === TAB) {
88036                return code;
88037              }
88038
88039              switch (code) {
88040                case NL:
88041                  // 0xA
88042                  this.line++;
88043                  this.column = 0;
88044                  this.positionAtNewLine = this.position;
88045                  return NL;
88046
88047                case CR:
88048                  {
88049                    // 0xD
88050                    // We may get NaN if we read past the end of the chunk, which is
88051                    // fine.
88052                    var next = chunk.charCodeAt(i + 1);
88053
88054                    if (next === NL || next === NEL) {
88055                      // A CR NL or CR NEL sequence is converted to NL so we have to skip
88056                      // over the next character. We already know it has a size of 1.
88057                      this.i = i + 2;
88058                    } // Otherwise, a CR is just converted to NL, no skip.
88059
88060                  }
88061
88062                /* yes, fall through */
88063
88064                case NEL: // 0x85
88065
88066                case LS:
88067                  // Ox2028
88068                  this.line++;
88069                  this.column = 0;
88070                  this.positionAtNewLine = this.position;
88071                  return NL_LIKE;
88072
88073                default:
88074                  this.fail("disallowed character.");
88075                  return code;
88076              }
88077            }
88078
88079            if (code > 0xDBFF) {
88080              // This is a specialized version of isCharAndNotRestricted that takes into
88081              // account that in this context code > 0xDBFF and code <= 0xFFFF. So it
88082              // does not test cases that don't need testing.
88083              if (!(code >= 0xE000 && code <= 0xFFFD)) {
88084                this.fail("disallowed character.");
88085              }
88086
88087              return code;
88088            }
88089
88090            var final = 0x10000 + (code - 0xD800) * 0x400 + (chunk.charCodeAt(i + 1) - 0xDC00);
88091            this.i = i + 2; // This is a specialized version of isCharAndNotRestricted that takes into
88092            // account that in this context necessarily final >= 0x10000.
88093
88094            if (final > 0x10FFFF) {
88095              this.fail("disallowed character.");
88096            }
88097
88098            return final;
88099          }
88100          /**
88101           * Like ``getCode`` but with the return value normalized so that ``NL`` is
88102           * returned for ``NL_LIKE``.
88103           */
88104
88105        }, {
88106          key: "getCodeNorm",
88107          value: function getCodeNorm() {
88108            var c = this.getCode();
88109            return c === NL_LIKE ? NL : c;
88110          }
88111        }, {
88112          key: "unget",
88113          value: function unget() {
88114            this.i = this.prevI;
88115            this.column--;
88116          }
88117          /**
88118           * Capture characters into a buffer until encountering one of a set of
88119           * characters.
88120           *
88121           * @param chars An array of codepoints. Encountering a character in the array
88122           * ends the capture. (``chars`` may safely contain ``NL``.)
88123           *
88124           * @return The character code that made the capture end, or ``EOC`` if we hit
88125           * the end of the chunk. The return value cannot be NL_LIKE: NL is returned
88126           * instead.
88127           */
88128
88129        }, {
88130          key: "captureTo",
88131          value: function captureTo(chars) {
88132            var start = this.i;
88133            var chunk = this.chunk; // eslint-disable-next-line no-constant-condition
88134
88135            while (true) {
88136              var c = this.getCode();
88137              var isNLLike = c === NL_LIKE;
88138              var final = isNLLike ? NL : c;
88139
88140              if (final === EOC || chars.includes(final)) {
88141                this.text += chunk.slice(start, this.prevI);
88142                return final;
88143              }
88144
88145              if (isNLLike) {
88146                this.text += "".concat(chunk.slice(start, this.prevI), "\n");
88147                start = this.i;
88148              }
88149            }
88150          }
88151          /**
88152           * Capture characters into a buffer until encountering a character.
88153           *
88154           * @param char The codepoint that ends the capture. **NOTE ``char`` MAY NOT
88155           * CONTAIN ``NL``.** Passing ``NL`` will result in buggy behavior.
88156           *
88157           * @return ``true`` if we ran into the character. Otherwise, we ran into the
88158           * end of the current chunk.
88159           */
88160
88161        }, {
88162          key: "captureToChar",
88163          value: function captureToChar(char) {
88164            var start = this.i;
88165            var chunk = this.chunk; // eslint-disable-next-line no-constant-condition
88166
88167            while (true) {
88168              var c = this.getCode();
88169
88170              switch (c) {
88171                case NL_LIKE:
88172                  this.text += "".concat(chunk.slice(start, this.prevI), "\n");
88173                  start = this.i;
88174                  c = NL;
88175                  break;
88176
88177                case EOC:
88178                  this.text += chunk.slice(start);
88179                  return false;
88180
88181                default:
88182              }
88183
88184              if (c === char) {
88185                this.text += chunk.slice(start, this.prevI);
88186                return true;
88187              }
88188            }
88189          }
88190          /**
88191           * Capture characters that satisfy ``isNameChar`` into the ``name`` field of
88192           * this parser.
88193           *
88194           * @return The character code that made the test fail, or ``EOC`` if we hit
88195           * the end of the chunk. The return value cannot be NL_LIKE: NL is returned
88196           * instead.
88197           */
88198
88199        }, {
88200          key: "captureNameChars",
88201          value: function captureNameChars() {
88202            var chunk = this.chunk,
88203                start = this.i; // eslint-disable-next-line no-constant-condition
88204
88205            while (true) {
88206              var c = this.getCode();
88207
88208              if (c === EOC) {
88209                this.name += chunk.slice(start);
88210                return EOC;
88211              } // NL is not a name char so we don't have to test specifically for it.
88212
88213
88214              if (!isNameChar(c)) {
88215                this.name += chunk.slice(start, this.prevI);
88216                return c === NL_LIKE ? NL : c;
88217              }
88218            }
88219          }
88220          /**
88221           * Skip white spaces.
88222           *
88223           * @return The character that ended the skip, or ``EOC`` if we hit
88224           * the end of the chunk. The return value cannot be NL_LIKE: NL is returned
88225           * instead.
88226           */
88227
88228        }, {
88229          key: "skipSpaces",
88230          value: function skipSpaces() {
88231            // eslint-disable-next-line no-constant-condition
88232            while (true) {
88233              var c = this.getCodeNorm();
88234
88235              if (c === EOC || !isS(c)) {
88236                return c;
88237              }
88238            }
88239          }
88240        }, {
88241          key: "setXMLVersion",
88242          value: function setXMLVersion(version) {
88243            this.currentXMLVersion = version;
88244            /*  eslint-disable @typescript-eslint/unbound-method */
88245
88246            if (version === "1.0") {
88247              this.isChar = isChar10;
88248              this.getCode = this.getCode10;
88249            } else {
88250              this.isChar = isChar11;
88251              this.getCode = this.getCode11;
88252            }
88253            /* eslint-enable @typescript-eslint/unbound-method */
88254
88255          } // STATE ENGINE METHODS
88256          // This needs to be a state separate from S_BEGIN_WHITESPACE because we want
88257          // to be sure never to come back to this state later.
88258
88259        }, {
88260          key: "sBegin",
88261          value: function sBegin() {
88262            // We are essentially peeking at the first character of the chunk. Since
88263            // S_BEGIN can be in effect only when we start working on the first chunk,
88264            // the index at which we must look is necessarily 0. Note also that the
88265            // following test does not depend on decoding surrogates.
88266            // If the initial character is 0xFEFF, ignore it.
88267            if (this.chunk.charCodeAt(0) === 0xFEFF) {
88268              this.i++;
88269              this.column++;
88270            }
88271
88272            this.state = S_BEGIN_WHITESPACE;
88273          }
88274        }, {
88275          key: "sBeginWhitespace",
88276          value: function sBeginWhitespace() {
88277            // We need to know whether we've encountered spaces or not because as soon
88278            // as we run into a space, an XML declaration is no longer possible. Rather
88279            // than slow down skipSpaces even in places where we don't care whether it
88280            // skipped anything or not, we check whether prevI is equal to the value of
88281            // i from before we skip spaces.
88282            var iBefore = this.i;
88283            var c = this.skipSpaces();
88284
88285            if (this.prevI !== iBefore) {
88286              this.xmlDeclPossible = false;
88287            }
88288
88289            switch (c) {
88290              case LESS:
88291                this.state = S_OPEN_WAKA; // We could naively call closeText but in this state, it is not normal
88292                // to have text be filled with any data.
88293
88294                if (this.text.length !== 0) {
88295                  throw new Error("no-empty text at start");
88296                }
88297
88298                break;
88299
88300              case EOC:
88301                break;
88302
88303              default:
88304                this.unget();
88305                this.state = S_TEXT;
88306                this.xmlDeclPossible = false;
88307            }
88308          }
88309        }, {
88310          key: "sDoctype",
88311          value: function sDoctype() {
88312            var _a;
88313
88314            var c = this.captureTo(DOCTYPE_TERMINATOR);
88315
88316            switch (c) {
88317              case GREATER:
88318                {
88319                  // eslint-disable-next-line no-unused-expressions
88320                  (_a = this.doctypeHandler) === null || _a === void 0 ? void 0 : _a.call(this, this.text);
88321                  this.text = "";
88322                  this.state = S_TEXT;
88323                  this.doctype = true; // just remember that we saw it.
88324
88325                  break;
88326                }
88327
88328              case EOC:
88329                break;
88330
88331              default:
88332                this.text += String.fromCodePoint(c);
88333
88334                if (c === OPEN_BRACKET) {
88335                  this.state = S_DTD;
88336                } else if (isQuote(c)) {
88337                  this.state = S_DOCTYPE_QUOTE;
88338                  this.q = c;
88339                }
88340
88341            }
88342          }
88343        }, {
88344          key: "sDoctypeQuote",
88345          value: function sDoctypeQuote() {
88346            var q = this.q;
88347
88348            if (this.captureToChar(q)) {
88349              this.text += String.fromCodePoint(q);
88350              this.q = null;
88351              this.state = S_DOCTYPE;
88352            }
88353          }
88354        }, {
88355          key: "sDTD",
88356          value: function sDTD() {
88357            var c = this.captureTo(DTD_TERMINATOR);
88358
88359            if (c === EOC) {
88360              return;
88361            }
88362
88363            this.text += String.fromCodePoint(c);
88364
88365            if (c === CLOSE_BRACKET) {
88366              this.state = S_DOCTYPE;
88367            } else if (c === LESS) {
88368              this.state = S_DTD_OPEN_WAKA;
88369            } else if (isQuote(c)) {
88370              this.state = S_DTD_QUOTED;
88371              this.q = c;
88372            }
88373          }
88374        }, {
88375          key: "sDTDQuoted",
88376          value: function sDTDQuoted() {
88377            var q = this.q;
88378
88379            if (this.captureToChar(q)) {
88380              this.text += String.fromCodePoint(q);
88381              this.state = S_DTD;
88382              this.q = null;
88383            }
88384          }
88385        }, {
88386          key: "sDTDOpenWaka",
88387          value: function sDTDOpenWaka() {
88388            var c = this.getCodeNorm();
88389            this.text += String.fromCodePoint(c);
88390
88391            switch (c) {
88392              case BANG:
88393                this.state = S_DTD_OPEN_WAKA_BANG;
88394                this.openWakaBang = "";
88395                break;
88396
88397              case QUESTION:
88398                this.state = S_DTD_PI;
88399                break;
88400
88401              default:
88402                this.state = S_DTD;
88403            }
88404          }
88405        }, {
88406          key: "sDTDOpenWakaBang",
88407          value: function sDTDOpenWakaBang() {
88408            var char = String.fromCodePoint(this.getCodeNorm());
88409            var owb = this.openWakaBang += char;
88410            this.text += char;
88411
88412            if (owb !== "-") {
88413              this.state = owb === "--" ? S_DTD_COMMENT : S_DTD;
88414              this.openWakaBang = "";
88415            }
88416          }
88417        }, {
88418          key: "sDTDComment",
88419          value: function sDTDComment() {
88420            if (this.captureToChar(MINUS)) {
88421              this.text += "-";
88422              this.state = S_DTD_COMMENT_ENDING;
88423            }
88424          }
88425        }, {
88426          key: "sDTDCommentEnding",
88427          value: function sDTDCommentEnding() {
88428            var c = this.getCodeNorm();
88429            this.text += String.fromCodePoint(c);
88430            this.state = c === MINUS ? S_DTD_COMMENT_ENDED : S_DTD_COMMENT;
88431          }
88432        }, {
88433          key: "sDTDCommentEnded",
88434          value: function sDTDCommentEnded() {
88435            var c = this.getCodeNorm();
88436            this.text += String.fromCodePoint(c);
88437
88438            if (c === GREATER) {
88439              this.state = S_DTD;
88440            } else {
88441              this.fail("malformed comment."); // <!-- blah -- bloo --> will be recorded as
88442              // a comment of " blah -- bloo "
88443
88444              this.state = S_DTD_COMMENT;
88445            }
88446          }
88447        }, {
88448          key: "sDTDPI",
88449          value: function sDTDPI() {
88450            if (this.captureToChar(QUESTION)) {
88451              this.text += "?";
88452              this.state = S_DTD_PI_ENDING;
88453            }
88454          }
88455        }, {
88456          key: "sDTDPIEnding",
88457          value: function sDTDPIEnding() {
88458            var c = this.getCodeNorm();
88459            this.text += String.fromCodePoint(c);
88460
88461            if (c === GREATER) {
88462              this.state = S_DTD;
88463            }
88464          }
88465        }, {
88466          key: "sText",
88467          value: function sText() {
88468            //
88469            // We did try a version of saxes where the S_TEXT state was split in two
88470            // states: one for text inside the root element, and one for text
88471            // outside. This was avoiding having to test this.tags.length to decide
88472            // what implementation to actually use.
88473            //
88474            // Peformance testing on gigabyte-size files did not show any advantage to
88475            // using the two states solution instead of the current one. Conversely, it
88476            // made the code a bit more complicated elsewhere. For instance, a comment
88477            // can appear before the root element so when a comment ended it was
88478            // necessary to determine whether to return to the S_TEXT state or to the
88479            // new text-outside-root state.
88480            //
88481            if (this.tags.length !== 0) {
88482              this.handleTextInRoot();
88483            } else {
88484              this.handleTextOutsideRoot();
88485            }
88486          }
88487        }, {
88488          key: "sEntity",
88489          value: function sEntity() {
88490            // This is essentially a specialized version of captureToChar(SEMICOLON...)
88491            var start = this.i;
88492            var chunk = this.chunk; // eslint-disable-next-line no-labels, no-restricted-syntax
88493
88494            loop: // eslint-disable-next-line no-constant-condition
88495            while (true) {
88496              switch (this.getCode()) {
88497                case NL_LIKE:
88498                  this.entity += "".concat(chunk.slice(start, this.prevI), "\n");
88499                  start = this.i;
88500                  break;
88501
88502                case SEMICOLON:
88503                  {
88504                    var entityReturnState = this.entityReturnState;
88505                    var entity = this.entity + chunk.slice(start, this.prevI);
88506                    this.state = entityReturnState;
88507                    var parsed = void 0;
88508
88509                    if (entity === "") {
88510                      this.fail("empty entity name.");
88511                      parsed = "&;";
88512                    } else {
88513                      parsed = this.parseEntity(entity);
88514                      this.entity = "";
88515                    }
88516
88517                    if (entityReturnState !== S_TEXT || this.textHandler !== undefined) {
88518                      this.text += parsed;
88519                    } // eslint-disable-next-line no-labels
88520
88521
88522                    break loop;
88523                  }
88524
88525                case EOC:
88526                  this.entity += chunk.slice(start); // eslint-disable-next-line no-labels
88527
88528                  break loop;
88529
88530                default:
88531              }
88532            }
88533          }
88534        }, {
88535          key: "sOpenWaka",
88536          value: function sOpenWaka() {
88537            // Reminder: a state handler is called with at least one character
88538            // available in the current chunk. So the first call to get code inside of
88539            // a state handler cannot return ``EOC``. That's why we don't test
88540            // for it.
88541            var c = this.getCode(); // either a /, ?, !, or text is coming next.
88542
88543            if (isNameStartChar(c)) {
88544              this.state = S_OPEN_TAG;
88545              this.unget();
88546              this.xmlDeclPossible = false;
88547            } else {
88548              switch (c) {
88549                case FORWARD_SLASH:
88550                  this.state = S_CLOSE_TAG;
88551                  this.xmlDeclPossible = false;
88552                  break;
88553
88554                case BANG:
88555                  this.state = S_OPEN_WAKA_BANG;
88556                  this.openWakaBang = "";
88557                  this.xmlDeclPossible = false;
88558                  break;
88559
88560                case QUESTION:
88561                  this.state = S_PI_FIRST_CHAR;
88562                  break;
88563
88564                default:
88565                  this.fail("disallowed character in tag name");
88566                  this.state = S_TEXT;
88567                  this.xmlDeclPossible = false;
88568              }
88569            }
88570          }
88571        }, {
88572          key: "sOpenWakaBang",
88573          value: function sOpenWakaBang() {
88574            this.openWakaBang += String.fromCodePoint(this.getCodeNorm());
88575
88576            switch (this.openWakaBang) {
88577              case "[CDATA[":
88578                if (!this.sawRoot && !this.reportedTextBeforeRoot) {
88579                  this.fail("text data outside of root node.");
88580                  this.reportedTextBeforeRoot = true;
88581                }
88582
88583                if (this.closedRoot && !this.reportedTextAfterRoot) {
88584                  this.fail("text data outside of root node.");
88585                  this.reportedTextAfterRoot = true;
88586                }
88587
88588                this.state = S_CDATA;
88589                this.openWakaBang = "";
88590                break;
88591
88592              case "--":
88593                this.state = S_COMMENT;
88594                this.openWakaBang = "";
88595                break;
88596
88597              case "DOCTYPE":
88598                this.state = S_DOCTYPE;
88599
88600                if (this.doctype || this.sawRoot) {
88601                  this.fail("inappropriately located doctype declaration.");
88602                }
88603
88604                this.openWakaBang = "";
88605                break;
88606
88607              default:
88608                // 7 happens to be the maximum length of the string that can possibly
88609                // match one of the cases above.
88610                if (this.openWakaBang.length >= 7) {
88611                  this.fail("incorrect syntax.");
88612                }
88613
88614            }
88615          }
88616        }, {
88617          key: "sComment",
88618          value: function sComment() {
88619            if (this.captureToChar(MINUS)) {
88620              this.state = S_COMMENT_ENDING;
88621            }
88622          }
88623        }, {
88624          key: "sCommentEnding",
88625          value: function sCommentEnding() {
88626            var _a;
88627
88628            var c = this.getCodeNorm();
88629
88630            if (c === MINUS) {
88631              this.state = S_COMMENT_ENDED; // eslint-disable-next-line no-unused-expressions
88632
88633              (_a = this.commentHandler) === null || _a === void 0 ? void 0 : _a.call(this, this.text);
88634              this.text = "";
88635            } else {
88636              this.text += "-".concat(String.fromCodePoint(c));
88637              this.state = S_COMMENT;
88638            }
88639          }
88640        }, {
88641          key: "sCommentEnded",
88642          value: function sCommentEnded() {
88643            var c = this.getCodeNorm();
88644
88645            if (c !== GREATER) {
88646              this.fail("malformed comment."); // <!-- blah -- bloo --> will be recorded as
88647              // a comment of " blah -- bloo "
88648
88649              this.text += "--".concat(String.fromCodePoint(c));
88650              this.state = S_COMMENT;
88651            } else {
88652              this.state = S_TEXT;
88653            }
88654          }
88655        }, {
88656          key: "sCData",
88657          value: function sCData() {
88658            if (this.captureToChar(CLOSE_BRACKET)) {
88659              this.state = S_CDATA_ENDING;
88660            }
88661          }
88662        }, {
88663          key: "sCDataEnding",
88664          value: function sCDataEnding() {
88665            var c = this.getCodeNorm();
88666
88667            if (c === CLOSE_BRACKET) {
88668              this.state = S_CDATA_ENDING_2;
88669            } else {
88670              this.text += "]".concat(String.fromCodePoint(c));
88671              this.state = S_CDATA;
88672            }
88673          }
88674        }, {
88675          key: "sCDataEnding2",
88676          value: function sCDataEnding2() {
88677            var _a;
88678
88679            var c = this.getCodeNorm();
88680
88681            switch (c) {
88682              case GREATER:
88683                {
88684                  // eslint-disable-next-line no-unused-expressions
88685                  (_a = this.cdataHandler) === null || _a === void 0 ? void 0 : _a.call(this, this.text);
88686                  this.text = "";
88687                  this.state = S_TEXT;
88688                  break;
88689                }
88690
88691              case CLOSE_BRACKET:
88692                this.text += "]";
88693                break;
88694
88695              default:
88696                this.text += "]]".concat(String.fromCodePoint(c));
88697                this.state = S_CDATA;
88698            }
88699          } // We need this separate state to check the first character fo the pi target
88700          // with this.nameStartCheck which allows less characters than this.nameCheck.
88701
88702        }, {
88703          key: "sPIFirstChar",
88704          value: function sPIFirstChar() {
88705            var c = this.getCodeNorm(); // This is first because in the case where the file is well-formed this is
88706            // the branch taken. We optimize for well-formedness.
88707
88708            if (this.nameStartCheck(c)) {
88709              this.piTarget += String.fromCodePoint(c);
88710              this.state = S_PI_REST;
88711            } else if (c === QUESTION || isS(c)) {
88712              this.fail("processing instruction without a target.");
88713              this.state = c === QUESTION ? S_PI_ENDING : S_PI_BODY;
88714            } else {
88715              this.fail("disallowed character in processing instruction name.");
88716              this.piTarget += String.fromCodePoint(c);
88717              this.state = S_PI_REST;
88718            }
88719          }
88720        }, {
88721          key: "sPIRest",
88722          value: function sPIRest() {
88723            // Capture characters into a piTarget while ``this.nameCheck`` run on the
88724            // character read returns true.
88725            var chunk = this.chunk,
88726                start = this.i; // eslint-disable-next-line no-constant-condition
88727
88728            while (true) {
88729              var c = this.getCodeNorm();
88730
88731              if (c === EOC) {
88732                this.piTarget += chunk.slice(start);
88733                return;
88734              } // NL cannot satisfy this.nameCheck so we don't have to test specifically
88735              // for it.
88736
88737
88738              if (!this.nameCheck(c)) {
88739                this.piTarget += chunk.slice(start, this.prevI);
88740                var isQuestion = c === QUESTION;
88741
88742                if (isQuestion || isS(c)) {
88743                  if (this.piTarget === "xml") {
88744                    if (!this.xmlDeclPossible) {
88745                      this.fail("an XML declaration must be at the start of the document.");
88746                    }
88747
88748                    this.state = isQuestion ? S_XML_DECL_ENDING : S_XML_DECL_NAME_START;
88749                  } else {
88750                    this.state = isQuestion ? S_PI_ENDING : S_PI_BODY;
88751                  }
88752                } else {
88753                  this.fail("disallowed character in processing instruction name.");
88754                  this.piTarget += String.fromCodePoint(c);
88755                }
88756
88757                break;
88758              }
88759            }
88760          }
88761        }, {
88762          key: "sPIBody",
88763          value: function sPIBody() {
88764            if (this.text.length === 0) {
88765              var c = this.getCodeNorm();
88766
88767              if (c === QUESTION) {
88768                this.state = S_PI_ENDING;
88769              } else if (!isS(c)) {
88770                this.text = String.fromCodePoint(c);
88771              }
88772            } // The question mark character is not valid inside any of the XML
88773            // declaration name/value pairs.
88774            else if (this.captureToChar(QUESTION)) {
88775                this.state = S_PI_ENDING;
88776              }
88777          }
88778        }, {
88779          key: "sPIEnding",
88780          value: function sPIEnding() {
88781            var _a;
88782
88783            var c = this.getCodeNorm();
88784
88785            if (c === GREATER) {
88786              var piTarget = this.piTarget;
88787
88788              if (piTarget.toLowerCase() === "xml") {
88789                this.fail("the XML declaration must appear at the start of the document.");
88790              } // eslint-disable-next-line no-unused-expressions
88791
88792
88793              (_a = this.piHandler) === null || _a === void 0 ? void 0 : _a.call(this, {
88794                target: piTarget,
88795                body: this.text
88796              });
88797              this.piTarget = this.text = "";
88798              this.state = S_TEXT;
88799            } else if (c === QUESTION) {
88800              // We ran into ?? as part of a processing instruction. We initially took
88801              // the first ? as a sign that the PI was ending, but it is not. So we have
88802              // to add it to the body but we take the new ? as a sign that the PI is
88803              // ending.
88804              this.text += "?";
88805            } else {
88806              this.text += "?".concat(String.fromCodePoint(c));
88807              this.state = S_PI_BODY;
88808            }
88809
88810            this.xmlDeclPossible = false;
88811          }
88812        }, {
88813          key: "sXMLDeclNameStart",
88814          value: function sXMLDeclNameStart() {
88815            var c = this.skipSpaces(); // The question mark character is not valid inside any of the XML
88816            // declaration name/value pairs.
88817
88818            if (c === QUESTION) {
88819              // It is valid to go to S_XML_DECL_ENDING from this state.
88820              this.state = S_XML_DECL_ENDING;
88821              return;
88822            }
88823
88824            if (c !== EOC) {
88825              this.state = S_XML_DECL_NAME;
88826              this.name = String.fromCodePoint(c);
88827            }
88828          }
88829        }, {
88830          key: "sXMLDeclName",
88831          value: function sXMLDeclName() {
88832            var c = this.captureTo(XML_DECL_NAME_TERMINATOR); // The question mark character is not valid inside any of the XML
88833            // declaration name/value pairs.
88834
88835            if (c === QUESTION) {
88836              this.state = S_XML_DECL_ENDING;
88837              this.name += this.text;
88838              this.text = "";
88839              this.fail("XML declaration is incomplete.");
88840              return;
88841            }
88842
88843            if (!(isS(c) || c === EQUAL)) {
88844              return;
88845            }
88846
88847            this.name += this.text;
88848            this.text = "";
88849
88850            if (!this.xmlDeclExpects.includes(this.name)) {
88851              switch (this.name.length) {
88852                case 0:
88853                  this.fail("did not expect any more name/value pairs.");
88854                  break;
88855
88856                case 1:
88857                  this.fail("expected the name ".concat(this.xmlDeclExpects[0], "."));
88858                  break;
88859
88860                default:
88861                  this.fail("expected one of ".concat(this.xmlDeclExpects.join(", ")));
88862              }
88863            }
88864
88865            this.state = c === EQUAL ? S_XML_DECL_VALUE_START : S_XML_DECL_EQ;
88866          }
88867        }, {
88868          key: "sXMLDeclEq",
88869          value: function sXMLDeclEq() {
88870            var c = this.getCodeNorm(); // The question mark character is not valid inside any of the XML
88871            // declaration name/value pairs.
88872
88873            if (c === QUESTION) {
88874              this.state = S_XML_DECL_ENDING;
88875              this.fail("XML declaration is incomplete.");
88876              return;
88877            }
88878
88879            if (isS(c)) {
88880              return;
88881            }
88882
88883            if (c !== EQUAL) {
88884              this.fail("value required.");
88885            }
88886
88887            this.state = S_XML_DECL_VALUE_START;
88888          }
88889        }, {
88890          key: "sXMLDeclValueStart",
88891          value: function sXMLDeclValueStart() {
88892            var c = this.getCodeNorm(); // The question mark character is not valid inside any of the XML
88893            // declaration name/value pairs.
88894
88895            if (c === QUESTION) {
88896              this.state = S_XML_DECL_ENDING;
88897              this.fail("XML declaration is incomplete.");
88898              return;
88899            }
88900
88901            if (isS(c)) {
88902              return;
88903            }
88904
88905            if (!isQuote(c)) {
88906              this.fail("value must be quoted.");
88907              this.q = SPACE;
88908            } else {
88909              this.q = c;
88910            }
88911
88912            this.state = S_XML_DECL_VALUE;
88913          }
88914        }, {
88915          key: "sXMLDeclValue",
88916          value: function sXMLDeclValue() {
88917            var c = this.captureTo([this.q, QUESTION]); // The question mark character is not valid inside any of the XML
88918            // declaration name/value pairs.
88919
88920            if (c === QUESTION) {
88921              this.state = S_XML_DECL_ENDING;
88922              this.text = "";
88923              this.fail("XML declaration is incomplete.");
88924              return;
88925            }
88926
88927            if (c === EOC) {
88928              return;
88929            }
88930
88931            var value = this.text;
88932            this.text = "";
88933
88934            switch (this.name) {
88935              case "version":
88936                {
88937                  this.xmlDeclExpects = ["encoding", "standalone"];
88938                  var version = value;
88939                  this.xmlDecl.version = version; // This is the test specified by XML 1.0 but it is fine for XML 1.1.
88940
88941                  if (!/^1\.[0-9]+$/.test(version)) {
88942                    this.fail("version number must match /^1\\.[0-9]+$/.");
88943                  } // When forceXMLVersion is set, the XML declaration is ignored.
88944                  else if (!this.opt.forceXMLVersion) {
88945                      this.setXMLVersion(version);
88946                    }
88947
88948                  break;
88949                }
88950
88951              case "encoding":
88952                if (!/^[A-Za-z][A-Za-z0-9._-]*$/.test(value)) {
88953                  this.fail("encoding value must match \
88954/^[A-Za-z0-9][A-Za-z0-9._-]*$/.");
88955                }
88956
88957                this.xmlDeclExpects = ["standalone"];
88958                this.xmlDecl.encoding = value;
88959                break;
88960
88961              case "standalone":
88962                if (value !== "yes" && value !== "no") {
88963                  this.fail("standalone value must match \"yes\" or \"no\".");
88964                }
88965
88966                this.xmlDeclExpects = [];
88967                this.xmlDecl.standalone = value;
88968                break;
88969
88970              default: // We don't need to raise an error here since we've already raised one
88971              // when checking what name was expected.
88972
88973            }
88974
88975            this.name = "";
88976            this.state = S_XML_DECL_SEPARATOR;
88977          }
88978        }, {
88979          key: "sXMLDeclSeparator",
88980          value: function sXMLDeclSeparator() {
88981            var c = this.getCodeNorm(); // The question mark character is not valid inside any of the XML
88982            // declaration name/value pairs.
88983
88984            if (c === QUESTION) {
88985              // It is valid to go to S_XML_DECL_ENDING from this state.
88986              this.state = S_XML_DECL_ENDING;
88987              return;
88988            }
88989
88990            if (!isS(c)) {
88991              this.fail("whitespace required.");
88992              this.unget();
88993            }
88994
88995            this.state = S_XML_DECL_NAME_START;
88996          }
88997        }, {
88998          key: "sXMLDeclEnding",
88999          value: function sXMLDeclEnding() {
89000            var _a;
89001
89002            var c = this.getCodeNorm();
89003
89004            if (c === GREATER) {
89005              if (this.piTarget !== "xml") {
89006                this.fail("processing instructions are not allowed before root.");
89007              } else if (this.name !== "version" && this.xmlDeclExpects.includes("version")) {
89008                this.fail("XML declaration must contain a version.");
89009              } // eslint-disable-next-line no-unused-expressions
89010
89011
89012              (_a = this.xmldeclHandler) === null || _a === void 0 ? void 0 : _a.call(this, this.xmlDecl);
89013              this.name = "";
89014              this.piTarget = this.text = "";
89015              this.state = S_TEXT;
89016            } else {
89017              // We got here because the previous character was a ?, but the question
89018              // mark character is not valid inside any of the XML declaration
89019              // name/value pairs.
89020              this.fail("The character ? is disallowed anywhere in XML declarations.");
89021            }
89022
89023            this.xmlDeclPossible = false;
89024          }
89025        }, {
89026          key: "sOpenTag",
89027          value: function sOpenTag() {
89028            var _a;
89029
89030            var c = this.captureNameChars();
89031
89032            if (c === EOC) {
89033              return;
89034            }
89035
89036            var tag = this.tag = {
89037              name: this.name,
89038              attributes: Object.create(null)
89039            };
89040            this.name = "";
89041
89042            if (this.xmlnsOpt) {
89043              this.topNS = tag.ns = Object.create(null);
89044            } // eslint-disable-next-line no-unused-expressions
89045
89046
89047            (_a = this.openTagStartHandler) === null || _a === void 0 ? void 0 : _a.call(this, tag);
89048            this.sawRoot = true;
89049
89050            if (!this.fragmentOpt && this.closedRoot) {
89051              this.fail("documents may contain only one root.");
89052            }
89053
89054            switch (c) {
89055              case GREATER:
89056                this.openTag();
89057                break;
89058
89059              case FORWARD_SLASH:
89060                this.state = S_OPEN_TAG_SLASH;
89061                break;
89062
89063              default:
89064                if (!isS(c)) {
89065                  this.fail("disallowed character in tag name.");
89066                }
89067
89068                this.state = S_ATTRIB;
89069            }
89070          }
89071        }, {
89072          key: "sOpenTagSlash",
89073          value: function sOpenTagSlash() {
89074            if (this.getCode() === GREATER) {
89075              this.openSelfClosingTag();
89076            } else {
89077              this.fail("forward-slash in opening tag not followed by >.");
89078              this.state = S_ATTRIB;
89079            }
89080          }
89081        }, {
89082          key: "sAttrib",
89083          value: function sAttrib() {
89084            var c = this.skipSpaces();
89085
89086            if (c === EOC) {
89087              return;
89088            }
89089
89090            if (isNameStartChar(c)) {
89091              this.unget();
89092              this.state = S_ATTRIB_NAME;
89093            } else if (c === GREATER) {
89094              this.openTag();
89095            } else if (c === FORWARD_SLASH) {
89096              this.state = S_OPEN_TAG_SLASH;
89097            } else {
89098              this.fail("disallowed character in attribute name.");
89099            }
89100          }
89101        }, {
89102          key: "sAttribName",
89103          value: function sAttribName() {
89104            var c = this.captureNameChars();
89105
89106            if (c === EQUAL) {
89107              this.state = S_ATTRIB_VALUE;
89108            } else if (isS(c)) {
89109              this.state = S_ATTRIB_NAME_SAW_WHITE;
89110            } else if (c === GREATER) {
89111              this.fail("attribute without value.");
89112              this.pushAttrib(this.name, this.name);
89113              this.name = this.text = "";
89114              this.openTag();
89115            } else if (c !== EOC) {
89116              this.fail("disallowed character in attribute name.");
89117            }
89118          }
89119        }, {
89120          key: "sAttribNameSawWhite",
89121          value: function sAttribNameSawWhite() {
89122            var c = this.skipSpaces();
89123
89124            switch (c) {
89125              case EOC:
89126                return;
89127
89128              case EQUAL:
89129                this.state = S_ATTRIB_VALUE;
89130                break;
89131
89132              default:
89133                this.fail("attribute without value."); // Should we do this???
89134                // this.tag.attributes[this.name] = "";
89135
89136                this.text = "";
89137                this.name = "";
89138
89139                if (c === GREATER) {
89140                  this.openTag();
89141                } else if (isNameStartChar(c)) {
89142                  this.unget();
89143                  this.state = S_ATTRIB_NAME;
89144                } else {
89145                  this.fail("disallowed character in attribute name.");
89146                  this.state = S_ATTRIB;
89147                }
89148
89149            }
89150          }
89151        }, {
89152          key: "sAttribValue",
89153          value: function sAttribValue() {
89154            var c = this.getCodeNorm();
89155
89156            if (isQuote(c)) {
89157              this.q = c;
89158              this.state = S_ATTRIB_VALUE_QUOTED;
89159            } else if (!isS(c)) {
89160              this.fail("unquoted attribute value.");
89161              this.state = S_ATTRIB_VALUE_UNQUOTED;
89162              this.unget();
89163            }
89164          }
89165        }, {
89166          key: "sAttribValueQuoted",
89167          value: function sAttribValueQuoted() {
89168            // We deliberately do not use captureTo here. The specialized code we use
89169            // here is faster than using captureTo.
89170            var q = this.q,
89171                chunk = this.chunk;
89172            var start = this.i; // eslint-disable-next-line no-constant-condition
89173
89174            while (true) {
89175              switch (this.getCode()) {
89176                case q:
89177                  this.pushAttrib(this.name, this.text + chunk.slice(start, this.prevI));
89178                  this.name = this.text = "";
89179                  this.q = null;
89180                  this.state = S_ATTRIB_VALUE_CLOSED;
89181                  return;
89182
89183                case AMP:
89184                  this.text += chunk.slice(start, this.prevI);
89185                  this.state = S_ENTITY;
89186                  this.entityReturnState = S_ATTRIB_VALUE_QUOTED;
89187                  return;
89188
89189                case NL:
89190                case NL_LIKE:
89191                case TAB:
89192                  this.text += "".concat(chunk.slice(start, this.prevI), " ");
89193                  start = this.i;
89194                  break;
89195
89196                case LESS:
89197                  this.text += chunk.slice(start, this.prevI);
89198                  this.fail("disallowed character.");
89199                  return;
89200
89201                case EOC:
89202                  this.text += chunk.slice(start);
89203                  return;
89204
89205                default:
89206              }
89207            }
89208          }
89209        }, {
89210          key: "sAttribValueClosed",
89211          value: function sAttribValueClosed() {
89212            var c = this.getCodeNorm();
89213
89214            if (isS(c)) {
89215              this.state = S_ATTRIB;
89216            } else if (c === GREATER) {
89217              this.openTag();
89218            } else if (c === FORWARD_SLASH) {
89219              this.state = S_OPEN_TAG_SLASH;
89220            } else if (isNameStartChar(c)) {
89221              this.fail("no whitespace between attributes.");
89222              this.unget();
89223              this.state = S_ATTRIB_NAME;
89224            } else {
89225              this.fail("disallowed character in attribute name.");
89226            }
89227          }
89228        }, {
89229          key: "sAttribValueUnquoted",
89230          value: function sAttribValueUnquoted() {
89231            // We don't do anything regarding EOL or space handling for unquoted
89232            // attributes. We already have failed by the time we get here, and the
89233            // contract that saxes upholds states that upon failure, it is not safe to
89234            // rely on the data passed to event handlers (other than
89235            // ``onerror``). Passing "bad" data is not a problem.
89236            var c = this.captureTo(ATTRIB_VALUE_UNQUOTED_TERMINATOR);
89237
89238            switch (c) {
89239              case AMP:
89240                this.state = S_ENTITY;
89241                this.entityReturnState = S_ATTRIB_VALUE_UNQUOTED;
89242                break;
89243
89244              case LESS:
89245                this.fail("disallowed character.");
89246                break;
89247
89248              case EOC:
89249                break;
89250
89251              default:
89252                if (this.text.includes("]]>")) {
89253                  this.fail("the string \"]]>\" is disallowed in char data.");
89254                }
89255
89256                this.pushAttrib(this.name, this.text);
89257                this.name = this.text = "";
89258
89259                if (c === GREATER) {
89260                  this.openTag();
89261                } else {
89262                  this.state = S_ATTRIB;
89263                }
89264
89265            }
89266          }
89267        }, {
89268          key: "sCloseTag",
89269          value: function sCloseTag() {
89270            var c = this.captureNameChars();
89271
89272            if (c === GREATER) {
89273              this.closeTag();
89274            } else if (isS(c)) {
89275              this.state = S_CLOSE_TAG_SAW_WHITE;
89276            } else if (c !== EOC) {
89277              this.fail("disallowed character in closing tag.");
89278            }
89279          }
89280        }, {
89281          key: "sCloseTagSawWhite",
89282          value: function sCloseTagSawWhite() {
89283            switch (this.skipSpaces()) {
89284              case GREATER:
89285                this.closeTag();
89286                break;
89287
89288              case EOC:
89289                break;
89290
89291              default:
89292                this.fail("disallowed character in closing tag.");
89293            }
89294          } // END OF STATE ENGINE METHODS
89295
89296        }, {
89297          key: "handleTextInRoot",
89298          value: function handleTextInRoot() {
89299            // This is essentially a specialized version of captureTo which is optimized
89300            // for performing the ]]> check. A previous version of this code, checked
89301            // ``this.text`` for the presence of ]]>. It simplified the code but was
89302            // very costly when character data contained a lot of entities to be parsed.
89303            //
89304            // Since we are using a specialized loop, we also keep track of the presence
89305            // of ]]> in text data. The sequence ]]> is forbidden to appear as-is.
89306            //
89307            var start = this.i,
89308                forbiddenState = this.forbiddenState;
89309            var chunk = this.chunk,
89310                handler = this.textHandler; // eslint-disable-next-line no-labels, no-restricted-syntax
89311
89312            scanLoop: // eslint-disable-next-line no-constant-condition
89313            while (true) {
89314              switch (this.getCode()) {
89315                case LESS:
89316                  {
89317                    this.state = S_OPEN_WAKA;
89318
89319                    if (handler !== undefined) {
89320                      var text = this.text;
89321                      var slice = chunk.slice(start, this.prevI);
89322
89323                      if (text.length !== 0) {
89324                        handler(text + slice);
89325                        this.text = "";
89326                      } else if (slice.length !== 0) {
89327                        handler(slice);
89328                      }
89329                    }
89330
89331                    forbiddenState = FORBIDDEN_START; // eslint-disable-next-line no-labels
89332
89333                    break scanLoop;
89334                  }
89335
89336                case AMP:
89337                  this.state = S_ENTITY;
89338                  this.entityReturnState = S_TEXT;
89339
89340                  if (handler !== undefined) {
89341                    this.text += chunk.slice(start, this.prevI);
89342                  }
89343
89344                  forbiddenState = FORBIDDEN_START; // eslint-disable-next-line no-labels
89345
89346                  break scanLoop;
89347
89348                case CLOSE_BRACKET:
89349                  switch (forbiddenState) {
89350                    case FORBIDDEN_START:
89351                      forbiddenState = FORBIDDEN_BRACKET;
89352                      break;
89353
89354                    case FORBIDDEN_BRACKET:
89355                      forbiddenState = FORBIDDEN_BRACKET_BRACKET;
89356                      break;
89357
89358                    case FORBIDDEN_BRACKET_BRACKET:
89359                      break;
89360
89361                    default:
89362                      throw new Error("impossible state");
89363                  }
89364
89365                  break;
89366
89367                case GREATER:
89368                  if (forbiddenState === FORBIDDEN_BRACKET_BRACKET) {
89369                    this.fail("the string \"]]>\" is disallowed in char data.");
89370                  }
89371
89372                  forbiddenState = FORBIDDEN_START;
89373                  break;
89374
89375                case NL_LIKE:
89376                  if (handler !== undefined) {
89377                    this.text += "".concat(chunk.slice(start, this.prevI), "\n");
89378                  }
89379
89380                  start = this.i;
89381                  forbiddenState = FORBIDDEN_START;
89382                  break;
89383
89384                case EOC:
89385                  if (handler !== undefined) {
89386                    this.text += chunk.slice(start);
89387                  } // eslint-disable-next-line no-labels
89388
89389
89390                  break scanLoop;
89391
89392                default:
89393                  forbiddenState = FORBIDDEN_START;
89394              }
89395            }
89396
89397            this.forbiddenState = forbiddenState;
89398          }
89399        }, {
89400          key: "handleTextOutsideRoot",
89401          value: function handleTextOutsideRoot() {
89402            // This is essentially a specialized version of captureTo which is optimized
89403            // for a specialized task. We keep track of the presence of non-space
89404            // characters in the text since these are errors when appearing outside the
89405            // document root element.
89406            var start = this.i;
89407            var chunk = this.chunk,
89408                handler = this.textHandler;
89409            var nonSpace = false; // eslint-disable-next-line no-labels, no-restricted-syntax
89410
89411            outRootLoop: // eslint-disable-next-line no-constant-condition
89412            while (true) {
89413              var code = this.getCode();
89414
89415              switch (code) {
89416                case LESS:
89417                  {
89418                    this.state = S_OPEN_WAKA;
89419
89420                    if (handler !== undefined) {
89421                      var text = this.text;
89422                      var slice = chunk.slice(start, this.prevI);
89423
89424                      if (text.length !== 0) {
89425                        handler(text + slice);
89426                        this.text = "";
89427                      } else if (slice.length !== 0) {
89428                        handler(slice);
89429                      }
89430                    } // eslint-disable-next-line no-labels
89431
89432
89433                    break outRootLoop;
89434                  }
89435
89436                case AMP:
89437                  this.state = S_ENTITY;
89438                  this.entityReturnState = S_TEXT;
89439
89440                  if (handler !== undefined) {
89441                    this.text += chunk.slice(start, this.prevI);
89442                  }
89443
89444                  nonSpace = true; // eslint-disable-next-line no-labels
89445
89446                  break outRootLoop;
89447
89448                case NL_LIKE:
89449                  if (handler !== undefined) {
89450                    this.text += "".concat(chunk.slice(start, this.prevI), "\n");
89451                  }
89452
89453                  start = this.i;
89454                  break;
89455
89456                case EOC:
89457                  if (handler !== undefined) {
89458                    this.text += chunk.slice(start);
89459                  } // eslint-disable-next-line no-labels
89460
89461
89462                  break outRootLoop;
89463
89464                default:
89465                  if (!isS(code)) {
89466                    nonSpace = true;
89467                  }
89468
89469              }
89470            }
89471
89472            if (!nonSpace) {
89473              return;
89474            } // We use the reportedTextBeforeRoot and reportedTextAfterRoot flags
89475            // to avoid reporting errors for every single character that is out of
89476            // place.
89477
89478
89479            if (!this.sawRoot && !this.reportedTextBeforeRoot) {
89480              this.fail("text data outside of root node.");
89481              this.reportedTextBeforeRoot = true;
89482            }
89483
89484            if (this.closedRoot && !this.reportedTextAfterRoot) {
89485              this.fail("text data outside of root node.");
89486              this.reportedTextAfterRoot = true;
89487            }
89488          }
89489        }, {
89490          key: "pushAttribNS",
89491          value: function pushAttribNS(name, value) {
89492            var _a;
89493
89494            var _this$qname = this.qname(name),
89495                prefix = _this$qname.prefix,
89496                local = _this$qname.local;
89497
89498            var attr = {
89499              name: name,
89500              prefix: prefix,
89501              local: local,
89502              value: value
89503            };
89504            this.attribList.push(attr); // eslint-disable-next-line no-unused-expressions
89505
89506            (_a = this.attributeHandler) === null || _a === void 0 ? void 0 : _a.call(this, attr);
89507
89508            if (prefix === "xmlns") {
89509              var trimmed = value.trim();
89510
89511              if (this.currentXMLVersion === "1.0" && trimmed === "") {
89512                this.fail("invalid attempt to undefine prefix in XML 1.0");
89513              }
89514
89515              this.topNS[local] = trimmed;
89516              nsPairCheck(this, local, trimmed);
89517            } else if (name === "xmlns") {
89518              var _trimmed = value.trim();
89519
89520              this.topNS[""] = _trimmed;
89521              nsPairCheck(this, "", _trimmed);
89522            }
89523          }
89524        }, {
89525          key: "pushAttribPlain",
89526          value: function pushAttribPlain(name, value) {
89527            var _a;
89528
89529            var attr = {
89530              name: name,
89531              value: value
89532            };
89533            this.attribList.push(attr); // eslint-disable-next-line no-unused-expressions
89534
89535            (_a = this.attributeHandler) === null || _a === void 0 ? void 0 : _a.call(this, attr);
89536          }
89537          /**
89538           * End parsing. This performs final well-formedness checks and resets the
89539           * parser to a clean state.
89540           *
89541           * @returns this
89542           */
89543
89544        }, {
89545          key: "end",
89546          value: function end() {
89547            var _a, _b;
89548
89549            if (!this.sawRoot) {
89550              this.fail("document must contain a root element.");
89551            }
89552
89553            var tags = this.tags;
89554
89555            while (tags.length > 0) {
89556              var tag = tags.pop();
89557              this.fail("unclosed tag: ".concat(tag.name));
89558            }
89559
89560            if (this.state !== S_BEGIN && this.state !== S_TEXT) {
89561              this.fail("unexpected end.");
89562            }
89563
89564            var text = this.text;
89565
89566            if (text.length !== 0) {
89567              // eslint-disable-next-line no-unused-expressions
89568              (_a = this.textHandler) === null || _a === void 0 ? void 0 : _a.call(this, text);
89569              this.text = "";
89570            }
89571
89572            this._closed = true; // eslint-disable-next-line no-unused-expressions
89573
89574            (_b = this.endHandler) === null || _b === void 0 ? void 0 : _b.call(this);
89575
89576            this._init();
89577
89578            return this;
89579          }
89580          /**
89581           * Resolve a namespace prefix.
89582           *
89583           * @param prefix The prefix to resolve.
89584           *
89585           * @returns The namespace URI or ``undefined`` if the prefix is not defined.
89586           */
89587
89588        }, {
89589          key: "resolve",
89590          value: function resolve(prefix) {
89591            var _a, _b;
89592
89593            var uri = this.topNS[prefix];
89594
89595            if (uri !== undefined) {
89596              return uri;
89597            }
89598
89599            var tags = this.tags;
89600
89601            for (var index = tags.length - 1; index >= 0; index--) {
89602              uri = tags[index].ns[prefix];
89603
89604              if (uri !== undefined) {
89605                return uri;
89606              }
89607            }
89608
89609            uri = this.ns[prefix];
89610
89611            if (uri !== undefined) {
89612              return uri;
89613            }
89614
89615            return (_b = (_a = this.opt).resolvePrefix) === null || _b === void 0 ? void 0 : _b.call(_a, prefix);
89616          }
89617          /**
89618           * Parse a qname into its prefix and local name parts.
89619           *
89620           * @param name The name to parse
89621           *
89622           * @returns
89623           */
89624
89625        }, {
89626          key: "qname",
89627          value: function qname(name) {
89628            // This is faster than using name.split(":").
89629            var colon = name.indexOf(":");
89630
89631            if (colon === -1) {
89632              return {
89633                prefix: "",
89634                local: name
89635              };
89636            }
89637
89638            var local = name.slice(colon + 1);
89639            var prefix = name.slice(0, colon);
89640
89641            if (prefix === "" || local === "" || local.includes(":")) {
89642              this.fail("malformed name: ".concat(name, "."));
89643            }
89644
89645            return {
89646              prefix: prefix,
89647              local: local
89648            };
89649          }
89650        }, {
89651          key: "processAttribsNS",
89652          value: function processAttribsNS() {
89653            var _a;
89654
89655            var attribList = this.attribList;
89656            var tag = this.tag;
89657            {
89658              // add namespace info to tag
89659              var _this$qname2 = this.qname(tag.name),
89660                  prefix = _this$qname2.prefix,
89661                  local = _this$qname2.local;
89662
89663              tag.prefix = prefix;
89664              tag.local = local;
89665              var uri = tag.uri = (_a = this.resolve(prefix)) !== null && _a !== void 0 ? _a : "";
89666
89667              if (prefix !== "") {
89668                if (prefix === "xmlns") {
89669                  this.fail("tags may not have \"xmlns\" as prefix.");
89670                }
89671
89672                if (uri === "") {
89673                  this.fail("unbound namespace prefix: ".concat(JSON.stringify(prefix), "."));
89674                  tag.uri = prefix;
89675                }
89676              }
89677            }
89678
89679            if (attribList.length === 0) {
89680              return;
89681            }
89682
89683            var attributes = tag.attributes;
89684            var seen = new Set(); // Note: do not apply default ns to attributes:
89685            //   http://www.w3.org/TR/REC-xml-names/#defaulting
89686
89687            var _iterator3 = _createForOfIteratorHelper2(attribList),
89688                _step3;
89689
89690            try {
89691              for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
89692                var attr = _step3.value;
89693                var name = attr.name,
89694                    _prefix = attr.prefix,
89695                    _local = attr.local;
89696
89697                var _uri = void 0;
89698
89699                var eqname = void 0;
89700
89701                if (_prefix === "") {
89702                  _uri = name === "xmlns" ? XMLNS_NAMESPACE : "";
89703                  eqname = name;
89704                } else {
89705                  _uri = this.resolve(_prefix); // if there's any attributes with an undefined namespace,
89706                  // then fail on them now.
89707
89708                  if (_uri === undefined) {
89709                    this.fail("unbound namespace prefix: ".concat(JSON.stringify(_prefix), "."));
89710                    _uri = _prefix;
89711                  }
89712
89713                  eqname = "{".concat(_uri, "}").concat(_local);
89714                }
89715
89716                if (seen.has(eqname)) {
89717                  this.fail("duplicate attribute: ".concat(eqname, "."));
89718                }
89719
89720                seen.add(eqname);
89721                attr.uri = _uri;
89722                attributes[name] = attr;
89723              }
89724            } catch (err) {
89725              _iterator3.e(err);
89726            } finally {
89727              _iterator3.f();
89728            }
89729
89730            this.attribList = [];
89731          }
89732        }, {
89733          key: "processAttribsPlain",
89734          value: function processAttribsPlain() {
89735            var attribList = this.attribList; // eslint-disable-next-line prefer-destructuring
89736
89737            var attributes = this.tag.attributes;
89738
89739            var _iterator4 = _createForOfIteratorHelper2(attribList),
89740                _step4;
89741
89742            try {
89743              for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
89744                var _step4$value = _step4.value,
89745                    name = _step4$value.name,
89746                    value = _step4$value.value;
89747
89748                if (attributes[name] !== undefined) {
89749                  this.fail("duplicate attribute: ".concat(name, "."));
89750                }
89751
89752                attributes[name] = value;
89753              }
89754            } catch (err) {
89755              _iterator4.e(err);
89756            } finally {
89757              _iterator4.f();
89758            }
89759
89760            this.attribList = [];
89761          }
89762          /**
89763           * Handle a complete open tag. This parser code calls this once it has seen
89764           * the whole tag. This method checks for well-formeness and then emits
89765           * ``onopentag``.
89766           */
89767
89768        }, {
89769          key: "openTag",
89770          value: function openTag() {
89771            var _a;
89772
89773            this.processAttribs();
89774            var tags = this.tags;
89775            var tag = this.tag;
89776            tag.isSelfClosing = false; // There cannot be any pending text here due to the onopentagstart that was
89777            // necessarily emitted before we get here. So we do not check text.
89778            // eslint-disable-next-line no-unused-expressions
89779
89780            (_a = this.openTagHandler) === null || _a === void 0 ? void 0 : _a.call(this, tag);
89781            tags.push(tag);
89782            this.state = S_TEXT;
89783            this.name = "";
89784          }
89785          /**
89786           * Handle a complete self-closing tag. This parser code calls this once it has
89787           * seen the whole tag. This method checks for well-formeness and then emits
89788           * ``onopentag`` and ``onclosetag``.
89789           */
89790
89791        }, {
89792          key: "openSelfClosingTag",
89793          value: function openSelfClosingTag() {
89794            var _a, _b, _c;
89795
89796            this.processAttribs();
89797            var tags = this.tags;
89798            var tag = this.tag;
89799            tag.isSelfClosing = true; // There cannot be any pending text here due to the onopentagstart that was
89800            // necessarily emitted before we get here. So we do not check text.
89801            // eslint-disable-next-line no-unused-expressions
89802
89803            (_a = this.openTagHandler) === null || _a === void 0 ? void 0 : _a.call(this, tag); // eslint-disable-next-line no-unused-expressions
89804
89805            (_b = this.closeTagHandler) === null || _b === void 0 ? void 0 : _b.call(this, tag);
89806            var top = this.tag = (_c = tags[tags.length - 1]) !== null && _c !== void 0 ? _c : null;
89807
89808            if (top === null) {
89809              this.closedRoot = true;
89810            }
89811
89812            this.state = S_TEXT;
89813            this.name = "";
89814          }
89815          /**
89816           * Handle a complete close tag. This parser code calls this once it has seen
89817           * the whole tag. This method checks for well-formeness and then emits
89818           * ``onclosetag``.
89819           */
89820
89821        }, {
89822          key: "closeTag",
89823          value: function closeTag() {
89824            var tags = this.tags,
89825                name = this.name; // Our state after this will be S_TEXT, no matter what, and we can clear
89826            // tagName now.
89827
89828            this.state = S_TEXT;
89829            this.name = "";
89830
89831            if (name === "") {
89832              this.fail("weird empty close tag.");
89833              this.text += "</>";
89834              return;
89835            }
89836
89837            var handler = this.closeTagHandler;
89838            var l = tags.length;
89839
89840            while (l-- > 0) {
89841              var tag = this.tag = tags.pop();
89842              this.topNS = tag.ns; // eslint-disable-next-line no-unused-expressions
89843
89844              handler === null || handler === void 0 ? void 0 : handler(tag);
89845
89846              if (tag.name === name) {
89847                break;
89848              }
89849
89850              this.fail("unexpected close tag.");
89851            }
89852
89853            if (l === 0) {
89854              this.closedRoot = true;
89855            } else if (l < 0) {
89856              this.fail("unmatched closing tag: ".concat(name, "."));
89857              this.text += "</".concat(name, ">");
89858            }
89859          }
89860          /**
89861           * Resolves an entity. Makes any necessary well-formedness checks.
89862           *
89863           * @param entity The entity to resolve.
89864           *
89865           * @returns The parsed entity.
89866           */
89867
89868        }, {
89869          key: "parseEntity",
89870          value: function parseEntity(entity) {
89871            // startsWith would be significantly slower for this test.
89872            // eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with
89873            if (entity[0] !== "#") {
89874              var defined = this.ENTITIES[entity];
89875
89876              if (defined !== undefined) {
89877                return defined;
89878              }
89879
89880              this.fail(this.isName(entity) ? "undefined entity." : "disallowed character in entity name.");
89881              return "&".concat(entity, ";");
89882            }
89883
89884            var num = NaN;
89885
89886            if (entity[1] === "x" && /^#x[0-9a-f]+$/i.test(entity)) {
89887              num = parseInt(entity.slice(2), 16);
89888            } else if (/^#[0-9]+$/.test(entity)) {
89889              num = parseInt(entity.slice(1), 10);
89890            } // The character reference is required to match the CHAR production.
89891
89892
89893            if (!this.isChar(num)) {
89894              this.fail("malformed character entity.");
89895              return "&".concat(entity, ";");
89896            }
89897
89898            return String.fromCodePoint(num);
89899          }
89900        }, {
89901          key: "closed",
89902          get: function get() {
89903            return this._closed;
89904          }
89905        }, {
89906          key: "position",
89907          get: function get() {
89908            return this.chunkPosition + this.i;
89909          }
89910          /**
89911           * The column number of the next character to be read by the parser.  *
89912           * This field is zero-based. (The first column in a line is 0.)
89913           *
89914           * This field reports the index at which the next character would be in the
89915           * line if the line were represented as a JavaScript string.  Note that this
89916           * *can* be different to a count based on the number of *Unicode characters*
89917           * due to how JavaScript handles astral plane characters.
89918           *
89919           * See [[column]] for a number that corresponds to a count of Unicode
89920           * characters.
89921           */
89922
89923        }, {
89924          key: "columnIndex",
89925          get: function get() {
89926            return this.position - this.positionAtNewLine;
89927          }
89928        }]);
89929
89930        return SaxesParser;
89931      }();
89932
89933      exports.SaxesParser = SaxesParser;
89934    }, {
89935      "xmlchars/xml/1.0/ed5": 512,
89936      "xmlchars/xml/1.1/ed2": 513,
89937      "xmlchars/xmlns/1.0/ed3": 514
89938    }],
89939    472: [function (require, module, exports) {
89940      (function (setImmediate) {
89941        'use strict';
89942
89943        module.exports = typeof setImmediate === 'function' ? setImmediate : function setImmediate() {
89944          var args = [].slice.apply(arguments);
89945          args.splice(1, 0, 0);
89946          setTimeout.apply(null, args);
89947        };
89948      }).call(this, require("timers").setImmediate);
89949    }, {
89950      "timers": 496
89951    }],
89952    473: [function (require, module, exports) {
89953      var Buffer = require('safe-buffer').Buffer; // prototype class for hash functions
89954
89955
89956      function Hash(blockSize, finalSize) {
89957        this._block = Buffer.alloc(blockSize);
89958        this._finalSize = finalSize;
89959        this._blockSize = blockSize;
89960        this._len = 0;
89961      }
89962
89963      Hash.prototype.update = function (data, enc) {
89964        if (typeof data === 'string') {
89965          enc = enc || 'utf8';
89966          data = Buffer.from(data, enc);
89967        }
89968
89969        var block = this._block;
89970        var blockSize = this._blockSize;
89971        var length = data.length;
89972        var accum = this._len;
89973
89974        for (var offset = 0; offset < length;) {
89975          var assigned = accum % blockSize;
89976          var remainder = Math.min(length - offset, blockSize - assigned);
89977
89978          for (var i = 0; i < remainder; i++) {
89979            block[assigned + i] = data[offset + i];
89980          }
89981
89982          accum += remainder;
89983          offset += remainder;
89984
89985          if (accum % blockSize === 0) {
89986            this._update(block);
89987          }
89988        }
89989
89990        this._len += length;
89991        return this;
89992      };
89993
89994      Hash.prototype.digest = function (enc) {
89995        var rem = this._len % this._blockSize;
89996        this._block[rem] = 0x80; // zero (rem + 1) trailing bits, where (rem + 1) is the smallest
89997        // non-negative solution to the equation (length + 1 + (rem + 1)) === finalSize mod blockSize
89998
89999        this._block.fill(0, rem + 1);
90000
90001        if (rem >= this._finalSize) {
90002          this._update(this._block);
90003
90004          this._block.fill(0);
90005        }
90006
90007        var bits = this._len * 8; // uint32
90008
90009        if (bits <= 0xffffffff) {
90010          this._block.writeUInt32BE(bits, this._blockSize - 4); // uint64
90011
90012        } else {
90013          var lowBits = (bits & 0xffffffff) >>> 0;
90014          var highBits = (bits - lowBits) / 0x100000000;
90015
90016          this._block.writeUInt32BE(highBits, this._blockSize - 8);
90017
90018          this._block.writeUInt32BE(lowBits, this._blockSize - 4);
90019        }
90020
90021        this._update(this._block);
90022
90023        var hash = this._hash();
90024
90025        return enc ? hash.toString(enc) : hash;
90026      };
90027
90028      Hash.prototype._update = function () {
90029        throw new Error('_update must be implemented by subclass');
90030      };
90031
90032      module.exports = Hash;
90033    }, {
vendor: 7,373 bytes, lines 90034-90308
90034      "safe-buffer": 470
90035    }],
90036    474: [function (require, module, exports) {
90037      var exports = module.exports = function SHA(algorithm) {
90038        algorithm = algorithm.toLowerCase();
90039        var Algorithm = exports[algorithm];
90040        if (!Algorithm) throw new Error(algorithm + ' is not supported (we accept pull requests)');
90041        return new Algorithm();
90042      };
90043
90044      exports.sha = require('./sha');
90045      exports.sha1 = require('./sha1');
90046      exports.sha224 = require('./sha224');
90047      exports.sha256 = require('./sha256');
90048      exports.sha384 = require('./sha384');
90049      exports.sha512 = require('./sha512');
90050    }, {
90051      "./sha": 475,
90052      "./sha1": 476,
90053      "./sha224": 477,
90054      "./sha256": 478,
90055      "./sha384": 479,
90056      "./sha512": 480
90057    }],
90058    475: [function (require, module, exports) {
90059      /*
90060       * A JavaScript implementation of the Secure Hash Algorithm, SHA-0, as defined
90061       * in FIPS PUB 180-1
90062       * This source code is derived from sha1.js of the same repository.
90063       * The difference between SHA-0 and SHA-1 is just a bitwise rotate left
90064       * operation was added.
90065       */
90066      var inherits = require('inherits');
90067
90068      var Hash = require('./hash');
90069
90070      var Buffer = require('safe-buffer').Buffer;
90071
90072      var K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc | 0, 0xca62c1d6 | 0];
90073      var W = new Array(80);
90074
90075      function Sha() {
90076        this.init();
90077        this._w = W;
90078        Hash.call(this, 64, 56);
90079      }
90080
90081      inherits(Sha, Hash);
90082
90083      Sha.prototype.init = function () {
90084        this._a = 0x67452301;
90085        this._b = 0xefcdab89;
90086        this._c = 0x98badcfe;
90087        this._d = 0x10325476;
90088        this._e = 0xc3d2e1f0;
90089        return this;
90090      };
90091
90092      function rotl5(num) {
90093        return num << 5 | num >>> 27;
90094      }
90095
90096      function rotl30(num) {
90097        return num << 30 | num >>> 2;
90098      }
90099
90100      function ft(s, b, c, d) {
90101        if (s === 0) return b & c | ~b & d;
90102        if (s === 2) return b & c | b & d | c & d;
90103        return b ^ c ^ d;
90104      }
90105
90106      Sha.prototype._update = function (M) {
90107        var W = this._w;
90108        var a = this._a | 0;
90109        var b = this._b | 0;
90110        var c = this._c | 0;
90111        var d = this._d | 0;
90112        var e = this._e | 0;
90113
90114        for (var i = 0; i < 16; ++i) {
90115          W[i] = M.readInt32BE(i * 4);
90116        }
90117
90118        for (; i < 80; ++i) {
90119          W[i] = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16];
90120        }
90121
90122        for (var j = 0; j < 80; ++j) {
90123          var s = ~~(j / 20);
90124          var t = rotl5(a) + ft(s, b, c, d) + e + W[j] + K[s] | 0;
90125          e = d;
90126          d = c;
90127          c = rotl30(b);
90128          b = a;
90129          a = t;
90130        }
90131
90132        this._a = a + this._a | 0;
90133        this._b = b + this._b | 0;
90134        this._c = c + this._c | 0;
90135        this._d = d + this._d | 0;
90136        this._e = e + this._e | 0;
90137      };
90138
90139      Sha.prototype._hash = function () {
90140        var H = Buffer.allocUnsafe(20);
90141        H.writeInt32BE(this._a | 0, 0);
90142        H.writeInt32BE(this._b | 0, 4);
90143        H.writeInt32BE(this._c | 0, 8);
90144        H.writeInt32BE(this._d | 0, 12);
90145        H.writeInt32BE(this._e | 0, 16);
90146        return H;
90147      };
90148
90149      module.exports = Sha;
90150    }, {
90151      "./hash": 473,
90152      "inherits": 364,
90153      "safe-buffer": 470
90154    }],
90155    476: [function (require, module, exports) {
90156      /*
90157       * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined
90158       * in FIPS PUB 180-1
90159       * Version 2.1a Copyright Paul Johnston 2000 - 2002.
90160       * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
90161       * Distributed under the BSD License
90162       * See http://pajhome.org.uk/crypt/md5 for details.
90163       */
90164      var inherits = require('inherits');
90165
90166      var Hash = require('./hash');
90167
90168      var Buffer = require('safe-buffer').Buffer;
90169
90170      var K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc | 0, 0xca62c1d6 | 0];
90171      var W = new Array(80);
90172
90173      function Sha1() {
90174        this.init();
90175        this._w = W;
90176        Hash.call(this, 64, 56);
90177      }
90178
90179      inherits(Sha1, Hash);
90180
90181      Sha1.prototype.init = function () {
90182        this._a = 0x67452301;
90183        this._b = 0xefcdab89;
90184        this._c = 0x98badcfe;
90185        this._d = 0x10325476;
90186        this._e = 0xc3d2e1f0;
90187        return this;
90188      };
90189
90190      function rotl1(num) {
90191        return num << 1 | num >>> 31;
90192      }
90193
90194      function rotl5(num) {
90195        return num << 5 | num >>> 27;
90196      }
90197
90198      function rotl30(num) {
90199        return num << 30 | num >>> 2;
90200      }
90201
90202      function ft(s, b, c, d) {
90203        if (s === 0) return b & c | ~b & d;
90204        if (s === 2) return b & c | b & d | c & d;
90205        return b ^ c ^ d;
90206      }
90207
90208      Sha1.prototype._update = function (M) {
90209        var W = this._w;
90210        var a = this._a | 0;
90211        var b = this._b | 0;
90212        var c = this._c | 0;
90213        var d = this._d | 0;
90214        var e = this._e | 0;
90215
90216        for (var i = 0; i < 16; ++i) {
90217          W[i] = M.readInt32BE(i * 4);
90218        }
90219
90220        for (; i < 80; ++i) {
90221          W[i] = rotl1(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]);
90222        }
90223
90224        for (var j = 0; j < 80; ++j) {
90225          var s = ~~(j / 20);
90226          var t = rotl5(a) + ft(s, b, c, d) + e + W[j] + K[s] | 0;
90227          e = d;
90228          d = c;
90229          c = rotl30(b);
90230          b = a;
90231          a = t;
90232        }
90233
90234        this._a = a + this._a | 0;
90235        this._b = b + this._b | 0;
90236        this._c = c + this._c | 0;
90237        this._d = d + this._d | 0;
90238        this._e = e + this._e | 0;
90239      };
90240
90241      Sha1.prototype._hash = function () {
90242        var H = Buffer.allocUnsafe(20);
90243        H.writeInt32BE(this._a | 0, 0);
90244        H.writeInt32BE(this._b | 0, 4);
90245        H.writeInt32BE(this._c | 0, 8);
90246        H.writeInt32BE(this._d | 0, 12);
90247        H.writeInt32BE(this._e | 0, 16);
90248        return H;
90249      };
90250
90251      module.exports = Sha1;
90252    }, {
90253      "./hash": 473,
90254      "inherits": 364,
90255      "safe-buffer": 470
90256    }],
90257    477: [function (require, module, exports) {
90258      /**
90259       * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined
90260       * in FIPS 180-2
90261       * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009.
90262       * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
90263       *
90264       */
90265      var inherits = require('inherits');
90266
90267      var Sha256 = require('./sha256');
90268
90269      var Hash = require('./hash');
90270
90271      var Buffer = require('safe-buffer').Buffer;
90272
90273      var W = new Array(64);
90274
90275      function Sha224() {
90276        this.init();
90277        this._w = W; // new Array(64)
90278
90279        Hash.call(this, 64, 56);
90280      }
90281
90282      inherits(Sha224, Sha256);
90283
90284      Sha224.prototype.init = function () {
90285        this._a = 0xc1059ed8;
90286        this._b = 0x367cd507;
90287        this._c = 0x3070dd17;
90288        this._d = 0xf70e5939;
90289        this._e = 0xffc00b31;
90290        this._f = 0x68581511;
90291        this._g = 0x64f98fa7;
90292        this._h = 0xbefa4fa4;
90293        return this;
90294      };
90295
90296      Sha224.prototype._hash = function () {
90297        var H = Buffer.allocUnsafe(28);
90298        H.writeInt32BE(this._a, 0);
90299        H.writeInt32BE(this._b, 4);
90300        H.writeInt32BE(this._c, 8);
90301        H.writeInt32BE(this._d, 12);
90302        H.writeInt32BE(this._e, 16);
90303        H.writeInt32BE(this._f, 20);
90304        H.writeInt32BE(this._g, 24);
90305        return H;
90306      };
90307
90308      module.exports = Sha224;
vendor: 4,105 bytes, lines 90309-90437
90309    }, {
90310      "./hash": 473,
90311      "./sha256": 478,
90312      "inherits": 364,
90313      "safe-buffer": 470
90314    }],
90315    478: [function (require, module, exports) {
90316      /**
90317       * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined
90318       * in FIPS 180-2
90319       * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009.
90320       * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
90321       *
90322       */
90323      var inherits = require('inherits');
90324
90325      var Hash = require('./hash');
90326
90327      var Buffer = require('safe-buffer').Buffer;
90328
90329      var K = [0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5, 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5, 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3, 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174, 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC, 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA, 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7, 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967, 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13, 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85, 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3, 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070, 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5, 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3, 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208, 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2];
90330      var W = new Array(64);
90331
90332      function Sha256() {
90333        this.init();
90334        this._w = W; // new Array(64)
90335
90336        Hash.call(this, 64, 56);
90337      }
90338
90339      inherits(Sha256, Hash);
90340
90341      Sha256.prototype.init = function () {
90342        this._a = 0x6a09e667;
90343        this._b = 0xbb67ae85;
90344        this._c = 0x3c6ef372;
90345        this._d = 0xa54ff53a;
90346        this._e = 0x510e527f;
90347        this._f = 0x9b05688c;
90348        this._g = 0x1f83d9ab;
90349        this._h = 0x5be0cd19;
90350        return this;
90351      };
90352
90353      function ch(x, y, z) {
90354        return z ^ x & (y ^ z);
90355      }
90356
90357      function maj(x, y, z) {
90358        return x & y | z & (x | y);
90359      }
90360
90361      function sigma0(x) {
90362        return (x >>> 2 | x << 30) ^ (x >>> 13 | x << 19) ^ (x >>> 22 | x << 10);
90363      }
90364
90365      function sigma1(x) {
90366        return (x >>> 6 | x << 26) ^ (x >>> 11 | x << 21) ^ (x >>> 25 | x << 7);
90367      }
90368
90369      function gamma0(x) {
90370        return (x >>> 7 | x << 25) ^ (x >>> 18 | x << 14) ^ x >>> 3;
90371      }
90372
90373      function gamma1(x) {
90374        return (x >>> 17 | x << 15) ^ (x >>> 19 | x << 13) ^ x >>> 10;
90375      }
90376
90377      Sha256.prototype._update = function (M) {
90378        var W = this._w;
90379        var a = this._a | 0;
90380        var b = this._b | 0;
90381        var c = this._c | 0;
90382        var d = this._d | 0;
90383        var e = this._e | 0;
90384        var f = this._f | 0;
90385        var g = this._g | 0;
90386        var h = this._h | 0;
90387
90388        for (var i = 0; i < 16; ++i) {
90389          W[i] = M.readInt32BE(i * 4);
90390        }
90391
90392        for (; i < 64; ++i) {
90393          W[i] = gamma1(W[i - 2]) + W[i - 7] + gamma0(W[i - 15]) + W[i - 16] | 0;
90394        }
90395
90396        for (var j = 0; j < 64; ++j) {
90397          var T1 = h + sigma1(e) + ch(e, f, g) + K[j] + W[j] | 0;
90398          var T2 = sigma0(a) + maj(a, b, c) | 0;
90399          h = g;
90400          g = f;
90401          f = e;
90402          e = d + T1 | 0;
90403          d = c;
90404          c = b;
90405          b = a;
90406          a = T1 + T2 | 0;
90407        }
90408
90409        this._a = a + this._a | 0;
90410        this._b = b + this._b | 0;
90411        this._c = c + this._c | 0;
90412        this._d = d + this._d | 0;
90413        this._e = e + this._e | 0;
90414        this._f = f + this._f | 0;
90415        this._g = g + this._g | 0;
90416        this._h = h + this._h | 0;
90417      };
90418
90419      Sha256.prototype._hash = function () {
90420        var H = Buffer.allocUnsafe(32);
90421        H.writeInt32BE(this._a, 0);
90422        H.writeInt32BE(this._b, 4);
90423        H.writeInt32BE(this._c, 8);
90424        H.writeInt32BE(this._d, 12);
90425        H.writeInt32BE(this._e, 16);
90426        H.writeInt32BE(this._f, 20);
90427        H.writeInt32BE(this._g, 24);
90428        H.writeInt32BE(this._h, 28);
90429        return H;
90430      };
90431
90432      module.exports = Sha256;
90433    }, {
90434      "./hash": 473,
90435      "inherits": 364,
90436      "safe-buffer": 470
90437    }],
vendor: 9,856 bytes, lines 90438-90704
90438    479: [function (require, module, exports) {
90439      var inherits = require('inherits');
90440
90441      var SHA512 = require('./sha512');
90442
90443      var Hash = require('./hash');
90444
90445      var Buffer = require('safe-buffer').Buffer;
90446
90447      var W = new Array(160);
90448
90449      function Sha384() {
90450        this.init();
90451        this._w = W;
90452        Hash.call(this, 128, 112);
90453      }
90454
90455      inherits(Sha384, SHA512);
90456
90457      Sha384.prototype.init = function () {
90458        this._ah = 0xcbbb9d5d;
90459        this._bh = 0x629a292a;
90460        this._ch = 0x9159015a;
90461        this._dh = 0x152fecd8;
90462        this._eh = 0x67332667;
90463        this._fh = 0x8eb44a87;
90464        this._gh = 0xdb0c2e0d;
90465        this._hh = 0x47b5481d;
90466        this._al = 0xc1059ed8;
90467        this._bl = 0x367cd507;
90468        this._cl = 0x3070dd17;
90469        this._dl = 0xf70e5939;
90470        this._el = 0xffc00b31;
90471        this._fl = 0x68581511;
90472        this._gl = 0x64f98fa7;
90473        this._hl = 0xbefa4fa4;
90474        return this;
90475      };
90476
90477      Sha384.prototype._hash = function () {
90478        var H = Buffer.allocUnsafe(48);
90479
90480        function writeInt64BE(h, l, offset) {
90481          H.writeInt32BE(h, offset);
90482          H.writeInt32BE(l, offset + 4);
90483        }
90484
90485        writeInt64BE(this._ah, this._al, 0);
90486        writeInt64BE(this._bh, this._bl, 8);
90487        writeInt64BE(this._ch, this._cl, 16);
90488        writeInt64BE(this._dh, this._dl, 24);
90489        writeInt64BE(this._eh, this._el, 32);
90490        writeInt64BE(this._fh, this._fl, 40);
90491        return H;
90492      };
90493
90494      module.exports = Sha384;
90495    }, {
90496      "./hash": 473,
90497      "./sha512": 480,
90498      "inherits": 364,
90499      "safe-buffer": 470
90500    }],
90501    480: [function (require, module, exports) {
90502      var inherits = require('inherits');
90503
90504      var Hash = require('./hash');
90505
90506      var Buffer = require('safe-buffer').Buffer;
90507
90508      var K = [0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd, 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc, 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019, 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118, 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe, 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2, 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1, 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694, 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3, 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65, 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483, 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5, 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210, 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4, 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725, 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70, 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926, 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df, 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8, 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b, 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001, 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30, 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910, 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8, 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53, 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8, 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb, 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3, 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60, 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec, 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9, 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b, 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207, 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178, 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6, 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b, 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493, 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c, 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a, 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817];
90509      var W = new Array(160);
90510
90511      function Sha512() {
90512        this.init();
90513        this._w = W;
90514        Hash.call(this, 128, 112);
90515      }
90516
90517      inherits(Sha512, Hash);
90518
90519      Sha512.prototype.init = function () {
90520        this._ah = 0x6a09e667;
90521        this._bh = 0xbb67ae85;
90522        this._ch = 0x3c6ef372;
90523        this._dh = 0xa54ff53a;
90524        this._eh = 0x510e527f;
90525        this._fh = 0x9b05688c;
90526        this._gh = 0x1f83d9ab;
90527        this._hh = 0x5be0cd19;
90528        this._al = 0xf3bcc908;
90529        this._bl = 0x84caa73b;
90530        this._cl = 0xfe94f82b;
90531        this._dl = 0x5f1d36f1;
90532        this._el = 0xade682d1;
90533        this._fl = 0x2b3e6c1f;
90534        this._gl = 0xfb41bd6b;
90535        this._hl = 0x137e2179;
90536        return this;
90537      };
90538
90539      function Ch(x, y, z) {
90540        return z ^ x & (y ^ z);
90541      }
90542
90543      function maj(x, y, z) {
90544        return x & y | z & (x | y);
90545      }
90546
90547      function sigma0(x, xl) {
90548        return (x >>> 28 | xl << 4) ^ (xl >>> 2 | x << 30) ^ (xl >>> 7 | x << 25);
90549      }
90550
90551      function sigma1(x, xl) {
90552        return (x >>> 14 | xl << 18) ^ (x >>> 18 | xl << 14) ^ (xl >>> 9 | x << 23);
90553      }
90554
90555      function Gamma0(x, xl) {
90556        return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ x >>> 7;
90557      }
90558
90559      function Gamma0l(x, xl) {
90560        return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ (x >>> 7 | xl << 25);
90561      }
90562
90563      function Gamma1(x, xl) {
90564        return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ x >>> 6;
90565      }
90566
90567      function Gamma1l(x, xl) {
90568        return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ (x >>> 6 | xl << 26);
90569      }
90570
90571      function getCarry(a, b) {
90572        return a >>> 0 < b >>> 0 ? 1 : 0;
90573      }
90574
90575      Sha512.prototype._update = function (M) {
90576        var W = this._w;
90577        var ah = this._ah | 0;
90578        var bh = this._bh | 0;
90579        var ch = this._ch | 0;
90580        var dh = this._dh | 0;
90581        var eh = this._eh | 0;
90582        var fh = this._fh | 0;
90583        var gh = this._gh | 0;
90584        var hh = this._hh | 0;
90585        var al = this._al | 0;
90586        var bl = this._bl | 0;
90587        var cl = this._cl | 0;
90588        var dl = this._dl | 0;
90589        var el = this._el | 0;
90590        var fl = this._fl | 0;
90591        var gl = this._gl | 0;
90592        var hl = this._hl | 0;
90593
90594        for (var i = 0; i < 32; i += 2) {
90595          W[i] = M.readInt32BE(i * 4);
90596          W[i + 1] = M.readInt32BE(i * 4 + 4);
90597        }
90598
90599        for (; i < 160; i += 2) {
90600          var xh = W[i - 15 * 2];
90601          var xl = W[i - 15 * 2 + 1];
90602          var gamma0 = Gamma0(xh, xl);
90603          var gamma0l = Gamma0l(xl, xh);
90604          xh = W[i - 2 * 2];
90605          xl = W[i - 2 * 2 + 1];
90606          var gamma1 = Gamma1(xh, xl);
90607          var gamma1l = Gamma1l(xl, xh); // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]
90608
90609          var Wi7h = W[i - 7 * 2];
90610          var Wi7l = W[i - 7 * 2 + 1];
90611          var Wi16h = W[i - 16 * 2];
90612          var Wi16l = W[i - 16 * 2 + 1];
90613          var Wil = gamma0l + Wi7l | 0;
90614          var Wih = gamma0 + Wi7h + getCarry(Wil, gamma0l) | 0;
90615          Wil = Wil + gamma1l | 0;
90616          Wih = Wih + gamma1 + getCarry(Wil, gamma1l) | 0;
90617          Wil = Wil + Wi16l | 0;
90618          Wih = Wih + Wi16h + getCarry(Wil, Wi16l) | 0;
90619          W[i] = Wih;
90620          W[i + 1] = Wil;
90621        }
90622
90623        for (var j = 0; j < 160; j += 2) {
90624          Wih = W[j];
90625          Wil = W[j + 1];
90626          var majh = maj(ah, bh, ch);
90627          var majl = maj(al, bl, cl);
90628          var sigma0h = sigma0(ah, al);
90629          var sigma0l = sigma0(al, ah);
90630          var sigma1h = sigma1(eh, el);
90631          var sigma1l = sigma1(el, eh); // t1 = h + sigma1 + ch + K[j] + W[j]
90632
90633          var Kih = K[j];
90634          var Kil = K[j + 1];
90635          var chh = Ch(eh, fh, gh);
90636          var chl = Ch(el, fl, gl);
90637          var t1l = hl + sigma1l | 0;
90638          var t1h = hh + sigma1h + getCarry(t1l, hl) | 0;
90639          t1l = t1l + chl | 0;
90640          t1h = t1h + chh + getCarry(t1l, chl) | 0;
90641          t1l = t1l + Kil | 0;
90642          t1h = t1h + Kih + getCarry(t1l, Kil) | 0;
90643          t1l = t1l + Wil | 0;
90644          t1h = t1h + Wih + getCarry(t1l, Wil) | 0; // t2 = sigma0 + maj
90645
90646          var t2l = sigma0l + majl | 0;
90647          var t2h = sigma0h + majh + getCarry(t2l, sigma0l) | 0;
90648          hh = gh;
90649          hl = gl;
90650          gh = fh;
90651          gl = fl;
90652          fh = eh;
90653          fl = el;
90654          el = dl + t1l | 0;
90655          eh = dh + t1h + getCarry(el, dl) | 0;
90656          dh = ch;
90657          dl = cl;
90658          ch = bh;
90659          cl = bl;
90660          bh = ah;
90661          bl = al;
90662          al = t1l + t2l | 0;
90663          ah = t1h + t2h + getCarry(al, t1l) | 0;
90664        }
90665
90666        this._al = this._al + al | 0;
90667        this._bl = this._bl + bl | 0;
90668        this._cl = this._cl + cl | 0;
90669        this._dl = this._dl + dl | 0;
90670        this._el = this._el + el | 0;
90671        this._fl = this._fl + fl | 0;
90672        this._gl = this._gl + gl | 0;
90673        this._hl = this._hl + hl | 0;
90674        this._ah = this._ah + ah + getCarry(this._al, al) | 0;
90675        this._bh = this._bh + bh + getCarry(this._bl, bl) | 0;
90676        this._ch = this._ch + ch + getCarry(this._cl, cl) | 0;
90677        this._dh = this._dh + dh + getCarry(this._dl, dl) | 0;
90678        this._eh = this._eh + eh + getCarry(this._el, el) | 0;
90679        this._fh = this._fh + fh + getCarry(this._fl, fl) | 0;
90680        this._gh = this._gh + gh + getCarry(this._gl, gl) | 0;
90681        this._hh = this._hh + hh + getCarry(this._hl, hl) | 0;
90682      };
90683
90684      Sha512.prototype._hash = function () {
90685        var H = Buffer.allocUnsafe(64);
90686
90687        function writeInt64BE(h, l, offset) {
90688          H.writeInt32BE(h, offset);
90689          H.writeInt32BE(l, offset + 4);
90690        }
90691
90692        writeInt64BE(this._ah, this._al, 0);
90693        writeInt64BE(this._bh, this._bl, 8);
90694        writeInt64BE(this._ch, this._cl, 16);
90695        writeInt64BE(this._dh, this._dl, 24);
90696        writeInt64BE(this._eh, this._el, 32);
90697        writeInt64BE(this._fh, this._fl, 40);
90698        writeInt64BE(this._gh, this._gl, 48);
90699        writeInt64BE(this._hh, this._hl, 56);
90700        return H;
90701      };
90702
90703      module.exports = Sha512;
90704    }, {
vendor: 4,291 bytes, lines 90705-90822
90705      "./hash": 473,
90706      "inherits": 364,
90707      "safe-buffer": 470
90708    }],
90709    481: [function (require, module, exports) {
90710      // Copyright Joyent, Inc. and other Node contributors.
90711      //
90712      // Permission is hereby granted, free of charge, to any person obtaining a
90713      // copy of this software and associated documentation files (the
90714      // "Software"), to deal in the Software without restriction, including
90715      // without limitation the rights to use, copy, modify, merge, publish,
90716      // distribute, sublicense, and/or sell copies of the Software, and to permit
90717      // persons to whom the Software is furnished to do so, subject to the
90718      // following conditions:
90719      //
90720      // The above copyright notice and this permission notice shall be included
90721      // in all copies or substantial portions of the Software.
90722      //
90723      // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
90724      // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
90725      // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
90726      // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
90727      // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
90728      // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
90729      // USE OR OTHER DEALINGS IN THE SOFTWARE.
90730      module.exports = Stream;
90731
90732      var EE = require('events').EventEmitter;
90733
90734      var inherits = require('inherits');
90735
90736      inherits(Stream, EE);
90737      Stream.Readable = require('readable-stream/readable.js');
90738      Stream.Writable = require('readable-stream/writable.js');
90739      Stream.Duplex = require('readable-stream/duplex.js');
90740      Stream.Transform = require('readable-stream/transform.js');
90741      Stream.PassThrough = require('readable-stream/passthrough.js'); // Backwards-compat with node 0.4.x
90742
90743      Stream.Stream = Stream; // old-style streams.  Note that the pipe method (the only relevant
90744      // part of this class) is overridden in the Readable class.
90745
90746      function Stream() {
90747        EE.call(this);
90748      }
90749
90750      Stream.prototype.pipe = function (dest, options) {
90751        var source = this;
90752
90753        function ondata(chunk) {
90754          if (dest.writable) {
90755            if (false === dest.write(chunk) && source.pause) {
90756              source.pause();
90757            }
90758          }
90759        }
90760
90761        source.on('data', ondata);
90762
90763        function ondrain() {
90764          if (source.readable && source.resume) {
90765            source.resume();
90766          }
90767        }
90768
90769        dest.on('drain', ondrain); // If the 'end' option is not supplied, dest.end() will be called when
90770        // source gets the 'end' or 'close' events.  Only dest.end() once.
90771
90772        if (!dest._isStdio && (!options || options.end !== false)) {
90773          source.on('end', onend);
90774          source.on('close', onclose);
90775        }
90776
90777        var didOnEnd = false;
90778
90779        function onend() {
90780          if (didOnEnd) return;
90781          didOnEnd = true;
90782          dest.end();
90783        }
90784
90785        function onclose() {
90786          if (didOnEnd) return;
90787          didOnEnd = true;
90788          if (typeof dest.destroy === 'function') dest.destroy();
90789        } // don't leave dangling pipes when there are errors.
90790
90791
90792        function onerror(er) {
90793          cleanup();
90794
90795          if (EE.listenerCount(this, 'error') === 0) {
90796            throw er; // Unhandled stream error in pipe.
90797          }
90798        }
90799
90800        source.on('error', onerror);
90801        dest.on('error', onerror); // remove all the event listeners that were added.
90802
90803        function cleanup() {
90804          source.removeListener('data', ondata);
90805          dest.removeListener('drain', ondrain);
90806          source.removeListener('end', onend);
90807          source.removeListener('close', onclose);
90808          source.removeListener('error', onerror);
90809          dest.removeListener('error', onerror);
90810          source.removeListener('end', cleanup);
90811          source.removeListener('close', cleanup);
90812          dest.removeListener('close', cleanup);
90813        }
90814
90815        source.on('end', cleanup);
90816        source.on('close', cleanup);
90817        dest.on('close', cleanup);
90818        dest.emit('pipe', source); // Allow for unix-like usage: A.pipe(B).pipe(C)
90819
90820        return dest;
90821      };
90822    }, {
90823      "events": 344,
90824      "inherits": 364,
90825      "readable-stream/duplex.js": 482,
90826      "readable-stream/passthrough.js": 491,
90827      "readable-stream/readable.js": 492,
90828      "readable-stream/transform.js": 493,
90829      "readable-stream/writable.js": 494
90830    }],
90831    482: [function (require, module, exports) {
90832      module.exports = require('./lib/_stream_duplex.js');
90833    }, {
90834      "./lib/_stream_duplex.js": 483
90835    }],
90836    483: [function (require, module, exports) {
90837      // Copyright Joyent, Inc. and other Node contributors.
90838      //
90839      // Permission is hereby granted, free of charge, to any person obtaining a
90840      // copy of this software and associated documentation files (the
90841      // "Software"), to deal in the Software without restriction, including
90842      // without limitation the rights to use, copy, modify, merge, publish,
90843      // distribute, sublicense, and/or sell copies of the Software, and to permit
90844      // persons to whom the Software is furnished to do so, subject to the
90845      // following conditions:
90846      //
90847      // The above copyright notice and this permission notice shall be included
90848      // in all copies or substantial portions of the Software.
90849      //
90850      // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
90851      // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
90852      // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
90853      // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
90854      // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
90855      // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
90856      // USE OR OTHER DEALINGS IN THE SOFTWARE.
90857      // a duplex stream is just a stream that is both readable and writable.
90858      // Since JS doesn't have multiple prototypal inheritance, this class
90859      // prototypally inherits from Readable, and then parasitically from
90860      // Writable.
90861      'use strict';
90862      /*<replacement>*/
90863
90864      var pna = require('process-nextick-args');
90865      /*</replacement>*/
90866
90867      /*<replacement>*/
90868
90869
90870      var objectKeys = Object.keys || function (obj) {
90871        var keys = [];
90872
90873        for (var key in obj) {
90874          keys.push(key);
90875        }
90876
90877        return keys;
90878      };
90879      /*</replacement>*/
90880
90881
90882      module.exports = Duplex;
90883      /*<replacement>*/
90884
90885      var util = Object.create(require('core-util-is'));
90886      util.inherits = require('inherits');
90887      /*</replacement>*/
90888
90889      var Readable = require('./_stream_readable');
90890
90891      var Writable = require('./_stream_writable');
90892
90893      util.inherits(Duplex, Readable);
90894      {
vendor: 4,671 bytes, lines 90895-91018
90895        // avoid scope creep, the keys array can then be collected
90896        var keys = objectKeys(Writable.prototype);
90897
90898        for (var v = 0; v < keys.length; v++) {
90899          var method = keys[v];
90900          if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
90901        }
90902      }
90903
90904      function Duplex(options) {
90905        if (!(this instanceof Duplex)) return new Duplex(options);
90906        Readable.call(this, options);
90907        Writable.call(this, options);
90908        if (options && options.readable === false) this.readable = false;
90909        if (options && options.writable === false) this.writable = false;
90910        this.allowHalfOpen = true;
90911        if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
90912        this.once('end', onend);
90913      }
90914
90915      Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
90916        // making it explicit this property is not enumerable
90917        // because otherwise some prototype manipulation in
90918        // userland will fail
90919        enumerable: false,
90920        get: function get() {
90921          return this._writableState.highWaterMark;
90922        }
90923      }); // the no-half-open enforcer
90924
90925      function onend() {
90926        // if we allow half-open state, or if the writable side ended,
90927        // then we're ok.
90928        if (this.allowHalfOpen || this._writableState.ended) return; // no more data can be written.
90929        // But allow more writes to happen in this tick.
90930
90931        pna.nextTick(onEndNT, this);
90932      }
90933
90934      function onEndNT(self) {
90935        self.end();
90936      }
90937
90938      Object.defineProperty(Duplex.prototype, 'destroyed', {
90939        get: function get() {
90940          if (this._readableState === undefined || this._writableState === undefined) {
90941            return false;
90942          }
90943
90944          return this._readableState.destroyed && this._writableState.destroyed;
90945        },
90946        set: function set(value) {
90947          // we ignore the value if the stream
90948          // has not been initialized yet
90949          if (this._readableState === undefined || this._writableState === undefined) {
90950            return;
90951          } // backward compatibility, the user is explicitly
90952          // managing destroyed
90953
90954
90955          this._readableState.destroyed = value;
90956          this._writableState.destroyed = value;
90957        }
90958      });
90959
90960      Duplex.prototype._destroy = function (err, cb) {
90961        this.push(null);
90962        this.end();
90963        pna.nextTick(cb, err);
90964      };
90965    }, {
90966      "./_stream_readable": 485,
90967      "./_stream_writable": 487,
90968      "core-util-is": 305,
90969      "inherits": 364,
90970      "process-nextick-args": 442
90971    }],
90972    484: [function (require, module, exports) {
90973      // Copyright Joyent, Inc. and other Node contributors.
90974      //
90975      // Permission is hereby granted, free of charge, to any person obtaining a
90976      // copy of this software and associated documentation files (the
90977      // "Software"), to deal in the Software without restriction, including
90978      // without limitation the rights to use, copy, modify, merge, publish,
90979      // distribute, sublicense, and/or sell copies of the Software, and to permit
90980      // persons to whom the Software is furnished to do so, subject to the
90981      // following conditions:
90982      //
90983      // The above copyright notice and this permission notice shall be included
90984      // in all copies or substantial portions of the Software.
90985      //
90986      // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
90987      // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
90988      // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
90989      // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
90990      // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
90991      // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
90992      // USE OR OTHER DEALINGS IN THE SOFTWARE.
90993      // a passthrough stream.
90994      // basically just the most minimal sort of Transform stream.
90995      // Every written chunk gets output as-is.
90996      'use strict';
90997
90998      module.exports = PassThrough;
90999
91000      var Transform = require('./_stream_transform');
91001      /*<replacement>*/
91002
91003
91004      var util = Object.create(require('core-util-is'));
91005      util.inherits = require('inherits');
91006      /*</replacement>*/
91007
91008      util.inherits(PassThrough, Transform);
91009
91010      function PassThrough(options) {
91011        if (!(this instanceof PassThrough)) return new PassThrough(options);
91012        Transform.call(this, options);
91013      }
91014
91015      PassThrough.prototype._transform = function (chunk, encoding, cb) {
91016        cb(null, chunk);
91017      };
91018    }, {
vendor: 4,102 bytes, lines 91019-91133
91019      "./_stream_transform": 486,
91020      "core-util-is": 305,
91021      "inherits": 364
91022    }],
91023    485: [function (require, module, exports) {
91024      (function (process, global) {
91025        // Copyright Joyent, Inc. and other Node contributors.
91026        //
91027        // Permission is hereby granted, free of charge, to any person obtaining a
91028        // copy of this software and associated documentation files (the
91029        // "Software"), to deal in the Software without restriction, including
91030        // without limitation the rights to use, copy, modify, merge, publish,
91031        // distribute, sublicense, and/or sell copies of the Software, and to permit
91032        // persons to whom the Software is furnished to do so, subject to the
91033        // following conditions:
91034        //
91035        // The above copyright notice and this permission notice shall be included
91036        // in all copies or substantial portions of the Software.
91037        //
91038        // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
91039        // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
91040        // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
91041        // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
91042        // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
91043        // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
91044        // USE OR OTHER DEALINGS IN THE SOFTWARE.
91045        'use strict';
91046        /*<replacement>*/
91047
91048        var pna = require('process-nextick-args');
91049        /*</replacement>*/
91050
91051
91052        module.exports = Readable;
91053        /*<replacement>*/
91054
91055        var isArray = require('isarray');
91056        /*</replacement>*/
91057
91058        /*<replacement>*/
91059
91060
91061        var Duplex;
91062        /*</replacement>*/
91063
91064        Readable.ReadableState = ReadableState;
91065        /*<replacement>*/
91066
91067        var EE = require('events').EventEmitter;
91068
91069        var EElistenerCount = function EElistenerCount(emitter, type) {
91070          return emitter.listeners(type).length;
91071        };
91072        /*</replacement>*/
91073
91074        /*<replacement>*/
91075
91076
91077        var Stream = require('./internal/streams/stream');
91078        /*</replacement>*/
91079
91080        /*<replacement>*/
91081
91082
91083        var Buffer = require('safe-buffer').Buffer;
91084
91085        var OurUint8Array = global.Uint8Array || function () {};
91086
91087        function _uint8ArrayToBuffer(chunk) {
91088          return Buffer.from(chunk);
91089        }
91090
91091        function _isUint8Array(obj) {
91092          return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
91093        }
91094        /*</replacement>*/
91095
91096        /*<replacement>*/
91097
91098
91099        var util = Object.create(require('core-util-is'));
91100        util.inherits = require('inherits');
91101        /*</replacement>*/
91102
91103        /*<replacement>*/
91104
91105        var debugUtil = require('util');
91106
91107        var debug = void 0;
91108
91109        if (debugUtil && debugUtil.debuglog) {
91110          debug = debugUtil.debuglog('stream');
91111        } else {
91112          debug = function debug() {};
91113        }
91114        /*</replacement>*/
91115
91116
91117        var BufferList = require('./internal/streams/BufferList');
91118
91119        var destroyImpl = require('./internal/streams/destroy');
91120
91121        var StringDecoder;
91122        util.inherits(Readable, Stream);
91123        var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];
91124
91125        function prependListener(emitter, event, fn) {
91126          // Sadly this is not cacheable as some libraries bundle their own
91127          // event emitter implementation with them.
91128          if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); // This is a hack to make sure that our error handler is attached before any
91129          // userland ones.  NEVER DO THIS. This is here only because this code needs
91130          // to continue to work with older versions of Node.js that do not include
91131          // the prependListener() method. The goal is to eventually remove this hack.
91132
91133          if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);
vendor: 5,979 bytes, lines 91133-91277
91133else emitter._events[event] = [fn, emitter._events[event]];
91134        }
91135
91136        function ReadableState(options, stream) {
91137          Duplex = Duplex || require('./_stream_duplex');
91138          options = options || {}; // Duplex streams are both readable and writable, but share
91139          // the same options object.
91140          // However, some cases require setting options to different
91141          // values for the readable and the writable sides of the duplex stream.
91142          // These options can be provided separately as readableXXX and writableXXX.
91143
91144          var isDuplex = stream instanceof Duplex; // object stream flag. Used to make read(n) ignore n and to
91145          // make all the buffer merging and length checks go away
91146
91147          this.objectMode = !!options.objectMode;
91148          if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; // the point at which it stops calling _read() to fill the buffer
91149          // Note: 0 is a valid value, means "don't call _read preemptively ever"
91150
91151          var hwm = options.highWaterMark;
91152          var readableHwm = options.readableHighWaterMark;
91153          var defaultHwm = this.objectMode ? 16 : 16 * 1024;
91154          if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm; // cast to ints.
91155
91156          this.highWaterMark = Math.floor(this.highWaterMark); // A linked list is used to store data chunks instead of an array because the
91157          // linked list can remove elements from the beginning faster than
91158          // array.shift()
91159
91160          this.buffer = new BufferList();
91161          this.length = 0;
91162          this.pipes = null;
91163          this.pipesCount = 0;
91164          this.flowing = null;
91165          this.ended = false;
91166          this.endEmitted = false;
91167          this.reading = false; // a flag to be able to tell if the event 'readable'/'data' is emitted
91168          // immediately, or on a later tick.  We set this to true at first, because
91169          // any actions that shouldn't happen until "later" should generally also
91170          // not happen before the first read call.
91171
91172          this.sync = true; // whenever we return null, then we set a flag to say
91173          // that we're awaiting a 'readable' event emission.
91174
91175          this.needReadable = false;
91176          this.emittedReadable = false;
91177          this.readableListening = false;
91178          this.resumeScheduled = false; // has it been destroyed
91179
91180          this.destroyed = false; // Crypto is kind of old and crusty.  Historically, its default string
91181          // encoding is 'binary' so we have to make this configurable.
91182          // Everything else in the universe uses 'utf8', though.
91183
91184          this.defaultEncoding = options.defaultEncoding || 'utf8'; // the number of writers that are awaiting a drain event in .pipe()s
91185
91186          this.awaitDrain = 0; // if true, a maybeReadMore has been scheduled
91187
91188          this.readingMore = false;
91189          this.decoder = null;
91190          this.encoding = null;
91191
91192          if (options.encoding) {
91193            if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
91194            this.decoder = new StringDecoder(options.encoding);
91195            this.encoding = options.encoding;
91196          }
91197        }
91198
91199        function Readable(options) {
91200          Duplex = Duplex || require('./_stream_duplex');
91201          if (!(this instanceof Readable)) return new Readable(options);
91202          this._readableState = new ReadableState(options, this); // legacy
91203
91204          this.readable = true;
91205
91206          if (options) {
91207            if (typeof options.read === 'function') this._read = options.read;
91208            if (typeof options.destroy === 'function') this._destroy = options.destroy;
91209          }
91210
91211          Stream.call(this);
91212        }
91213
91214        Object.defineProperty(Readable.prototype, 'destroyed', {
91215          get: function get() {
91216            if (this._readableState === undefined) {
91217              return false;
91218            }
91219
91220            return this._readableState.destroyed;
91221          },
91222          set: function set(value) {
91223            // we ignore the value if the stream
91224            // has not been initialized yet
91225            if (!this._readableState) {
91226              return;
91227            } // backward compatibility, the user is explicitly
91228            // managing destroyed
91229
91230
91231            this._readableState.destroyed = value;
91232          }
91233        });
91234        Readable.prototype.destroy = destroyImpl.destroy;
91235        Readable.prototype._undestroy = destroyImpl.undestroy;
91236
91237        Readable.prototype._destroy = function (err, cb) {
91238          this.push(null);
91239          cb(err);
91240        }; // Manually shove something into the read() buffer.
91241        // This returns true if the highWaterMark has not been hit yet,
91242        // similar to how Writable.write() returns true if you should
91243        // write() some more.
91244
91245
91246        Readable.prototype.push = function (chunk, encoding) {
91247          var state = this._readableState;
91248          var skipChunkCheck;
91249
91250          if (!state.objectMode) {
91251            if (typeof chunk === 'string') {
91252              encoding = encoding || state.defaultEncoding;
91253
91254              if (encoding !== state.encoding) {
91255                chunk = Buffer.from(chunk, encoding);
91256                encoding = '';
91257              }
91258
91259              skipChunkCheck = true;
91260            }
91261          } else {
91262            skipChunkCheck = true;
91263          }
91264
91265          return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
91266        }; // Unshift should *always* be something directly out of read()
91267
91268
91269        Readable.prototype.unshift = function (chunk) {
91270          return readableAddChunk(this, chunk, null, true, false);
91271        };
91272
91273        function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
91274          var state = stream._readableState;
91275
91276          if (chunk === null) {
91277            state.reading = false;
vendor: 10,931 bytes, lines 91278-91558
91278            onEofChunk(stream, state);
91279          } else {
91280            var er;
91281            if (!skipChunkCheck) er = chunkInvalid(state, chunk);
91282
91283            if (er) {
91284              stream.emit('error', er);
91285            } else if (state.objectMode || chunk && chunk.length > 0) {
91286              if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {
91287                chunk = _uint8ArrayToBuffer(chunk);
91288              }
91289
91290              if (addToFront) {
91291                if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true);
91292              } else if (state.ended) {
91293                stream.emit('error', new Error('stream.push() after EOF'));
91294              } else {
91295                state.reading = false;
91296
91297                if (state.decoder && !encoding) {
91298                  chunk = state.decoder.write(chunk);
91299                  if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);
91300                } else {
91301                  addChunk(stream, state, chunk, false);
91302                }
91303              }
91304            } else if (!addToFront) {
91305              state.reading = false;
91306            }
91307          }
91308
91309          return needMoreData(state);
91310        }
91311
91312        function addChunk(stream, state, chunk, addToFront) {
91313          if (state.flowing && state.length === 0 && !state.sync) {
91314            stream.emit('data', chunk);
91315            stream.read(0);
91316          } else {
91317            // update the buffer info.
91318            state.length += state.objectMode ? 1 : chunk.length;
91319            if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);
91320            if (state.needReadable) emitReadable(stream);
91321          }
91322
91323          maybeReadMore(stream, state);
91324        }
91325
91326        function chunkInvalid(state, chunk) {
91327          var er;
91328
91329          if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
91330            er = new TypeError('Invalid non-string/buffer chunk');
91331          }
91332
91333          return er;
91334        } // if it's past the high water mark, we can push in some more.
91335        // Also, if we have no data yet, we can stand some
91336        // more bytes.  This is to work around cases where hwm=0,
91337        // such as the repl.  Also, if the push() triggered a
91338        // readable event, and the user called read(largeNumber) such that
91339        // needReadable was set, then we ought to push more, so that another
91340        // 'readable' event will be triggered.
91341
91342
91343        function needMoreData(state) {
91344          return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
91345        }
91346
91347        Readable.prototype.isPaused = function () {
91348          return this._readableState.flowing === false;
91349        }; // backwards compatibility.
91350
91351
91352        Readable.prototype.setEncoding = function (enc) {
91353          if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
91354          this._readableState.decoder = new StringDecoder(enc);
91355          this._readableState.encoding = enc;
91356          return this;
91357        }; // Don't raise the hwm > 8MB
91358
91359
91360        var MAX_HWM = 0x800000;
91361
91362        function computeNewHighWaterMark(n) {
91363          if (n >= MAX_HWM) {
91364            n = MAX_HWM;
91365          } else {
91366            // Get the next highest power of 2 to prevent increasing hwm excessively in
91367            // tiny amounts
91368            n--;
91369            n |= n >>> 1;
91370            n |= n >>> 2;
91371            n |= n >>> 4;
91372            n |= n >>> 8;
91373            n |= n >>> 16;
91374            n++;
91375          }
91376
91377          return n;
91378        } // This function is designed to be inlinable, so please take care when making
91379        // changes to the function body.
91380
91381
91382        function howMuchToRead(n, state) {
91383          if (n <= 0 || state.length === 0 && state.ended) return 0;
91384          if (state.objectMode) return 1;
91385
91386          if (n !== n) {
91387            // Only flow one buffer at a time
91388            if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
91389          } // If we're asking for more than the current hwm, then raise the hwm.
91390
91391
91392          if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
91393          if (n <= state.length) return n; // Don't have enough
91394
91395          if (!state.ended) {
91396            state.needReadable = true;
91397            return 0;
91398          }
91399
91400          return state.length;
91401        } // you can override either this method, or the async _read(n) below.
91402
91403
91404        Readable.prototype.read = function (n) {
91405          debug('read', n);
91406          n = parseInt(n, 10);
91407          var state = this._readableState;
91408          var nOrig = n;
91409          if (n !== 0) state.emittedReadable = false; // if we're doing read(0) to trigger a readable event, but we
91410          // already have a bunch of data in the buffer, then just trigger
91411          // the 'readable' event and move on.
91412
91413          if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
91414            debug('read: emitReadable', state.length, state.ended);
91415            if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
91416            return null;
91417          }
91418
91419          n = howMuchToRead(n, state); // if we've ended, and we're now clear, then finish it up.
91420
91421          if (n === 0 && state.ended) {
91422            if (state.length === 0) endReadable(this);
91423            return null;
91424          } // All the actual chunk generation logic needs to be
91425          // *below* the call to _read.  The reason is that in certain
91426          // synthetic stream cases, such as passthrough streams, _read
91427          // may be a completely synchronous operation which may change
91428          // the state of the read buffer, providing enough data when
91429          // before there was *not* enough.
91430          //
91431          // So, the steps are:
91432          // 1. Figure out what the state of things will be after we do
91433          // a read from the buffer.
91434          //
91435          // 2. If that resulting state will trigger a _read, then call _read.
91436          // Note that this may be asynchronous, or synchronous.  Yes, it is
91437          // deeply ugly to write APIs this way, but that still doesn't mean
91438          // that the Readable class should behave improperly, as streams are
91439          // designed to be sync/async agnostic.
91440          // Take note if the _read call is sync or async (ie, if the read call
91441          // has returned yet), so that we know whether or not it's safe to emit
91442          // 'readable' etc.
91443          //
91444          // 3. Actually pull the requested chunks out of the buffer and return.
91445          // if we need a readable event, then we need to do some reading.
91446
91447
91448          var doRead = state.needReadable;
91449          debug('need readable', doRead); // if we currently have less than the highWaterMark, then also read some
91450
91451          if (state.length === 0 || state.length - n < state.highWaterMark) {
91452            doRead = true;
91453            debug('length less than watermark', doRead);
91454          } // however, if we've ended, then there's no point, and if we're already
91455          // reading, then it's unnecessary.
91456
91457
91458          if (state.ended || state.reading) {
91459            doRead = false;
91460            debug('reading or ended', doRead);
91461          } else if (doRead) {
91462            debug('do read');
91463            state.reading = true;
91464            state.sync = true; // if the length is currently zero, then we *need* a readable event.
91465
91466            if (state.length === 0) state.needReadable = true; // call internal read method
91467
91468            this._read(state.highWaterMark);
91469
91470            state.sync = false; // If _read pushed data synchronously, then `reading` will be false,
91471            // and we need to re-evaluate how much data we can return to the user.
91472
91473            if (!state.reading) n = howMuchToRead(nOrig, state);
91474          }
91475
91476          var ret;
91477          if (n > 0) ret = fromList(n, state);else ret = null;
91478
91479          if (ret === null) {
91480            state.needReadable = true;
91481            n = 0;
91482          } else {
91483            state.length -= n;
91484          }
91485
91486          if (state.length === 0) {
91487            // If we have nothing in the buffer, then we want to know
91488            // as soon as we *do* get something into the buffer.
91489            if (!state.ended) state.needReadable = true; // If we tried to read() past the EOF, then emit end on the next tick.
91490
91491            if (nOrig !== n && state.ended) endReadable(this);
91492          }
91493
91494          if (ret !== null) this.emit('data', ret);
91495          return ret;
91496        };
91497
91498        function onEofChunk(stream, state) {
91499          if (state.ended) return;
91500
91501          if (state.decoder) {
91502            var chunk = state.decoder.end();
91503
91504            if (chunk && chunk.length) {
91505              state.buffer.push(chunk);
91506              state.length += state.objectMode ? 1 : chunk.length;
91507            }
91508          }
91509
91510          state.ended = true; // emit 'readable' now to make sure it gets picked up.
91511
91512          emitReadable(stream);
91513        } // Don't emit readable right away in sync mode, because this can trigger
91514        // another read() call => stack overflow.  This way, it might trigger
91515        // a nextTick recursion warning, but that's not so bad.
91516
91517
91518        function emitReadable(stream) {
91519          var state = stream._readableState;
91520          state.needReadable = false;
91521
91522          if (!state.emittedReadable) {
91523            debug('emitReadable', state.flowing);
91524            state.emittedReadable = true;
91525            if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream);
91526          }
91527        }
91528
91529        function emitReadable_(stream) {
91530          debug('emit readable');
91531          stream.emit('readable');
91532          flow(stream);
91533        } // at this point, the user has presumably seen the 'readable' event,
91534        // and called read() to consume some data.  that may have triggered
91535        // in turn another _read(n) call, in which case reading = true if
91536        // it's in progress.
91537        // However, if we're not ended, or reading, and the length < hwm,
91538        // then go ahead and try to read some more preemptively.
91539
91540
91541        function maybeReadMore(stream, state) {
91542          if (!state.readingMore) {
91543            state.readingMore = true;
91544            pna.nextTick(maybeReadMore_, stream, state);
91545          }
91546        }
91547
91548        function maybeReadMore_(stream, state) {
91549          var len = state.length;
91550
91551          while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
91552            debug('maybeReadMore read 0');
91553            stream.read(0);
91554            if (len === state.length) // didn't get any data, stop spinning.
91555              break;else len = state.length;
91556          }
91557
91558          state.readingMore = false;
vendor: 10,219 bytes, lines 91559-91860
91559        } // abstract method.  to be overridden in specific implementation classes.
91560        // call cb(er, data) where data is <= n in length.
91561        // for virtual (non-string, non-buffer) streams, "length" is somewhat
91562        // arbitrary, and perhaps not very meaningful.
91563
91564
91565        Readable.prototype._read = function (n) {
91566          this.emit('error', new Error('_read() is not implemented'));
91567        };
91568
91569        Readable.prototype.pipe = function (dest, pipeOpts) {
91570          var src = this;
91571          var state = this._readableState;
91572
91573          switch (state.pipesCount) {
91574            case 0:
91575              state.pipes = dest;
91576              break;
91577
91578            case 1:
91579              state.pipes = [state.pipes, dest];
91580              break;
91581
91582            default:
91583              state.pipes.push(dest);
91584              break;
91585          }
91586
91587          state.pipesCount += 1;
91588          debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
91589          var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
91590          var endFn = doEnd ? onend : unpipe;
91591          if (state.endEmitted) pna.nextTick(endFn);else src.once('end', endFn);
91592          dest.on('unpipe', onunpipe);
91593
91594          function onunpipe(readable, unpipeInfo) {
91595            debug('onunpipe');
91596
91597            if (readable === src) {
91598              if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
91599                unpipeInfo.hasUnpiped = true;
91600                cleanup();
91601              }
91602            }
91603          }
91604
91605          function onend() {
91606            debug('onend');
91607            dest.end();
91608          } // when the dest drains, it reduces the awaitDrain counter
91609          // on the source.  This would be more elegant with a .once()
91610          // handler in flow(), but adding and removing repeatedly is
91611          // too slow.
91612
91613
91614          var ondrain = pipeOnDrain(src);
91615          dest.on('drain', ondrain);
91616          var cleanedUp = false;
91617
91618          function cleanup() {
91619            debug('cleanup'); // cleanup event handlers once the pipe is broken
91620
91621            dest.removeListener('close', onclose);
91622            dest.removeListener('finish', onfinish);
91623            dest.removeListener('drain', ondrain);
91624            dest.removeListener('error', onerror);
91625            dest.removeListener('unpipe', onunpipe);
91626            src.removeListener('end', onend);
91627            src.removeListener('end', unpipe);
91628            src.removeListener('data', ondata);
91629            cleanedUp = true; // if the reader is waiting for a drain event from this
91630            // specific writer, then it would cause it to never start
91631            // flowing again.
91632            // So, if this is awaiting a drain, then we just call it now.
91633            // If we don't know, then assume that we are waiting for one.
91634
91635            if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
91636          } // If the user pushes more data while we're writing to dest then we'll end up
91637          // in ondata again. However, we only want to increase awaitDrain once because
91638          // dest will only emit one 'drain' event for the multiple writes.
91639          // => Introduce a guard on increasing awaitDrain.
91640
91641
91642          var increasedAwaitDrain = false;
91643          src.on('data', ondata);
91644
91645          function ondata(chunk) {
91646            debug('ondata');
91647            increasedAwaitDrain = false;
91648            var ret = dest.write(chunk);
91649
91650            if (false === ret && !increasedAwaitDrain) {
91651              // If the user unpiped during `dest.write()`, it is possible
91652              // to get stuck in a permanently paused state if that write
91653              // also returned false.
91654              // => Check whether `dest` is still a piping destination.
91655              if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
91656                debug('false write response, pause', src._readableState.awaitDrain);
91657                src._readableState.awaitDrain++;
91658                increasedAwaitDrain = true;
91659              }
91660
91661              src.pause();
91662            }
91663          } // if the dest has an error, then stop piping into it.
91664          // however, don't suppress the throwing behavior for this.
91665
91666
91667          function onerror(er) {
91668            debug('onerror', er);
91669            unpipe();
91670            dest.removeListener('error', onerror);
91671            if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);
91672          } // Make sure our error handler is attached before userland ones.
91673
91674
91675          prependListener(dest, 'error', onerror); // Both close and finish should trigger unpipe, but only once.
91676
91677          function onclose() {
91678            dest.removeListener('finish', onfinish);
91679            unpipe();
91680          }
91681
91682          dest.once('close', onclose);
91683
91684          function onfinish() {
91685            debug('onfinish');
91686            dest.removeListener('close', onclose);
91687            unpipe();
91688          }
91689
91690          dest.once('finish', onfinish);
91691
91692          function unpipe() {
91693            debug('unpipe');
91694            src.unpipe(dest);
91695          } // tell the dest that it's being piped to
91696
91697
91698          dest.emit('pipe', src); // start the flow if it hasn't been started already.
91699
91700          if (!state.flowing) {
91701            debug('pipe resume');
91702            src.resume();
91703          }
91704
91705          return dest;
91706        };
91707
91708        function pipeOnDrain(src) {
91709          return function () {
91710            var state = src._readableState;
91711            debug('pipeOnDrain', state.awaitDrain);
91712            if (state.awaitDrain) state.awaitDrain--;
91713
91714            if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
91715              state.flowing = true;
91716              flow(src);
91717            }
91718          };
91719        }
91720
91721        Readable.prototype.unpipe = function (dest) {
91722          var state = this._readableState;
91723          var unpipeInfo = {
91724            hasUnpiped: false
91725          }; // if we're not piping anywhere, then do nothing.
91726
91727          if (state.pipesCount === 0) return this; // just one destination.  most common case.
91728
91729          if (state.pipesCount === 1) {
91730            // passed in one, but it's not the right one.
91731            if (dest && dest !== state.pipes) return this;
91732            if (!dest) dest = state.pipes; // got a match.
91733
91734            state.pipes = null;
91735            state.pipesCount = 0;
91736            state.flowing = false;
91737            if (dest) dest.emit('unpipe', this, unpipeInfo);
91738            return this;
91739          } // slow case. multiple pipe destinations.
91740
91741
91742          if (!dest) {
91743            // remove all.
91744            var dests = state.pipes;
91745            var len = state.pipesCount;
91746            state.pipes = null;
91747            state.pipesCount = 0;
91748            state.flowing = false;
91749
91750            for (var i = 0; i < len; i++) {
91751              dests[i].emit('unpipe', this, unpipeInfo);
91752            }
91753
91754            return this;
91755          } // try to find the right one.
91756
91757
91758          var index = indexOf(state.pipes, dest);
91759          if (index === -1) return this;
91760          state.pipes.splice(index, 1);
91761          state.pipesCount -= 1;
91762          if (state.pipesCount === 1) state.pipes = state.pipes[0];
91763          dest.emit('unpipe', this, unpipeInfo);
91764          return this;
91765        }; // set up data events if they are asked for
91766        // Ensure readable listeners eventually get something
91767
91768
91769        Readable.prototype.on = function (ev, fn) {
91770          var res = Stream.prototype.on.call(this, ev, fn);
91771
91772          if (ev === 'data') {
91773            // Start flowing on next tick if stream isn't explicitly paused
91774            if (this._readableState.flowing !== false) this.resume();
91775          } else if (ev === 'readable') {
91776            var state = this._readableState;
91777
91778            if (!state.endEmitted && !state.readableListening) {
91779              state.readableListening = state.needReadable = true;
91780              state.emittedReadable = false;
91781
91782              if (!state.reading) {
91783                pna.nextTick(nReadingNextTick, this);
91784              } else if (state.length) {
91785                emitReadable(this);
91786              }
91787            }
91788          }
91789
91790          return res;
91791        };
91792
91793        Readable.prototype.addListener = Readable.prototype.on;
91794
91795        function nReadingNextTick(self) {
91796          debug('readable nexttick read 0');
91797          self.read(0);
91798        } // pause() and resume() are remnants of the legacy readable stream API
91799        // If the user uses them, then switch into old mode.
91800
91801
91802        Readable.prototype.resume = function () {
91803          var state = this._readableState;
91804
91805          if (!state.flowing) {
91806            debug('resume');
91807            state.flowing = true;
91808            resume(this, state);
91809          }
91810
91811          return this;
91812        };
91813
91814        function resume(stream, state) {
91815          if (!state.resumeScheduled) {
91816            state.resumeScheduled = true;
91817            pna.nextTick(resume_, stream, state);
91818          }
91819        }
91820
91821        function resume_(stream, state) {
91822          if (!state.reading) {
91823            debug('resume read 0');
91824            stream.read(0);
91825          }
91826
91827          state.resumeScheduled = false;
91828          state.awaitDrain = 0;
91829          stream.emit('resume');
91830          flow(stream);
91831          if (state.flowing && !state.reading) stream.read(0);
91832        }
91833
91834        Readable.prototype.pause = function () {
91835          debug('call pause flowing=%j', this._readableState.flowing);
91836
91837          if (false !== this._readableState.flowing) {
91838            debug('pause');
91839            this._readableState.flowing = false;
91840            this.emit('pause');
91841          }
91842
91843          return this;
91844        };
91845
91846        function flow(stream) {
91847          var state = stream._readableState;
91848          debug('flow', state.flowing);
91849
91850          while (state.flowing && stream.read() !== null) {}
91851        } // wrap an old-style stream as the async data source.
91852        // This is *not* part of the readable stream interface.
91853        // It is an ugly unfortunate mess of history.
91854
91855
91856        Readable.prototype.wrap = function (stream) {
91857          var _this = this;
91858
91859          var state = this._readableState;
91860          var paused = false;
vendor: 6,529 bytes, lines 91861-92052
91861          stream.on('end', function () {
91862            debug('wrapped end');
91863
91864            if (state.decoder && !state.ended) {
91865              var chunk = state.decoder.end();
91866              if (chunk && chunk.length) _this.push(chunk);
91867            }
91868
91869            _this.push(null);
91870          });
91871          stream.on('data', function (chunk) {
91872            debug('wrapped data');
91873            if (state.decoder) chunk = state.decoder.write(chunk); // don't skip over falsy values in objectMode
91874
91875            if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
91876
91877            var ret = _this.push(chunk);
91878
91879            if (!ret) {
91880              paused = true;
91881              stream.pause();
91882            }
91883          }); // proxy all the other methods.
91884          // important when wrapping filters and duplexes.
91885
91886          for (var i in stream) {
91887            if (this[i] === undefined && typeof stream[i] === 'function') {
91888              this[i] = function (method) {
91889                return function () {
91890                  return stream[method].apply(stream, arguments);
91891                };
91892              }(i);
91893            }
91894          } // proxy certain important events.
91895
91896
91897          for (var n = 0; n < kProxyEvents.length; n++) {
91898            stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
91899          } // when we try to consume some more bytes, simply unpause the
91900          // underlying stream.
91901
91902
91903          this._read = function (n) {
91904            debug('wrapped _read', n);
91905
91906            if (paused) {
91907              paused = false;
91908              stream.resume();
91909            }
91910          };
91911
91912          return this;
91913        };
91914
91915        Object.defineProperty(Readable.prototype, 'readableHighWaterMark', {
91916          // making it explicit this property is not enumerable
91917          // because otherwise some prototype manipulation in
91918          // userland will fail
91919          enumerable: false,
91920          get: function get() {
91921            return this._readableState.highWaterMark;
91922          }
91923        }); // exposed for testing purposes only.
91924
91925        Readable._fromList = fromList; // Pluck off n bytes from an array of buffers.
91926        // Length is the combined lengths of all the buffers in the list.
91927        // This function is designed to be inlinable, so please take care when making
91928        // changes to the function body.
91929
91930        function fromList(n, state) {
91931          // nothing buffered
91932          if (state.length === 0) return null;
91933          var ret;
91934          if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
91935            // read it all, truncate the list
91936            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);
91937            state.buffer.clear();
91938          } else {
91939            // read part of list
91940            ret = fromListPartial(n, state.buffer, state.decoder);
91941          }
91942          return ret;
91943        } // Extracts only enough buffered data to satisfy the amount requested.
91944        // This function is designed to be inlinable, so please take care when making
91945        // changes to the function body.
91946
91947
91948        function fromListPartial(n, list, hasStrings) {
91949          var ret;
91950
91951          if (n < list.head.data.length) {
91952            // slice is the same for buffers and strings
91953            ret = list.head.data.slice(0, n);
91954            list.head.data = list.head.data.slice(n);
91955          } else if (n === list.head.data.length) {
91956            // first chunk is a perfect match
91957            ret = list.shift();
91958          } else {
91959            // result spans more than one buffer
91960            ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
91961          }
91962
91963          return ret;
91964        } // Copies a specified amount of characters from the list of buffered data
91965        // chunks.
91966        // This function is designed to be inlinable, so please take care when making
91967        // changes to the function body.
91968
91969
91970        function copyFromBufferString(n, list) {
91971          var p = list.head;
91972          var c = 1;
91973          var ret = p.data;
91974          n -= ret.length;
91975
91976          while (p = p.next) {
91977            var str = p.data;
91978            var nb = n > str.length ? str.length : n;
91979            if (nb === str.length) ret += str;else ret += str.slice(0, n);
91980            n -= nb;
91981
91982            if (n === 0) {
91983              if (nb === str.length) {
91984                ++c;
91985                if (p.next) list.head = p.next;else list.head = list.tail = null;
91986              } else {
91987                list.head = p;
91988                p.data = str.slice(nb);
91989              }
91990
91991              break;
91992            }
91993
91994            ++c;
91995          }
91996
91997          list.length -= c;
91998          return ret;
91999        } // Copies a specified amount of bytes from the list of buffered data chunks.
92000        // This function is designed to be inlinable, so please take care when making
92001        // changes to the function body.
92002
92003
92004        function copyFromBuffer(n, list) {
92005          var ret = Buffer.allocUnsafe(n);
92006          var p = list.head;
92007          var c = 1;
92008          p.data.copy(ret);
92009          n -= p.data.length;
92010
92011          while (p = p.next) {
92012            var buf = p.data;
92013            var nb = n > buf.length ? buf.length : n;
92014            buf.copy(ret, ret.length - n, 0, nb);
92015            n -= nb;
92016
92017            if (n === 0) {
92018              if (nb === buf.length) {
92019                ++c;
92020                if (p.next) list.head = p.next;else list.head = list.tail = null;
92021              } else {
92022                list.head = p;
92023                p.data = buf.slice(nb);
92024              }
92025
92026              break;
92027            }
92028
92029            ++c;
92030          }
92031
92032          list.length -= c;
92033          return ret;
92034        }
92035
92036        function endReadable(stream) {
92037          var state = stream._readableState; // If we get here before consuming all the bytes, then that is a
92038          // bug in node.  Should never happen.
92039
92040          if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream');
92041
92042          if (!state.endEmitted) {
92043            state.ended = true;
92044            pna.nextTick(endReadableNT, state, stream);
92045          }
92046        }
92047
92048        function endReadableNT(state, stream) {
92049          // Check that we didn't get one last unshift.
92050          if (!state.endEmitted && state.length === 0) {
92051            state.endEmitted = true;
92052            stream.readable = false;
vendor: 5,096 bytes, lines 92053-92158
92053            stream.emit('end');
92054          }
92055        }
92056
92057        function indexOf(xs, x) {
92058          for (var i = 0, l = xs.length; i < l; i++) {
92059            if (xs[i] === x) return i;
92060          }
92061
92062          return -1;
92063        }
92064      }).call(this, require('_process'), typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
92065    }, {
92066      "./_stream_duplex": 483,
92067      "./internal/streams/BufferList": 488,
92068      "./internal/streams/destroy": 489,
92069      "./internal/streams/stream": 490,
92070      "_process": 443,
92071      "core-util-is": 305,
92072      "events": 344,
92073      "inherits": 364,
92074      "isarray": 366,
92075      "process-nextick-args": 442,
92076      "safe-buffer": 470,
92077      "string_decoder/": 495,
92078      "util": 183
92079    }],
92080    486: [function (require, module, exports) {
92081      // Copyright Joyent, Inc. and other Node contributors.
92082      //
92083      // Permission is hereby granted, free of charge, to any person obtaining a
92084      // copy of this software and associated documentation files (the
92085      // "Software"), to deal in the Software without restriction, including
92086      // without limitation the rights to use, copy, modify, merge, publish,
92087      // distribute, sublicense, and/or sell copies of the Software, and to permit
92088      // persons to whom the Software is furnished to do so, subject to the
92089      // following conditions:
92090      //
92091      // The above copyright notice and this permission notice shall be included
92092      // in all copies or substantial portions of the Software.
92093      //
92094      // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
92095      // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
92096      // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
92097      // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
92098      // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
92099      // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
92100      // USE OR OTHER DEALINGS IN THE SOFTWARE.
92101      // a transform stream is a readable/writable stream where you do
92102      // something with the data.  Sometimes it's called a "filter",
92103      // but that's not a great name for it, since that implies a thing where
92104      // some bits pass through, and others are simply ignored.  (That would
92105      // be a valid example of a transform, of course.)
92106      //
92107      // While the output is causally related to the input, it's not a
92108      // necessarily symmetric or synchronous transformation.  For example,
92109      // a zlib stream might take multiple plain-text writes(), and then
92110      // emit a single compressed chunk some time in the future.
92111      //
92112      // Here's how this works:
92113      //
92114      // The Transform stream has all the aspects of the readable and writable
92115      // stream classes.  When you write(chunk), that calls _write(chunk,cb)
92116      // internally, and returns false if there's a lot of pending writes
92117      // buffered up.  When you call read(), that calls _read(n) until
92118      // there's enough pending readable data buffered up.
92119      //
92120      // In a transform stream, the written data is placed in a buffer.  When
92121      // _read(n) is called, it transforms the queued up data, calling the
92122      // buffered _write cb's as it consumes chunks.  If consuming a single
92123      // written chunk would result in multiple output chunks, then the first
92124      // outputted bit calls the readcb, and subsequent chunks just go into
92125      // the read buffer, and will cause it to emit 'readable' if necessary.
92126      //
92127      // This way, back-pressure is actually determined by the reading side,
92128      // since _read has to be called to start processing a new chunk.  However,
92129      // a pathological inflate type of transform can cause excessive buffering
92130      // here.  For example, imagine a stream where every byte of input is
92131      // interpreted as an integer from 0-255, and then results in that many
92132      // bytes of output.  Writing the 4 bytes {ff,ff,ff,ff} would result in
92133      // 1kb of data being output.  In this case, you could write a very small
92134      // amount of input, and end up with a very large amount of output.  In
92135      // such a pathological inflating mechanism, there'd be no way to tell
92136      // the system to stop doing the transform.  A single 4MB write could
92137      // cause the system to run out of memory.
92138      //
92139      // However, even in such a pathological case, only a single written chunk
92140      // would be consumed, and then the rest would wait (un-transformed) until
92141      // the results of the previous transformed chunk were consumed.
92142      'use strict';
92143
92144      module.exports = Transform;
92145
92146      var Duplex = require('./_stream_duplex');
92147      /*<replacement>*/
92148
92149
92150      var util = Object.create(require('core-util-is'));
92151      util.inherits = require('inherits');
92152      /*</replacement>*/
92153
92154      util.inherits(Transform, Duplex);
92155
92156      function afterTransform(er, data) {
92157        var ts = this._transformState;
92158        ts.transforming = false;
vendor: 4,520 bytes, lines 92159-92285
92159        var cb = ts.writecb;
92160
92161        if (!cb) {
92162          return this.emit('error', new Error('write callback called multiple times'));
92163        }
92164
92165        ts.writechunk = null;
92166        ts.writecb = null;
92167        if (data != null) // single equals check for both `null` and `undefined`
92168          this.push(data);
92169        cb(er);
92170        var rs = this._readableState;
92171        rs.reading = false;
92172
92173        if (rs.needReadable || rs.length < rs.highWaterMark) {
92174          this._read(rs.highWaterMark);
92175        }
92176      }
92177
92178      function Transform(options) {
92179        if (!(this instanceof Transform)) return new Transform(options);
92180        Duplex.call(this, options);
92181        this._transformState = {
92182          afterTransform: afterTransform.bind(this),
92183          needTransform: false,
92184          transforming: false,
92185          writecb: null,
92186          writechunk: null,
92187          writeencoding: null
92188        }; // start out asking for a readable event once data is transformed.
92189
92190        this._readableState.needReadable = true; // we have implemented the _read method, and done the other things
92191        // that Readable wants before the first _read call, so unset the
92192        // sync guard flag.
92193
92194        this._readableState.sync = false;
92195
92196        if (options) {
92197          if (typeof options.transform === 'function') this._transform = options.transform;
92198          if (typeof options.flush === 'function') this._flush = options.flush;
92199        } // When the writable side finishes, then flush out anything remaining.
92200
92201
92202        this.on('prefinish', prefinish);
92203      }
92204
92205      function prefinish() {
92206        var _this = this;
92207
92208        if (typeof this._flush === 'function') {
92209          this._flush(function (er, data) {
92210            done(_this, er, data);
92211          });
92212        } else {
92213          done(this, null, null);
92214        }
92215      }
92216
92217      Transform.prototype.push = function (chunk, encoding) {
92218        this._transformState.needTransform = false;
92219        return Duplex.prototype.push.call(this, chunk, encoding);
92220      }; // This is the part where you do stuff!
92221      // override this function in implementation classes.
92222      // 'chunk' is an input chunk.
92223      //
92224      // Call `push(newChunk)` to pass along transformed output
92225      // to the readable side.  You may call 'push' zero or more times.
92226      //
92227      // Call `cb(err)` when you are done with this chunk.  If you pass
92228      // an error, then that'll put the hurt on the whole operation.  If you
92229      // never call cb(), then you'll never get another chunk.
92230
92231
92232      Transform.prototype._transform = function (chunk, encoding, cb) {
92233        throw new Error('_transform() is not implemented');
92234      };
92235
92236      Transform.prototype._write = function (chunk, encoding, cb) {
92237        var ts = this._transformState;
92238        ts.writecb = cb;
92239        ts.writechunk = chunk;
92240        ts.writeencoding = encoding;
92241
92242        if (!ts.transforming) {
92243          var rs = this._readableState;
92244          if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
92245        }
92246      }; // Doesn't matter what the args are here.
92247      // _transform does all the work.
92248      // That we got here means that the readable side wants more data.
92249
92250
92251      Transform.prototype._read = function (n) {
92252        var ts = this._transformState;
92253
92254        if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
92255          ts.transforming = true;
92256
92257          this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
92258        } else {
92259          // mark that we need a transform, so that any data that comes in
92260          // will get processed, now that we've asked for it.
92261          ts.needTransform = true;
92262        }
92263      };
92264
92265      Transform.prototype._destroy = function (err, cb) {
92266        var _this2 = this;
92267
92268        Duplex.prototype._destroy.call(this, err, function (err2) {
92269          cb(err2);
92270
92271          _this2.emit('close');
92272        });
92273      };
92274
92275      function done(stream, er, data) {
92276        if (er) return stream.emit('error', er);
92277        if (data != null) // single equals check for both `null` and `undefined`
92278          stream.push(data); // if there's nothing in the write buffer, then that means
92279        // that nothing more will ever be provided
92280
92281        if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0');
92282        if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming');
92283        return stream.push(null);
92284      }
92285    }, {
vendor: 6,365 bytes, lines 92286-92449
92286      "./_stream_duplex": 483,
92287      "core-util-is": 305,
92288      "inherits": 364
92289    }],
92290    487: [function (require, module, exports) {
92291      (function (process, global, setImmediate) {
92292        // Copyright Joyent, Inc. and other Node contributors.
92293        //
92294        // Permission is hereby granted, free of charge, to any person obtaining a
92295        // copy of this software and associated documentation files (the
92296        // "Software"), to deal in the Software without restriction, including
92297        // without limitation the rights to use, copy, modify, merge, publish,
92298        // distribute, sublicense, and/or sell copies of the Software, and to permit
92299        // persons to whom the Software is furnished to do so, subject to the
92300        // following conditions:
92301        //
92302        // The above copyright notice and this permission notice shall be included
92303        // in all copies or substantial portions of the Software.
92304        //
92305        // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
92306        // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
92307        // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
92308        // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
92309        // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
92310        // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
92311        // USE OR OTHER DEALINGS IN THE SOFTWARE.
92312        // A bit simpler than readable streams.
92313        // Implement an async ._write(chunk, encoding, cb), and it'll handle all
92314        // the drain event emission and buffering.
92315        'use strict';
92316        /*<replacement>*/
92317
92318        var pna = require('process-nextick-args');
92319        /*</replacement>*/
92320
92321
92322        module.exports = Writable;
92323        /* <replacement> */
92324
92325        function WriteReq(chunk, encoding, cb) {
92326          this.chunk = chunk;
92327          this.encoding = encoding;
92328          this.callback = cb;
92329          this.next = null;
92330        } // It seems a linked list but it is not
92331        // there will be only 2 of these for each stream
92332
92333
92334        function CorkedRequest(state) {
92335          var _this = this;
92336
92337          this.next = null;
92338          this.entry = null;
92339
92340          this.finish = function () {
92341            onCorkedFinish(_this, state);
92342          };
92343        }
92344        /* </replacement> */
92345
92346        /*<replacement>*/
92347
92348
92349        var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick;
92350        /*</replacement>*/
92351
92352        /*<replacement>*/
92353
92354        var Duplex;
92355        /*</replacement>*/
92356
92357        Writable.WritableState = WritableState;
92358        /*<replacement>*/
92359
92360        var util = Object.create(require('core-util-is'));
92361        util.inherits = require('inherits');
92362        /*</replacement>*/
92363
92364        /*<replacement>*/
92365
92366        var internalUtil = {
92367          deprecate: require('util-deprecate')
92368        };
92369        /*</replacement>*/
92370
92371        /*<replacement>*/
92372
92373        var Stream = require('./internal/streams/stream');
92374        /*</replacement>*/
92375
92376        /*<replacement>*/
92377
92378
92379        var Buffer = require('safe-buffer').Buffer;
92380
92381        var OurUint8Array = global.Uint8Array || function () {};
92382
92383        function _uint8ArrayToBuffer(chunk) {
92384          return Buffer.from(chunk);
92385        }
92386
92387        function _isUint8Array(obj) {
92388          return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
92389        }
92390        /*</replacement>*/
92391
92392
92393        var destroyImpl = require('./internal/streams/destroy');
92394
92395        util.inherits(Writable, Stream);
92396
92397        function nop() {}
92398
92399        function WritableState(options, stream) {
92400          Duplex = Duplex || require('./_stream_duplex');
92401          options = options || {}; // Duplex streams are both readable and writable, but share
92402          // the same options object.
92403          // However, some cases require setting options to different
92404          // values for the readable and the writable sides of the duplex stream.
92405          // These options can be provided separately as readableXXX and writableXXX.
92406
92407          var isDuplex = stream instanceof Duplex; // object stream flag to indicate whether or not this stream
92408          // contains buffers or objects.
92409
92410          this.objectMode = !!options.objectMode;
92411          if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; // the point at which write() starts returning false
92412          // Note: 0 is a valid value, means that we always return false if
92413          // the entire buffer is not flushed immediately on write()
92414
92415          var hwm = options.highWaterMark;
92416          var writableHwm = options.writableHighWaterMark;
92417          var defaultHwm = this.objectMode ? 16 : 16 * 1024;
92418          if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm; // cast to ints.
92419
92420          this.highWaterMark = Math.floor(this.highWaterMark); // if _final has been called
92421
92422          this.finalCalled = false; // drain event flag.
92423
92424          this.needDrain = false; // at the start of calling end()
92425
92426          this.ending = false; // when end() has been called, and returned
92427
92428          this.ended = false; // when 'finish' is emitted
92429
92430          this.finished = false; // has it been destroyed
92431
92432          this.destroyed = false; // should we decode strings into buffers before passing to _write?
92433          // this is here so that some node-core streams can optimize string
92434          // handling at a lower level.
92435
92436          var noDecode = options.decodeStrings === false;
92437          this.decodeStrings = !noDecode; // Crypto is kind of old and crusty.  Historically, its default string
92438          // encoding is 'binary' so we have to make this configurable.
92439          // Everything else in the universe uses 'utf8', though.
92440
92441          this.defaultEncoding = options.defaultEncoding || 'utf8'; // not an actual buffer we keep track of, but a measurement
92442          // of how much we're waiting to get pushed to some underlying
92443          // socket or file.
92444
92445          this.length = 0; // a flag to see when we're in the middle of a write.
92446
92447          this.writing = false; // when true all writes will be buffered until .uncork() call
92448
92449          this.corked = 0;
vendor: 14,549 bytes, lines 92449-92832
92449 // a flag to be able to tell if the onwrite cb is called immediately,
92450          // or on a later tick.  We set this to true at first, because any
92451          // actions that shouldn't happen until "later" should generally also
92452          // not happen before the first write call.
92453
92454          this.sync = true; // a flag to know if we're processing previously buffered items, which
92455          // may call the _write() callback in the same tick, so that we don't
92456          // end up in an overlapped onwrite situation.
92457
92458          this.bufferProcessing = false; // the callback that's passed to _write(chunk,cb)
92459
92460          this.onwrite = function (er) {
92461            onwrite(stream, er);
92462          }; // the callback that the user supplies to write(chunk,encoding,cb)
92463
92464
92465          this.writecb = null; // the amount that is being written when _write is called.
92466
92467          this.writelen = 0;
92468          this.bufferedRequest = null;
92469          this.lastBufferedRequest = null; // number of pending user-supplied write callbacks
92470          // this must be 0 before 'finish' can be emitted
92471
92472          this.pendingcb = 0; // emit prefinish if the only thing we're waiting for is _write cbs
92473          // This is relevant for synchronous Transform streams
92474
92475          this.prefinished = false; // True if the error was already emitted and should not be thrown again
92476
92477          this.errorEmitted = false; // count buffered requests
92478
92479          this.bufferedRequestCount = 0; // allocate the first CorkedRequest, there is always
92480          // one allocated and free to use, and we maintain at most two
92481
92482          this.corkedRequestsFree = new CorkedRequest(this);
92483        }
92484
92485        WritableState.prototype.getBuffer = function getBuffer() {
92486          var current = this.bufferedRequest;
92487          var out = [];
92488
92489          while (current) {
92490            out.push(current);
92491            current = current.next;
92492          }
92493
92494          return out;
92495        };
92496
92497        (function () {
92498          try {
92499            Object.defineProperty(WritableState.prototype, 'buffer', {
92500              get: internalUtil.deprecate(function () {
92501                return this.getBuffer();
92502              }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')
92503            });
92504          } catch (_) {}
92505        })(); // Test _writableState for inheritance to account for Duplex streams,
92506        // whose prototype chain only points to Readable.
92507
92508
92509        var realHasInstance;
92510
92511        if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {
92512          realHasInstance = Function.prototype[Symbol.hasInstance];
92513          Object.defineProperty(Writable, Symbol.hasInstance, {
92514            value: function value(object) {
92515              if (realHasInstance.call(this, object)) return true;
92516              if (this !== Writable) return false;
92517              return object && object._writableState instanceof WritableState;
92518            }
92519          });
92520        } else {
92521          realHasInstance = function realHasInstance(object) {
92522            return object instanceof this;
92523          };
92524        }
92525
92526        function Writable(options) {
92527          Duplex = Duplex || require('./_stream_duplex'); // Writable ctor is applied to Duplexes, too.
92528          // `realHasInstance` is necessary because using plain `instanceof`
92529          // would return false, as no `_writableState` property is attached.
92530          // Trying to use the custom `instanceof` for Writable here will also break the
92531          // Node.js LazyTransform implementation, which has a non-trivial getter for
92532          // `_writableState` that would lead to infinite recursion.
92533
92534          if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
92535            return new Writable(options);
92536          }
92537
92538          this._writableState = new WritableState(options, this); // legacy.
92539
92540          this.writable = true;
92541
92542          if (options) {
92543            if (typeof options.write === 'function') this._write = options.write;
92544            if (typeof options.writev === 'function') this._writev = options.writev;
92545            if (typeof options.destroy === 'function') this._destroy = options.destroy;
92546            if (typeof options.final === 'function') this._final = options.final;
92547          }
92548
92549          Stream.call(this);
92550        } // Otherwise people can pipe Writable streams, which is just wrong.
92551
92552
92553        Writable.prototype.pipe = function () {
92554          this.emit('error', new Error('Cannot pipe, not readable'));
92555        };
92556
92557        function writeAfterEnd(stream, cb) {
92558          var er = new Error('write after end'); // TODO: defer error events consistently everywhere, not just the cb
92559
92560          stream.emit('error', er);
92561          pna.nextTick(cb, er);
92562        } // Checks that a user-supplied chunk is valid, especially for the particular
92563        // mode the stream is in. Currently this means that `null` is never accepted
92564        // and undefined/non-string values are only allowed in object mode.
92565
92566
92567        function validChunk(stream, state, chunk, cb) {
92568          var valid = true;
92569          var er = false;
92570
92571          if (chunk === null) {
92572            er = new TypeError('May not write null values to stream');
92573          } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
92574            er = new TypeError('Invalid non-string/buffer chunk');
92575          }
92576
92577          if (er) {
92578            stream.emit('error', er);
92579            pna.nextTick(cb, er);
92580            valid = false;
92581          }
92582
92583          return valid;
92584        }
92585
92586        Writable.prototype.write = function (chunk, encoding, cb) {
92587          var state = this._writableState;
92588          var ret = false;
92589
92590          var isBuf = !state.objectMode && _isUint8Array(chunk);
92591
92592          if (isBuf && !Buffer.isBuffer(chunk)) {
92593            chunk = _uint8ArrayToBuffer(chunk);
92594          }
92595
92596          if (typeof encoding === 'function') {
92597            cb = encoding;
92598            encoding = null;
92599          }
92600
92601          if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
92602          if (typeof cb !== 'function') cb = nop;
92603          if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {
92604            state.pendingcb++;
92605            ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
92606          }
92607          return ret;
92608        };
92609
92610        Writable.prototype.cork = function () {
92611          var state = this._writableState;
92612          state.corked++;
92613        };
92614
92615        Writable.prototype.uncork = function () {
92616          var state = this._writableState;
92617
92618          if (state.corked) {
92619            state.corked--;
92620            if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
92621          }
92622        };
92623
92624        Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
92625          // node::ParseEncoding() requires lower case.
92626          if (typeof encoding === 'string') encoding = encoding.toLowerCase();
92627          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);
92628          this._writableState.defaultEncoding = encoding;
92629          return this;
92630        };
92631
92632        function decodeChunk(state, chunk, encoding) {
92633          if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
92634            chunk = Buffer.from(chunk, encoding);
92635          }
92636
92637          return chunk;
92638        }
92639
92640        Object.defineProperty(Writable.prototype, 'writableHighWaterMark', {
92641          // making it explicit this property is not enumerable
92642          // because otherwise some prototype manipulation in
92643          // userland will fail
92644          enumerable: false,
92645          get: function get() {
92646            return this._writableState.highWaterMark;
92647          }
92648        }); // if we're already writing something, then just put this
92649        // in the queue, and wait our turn.  Otherwise, call _write
92650        // If we return false, then we need a drain event, so set that flag.
92651
92652        function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
92653          if (!isBuf) {
92654            var newChunk = decodeChunk(state, chunk, encoding);
92655
92656            if (chunk !== newChunk) {
92657              isBuf = true;
92658              encoding = 'buffer';
92659              chunk = newChunk;
92660            }
92661          }
92662
92663          var len = state.objectMode ? 1 : chunk.length;
92664          state.length += len;
92665          var ret = state.length < state.highWaterMark; // we must ensure that previous needDrain will not be reset to false.
92666
92667          if (!ret) state.needDrain = true;
92668
92669          if (state.writing || state.corked) {
92670            var last = state.lastBufferedRequest;
92671            state.lastBufferedRequest = {
92672              chunk: chunk,
92673              encoding: encoding,
92674              isBuf: isBuf,
92675              callback: cb,
92676              next: null
92677            };
92678
92679            if (last) {
92680              last.next = state.lastBufferedRequest;
92681            } else {
92682              state.bufferedRequest = state.lastBufferedRequest;
92683            }
92684
92685            state.bufferedRequestCount += 1;
92686          } else {
92687            doWrite(stream, state, false, len, chunk, encoding, cb);
92688          }
92689
92690          return ret;
92691        }
92692
92693        function doWrite(stream, state, writev, len, chunk, encoding, cb) {
92694          state.writelen = len;
92695          state.writecb = cb;
92696          state.writing = true;
92697          state.sync = true;
92698          if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
92699          state.sync = false;
92700        }
92701
92702        function onwriteError(stream, state, sync, er, cb) {
92703          --state.pendingcb;
92704
92705          if (sync) {
92706            // defer the callback if we are being called synchronously
92707            // to avoid piling up things on the stack
92708            pna.nextTick(cb, er); // this can emit finish, and it will always happen
92709            // after error
92710
92711            pna.nextTick(finishMaybe, stream, state);
92712            stream._writableState.errorEmitted = true;
92713            stream.emit('error', er);
92714          } else {
92715            // the caller expect this to happen before if
92716            // it is async
92717            cb(er);
92718            stream._writableState.errorEmitted = true;
92719            stream.emit('error', er); // this can emit finish, but finish must
92720            // always follow error
92721
92722            finishMaybe(stream, state);
92723          }
92724        }
92725
92726        function onwriteStateUpdate(state) {
92727          state.writing = false;
92728          state.writecb = null;
92729          state.length -= state.writelen;
92730          state.writelen = 0;
92731        }
92732
92733        function onwrite(stream, er) {
92734          var state = stream._writableState;
92735          var sync = state.sync;
92736          var cb = state.writecb;
92737          onwriteStateUpdate(state);
92738          if (er) onwriteError(stream, state, sync, er, cb);else {
92739            // Check if we're actually ready to finish, but don't emit yet
92740            var finished = needFinish(state);
92741
92742            if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
92743              clearBuffer(stream, state);
92744            }
92745
92746            if (sync) {
92747              /*<replacement>*/
92748              asyncWrite(afterWrite, stream, state, finished, cb);
92749              /*</replacement>*/
92750            } else {
92751              afterWrite(stream, state, finished, cb);
92752            }
92753          }
92754        }
92755
92756        function afterWrite(stream, state, finished, cb) {
92757          if (!finished) onwriteDrain(stream, state);
92758          state.pendingcb--;
92759          cb();
92760          finishMaybe(stream, state);
92761        } // Must force callback to be called on nextTick, so that we don't
92762        // emit 'drain' before the write() consumer gets the 'false' return
92763        // value, and has a chance to attach a 'drain' listener.
92764
92765
92766        function onwriteDrain(stream, state) {
92767          if (state.length === 0 && state.needDrain) {
92768            state.needDrain = false;
92769            stream.emit('drain');
92770          }
92771        } // if there's something in the buffer waiting, then process it
92772
92773
92774        function clearBuffer(stream, state) {
92775          state.bufferProcessing = true;
92776          var entry = state.bufferedRequest;
92777
92778          if (stream._writev && entry && entry.next) {
92779            // Fast case, write everything using _writev()
92780            var l = state.bufferedRequestCount;
92781            var buffer = new Array(l);
92782            var holder = state.corkedRequestsFree;
92783            holder.entry = entry;
92784            var count = 0;
92785            var allBuffers = true;
92786
92787            while (entry) {
92788              buffer[count] = entry;
92789              if (!entry.isBuf) allBuffers = false;
92790              entry = entry.next;
92791              count += 1;
92792            }
92793
92794            buffer.allBuffers = allBuffers;
92795            doWrite(stream, state, true, state.length, buffer, '', holder.finish); // doWrite is almost always async, defer these to save a bit of time
92796            // as the hot path ends with doWrite
92797
92798            state.pendingcb++;
92799            state.lastBufferedRequest = null;
92800
92801            if (holder.next) {
92802              state.corkedRequestsFree = holder.next;
92803              holder.next = null;
92804            } else {
92805              state.corkedRequestsFree = new CorkedRequest(state);
92806            }
92807
92808            state.bufferedRequestCount = 0;
92809          } else {
92810            // Slow case, write chunks one-by-one
92811            while (entry) {
92812              var chunk = entry.chunk;
92813              var encoding = entry.encoding;
92814              var cb = entry.callback;
92815              var len = state.objectMode ? 1 : chunk.length;
92816              doWrite(stream, state, false, len, chunk, encoding, cb);
92817              entry = entry.next;
92818              state.bufferedRequestCount--; // if we didn't call the onwrite immediately, then
92819              // it means that we need to wait until it does.
92820              // also, that means that the chunk and cb are currently
92821              // being processed, so move the buffer counter past them.
92822
92823              if (state.writing) {
92824                break;
92825              }
92826            }
92827
92828            if (entry === null) state.lastBufferedRequest = null;
92829          }
92830
92831          state.bufferedRequest = entry;
92832          state.bufferProcessing = false;
vendor: 9,393 bytes, lines 92833-93163
92833        }
92834
92835        Writable.prototype._write = function (chunk, encoding, cb) {
92836          cb(new Error('_write() is not implemented'));
92837        };
92838
92839        Writable.prototype._writev = null;
92840
92841        Writable.prototype.end = function (chunk, encoding, cb) {
92842          var state = this._writableState;
92843
92844          if (typeof chunk === 'function') {
92845            cb = chunk;
92846            chunk = null;
92847            encoding = null;
92848          } else if (typeof encoding === 'function') {
92849            cb = encoding;
92850            encoding = null;
92851          }
92852
92853          if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); // .end() fully uncorks
92854
92855          if (state.corked) {
92856            state.corked = 1;
92857            this.uncork();
92858          } // ignore unnecessary end() calls.
92859
92860
92861          if (!state.ending && !state.finished) endWritable(this, state, cb);
92862        };
92863
92864        function needFinish(state) {
92865          return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
92866        }
92867
92868        function callFinal(stream, state) {
92869          stream._final(function (err) {
92870            state.pendingcb--;
92871
92872            if (err) {
92873              stream.emit('error', err);
92874            }
92875
92876            state.prefinished = true;
92877            stream.emit('prefinish');
92878            finishMaybe(stream, state);
92879          });
92880        }
92881
92882        function prefinish(stream, state) {
92883          if (!state.prefinished && !state.finalCalled) {
92884            if (typeof stream._final === 'function') {
92885              state.pendingcb++;
92886              state.finalCalled = true;
92887              pna.nextTick(callFinal, stream, state);
92888            } else {
92889              state.prefinished = true;
92890              stream.emit('prefinish');
92891            }
92892          }
92893        }
92894
92895        function finishMaybe(stream, state) {
92896          var need = needFinish(state);
92897
92898          if (need) {
92899            prefinish(stream, state);
92900
92901            if (state.pendingcb === 0) {
92902              state.finished = true;
92903              stream.emit('finish');
92904            }
92905          }
92906
92907          return need;
92908        }
92909
92910        function endWritable(stream, state, cb) {
92911          state.ending = true;
92912          finishMaybe(stream, state);
92913
92914          if (cb) {
92915            if (state.finished) pna.nextTick(cb);else stream.once('finish', cb);
92916          }
92917
92918          state.ended = true;
92919          stream.writable = false;
92920        }
92921
92922        function onCorkedFinish(corkReq, state, err) {
92923          var entry = corkReq.entry;
92924          corkReq.entry = null;
92925
92926          while (entry) {
92927            var cb = entry.callback;
92928            state.pendingcb--;
92929            cb(err);
92930            entry = entry.next;
92931          }
92932
92933          if (state.corkedRequestsFree) {
92934            state.corkedRequestsFree.next = corkReq;
92935          } else {
92936            state.corkedRequestsFree = corkReq;
92937          }
92938        }
92939
92940        Object.defineProperty(Writable.prototype, 'destroyed', {
92941          get: function get() {
92942            if (this._writableState === undefined) {
92943              return false;
92944            }
92945
92946            return this._writableState.destroyed;
92947          },
92948          set: function set(value) {
92949            // we ignore the value if the stream
92950            // has not been initialized yet
92951            if (!this._writableState) {
92952              return;
92953            } // backward compatibility, the user is explicitly
92954            // managing destroyed
92955
92956
92957            this._writableState.destroyed = value;
92958          }
92959        });
92960        Writable.prototype.destroy = destroyImpl.destroy;
92961        Writable.prototype._undestroy = destroyImpl.undestroy;
92962
92963        Writable.prototype._destroy = function (err, cb) {
92964          this.end();
92965          cb(err);
92966        };
92967      }).call(this, require('_process'), typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}, require("timers").setImmediate);
92968    }, {
92969      "./_stream_duplex": 483,
92970      "./internal/streams/destroy": 489,
92971      "./internal/streams/stream": 490,
92972      "_process": 443,
92973      "core-util-is": 305,
92974      "inherits": 364,
92975      "process-nextick-args": 442,
92976      "safe-buffer": 470,
92977      "timers": 496,
92978      "util-deprecate": 497
92979    }],
92980    488: [function (require, module, exports) {
92981      'use strict';
92982
92983      function _classCallCheck(instance, Constructor) {
92984        if (!(instance instanceof Constructor)) {
92985          throw new TypeError("Cannot call a class as a function");
92986        }
92987      }
92988
92989      var Buffer = require('safe-buffer').Buffer;
92990
92991      var util = require('util');
92992
92993      function copyBuffer(src, target, offset) {
92994        src.copy(target, offset);
92995      }
92996
92997      module.exports = function () {
92998        function BufferList() {
92999          _classCallCheck(this, BufferList);
93000
93001          this.head = null;
93002          this.tail = null;
93003          this.length = 0;
93004        }
93005
93006        BufferList.prototype.push = function push(v) {
93007          var entry = {
93008            data: v,
93009            next: null
93010          };
93011          if (this.length > 0) this.tail.next = entry;else this.head = entry;
93012          this.tail = entry;
93013          ++this.length;
93014        };
93015
93016        BufferList.prototype.unshift = function unshift(v) {
93017          var entry = {
93018            data: v,
93019            next: this.head
93020          };
93021          if (this.length === 0) this.tail = entry;
93022          this.head = entry;
93023          ++this.length;
93024        };
93025
93026        BufferList.prototype.shift = function shift() {
93027          if (this.length === 0) return;
93028          var ret = this.head.data;
93029          if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
93030          --this.length;
93031          return ret;
93032        };
93033
93034        BufferList.prototype.clear = function clear() {
93035          this.head = this.tail = null;
93036          this.length = 0;
93037        };
93038
93039        BufferList.prototype.join = function join(s) {
93040          if (this.length === 0) return '';
93041          var p = this.head;
93042          var ret = '' + p.data;
93043
93044          while (p = p.next) {
93045            ret += s + p.data;
93046          }
93047
93048          return ret;
93049        };
93050
93051        BufferList.prototype.concat = function concat(n) {
93052          if (this.length === 0) return Buffer.alloc(0);
93053          if (this.length === 1) return this.head.data;
93054          var ret = Buffer.allocUnsafe(n >>> 0);
93055          var p = this.head;
93056          var i = 0;
93057
93058          while (p) {
93059            copyBuffer(p.data, ret, i);
93060            i += p.data.length;
93061            p = p.next;
93062          }
93063
93064          return ret;
93065        };
93066
93067        return BufferList;
93068      }();
93069
93070      if (util && util.inspect && util.inspect.custom) {
93071        module.exports.prototype[util.inspect.custom] = function () {
93072          var obj = util.inspect({
93073            length: this.length
93074          });
93075          return this.constructor.name + ' ' + obj;
93076        };
93077      }
93078    }, {
93079      "safe-buffer": 470,
93080      "util": 183
93081    }],
93082    489: [function (require, module, exports) {
93083      'use strict';
93084      /*<replacement>*/
93085
93086      var pna = require('process-nextick-args');
93087      /*</replacement>*/
93088      // undocumented cb() API, needed for core, not for public API
93089
93090
93091      function destroy(err, cb) {
93092        var _this = this;
93093
93094        var readableDestroyed = this._readableState && this._readableState.destroyed;
93095        var writableDestroyed = this._writableState && this._writableState.destroyed;
93096
93097        if (readableDestroyed || writableDestroyed) {
93098          if (cb) {
93099            cb(err);
93100          } else if (err && (!this._writableState || !this._writableState.errorEmitted)) {
93101            pna.nextTick(emitErrorNT, this, err);
93102          }
93103
93104          return this;
93105        } // we set destroyed to true before firing error callbacks in order
93106        // to make it re-entrance safe in case destroy() is called within callbacks
93107
93108
93109        if (this._readableState) {
93110          this._readableState.destroyed = true;
93111        } // if this is a duplex stream mark the writable part as destroyed as well
93112
93113
93114        if (this._writableState) {
93115          this._writableState.destroyed = true;
93116        }
93117
93118        this._destroy(err || null, function (err) {
93119          if (!cb && err) {
93120            pna.nextTick(emitErrorNT, _this, err);
93121
93122            if (_this._writableState) {
93123              _this._writableState.errorEmitted = true;
93124            }
93125          } else if (cb) {
93126            cb(err);
93127          }
93128        });
93129
93130        return this;
93131      }
93132
93133      function undestroy() {
93134        if (this._readableState) {
93135          this._readableState.destroyed = false;
93136          this._readableState.reading = false;
93137          this._readableState.ended = false;
93138          this._readableState.endEmitted = false;
93139        }
93140
93141        if (this._writableState) {
93142          this._writableState.destroyed = false;
93143          this._writableState.ended = false;
93144          this._writableState.ending = false;
93145          this._writableState.finished = false;
93146          this._writableState.errorEmitted = false;
93147        }
93148      }
93149
93150      function emitErrorNT(self, err) {
93151        self.emit('error', err);
93152      }
93153
93154      module.exports = {
93155        destroy: destroy,
93156        undestroy: undestroy
93157      };
93158    }, {
93159      "process-nextick-args": 442
93160    }],
93161    490: [function (require, module, exports) {
93162      arguments[4][466][0].apply(exports, arguments);
93163    }, {
vendor: 3,910 bytes, lines 93164-93281
93164      "dup": 466,
93165      "events": 344
93166    }],
93167    491: [function (require, module, exports) {
93168      module.exports = require('./readable').PassThrough;
93169    }, {
93170      "./readable": 492
93171    }],
93172    492: [function (require, module, exports) {
93173      exports = module.exports = require('./lib/_stream_readable.js');
93174      exports.Stream = exports;
93175      exports.Readable = exports;
93176      exports.Writable = require('./lib/_stream_writable.js');
93177      exports.Duplex = require('./lib/_stream_duplex.js');
93178      exports.Transform = require('./lib/_stream_transform.js');
93179      exports.PassThrough = require('./lib/_stream_passthrough.js');
93180    }, {
93181      "./lib/_stream_duplex.js": 483,
93182      "./lib/_stream_passthrough.js": 484,
93183      "./lib/_stream_readable.js": 485,
93184      "./lib/_stream_transform.js": 486,
93185      "./lib/_stream_writable.js": 487
93186    }],
93187    493: [function (require, module, exports) {
93188      module.exports = require('./readable').Transform;
93189    }, {
93190      "./readable": 492
93191    }],
93192    494: [function (require, module, exports) {
93193      module.exports = require('./lib/_stream_writable.js');
93194    }, {
93195      "./lib/_stream_writable.js": 487
93196    }],
93197    495: [function (require, module, exports) {
93198      // Copyright Joyent, Inc. and other Node contributors.
93199      //
93200      // Permission is hereby granted, free of charge, to any person obtaining a
93201      // copy of this software and associated documentation files (the
93202      // "Software"), to deal in the Software without restriction, including
93203      // without limitation the rights to use, copy, modify, merge, publish,
93204      // distribute, sublicense, and/or sell copies of the Software, and to permit
93205      // persons to whom the Software is furnished to do so, subject to the
93206      // following conditions:
93207      //
93208      // The above copyright notice and this permission notice shall be included
93209      // in all copies or substantial portions of the Software.
93210      //
93211      // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
93212      // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
93213      // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
93214      // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
93215      // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
93216      // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
93217      // USE OR OTHER DEALINGS IN THE SOFTWARE.
93218      'use strict';
93219      /*<replacement>*/
93220
93221      var Buffer = require('safe-buffer').Buffer;
93222      /*</replacement>*/
93223
93224
93225      var isEncoding = Buffer.isEncoding || function (encoding) {
93226        encoding = '' + encoding;
93227
93228        switch (encoding && encoding.toLowerCase()) {
93229          case 'hex':
93230          case 'utf8':
93231          case 'utf-8':
93232          case 'ascii':
93233          case 'binary':
93234          case 'base64':
93235          case 'ucs2':
93236          case 'ucs-2':
93237          case 'utf16le':
93238          case 'utf-16le':
93239          case 'raw':
93240            return true;
93241
93242          default:
93243            return false;
93244        }
93245      };
93246
93247      function _normalizeEncoding(enc) {
93248        if (!enc) return 'utf8';
93249        var retried;
93250
93251        while (true) {
93252          switch (enc) {
93253            case 'utf8':
93254            case 'utf-8':
93255              return 'utf8';
93256
93257            case 'ucs2':
93258            case 'ucs-2':
93259            case 'utf16le':
93260            case 'utf-16le':
93261              return 'utf16le';
93262
93263            case 'latin1':
93264            case 'binary':
93265              return 'latin1';
93266
93267            case 'base64':
93268            case 'ascii':
93269            case 'hex':
93270              return enc;
93271
93272            default:
93273              if (retried) return; // undefined
93274
93275              enc = ('' + enc).toLowerCase();
93276              retried = true;
93277          }
93278        }
93279      }
93280
93281      ; // Do not cache `Buffer.isEncoding` when checking encoding names as some
vendor: 6,764 bytes, lines 93282-93480
93282      // modules monkey-patch it to support additional encodings
93283
93284      function normalizeEncoding(enc) {
93285        var nenc = _normalizeEncoding(enc);
93286
93287        if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);
93288        return nenc || enc;
93289      } // StringDecoder provides an interface for efficiently splitting a series of
93290      // buffers into a series of JS strings without breaking apart multi-byte
93291      // characters.
93292
93293
93294      exports.StringDecoder = StringDecoder;
93295
93296      function StringDecoder(encoding) {
93297        this.encoding = normalizeEncoding(encoding);
93298        var nb;
93299
93300        switch (this.encoding) {
93301          case 'utf16le':
93302            this.text = utf16Text;
93303            this.end = utf16End;
93304            nb = 4;
93305            break;
93306
93307          case 'utf8':
93308            this.fillLast = utf8FillLast;
93309            nb = 4;
93310            break;
93311
93312          case 'base64':
93313            this.text = base64Text;
93314            this.end = base64End;
93315            nb = 3;
93316            break;
93317
93318          default:
93319            this.write = simpleWrite;
93320            this.end = simpleEnd;
93321            return;
93322        }
93323
93324        this.lastNeed = 0;
93325        this.lastTotal = 0;
93326        this.lastChar = Buffer.allocUnsafe(nb);
93327      }
93328
93329      StringDecoder.prototype.write = function (buf) {
93330        if (buf.length === 0) return '';
93331        var r;
93332        var i;
93333
93334        if (this.lastNeed) {
93335          r = this.fillLast(buf);
93336          if (r === undefined) return '';
93337          i = this.lastNeed;
93338          this.lastNeed = 0;
93339        } else {
93340          i = 0;
93341        }
93342
93343        if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);
93344        return r || '';
93345      };
93346
93347      StringDecoder.prototype.end = utf8End; // Returns only complete characters in a Buffer
93348
93349      StringDecoder.prototype.text = utf8Text; // Attempts to complete a partial non-UTF-8 character using bytes from a Buffer
93350
93351      StringDecoder.prototype.fillLast = function (buf) {
93352        if (this.lastNeed <= buf.length) {
93353          buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
93354          return this.lastChar.toString(this.encoding, 0, this.lastTotal);
93355        }
93356
93357        buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
93358        this.lastNeed -= buf.length;
93359      }; // Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a
93360      // continuation byte. If an invalid byte is detected, -2 is returned.
93361
93362
93363      function utf8CheckByte(byte) {
93364        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;
93365        return byte >> 6 === 0x02 ? -1 : -2;
93366      } // Checks at most 3 bytes at the end of a Buffer in order to detect an
93367      // incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)
93368      // needed to complete the UTF-8 character (if applicable) are returned.
93369
93370
93371      function utf8CheckIncomplete(self, buf, i) {
93372        var j = buf.length - 1;
93373        if (j < i) return 0;
93374        var nb = utf8CheckByte(buf[j]);
93375
93376        if (nb >= 0) {
93377          if (nb > 0) self.lastNeed = nb - 1;
93378          return nb;
93379        }
93380
93381        if (--j < i || nb === -2) return 0;
93382        nb = utf8CheckByte(buf[j]);
93383
93384        if (nb >= 0) {
93385          if (nb > 0) self.lastNeed = nb - 2;
93386          return nb;
93387        }
93388
93389        if (--j < i || nb === -2) return 0;
93390        nb = utf8CheckByte(buf[j]);
93391
93392        if (nb >= 0) {
93393          if (nb > 0) {
93394            if (nb === 2) nb = 0;else self.lastNeed = nb - 3;
93395          }
93396
93397          return nb;
93398        }
93399
93400        return 0;
93401      } // Validates as many continuation bytes for a multi-byte UTF-8 character as
93402      // needed or are available. If we see a non-continuation byte where we expect
93403      // one, we "replace" the validated continuation bytes we've seen so far with
93404      // a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding
93405      // behavior. The continuation byte check is included three times in the case
93406      // where all of the continuation bytes for a character exist in the same buffer.
93407      // It is also done this way as a slight performance increase instead of using a
93408      // loop.
93409
93410
93411      function utf8CheckExtraBytes(self, buf, p) {
93412        if ((buf[0] & 0xC0) !== 0x80) {
93413          self.lastNeed = 0;
93414          return "\uFFFD";
93415        }
93416
93417        if (self.lastNeed > 1 && buf.length > 1) {
93418          if ((buf[1] & 0xC0) !== 0x80) {
93419            self.lastNeed = 1;
93420            return "\uFFFD";
93421          }
93422
93423          if (self.lastNeed > 2 && buf.length > 2) {
93424            if ((buf[2] & 0xC0) !== 0x80) {
93425              self.lastNeed = 2;
93426              return "\uFFFD";
93427            }
93428          }
93429        }
93430      } // Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.
93431
93432
93433      function utf8FillLast(buf) {
93434        var p = this.lastTotal - this.lastNeed;
93435        var r = utf8CheckExtraBytes(this, buf, p);
93436        if (r !== undefined) return r;
93437
93438        if (this.lastNeed <= buf.length) {
93439          buf.copy(this.lastChar, p, 0, this.lastNeed);
93440          return this.lastChar.toString(this.encoding, 0, this.lastTotal);
93441        }
93442
93443        buf.copy(this.lastChar, p, 0, buf.length);
93444        this.lastNeed -= buf.length;
93445      } // Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a
93446      // partial character, the character's bytes are buffered until the required
93447      // number of bytes are available.
93448
93449
93450      function utf8Text(buf, i) {
93451        var total = utf8CheckIncomplete(this, buf, i);
93452        if (!this.lastNeed) return buf.toString('utf8', i);
93453        this.lastTotal = total;
93454        var end = buf.length - (total - this.lastNeed);
93455        buf.copy(this.lastChar, 0, end);
93456        return buf.toString('utf8', i, end);
93457      } // For UTF-8, a replacement character is added when ending on a partial
93458      // character.
93459
93460
93461      function utf8End(buf) {
93462        var r = buf && buf.length ? this.write(buf) : '';
93463        if (this.lastNeed) return r + "\uFFFD";
93464        return r;
93465      } // UTF-16LE typically needs two bytes per character, but even if we have an even
93466      // number of bytes available, we need to check if we end on a leading/high
93467      // surrogate. In that case, we need to wait for the next two bytes in order to
93468      // decode the last character properly.
93469
93470
93471      function utf16Text(buf, i) {
93472        if ((buf.length - i) % 2 === 0) {
93473          var r = buf.toString('utf16le', i);
93474
93475          if (r) {
93476            var c = r.charCodeAt(r.length - 1);
93477
93478            if (c >= 0xD800 && c <= 0xDBFF) {
93479              this.lastNeed = 2;
93480              this.lastTotal = 4;
vendor: 4,062 bytes, lines 93481-93605
93481              this.lastChar[0] = buf[buf.length - 2];
93482              this.lastChar[1] = buf[buf.length - 1];
93483              return r.slice(0, -1);
93484            }
93485          }
93486
93487          return r;
93488        }
93489
93490        this.lastNeed = 1;
93491        this.lastTotal = 2;
93492        this.lastChar[0] = buf[buf.length - 1];
93493        return buf.toString('utf16le', i, buf.length - 1);
93494      } // For UTF-16LE we do not explicitly append special replacement characters if we
93495      // end on a partial character, we simply let v8 handle that.
93496
93497
93498      function utf16End(buf) {
93499        var r = buf && buf.length ? this.write(buf) : '';
93500
93501        if (this.lastNeed) {
93502          var end = this.lastTotal - this.lastNeed;
93503          return r + this.lastChar.toString('utf16le', 0, end);
93504        }
93505
93506        return r;
93507      }
93508
93509      function base64Text(buf, i) {
93510        var n = (buf.length - i) % 3;
93511        if (n === 0) return buf.toString('base64', i);
93512        this.lastNeed = 3 - n;
93513        this.lastTotal = 3;
93514
93515        if (n === 1) {
93516          this.lastChar[0] = buf[buf.length - 1];
93517        } else {
93518          this.lastChar[0] = buf[buf.length - 2];
93519          this.lastChar[1] = buf[buf.length - 1];
93520        }
93521
93522        return buf.toString('base64', i, buf.length - n);
93523      }
93524
93525      function base64End(buf) {
93526        var r = buf && buf.length ? this.write(buf) : '';
93527        if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);
93528        return r;
93529      } // Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)
93530
93531
93532      function simpleWrite(buf) {
93533        return buf.toString(this.encoding);
93534      }
93535
93536      function simpleEnd(buf) {
93537        return buf && buf.length ? this.write(buf) : '';
93538      }
93539    }, {
93540      "safe-buffer": 470
93541    }],
93542    496: [function (require, module, exports) {
93543      (function (setImmediate, clearImmediate) {
93544        var nextTick = require('process/browser.js').nextTick;
93545
93546        var apply = Function.prototype.apply;
93547        var slice = Array.prototype.slice;
93548        var immediateIds = {};
93549        var nextImmediateId = 0; // DOM APIs, for completeness
93550
93551        exports.setTimeout = function () {
93552          return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);
93553        };
93554
93555        exports.setInterval = function () {
93556          return new Timeout(apply.call(setInterval, window, arguments), clearInterval);
93557        };
93558
93559        exports.clearTimeout = exports.clearInterval = function (timeout) {
93560          timeout.close();
93561        };
93562
93563        function Timeout(id, clearFn) {
93564          this._id = id;
93565          this._clearFn = clearFn;
93566        }
93567
93568        Timeout.prototype.unref = Timeout.prototype.ref = function () {};
93569
93570        Timeout.prototype.close = function () {
93571          this._clearFn.call(window, this._id);
93572        }; // Does not start the time, just sets up the members needed.
93573
93574
93575        exports.enroll = function (item, msecs) {
93576          clearTimeout(item._idleTimeoutId);
93577          item._idleTimeout = msecs;
93578        };
93579
93580        exports.unenroll = function (item) {
93581          clearTimeout(item._idleTimeoutId);
93582          item._idleTimeout = -1;
93583        };
93584
93585        exports._unrefActive = exports.active = function (item) {
93586          clearTimeout(item._idleTimeoutId);
93587          var msecs = item._idleTimeout;
93588
93589          if (msecs >= 0) {
93590            item._idleTimeoutId = setTimeout(function onTimeout() {
93591              if (item._onTimeout) item._onTimeout();
93592            }, msecs);
93593          }
93594        }; // That's not how node.js implements it but the exposed api is the same.
93595
93596
93597        exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function (fn) {
93598          var id = nextImmediateId++;
93599          var args = arguments.length < 2 ? false : slice.call(arguments, 1);
93600          immediateIds[id] = true;
93601          nextTick(function onNextTick() {
93602            if (immediateIds[id]) {
93603              // fn.call() is faster so we optimize for the common use-case
93604              // @see http://jsperf.com/call-apply-segu
93605              if (args) {
vendor: 7,211 bytes, lines 93606-93816
93606                fn.apply(null, args);
93607              } else {
93608                fn.call(null);
93609              } // Prevent ids from leaking
93610
93611
93612              exports.clearImmediate(id);
93613            }
93614          });
93615          return id;
93616        };
93617        exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function (id) {
93618          delete immediateIds[id];
93619        };
93620      }).call(this, require("timers").setImmediate, require("timers").clearImmediate);
93621    }, {
93622      "process/browser.js": 443,
93623      "timers": 496
93624    }],
93625    497: [function (require, module, exports) {
93626      (function (global) {
93627        /**
93628         * Module exports.
93629         */
93630        module.exports = deprecate;
93631        /**
93632         * Mark that a method should not be used.
93633         * Returns a modified function which warns once by default.
93634         *
93635         * If `localStorage.noDeprecation = true` is set, then it is a no-op.
93636         *
93637         * If `localStorage.throwDeprecation = true` is set, then deprecated functions
93638         * will throw an Error when invoked.
93639         *
93640         * If `localStorage.traceDeprecation = true` is set, then deprecated functions
93641         * will invoke `console.trace()` instead of `console.error()`.
93642         *
93643         * @param {Function} fn - the function to deprecate
93644         * @param {String} msg - the string to print to the console when `fn` is invoked
93645         * @returns {Function} a new "deprecated" version of `fn`
93646         * @api public
93647         */
93648
93649        function deprecate(fn, msg) {
93650          if (config('noDeprecation')) {
93651            return fn;
93652          }
93653
93654          var warned = false;
93655
93656          function deprecated() {
93657            if (!warned) {
93658              if (config('throwDeprecation')) {
93659                throw new Error(msg);
93660              } else if (config('traceDeprecation')) {
93661                console.trace(msg);
93662              } else {
93663                console.warn(msg);
93664              }
93665
93666              warned = true;
93667            }
93668
93669            return fn.apply(this, arguments);
93670          }
93671
93672          return deprecated;
93673        }
93674        /**
93675         * Checks `localStorage` for boolean values for the given `name`.
93676         *
93677         * @param {String} name
93678         * @returns {Boolean}
93679         * @api private
93680         */
93681
93682
93683        function config(name) {
93684          // accessing global.localStorage can trigger a DOMException in sandboxed iframes
93685          try {
93686            if (!global.localStorage) return false;
93687          } catch (_) {
93688            return false;
93689          }
93690
93691          var val = global.localStorage[name];
93692          if (null == val) return false;
93693          return String(val).toLowerCase() === 'true';
93694        }
93695      }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
93696    }, {}],
93697    498: [function (require, module, exports) {
93698      if (typeof Object.create === 'function') {
93699        // implementation from standard node.js 'util' module
93700        module.exports = function inherits(ctor, superCtor) {
93701          ctor.super_ = superCtor;
93702          ctor.prototype = Object.create(superCtor.prototype, {
93703            constructor: {
93704              value: ctor,
93705              enumerable: false,
93706              writable: true,
93707              configurable: true
93708            }
93709          });
93710        };
93711      } else {
93712        // old school shim for old browsers
93713        module.exports = function inherits(ctor, superCtor) {
93714          ctor.super_ = superCtor;
93715
93716          var TempCtor = function TempCtor() {};
93717
93718          TempCtor.prototype = superCtor.prototype;
93719          ctor.prototype = new TempCtor();
93720          ctor.prototype.constructor = ctor;
93721        };
93722      }
93723    }, {}],
93724    499: [function (require, module, exports) {
93725      module.exports = function isBuffer(arg) {
93726        return arg && _typeof2(arg) === 'object' && typeof arg.copy === 'function' && typeof arg.fill === 'function' && typeof arg.readUInt8 === 'function';
93727      };
93728    }, {}],
93729    500: [function (require, module, exports) {
93730      (function (process, global) {
93731        // Copyright Joyent, Inc. and other Node contributors.
93732        //
93733        // Permission is hereby granted, free of charge, to any person obtaining a
93734        // copy of this software and associated documentation files (the
93735        // "Software"), to deal in the Software without restriction, including
93736        // without limitation the rights to use, copy, modify, merge, publish,
93737        // distribute, sublicense, and/or sell copies of the Software, and to permit
93738        // persons to whom the Software is furnished to do so, subject to the
93739        // following conditions:
93740        //
93741        // The above copyright notice and this permission notice shall be included
93742        // in all copies or substantial portions of the Software.
93743        //
93744        // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
93745        // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
93746        // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
93747        // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
93748        // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
93749        // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
93750        // USE OR OTHER DEALINGS IN THE SOFTWARE.
93751        var formatRegExp = /%[sdj%]/g;
93752
93753        exports.format = function (f) {
93754          if (!isString(f)) {
93755            var objects = [];
93756
93757            for (var i = 0; i < arguments.length; i++) {
93758              objects.push(inspect(arguments[i]));
93759            }
93760
93761            return objects.join(' ');
93762          }
93763
93764          var i = 1;
93765          var args = arguments;
93766          var len = args.length;
93767          var str = String(f).replace(formatRegExp, function (x) {
93768            if (x === '%%') return '%';
93769            if (i >= len) return x;
93770
93771            switch (x) {
93772              case '%s':
93773                return String(args[i++]);
93774
93775              case '%d':
93776                return Number(args[i++]);
93777
93778              case '%j':
93779                try {
93780                  return JSON.stringify(args[i++]);
93781                } catch (_) {
93782                  return '[Circular]';
93783                }
93784
93785              default:
93786                return x;
93787            }
93788          });
93789
93790          for (var x = args[i]; i < len; x = args[++i]) {
93791            if (isNull(x) || !isObject(x)) {
93792              str += ' ' + x;
93793            } else {
93794              str += ' ' + inspect(x);
93795            }
93796          }
93797
93798          return str;
93799        }; // Mark that a method should not be used.
93800        // Returns a modified function which warns once by default.
93801        // If --no-deprecation is set, then it is a no-op.
93802
93803
93804        exports.deprecate = function (fn, msg) {
93805          // Allow for deprecating things in the process of starting up.
93806          if (isUndefined(global.process)) {
93807            return function () {
93808              return exports.deprecate(fn, msg).apply(this, arguments);
93809            };
93810          }
93811
93812          if (process.noDeprecation === true) {
93813            return fn;
93814          }
93815
93816          var warned = false;
vendor: 4,732 bytes, lines 93817-93969
93817
93818          function deprecated() {
93819            if (!warned) {
93820              if (process.throwDeprecation) {
93821                throw new Error(msg);
93822              } else if (process.traceDeprecation) {
93823                console.trace(msg);
93824              } else {
93825                console.error(msg);
93826              }
93827
93828              warned = true;
93829            }
93830
93831            return fn.apply(this, arguments);
93832          }
93833
93834          return deprecated;
93835        };
93836
93837        var debugs = {};
93838        var debugEnviron;
93839
93840        exports.debuglog = function (set) {
93841          if (isUndefined(debugEnviron)) debugEnviron = process.env.NODE_DEBUG || '';
93842          set = set.toUpperCase();
93843
93844          if (!debugs[set]) {
93845            if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
93846              var pid = process.pid;
93847
93848              debugs[set] = function () {
93849                var msg = exports.format.apply(exports, arguments);
93850                console.error('%s %d: %s', set, pid, msg);
93851              };
93852            } else {
93853              debugs[set] = function () {};
93854            }
93855          }
93856
93857          return debugs[set];
93858        };
93859        /**
93860         * Echos the value of a value. Trys to print the value out
93861         * in the best way possible given the different types.
93862         *
93863         * @param {Object} obj The object to print out.
93864         * @param {Object} opts Optional options object that alters the output.
93865         */
93866
93867        /* legacy: obj, showHidden, depth, colors*/
93868
93869
93870        function inspect(obj, opts) {
93871          // default options
93872          var ctx = {
93873            seen: [],
93874            stylize: stylizeNoColor
93875          }; // legacy...
93876
93877          if (arguments.length >= 3) ctx.depth = arguments[2];
93878          if (arguments.length >= 4) ctx.colors = arguments[3];
93879
93880          if (isBoolean(opts)) {
93881            // legacy...
93882            ctx.showHidden = opts;
93883          } else if (opts) {
93884            // got an "options" object
93885            exports._extend(ctx, opts);
93886          } // set default options
93887
93888
93889          if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
93890          if (isUndefined(ctx.depth)) ctx.depth = 2;
93891          if (isUndefined(ctx.colors)) ctx.colors = false;
93892          if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
93893          if (ctx.colors) ctx.stylize = stylizeWithColor;
93894          return formatValue(ctx, obj, ctx.depth);
93895        }
93896
93897        exports.inspect = inspect; // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
93898
93899        inspect.colors = {
93900          'bold': [1, 22],
93901          'italic': [3, 23],
93902          'underline': [4, 24],
93903          'inverse': [7, 27],
93904          'white': [37, 39],
93905          'grey': [90, 39],
93906          'black': [30, 39],
93907          'blue': [34, 39],
93908          'cyan': [36, 39],
93909          'green': [32, 39],
93910          'magenta': [35, 39],
93911          'red': [31, 39],
93912          'yellow': [33, 39]
93913        }; // Don't use 'blue' not visible on cmd.exe
93914
93915        inspect.styles = {
93916          'special': 'cyan',
93917          'number': 'yellow',
93918          'boolean': 'yellow',
93919          'undefined': 'grey',
93920          'null': 'bold',
93921          'string': 'green',
93922          'date': 'magenta',
93923          // "name": intentionally not styling
93924          'regexp': 'red'
93925        };
93926
93927        function stylizeWithColor(str, styleType) {
93928          var style = inspect.styles[styleType];
93929
93930          if (style) {
93931            return "\x1B[" + inspect.colors[style][0] + 'm' + str + "\x1B[" + inspect.colors[style][1] + 'm';
93932          } else {
93933            return str;
93934          }
93935        }
93936
93937        function stylizeNoColor(str, styleType) {
93938          return str;
93939        }
93940
93941        function arrayToHash(array) {
93942          var hash = {};
93943          array.forEach(function (val, idx) {
93944            hash[val] = true;
93945          });
93946          return hash;
93947        }
93948
93949        function formatValue(ctx, value, recurseTimes) {
93950          // Provide a hook for user-specified inspect functions.
93951          // Check that value is an object with an inspect function on it
93952          if (ctx.customInspect && value && isFunction(value.inspect) && // Filter out the util module, it's inspect function is special
93953          value.inspect !== exports.inspect && // Also filter out any prototype objects using the circular check.
93954          !(value.constructor && value.constructor.prototype === value)) {
93955            var ret = value.inspect(recurseTimes, ctx);
93956
93957            if (!isString(ret)) {
93958              ret = formatValue(ctx, ret, recurseTimes);
93959            }
93960
93961            return ret;
93962          } // Primitive types cannot have properties
93963
93964
93965          var primitive = formatPrimitive(ctx, value);
93966
93967          if (primitive) {
93968            return primitive;
93969          }
vendor: 10,892 bytes, lines 93969-94310
93969 // Look up the keys of the object.
93970
93971
93972          var keys = Object.keys(value);
93973          var visibleKeys = arrayToHash(keys);
93974
93975          if (ctx.showHidden) {
93976            keys = Object.getOwnPropertyNames(value);
93977          } // IE doesn't make error fields non-enumerable
93978          // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
93979
93980
93981          if (isError(value) && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
93982            return formatError(value);
93983          } // Some type of object without properties can be shortcutted.
93984
93985
93986          if (keys.length === 0) {
93987            if (isFunction(value)) {
93988              var name = value.name ? ': ' + value.name : '';
93989              return ctx.stylize('[Function' + name + ']', 'special');
93990            }
93991
93992            if (isRegExp(value)) {
93993              return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
93994            }
93995
93996            if (isDate(value)) {
93997              return ctx.stylize(Date.prototype.toString.call(value), 'date');
93998            }
93999
94000            if (isError(value)) {
94001              return formatError(value);
94002            }
94003          }
94004
94005          var base = '',
94006              array = false,
94007              braces = ['{', '}']; // Make Array say that they are Array
94008
94009          if (isArray(value)) {
94010            array = true;
94011            braces = ['[', ']'];
94012          } // Make functions say that they are functions
94013
94014
94015          if (isFunction(value)) {
94016            var n = value.name ? ': ' + value.name : '';
94017            base = ' [Function' + n + ']';
94018          } // Make RegExps say that they are RegExps
94019
94020
94021          if (isRegExp(value)) {
94022            base = ' ' + RegExp.prototype.toString.call(value);
94023          } // Make dates with properties first say the date
94024
94025
94026          if (isDate(value)) {
94027            base = ' ' + Date.prototype.toUTCString.call(value);
94028          } // Make error with message first say the error
94029
94030
94031          if (isError(value)) {
94032            base = ' ' + formatError(value);
94033          }
94034
94035          if (keys.length === 0 && (!array || value.length == 0)) {
94036            return braces[0] + base + braces[1];
94037          }
94038
94039          if (recurseTimes < 0) {
94040            if (isRegExp(value)) {
94041              return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
94042            } else {
94043              return ctx.stylize('[Object]', 'special');
94044            }
94045          }
94046
94047          ctx.seen.push(value);
94048          var output;
94049
94050          if (array) {
94051            output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
94052          } else {
94053            output = keys.map(function (key) {
94054              return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
94055            });
94056          }
94057
94058          ctx.seen.pop();
94059          return reduceToSingleString(output, base, braces);
94060        }
94061
94062        function formatPrimitive(ctx, value) {
94063          if (isUndefined(value)) return ctx.stylize('undefined', 'undefined');
94064
94065          if (isString(value)) {
94066            var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '').replace(/'/g, "\\'").replace(/\\"/g, '"') + '\'';
94067            return ctx.stylize(simple, 'string');
94068          }
94069
94070          if (isNumber(value)) return ctx.stylize('' + value, 'number');
94071          if (isBoolean(value)) return ctx.stylize('' + value, 'boolean'); // For some reason typeof null is "object", so special case here.
94072
94073          if (isNull(value)) return ctx.stylize('null', 'null');
94074        }
94075
94076        function formatError(value) {
94077          return '[' + Error.prototype.toString.call(value) + ']';
94078        }
94079
94080        function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
94081          var output = [];
94082
94083          for (var i = 0, l = value.length; i < l; ++i) {
94084            if (hasOwnProperty(value, String(i))) {
94085              output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, String(i), true));
94086            } else {
94087              output.push('');
94088            }
94089          }
94090
94091          keys.forEach(function (key) {
94092            if (!key.match(/^\d+$/)) {
94093              output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, key, true));
94094            }
94095          });
94096          return output;
94097        }
94098
94099        function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
94100          var name, str, desc;
94101          desc = Object.getOwnPropertyDescriptor(value, key) || {
94102            value: value[key]
94103          };
94104
94105          if (desc.get) {
94106            if (desc.set) {
94107              str = ctx.stylize('[Getter/Setter]', 'special');
94108            } else {
94109              str = ctx.stylize('[Getter]', 'special');
94110            }
94111          } else {
94112            if (desc.set) {
94113              str = ctx.stylize('[Setter]', 'special');
94114            }
94115          }
94116
94117          if (!hasOwnProperty(visibleKeys, key)) {
94118            name = '[' + key + ']';
94119          }
94120
94121          if (!str) {
94122            if (ctx.seen.indexOf(desc.value) < 0) {
94123              if (isNull(recurseTimes)) {
94124                str = formatValue(ctx, desc.value, null);
94125              } else {
94126                str = formatValue(ctx, desc.value, recurseTimes - 1);
94127              }
94128
94129              if (str.indexOf('\n') > -1) {
94130                if (array) {
94131                  str = str.split('\n').map(function (line) {
94132                    return '  ' + line;
94133                  }).join('\n').substr(2);
94134                } else {
94135                  str = '\n' + str.split('\n').map(function (line) {
94136                    return '   ' + line;
94137                  }).join('\n');
94138                }
94139              }
94140            } else {
94141              str = ctx.stylize('[Circular]', 'special');
94142            }
94143          }
94144
94145          if (isUndefined(name)) {
94146            if (array && key.match(/^\d+$/)) {
94147              return str;
94148            }
94149
94150            name = JSON.stringify('' + key);
94151
94152            if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
94153              name = name.substr(1, name.length - 2);
94154              name = ctx.stylize(name, 'name');
94155            } else {
94156              name = name.replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'");
94157              name = ctx.stylize(name, 'string');
94158            }
94159          }
94160
94161          return name + ': ' + str;
94162        }
94163
94164        function reduceToSingleString(output, base, braces) {
94165          var numLinesEst = 0;
94166          var length = output.reduce(function (prev, cur) {
94167            numLinesEst++;
94168            if (cur.indexOf('\n') >= 0) numLinesEst++;
94169            return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
94170          }, 0);
94171
94172          if (length > 60) {
94173            return braces[0] + (base === '' ? '' : base + '\n ') + ' ' + output.join(',\n  ') + ' ' + braces[1];
94174          }
94175
94176          return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
94177        } // NOTE: These type checking functions intentionally don't use `instanceof`
94178        // because it is fragile and can be easily faked with `Object.create()`.
94179
94180
94181        function isArray(ar) {
94182          return Array.isArray(ar);
94183        }
94184
94185        exports.isArray = isArray;
94186
94187        function isBoolean(arg) {
94188          return typeof arg === 'boolean';
94189        }
94190
94191        exports.isBoolean = isBoolean;
94192
94193        function isNull(arg) {
94194          return arg === null;
94195        }
94196
94197        exports.isNull = isNull;
94198
94199        function isNullOrUndefined(arg) {
94200          return arg == null;
94201        }
94202
94203        exports.isNullOrUndefined = isNullOrUndefined;
94204
94205        function isNumber(arg) {
94206          return typeof arg === 'number';
94207        }
94208
94209        exports.isNumber = isNumber;
94210
94211        function isString(arg) {
94212          return typeof arg === 'string';
94213        }
94214
94215        exports.isString = isString;
94216
94217        function isSymbol(arg) {
94218          return _typeof2(arg) === 'symbol';
94219        }
94220
94221        exports.isSymbol = isSymbol;
94222
94223        function isUndefined(arg) {
94224          return arg === void 0;
94225        }
94226
94227        exports.isUndefined = isUndefined;
94228
94229        function isRegExp(re) {
94230          return isObject(re) && objectToString(re) === '[object RegExp]';
94231        }
94232
94233        exports.isRegExp = isRegExp;
94234
94235        function isObject(arg) {
94236          return _typeof2(arg) === 'object' && arg !== null;
94237        }
94238
94239        exports.isObject = isObject;
94240
94241        function isDate(d) {
94242          return isObject(d) && objectToString(d) === '[object Date]';
94243        }
94244
94245        exports.isDate = isDate;
94246
94247        function isError(e) {
94248          return isObject(e) && (objectToString(e) === '[object Error]' || e instanceof Error);
94249        }
94250
94251        exports.isError = isError;
94252
94253        function isFunction(arg) {
94254          return typeof arg === 'function';
94255        }
94256
94257        exports.isFunction = isFunction;
94258
94259        function isPrimitive(arg) {
94260          return arg === null || typeof arg === 'boolean' || typeof arg === 'number' || typeof arg === 'string' || _typeof2(arg) === 'symbol' || // ES6 symbol
94261          typeof arg === 'undefined';
94262        }
94263
94264        exports.isPrimitive = isPrimitive;
94265        exports.isBuffer = require('./support/isBuffer');
94266
94267        function objectToString(o) {
94268          return Object.prototype.toString.call(o);
94269        }
94270
94271        function pad(n) {
94272          return n < 10 ? '0' + n.toString(10) : n.toString(10);
94273        }
94274
94275        var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; // 26 Feb 16:19:34
94276
94277        function timestamp() {
94278          var d = new Date();
94279          var time = [pad(d.getHours()), pad(d.getMinutes()), pad(d.getSeconds())].join(':');
94280          return [d.getDate(), months[d.getMonth()], time].join(' ');
94281        } // log is just a thin wrapper to console.log that prepends a timestamp
94282
94283
94284        exports.log = function () {
94285          console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
94286        };
94287        /**
94288         * Inherit the prototype methods from one constructor into another.
94289         *
94290         * The Function.prototype.inherits from lang.js rewritten as a standalone
94291         * function (not on Function.prototype). NOTE: If this file is to be loaded
94292         * during bootstrapping this function needs to be rewritten using some native
94293         * functions as prototype setup using normal JavaScript does not work as
94294         * expected during bootstrapping (see mirror.js in r114903).
94295         *
94296         * @param {function} ctor Constructor function which needs to inherit the
94297         *     prototype.
94298         * @param {function} superCtor Constructor function to inherit prototype from.
94299         */
94300
94301
94302        exports.inherits = require('inherits');
94303
94304        exports._extend = function (origin, add) {
94305          // Don't do anything if add isn't an object
94306          if (!add || !isObject(add)) return origin;
94307          var keys = Object.keys(add);
94308          var i = keys.length;
94309
94310          while (i--) {
94311            origin[keys[i]] = add[keys[i]];
94312          }
94313
94314          return origin;
94315        };
94316
94317        function hasOwnProperty(obj, prop) {
94318          return Object.prototype.hasOwnProperty.call(obj, prop);
94319        }
94320      }).call(this, require('_process'), typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
94321    }, {
94322      "./support/isBuffer": 499,
94323      "_process": 443,
94324      "inherits": 498
94325    }],
94326    501: [function (require, module, exports) {
94327      "use strict";
94328
94329      Object.defineProperty(exports, "__esModule", {
94330        value: true
94331      });
94332      exports.default = void 0;
94333      /**
94334       * Convert array of 16 byte values to UUID string format of the form:
94335       * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
94336       */
94337
94338      var byteToHex = [];
94339
94340      for (var i = 0; i < 256; ++i) {
94341        byteToHex[i] = (i + 0x100).toString(16).substr(1);
94342      }
94343
94344      function bytesToUuid(buf, offset) {
94345        var i = offset || 0;
94346        var bth = byteToHex; // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
94347
94348        return [bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]]].join('');
94349      }
94350
94351      var _default = bytesToUuid;
94352      exports.default = _default;
94353      module.exports = exports.default;
94354    }, {}],
94355    502: [function (require, module, exports) {
94356      "use strict";
94357
94358      Object.defineProperty(exports, "__esModule", {
94359        value: true
94360      });
94361      Object.defineProperty(exports, "v1", {
94362        enumerable: true,
94363        get: function get() {
94364          return _v.default;
94365        }
94366      });
94367      Object.defineProperty(exports, "v3", {
94368        enumerable: true,
94369        get: function get() {
94370          return _v2.default;
94371        }
94372      });
94373      Object.defineProperty(exports, "v4", {
94374        enumerable: true,
94375        get: function get() {
94376          return _v3.default;
94377        }
94378      });
94379      Object.defineProperty(exports, "v5", {
94380        enumerable: true,
94381        get: function get() {
94382          return _v4.default;
94383        }
94384      });
94385
94386      var _v = _interopRequireDefault(require("./v1.js"));
94387
94388      var _v2 = _interopRequireDefault(require("./v3.js"));
94389
94390      var _v3 = _interopRequireDefault(require("./v4.js"));
94391
94392      var _v4 = _interopRequireDefault(require("./v5.js"));
94393
94394      function _interopRequireDefault(obj) {
94395        return obj && obj.__esModule ? obj : {
94396          default: obj
94397        };
94398      }
94399    }, {
94400      "./v1.js": 506,
94401      "./v3.js": 507,
94402      "./v4.js": 509,
94403      "./v5.js": 510
94404    }],
94405    503: [function (require, module, exports) {
94406      "use strict";
94407
94408      Object.defineProperty(exports, "__esModule", {
94409        value: true
94410      });
94411      exports.default = void 0;
94412      /*
94413       * Browser-compatible JavaScript MD5
94414       *
94415       * Modification of JavaScript MD5
94416       * https://github.com/blueimp/JavaScript-MD5
94417       *
94418       * Copyright 2011, Sebastian Tschan
94419       * https://blueimp.net
94420       *
94421       * Licensed under the MIT license:
94422       * https://opensource.org/licenses/MIT
94423       *
94424       * Based on
94425       * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
94426       * Digest Algorithm, as defined in RFC 1321.
94427       * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009
94428       * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
94429       * Distributed under the BSD License
94430       * See http://pajhome.org.uk/crypt/md5 for more info.
94431       */
94432
94433      function md5(bytes) {
94434        if (typeof bytes == 'string') {
94435          var msg = unescape(encodeURIComponent(bytes)); // UTF8 escape
94436
94437          bytes = new Array(msg.length);
94438
94439          for (var i = 0; i < msg.length; i++) {
94440            bytes[i] = msg.charCodeAt(i);
94441          }
94442        }
94443
94444        return md5ToHexEncodedArray(wordsToMd5(bytesToWords(bytes), bytes.length * 8));
94445      }
94446      /*
94447       * Convert an array of little-endian words to an array of bytes
94448       */
94449
94450
94451      function md5ToHexEncodedArray(input) {
94452        var i;
94453        var x;
94454        var output = [];
94455        var length32 = input.length * 32;
94456        var hexTab = '0123456789abcdef';
94457        var hex;
94458
94459        for (i = 0; i < length32; i += 8) {
vendor: 14,966 bytes, lines 94460-94873
94460          x = input[i >> 5] >>> i % 32 & 0xff;
94461          hex = parseInt(hexTab.charAt(x >>> 4 & 0x0f) + hexTab.charAt(x & 0x0f), 16);
94462          output.push(hex);
94463        }
94464
94465        return output;
94466      }
94467      /*
94468       * Calculate the MD5 of an array of little-endian words, and a bit length.
94469       */
94470
94471
94472      function wordsToMd5(x, len) {
94473        /* append padding */
94474        x[len >> 5] |= 0x80 << len % 32;
94475        x[(len + 64 >>> 9 << 4) + 14] = len;
94476        var i;
94477        var olda;
94478        var oldb;
94479        var oldc;
94480        var oldd;
94481        var a = 1732584193;
94482        var b = -271733879;
94483        var c = -1732584194;
94484        var d = 271733878;
94485
94486        for (i = 0; i < x.length; i += 16) {
94487          olda = a;
94488          oldb = b;
94489          oldc = c;
94490          oldd = d;
94491          a = md5ff(a, b, c, d, x[i], 7, -680876936);
94492          d = md5ff(d, a, b, c, x[i + 1], 12, -389564586);
94493          c = md5ff(c, d, a, b, x[i + 2], 17, 606105819);
94494          b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330);
94495          a = md5ff(a, b, c, d, x[i + 4], 7, -176418897);
94496          d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426);
94497          c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341);
94498          b = md5ff(b, c, d, a, x[i + 7], 22, -45705983);
94499          a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416);
94500          d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417);
94501          c = md5ff(c, d, a, b, x[i + 10], 17, -42063);
94502          b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162);
94503          a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682);
94504          d = md5ff(d, a, b, c, x[i + 13], 12, -40341101);
94505          c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290);
94506          b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329);
94507          a = md5gg(a, b, c, d, x[i + 1], 5, -165796510);
94508          d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632);
94509          c = md5gg(c, d, a, b, x[i + 11], 14, 643717713);
94510          b = md5gg(b, c, d, a, x[i], 20, -373897302);
94511          a = md5gg(a, b, c, d, x[i + 5], 5, -701558691);
94512          d = md5gg(d, a, b, c, x[i + 10], 9, 38016083);
94513          c = md5gg(c, d, a, b, x[i + 15], 14, -660478335);
94514          b = md5gg(b, c, d, a, x[i + 4], 20, -405537848);
94515          a = md5gg(a, b, c, d, x[i + 9], 5, 568446438);
94516          d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690);
94517          c = md5gg(c, d, a, b, x[i + 3], 14, -187363961);
94518          b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501);
94519          a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467);
94520          d = md5gg(d, a, b, c, x[i + 2], 9, -51403784);
94521          c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473);
94522          b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734);
94523          a = md5hh(a, b, c, d, x[i + 5], 4, -378558);
94524          d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463);
94525          c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562);
94526          b = md5hh(b, c, d, a, x[i + 14], 23, -35309556);
94527          a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060);
94528          d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353);
94529          c = md5hh(c, d, a, b, x[i + 7], 16, -155497632);
94530          b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640);
94531          a = md5hh(a, b, c, d, x[i + 13], 4, 681279174);
94532          d = md5hh(d, a, b, c, x[i], 11, -358537222);
94533          c = md5hh(c, d, a, b, x[i + 3], 16, -722521979);
94534          b = md5hh(b, c, d, a, x[i + 6], 23, 76029189);
94535          a = md5hh(a, b, c, d, x[i + 9], 4, -640364487);
94536          d = md5hh(d, a, b, c, x[i + 12], 11, -421815835);
94537          c = md5hh(c, d, a, b, x[i + 15], 16, 530742520);
94538          b = md5hh(b, c, d, a, x[i + 2], 23, -995338651);
94539          a = md5ii(a, b, c, d, x[i], 6, -198630844);
94540          d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415);
94541          c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905);
94542          b = md5ii(b, c, d, a, x[i + 5], 21, -57434055);
94543          a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571);
94544          d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606);
94545          c = md5ii(c, d, a, b, x[i + 10], 15, -1051523);
94546          b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799);
94547          a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359);
94548          d = md5ii(d, a, b, c, x[i + 15], 10, -30611744);
94549          c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380);
94550          b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649);
94551          a = md5ii(a, b, c, d, x[i + 4], 6, -145523070);
94552          d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379);
94553          c = md5ii(c, d, a, b, x[i + 2], 15, 718787259);
94554          b = md5ii(b, c, d, a, x[i + 9], 21, -343485551);
94555          a = safeAdd(a, olda);
94556          b = safeAdd(b, oldb);
94557          c = safeAdd(c, oldc);
94558          d = safeAdd(d, oldd);
94559        }
94560
94561        return [a, b, c, d];
94562      }
94563      /*
94564       * Convert an array bytes to an array of little-endian words
94565       * Characters >255 have their high-byte silently ignored.
94566       */
94567
94568
94569      function bytesToWords(input) {
94570        var i;
94571        var output = [];
94572        output[(input.length >> 2) - 1] = undefined;
94573
94574        for (i = 0; i < output.length; i += 1) {
94575          output[i] = 0;
94576        }
94577
94578        var length8 = input.length * 8;
94579
94580        for (i = 0; i < length8; i += 8) {
94581          output[i >> 5] |= (input[i / 8] & 0xff) << i % 32;
94582        }
94583
94584        return output;
94585      }
94586      /*
94587       * Add integers, wrapping at 2^32. This uses 16-bit operations internally
94588       * to work around bugs in some JS interpreters.
94589       */
94590
94591
94592      function safeAdd(x, y) {
94593        var lsw = (x & 0xffff) + (y & 0xffff);
94594        var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
94595        return msw << 16 | lsw & 0xffff;
94596      }
94597      /*
94598       * Bitwise rotate a 32-bit number to the left.
94599       */
94600
94601
94602      function bitRotateLeft(num, cnt) {
94603        return num << cnt | num >>> 32 - cnt;
94604      }
94605      /*
94606       * These functions implement the four basic operations the algorithm uses.
94607       */
94608
94609
94610      function md5cmn(q, a, b, x, s, t) {
94611        return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b);
94612      }
94613
94614      function md5ff(a, b, c, d, x, s, t) {
94615        return md5cmn(b & c | ~b & d, a, b, x, s, t);
94616      }
94617
94618      function md5gg(a, b, c, d, x, s, t) {
94619        return md5cmn(b & d | c & ~d, a, b, x, s, t);
94620      }
94621
94622      function md5hh(a, b, c, d, x, s, t) {
94623        return md5cmn(b ^ c ^ d, a, b, x, s, t);
94624      }
94625
94626      function md5ii(a, b, c, d, x, s, t) {
94627        return md5cmn(c ^ (b | ~d), a, b, x, s, t);
94628      }
94629
94630      var _default = md5;
94631      exports.default = _default;
94632      module.exports = exports.default;
94633    }, {}],
94634    504: [function (require, module, exports) {
94635      "use strict";
94636
94637      Object.defineProperty(exports, "__esModule", {
94638        value: true
94639      });
94640      exports.default = rng; // Unique ID creation requires a high quality random # generator. In the browser we therefore
94641      // require the crypto API and do not support built-in fallback to lower quality random number
94642      // generators (like Math.random()).
94643      // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. Also,
94644      // find the complete implementation of crypto (msCrypto) on IE11.
94645
94646      var getRandomValues = typeof crypto != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto != 'undefined' && typeof msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto);
94647      var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef
94648
94649      function rng() {
94650        if (!getRandomValues) {
94651          throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
94652        }
94653
94654        return getRandomValues(rnds8);
94655      }
94656
94657      module.exports = exports.default;
94658    }, {}],
94659    505: [function (require, module, exports) {
94660      "use strict";
94661
94662      Object.defineProperty(exports, "__esModule", {
94663        value: true
94664      });
94665      exports.default = void 0; // Adapted from Chris Veness' SHA1 code at
94666      // http://www.movable-type.co.uk/scripts/sha1.html
94667
94668      function f(s, x, y, z) {
94669        switch (s) {
94670          case 0:
94671            return x & y ^ ~x & z;
94672
94673          case 1:
94674            return x ^ y ^ z;
94675
94676          case 2:
94677            return x & y ^ x & z ^ y & z;
94678
94679          case 3:
94680            return x ^ y ^ z;
94681        }
94682      }
94683
94684      function ROTL(x, n) {
94685        return x << n | x >>> 32 - n;
94686      }
94687
94688      function sha1(bytes) {
94689        var K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6];
94690        var H = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0];
94691
94692        if (typeof bytes == 'string') {
94693          var msg = unescape(encodeURIComponent(bytes)); // UTF8 escape
94694
94695          bytes = new Array(msg.length);
94696
94697          for (var i = 0; i < msg.length; i++) {
94698            bytes[i] = msg.charCodeAt(i);
94699          }
94700        }
94701
94702        bytes.push(0x80);
94703        var l = bytes.length / 4 + 2;
94704        var N = Math.ceil(l / 16);
94705        var M = new Array(N);
94706
94707        for (var i = 0; i < N; i++) {
94708          M[i] = new Array(16);
94709
94710          for (var j = 0; j < 16; j++) {
94711            M[i][j] = bytes[i * 64 + j * 4] << 24 | bytes[i * 64 + j * 4 + 1] << 16 | bytes[i * 64 + j * 4 + 2] << 8 | bytes[i * 64 + j * 4 + 3];
94712          }
94713        }
94714
94715        M[N - 1][14] = (bytes.length - 1) * 8 / Math.pow(2, 32);
94716        M[N - 1][14] = Math.floor(M[N - 1][14]);
94717        M[N - 1][15] = (bytes.length - 1) * 8 & 0xffffffff;
94718
94719        for (var i = 0; i < N; i++) {
94720          var W = new Array(80);
94721
94722          for (var t = 0; t < 16; t++) {
94723            W[t] = M[i][t];
94724          }
94725
94726          for (var t = 16; t < 80; t++) {
94727            W[t] = ROTL(W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16], 1);
94728          }
94729
94730          var a = H[0];
94731          var b = H[1];
94732          var c = H[2];
94733          var d = H[3];
94734          var e = H[4];
94735
94736          for (var t = 0; t < 80; t++) {
94737            var s = Math.floor(t / 20);
94738            var T = ROTL(a, 5) + f(s, b, c, d) + e + K[s] + W[t] >>> 0;
94739            e = d;
94740            d = c;
94741            c = ROTL(b, 30) >>> 0;
94742            b = a;
94743            a = T;
94744          }
94745
94746          H[0] = H[0] + a >>> 0;
94747          H[1] = H[1] + b >>> 0;
94748          H[2] = H[2] + c >>> 0;
94749          H[3] = H[3] + d >>> 0;
94750          H[4] = H[4] + e >>> 0;
94751        }
94752
94753        return [H[0] >> 24 & 0xff, H[0] >> 16 & 0xff, H[0] >> 8 & 0xff, H[0] & 0xff, H[1] >> 24 & 0xff, H[1] >> 16 & 0xff, H[1] >> 8 & 0xff, H[1] & 0xff, H[2] >> 24 & 0xff, H[2] >> 16 & 0xff, H[2] >> 8 & 0xff, H[2] & 0xff, H[3] >> 24 & 0xff, H[3] >> 16 & 0xff, H[3] >> 8 & 0xff, H[3] & 0xff, H[4] >> 24 & 0xff, H[4] >> 16 & 0xff, H[4] >> 8 & 0xff, H[4] & 0xff];
94754      }
94755
94756      var _default = sha1;
94757      exports.default = _default;
94758      module.exports = exports.default;
94759    }, {}],
94760    506: [function (require, module, exports) {
94761      "use strict";
94762
94763      Object.defineProperty(exports, "__esModule", {
94764        value: true
94765      });
94766      exports.default = void 0;
94767
94768      var _rng = _interopRequireDefault(require("./rng.js"));
94769
94770      var _bytesToUuid = _interopRequireDefault(require("./bytesToUuid.js"));
94771
94772      function _interopRequireDefault(obj) {
94773        return obj && obj.__esModule ? obj : {
94774          default: obj
94775        };
94776      } // **`v1()` - Generate time-based UUID**
94777      //
94778      // Inspired by https://github.com/LiosK/UUID.js
94779      // and http://docs.python.org/library/uuid.html
94780
94781
94782      var _nodeId;
94783
94784      var _clockseq; // Previous uuid creation time
94785
94786
94787      var _lastMSecs = 0;
94788      var _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details
94789
94790      function v1(options, buf, offset) {
94791        var i = buf && offset || 0;
94792        var b = buf || [];
94793        options = options || {};
94794        var node = options.node || _nodeId;
94795        var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not
94796        // specified.  We do this lazily to minimize issues related to insufficient
94797        // system entropy.  See #189
94798
94799        if (node == null || clockseq == null) {
94800          var seedBytes = options.random || (options.rng || _rng.default)();
94801
94802          if (node == null) {
94803            // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
94804            node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]];
94805          }
94806
94807          if (clockseq == null) {
94808            // Per 4.2.2, randomize (14 bit) clockseq
94809            clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;
94810          }
94811        } // UUID timestamps are 100 nano-second units since the Gregorian epoch,
94812        // (1582-10-15 00:00).  JSNumbers aren't precise enough for this, so
94813        // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'
94814        // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.
94815
94816
94817        var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime(); // Per 4.2.1.2, use count of uuid's generated during the current clock
94818        // cycle to simulate higher resolution clock
94819
94820        var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs)
94821
94822        var dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression
94823
94824        if (dt < 0 && options.clockseq === undefined) {
94825          clockseq = clockseq + 1 & 0x3fff;
94826        } // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new
94827        // time interval
94828
94829
94830        if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {
94831          nsecs = 0;
94832        } // Per 4.2.1.2 Throw error if too many uuids are requested
94833
94834
94835        if (nsecs >= 10000) {
94836          throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");
94837        }
94838
94839        _lastMSecs = msecs;
94840        _lastNSecs = nsecs;
94841        _clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch
94842
94843        msecs += 12219292800000; // `time_low`
94844
94845        var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
94846        b[i++] = tl >>> 24 & 0xff;
94847        b[i++] = tl >>> 16 & 0xff;
94848        b[i++] = tl >>> 8 & 0xff;
94849        b[i++] = tl & 0xff; // `time_mid`
94850
94851        var tmh = msecs / 0x100000000 * 10000 & 0xfffffff;
94852        b[i++] = tmh >>> 8 & 0xff;
94853        b[i++] = tmh & 0xff; // `time_high_and_version`
94854
94855        b[i++] = tmh >>> 24 & 0xf | 0x10; // include version
94856
94857        b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)
94858
94859        b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low`
94860
94861        b[i++] = clockseq & 0xff; // `node`
94862
94863        for (var n = 0; n < 6; ++n) {
94864          b[i + n] = node[n];
94865        }
94866
94867        return buf ? buf : (0, _bytesToUuid.default)(b);
94868      }
94869
94870      var _default = v1;
94871      exports.default = _default;
94872      module.exports = exports.default;
94873    }, {
94874      "./bytesToUuid.js": 501,
94875      "./rng.js": 504
94876    }],
94877    507: [function (require, module, exports) {
94878      "use strict";
94879
94880      Object.defineProperty(exports, "__esModule", {
94881        value: true
94882      });
94883      exports.default = void 0;
94884
94885      var _v = _interopRequireDefault(require("./v35.js"));
94886
94887      var _md = _interopRequireDefault(require("./md5.js"));
94888
94889      function _interopRequireDefault(obj) {
94890        return obj && obj.__esModule ? obj : {
94891          default: obj
94892        };
94893      }
94894
94895      var v3 = (0, _v.default)('v3', 0x30, _md.default);
94896      var _default = v3;
94897      exports.default = _default;
94898      module.exports = exports.default;
94899    }, {
94900      "./md5.js": 503,
94901      "./v35.js": 508
94902    }],
94903    508: [function (require, module, exports) {
94904      "use strict";
94905
94906      Object.defineProperty(exports, "__esModule", {
94907        value: true
94908      });
94909      exports.default = _default;
94910      exports.URL = exports.DNS = void 0;
94911
94912      var _bytesToUuid = _interopRequireDefault(require("./bytesToUuid.js"));
94913
94914      function _interopRequireDefault(obj) {
94915        return obj && obj.__esModule ? obj : {
94916          default: obj
94917        };
94918      }
94919
94920      function uuidToBytes(uuid) {
94921        // Note: We assume we're being passed a valid uuid string
94922        var bytes = [];
94923        uuid.replace(/[a-fA-F0-9]{2}/g, function (hex) {
94924          bytes.push(parseInt(hex, 16));
94925        });
94926        return bytes;
94927      }
94928
94929      function stringToBytes(str) {
94930        str = unescape(encodeURIComponent(str)); // UTF8 escape
94931
94932        var bytes = new Array(str.length);
94933
94934        for (var i = 0; i < str.length; i++) {
94935          bytes[i] = str.charCodeAt(i);
94936        }
94937
94938        return bytes;
94939      }
94940
94941      var DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
94942      exports.DNS = DNS;
94943      var URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
94944      exports.URL = URL;
94945
94946      function _default(name, version, hashfunc) {
94947        var generateUUID = function generateUUID(value, namespace, buf, offset) {
94948          var off = buf && offset || 0;
94949          if (typeof value == 'string') value = stringToBytes(value);
94950          if (typeof namespace == 'string') namespace = uuidToBytes(namespace);
94951          if (!Array.isArray(value)) throw TypeError('value must be an array of bytes');
94952          if (!Array.isArray(namespace) || namespace.length !== 16) throw TypeError('namespace must be uuid string or an Array of 16 byte values'); // Per 4.3
94953
94954          var bytes = hashfunc(namespace.concat(value));
94955          bytes[6] = bytes[6] & 0x0f | version;
94956          bytes[8] = bytes[8] & 0x3f | 0x80;
94957
94958          if (buf) {
94959            for (var idx = 0; idx < 16; ++idx) {
94960              buf[off + idx] = bytes[idx];
94961            }
94962          }
94963
94964          return buf || (0, _bytesToUuid.default)(bytes);
94965        }; // Function#name is not settable on some platforms (#270)
94966
94967
94968        try {
94969          generateUUID.name = name;
94970        } catch (err) {} // For CommonJS default export support
94971
94972
94973        generateUUID.DNS = DNS;
94974        generateUUID.URL = URL;
94975        return generateUUID;
94976      }
94977    }, {
94978      "./bytesToUuid.js": 501
94979    }],
94980    509: [function (require, module, exports) {
94981      "use strict";
94982
94983      Object.defineProperty(exports, "__esModule", {
94984        value: true
94985      });
94986      exports.default = void 0;
94987
94988      var _rng = _interopRequireDefault(require("./rng.js"));
94989
94990      var _bytesToUuid = _interopRequireDefault(require("./bytesToUuid.js"));
94991
94992      function _interopRequireDefault(obj) {
94993        return obj && obj.__esModule ? obj : {
94994          default: obj
94995        };
94996      }
94997
94998      function v4(options, buf, offset) {
94999        var i = buf && offset || 0;
95000
95001        if (typeof options == 'string') {
95002          buf = options === 'binary' ? new Array(16) : null;
95003          options = null;
95004        }
95005
95006        options = options || {};
95007
95008        var rnds = options.random || (options.rng || _rng.default)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
95009
95010
95011        rnds[6] = rnds[6] & 0x0f | 0x40;
95012        rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
95013
95014        if (buf) {
95015          for (var ii = 0; ii < 16; ++ii) {
95016            buf[i + ii] = rnds[ii];
95017          }
95018        }
95019
95020        return buf || (0, _bytesToUuid.default)(rnds);
95021      }
95022
95023      var _default = v4;
95024      exports.default = _default;
95025      module.exports = exports.default;
95026    }, {
95027      "./bytesToUuid.js": 501,
95028      "./rng.js": 504
95029    }],
95030    510: [function (require, module, exports) {
95031      "use strict";
95032
95033      Object.defineProperty(exports, "__esModule", {
95034        value: true
95035      });
95036      exports.default = void 0;
95037
95038      var _v = _interopRequireDefault(require("./v35.js"));
95039
95040      var _sha = _interopRequireDefault(require("./sha1.js"));
95041
95042      function _interopRequireDefault(obj) {
95043        return obj && obj.__esModule ? obj : {
95044          default: obj
95045        };
95046      }
95047
95048      var v5 = (0, _v.default)('v5', 0x50, _sha.default);
95049      var _default = v5;
95050      exports.default = _default;
95051      module.exports = exports.default;
95052    }, {
95053      "./sha1.js": 505,
95054      "./v35.js": 508
95055    }],
95056    511: [function (require, module, exports) {
95057      var indexOf = function indexOf(xs, item) {
95058        if (xs.indexOf) return xs.indexOf(item);else for (var i = 0; i < xs.length; i++) {
95059          if (xs[i] === item) return i;
95060        }
95061        return -1;
95062      };
95063
95064      var Object_keys = function Object_keys(obj) {
95065        if (Object.keys) return Object.keys(obj);else {
95066          var res = [];
95067
95068          for (var key in obj) {
95069            res.push(key);
95070          }
95071
95072          return res;
95073        }
95074      };
95075
95076      var forEach = function forEach(xs, fn) {
95077        if (xs.forEach) return xs.forEach(fn);else for (var i = 0; i < xs.length; i++) {
95078          fn(xs[i], i, xs);
95079        }
95080      };
95081
95082      var defineProp = function () {
95083        try {
95084          Object.defineProperty({}, '_', {});
95085          return function (obj, name, value) {
95086            Object.defineProperty(obj, name, {
95087              writable: true,
95088              enumerable: false,
95089              configurable: true,
95090              value: value
95091            });
95092          };
95093        } catch (e) {
95094          return function (obj, name, value) {
95095            obj[name] = value;
95096          };
95097        }
95098      }();
95099
95100      var globals = ['Array', 'Boolean', 'Date', 'Error', 'EvalError', 'Function', 'Infinity', 'JSON', 'Math', 'NaN', 'Number', 'Object', 'RangeError', 'ReferenceError', 'RegExp', 'String', 'SyntaxError', 'TypeError', 'URIError', 'decodeURI', 'decodeURIComponent', 'encodeURI', 'encodeURIComponent', 'escape', 'eval', 'isFinite', 'isNaN', 'parseFloat', 'parseInt', 'undefined', 'unescape'];
95101
95102      function Context() {}
95103
95104      Context.prototype = {};
95105
95106      var Script = exports.Script = function NodeScript(code) {
95107        if (!(this instanceof Script)) return new Script(code);
95108        this.code = code;
95109      };
95110
95111      Script.prototype.runInContext = function (context) {
95112        if (!(context instanceof Context)) {
95113          throw new TypeError("needs a 'context' argument.");
95114        }
95115
95116        var iframe = document.createElement('iframe');
95117        if (!iframe.style) iframe.style = {};
95118        iframe.style.display = 'none';
95119        document.body.appendChild(iframe);
95120        var win = iframe.contentWindow;
95121        var wEval = win.eval,
95122            wExecScript = win.execScript;
95123
95124        if (!wEval && wExecScript) {
95125          // win.eval() magically appears when this is called in IE:
95126          wExecScript.call(win, 'null');
95127          wEval = win.eval;
95128        }
95129
95130        forEach(Object_keys(context), function (key) {
95131          win[key] = context[key];
95132        });
95133        forEach(globals, function (key) {
95134          if (context[key]) {
95135            win[key] = context[key];
95136          }
95137        });
95138        var winKeys = Object_keys(win);
95139        var res = wEval.call(win, this.code);
95140        forEach(Object_keys(win), function (key) {
95141          // Avoid copying circular objects like `top` and `window` by only
95142          // updating existing context properties or new properties in the `win`
95143          // that was only introduced after the eval.
95144          if (key in context || indexOf(winKeys, key) === -1) {
95145            context[key] = win[key];
95146          }
95147        });
95148        forEach(globals, function (key) {
95149          if (!(key in context)) {
95150            defineProp(context, key, win[key]);
95151          }
95152        });
95153        document.body.removeChild(iframe);
95154        return res;
95155      };
95156
95157      Script.prototype.runInThisContext = function () {
95158        return eval(this.code); // maybe...
95159      };
95160
95161      Script.prototype.runInNewContext = function (context) {
95162        var ctx = Script.createContext(context);
95163        var res = this.runInContext(ctx);
95164
95165        if (context) {
95166          forEach(Object_keys(ctx), function (key) {
95167            context[key] = ctx[key];
95168          });
95169        }
95170
95171        return res;
95172      };
95173
95174      forEach(Object_keys(Script.prototype), function (name) {
95175        exports[name] = Script[name] = function (code) {
95176          var s = Script(code);
95177          return s[name].apply(s, [].slice.call(arguments, 1));
95178        };
95179      });
95180
95181      exports.isContext = function (context) {
95182        return context instanceof Context;
95183      };
95184
95185      exports.createScript = function (code) {
95186        return exports.Script(code);
95187      };
95188
95189      exports.createContext = Script.createContext = function (context) {
95190        var copy = new Context();
95191
95192        if (_typeof2(context) === 'object') {
95193          forEach(Object_keys(context), function (key) {
95194            copy[key] = context[key];
95195          });
95196        }
95197
95198        return copy;
95199      };
95200    }, {}],
95201    512: [function (require, module, exports) {
95202      "use strict";
95203      /**
95204       * Character classes and associated utilities for the 5th edition of XML 1.0.
95205       *
95206       * @author Louis-Dominique Dubeau
95207       * @license MIT
95208       * @copyright Louis-Dominique Dubeau
95209       */
95210
95211      Object.defineProperty(exports, "__esModule", {
95212        value: true
95213      }); //
95214      // Fragments.
95215      //
95216
95217      exports.CHAR = "\t\n\r -\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF";
95218      exports.S = " \t\r\n"; // tslint:disable-next-line:max-line-length
95219
95220      exports.NAME_START_CHAR = ":A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\uD800\uDC00-\uDB7F\uDFFF";
95221      exports.NAME_CHAR = "-" + exports.NAME_START_CHAR + ".0-9\xB7\u0300-\u036F\u203F-\u2040"; //
95222      // Regular expressions.
95223      //
95224
95225      exports.CHAR_RE = new RegExp("^[" + exports.CHAR + "]$", "u");
95226      exports.S_RE = new RegExp("^[" + exports.S + "]+$", "u");
95227      exports.NAME_START_CHAR_RE = new RegExp("^[" + exports.NAME_START_CHAR + "]$", "u");
95228      exports.NAME_CHAR_RE = new RegExp("^[" + exports.NAME_CHAR + "]$", "u");
95229      exports.NAME_RE = new RegExp("^[" + exports.NAME_START_CHAR + "][" + exports.NAME_CHAR + "]*$", "u");
95230      exports.NMTOKEN_RE = new RegExp("^[" + exports.NAME_CHAR + "]+$", "u");
95231      var TAB = 9;
95232      var NL = 0xA;
95233      var CR = 0xD;
95234      var SPACE = 0x20; //
95235      // Lists.
95236      //
95237
95238      /** All characters in the ``S`` production. */
95239
95240      exports.S_LIST = [SPACE, NL, CR, TAB];
95241      /**
95242       * Determines whether a codepoint matches the ``CHAR`` production.
95243       *
95244       * @param c The code point.
95245       *
95246       * @returns ``true`` if the codepoint matches ``CHAR``.
95247       */
95248
95249      function isChar(c) {
95250        return c >= SPACE && c <= 0xD7FF || c === NL || c === CR || c === TAB || c >= 0xE000 && c <= 0xFFFD || c >= 0x10000 && c <= 0x10FFFF;
95251      }
95252
95253      exports.isChar = isChar;
95254      /**
95255       * Determines whether a codepoint matches the ``S`` (space) production.
95256       *
95257       * @param c The code point.
95258       *
95259       * @returns ``true`` if the codepoint matches ``S``.
95260       */
95261
95262      function isS(c) {
95263        return c === SPACE || c === NL || c === CR || c === TAB;
95264      }
95265
95266      exports.isS = isS;
95267      /**
95268       * Determines whether a codepoint matches the ``NAME_START_CHAR`` production.
95269       *
95270       * @param c The code point.
95271       *
95272       * @returns ``true`` if the codepoint matches ``NAME_START_CHAR``.
95273       */
95274
95275      function isNameStartChar(c) {
95276        return c >= 0x41 && c <= 0x5A || c >= 0x61 && c <= 0x7A || c === 0x3A || c === 0x5F || c === 0x200C || c === 0x200D || c >= 0xC0 && c <= 0xD6 || c >= 0xD8 && c <= 0xF6 || c >= 0x00F8 && c <= 0x02FF || c >= 0x0370 && c <= 0x037D || c >= 0x037F && c <= 0x1FFF || c >= 0x2070 && c <= 0x218F || c >= 0x2C00 && c <= 0x2FEF || c >= 0x3001 && c <= 0xD7FF || c >= 0xF900 && c <= 0xFDCF || c >= 0xFDF0 && c <= 0xFFFD || c >= 0x10000 && c <= 0xEFFFF;
95277      }
95278
95279      exports.isNameStartChar = isNameStartChar;
95280      /**
95281       * Determines whether a codepoint matches the ``NAME_CHAR`` production.
95282       *
95283       * @param c The code point.
95284       *
95285       * @returns ``true`` if the codepoint matches ``NAME_CHAR``.
95286       */
95287
95288      function isNameChar(c) {
95289        return isNameStartChar(c) || c >= 0x30 && c <= 0x39 || c === 0x2D || c === 0x2E || c === 0xB7 || c >= 0x0300 && c <= 0x036F || c >= 0x203F && c <= 0x2040;
95290      }
95291
95292      exports.isNameChar = isNameChar;
95293    }, {}],
vendor: 7,400 bytes, lines 95294-95475
95294    513: [function (require, module, exports) {
95295      "use strict";
95296      /**
95297       * Character classes and associated utilities for the 2nd edition of XML 1.1.
95298       *
95299       * @author Louis-Dominique Dubeau
95300       * @license MIT
95301       * @copyright Louis-Dominique Dubeau
95302       */
95303
95304      Object.defineProperty(exports, "__esModule", {
95305        value: true
95306      }); //
95307      // Fragments.
95308      //
95309
95310      exports.CHAR = "\x01-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF";
95311      exports.RESTRICTED_CHAR = "\x01-\b\x0B\f\x0E-\x1F\x7F-\x84\x86-\x9F";
95312      exports.S = " \t\r\n"; // tslint:disable-next-line:max-line-length
95313
95314      exports.NAME_START_CHAR = ":A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\uD800\uDC00-\uDB7F\uDFFF";
95315      exports.NAME_CHAR = "-" + exports.NAME_START_CHAR + ".0-9\xB7\u0300-\u036F\u203F-\u2040"; //
95316      // Regular expressions.
95317      //
95318
95319      exports.CHAR_RE = new RegExp("^[" + exports.CHAR + "]$", "u");
95320      exports.RESTRICTED_CHAR_RE = new RegExp("^[" + exports.RESTRICTED_CHAR + "]$", "u");
95321      exports.S_RE = new RegExp("^[" + exports.S + "]+$", "u");
95322      exports.NAME_START_CHAR_RE = new RegExp("^[" + exports.NAME_START_CHAR + "]$", "u");
95323      exports.NAME_CHAR_RE = new RegExp("^[" + exports.NAME_CHAR + "]$", "u");
95324      exports.NAME_RE = new RegExp("^[" + exports.NAME_START_CHAR + "][" + exports.NAME_CHAR + "]*$", "u");
95325      exports.NMTOKEN_RE = new RegExp("^[" + exports.NAME_CHAR + "]+$", "u");
95326      var TAB = 9;
95327      var NL = 0xA;
95328      var CR = 0xD;
95329      var SPACE = 0x20; //
95330      // Lists.
95331      //
95332
95333      /** All characters in the ``S`` production. */
95334
95335      exports.S_LIST = [SPACE, NL, CR, TAB];
95336      /**
95337       * Determines whether a codepoint matches the ``CHAR`` production.
95338       *
95339       * @param c The code point.
95340       *
95341       * @returns ``true`` if the codepoint matches ``CHAR``.
95342       */
95343
95344      function isChar(c) {
95345        return c >= 0x0001 && c <= 0xD7FF || c >= 0xE000 && c <= 0xFFFD || c >= 0x10000 && c <= 0x10FFFF;
95346      }
95347
95348      exports.isChar = isChar;
95349      /**
95350       * Determines whether a codepoint matches the ``RESTRICTED_CHAR`` production.
95351       *
95352       * @param c The code point.
95353       *
95354       * @returns ``true`` if the codepoint matches ``RESTRICTED_CHAR``.
95355       */
95356
95357      function isRestrictedChar(c) {
95358        return c >= 0x1 && c <= 0x8 || c === 0xB || c === 0xC || c >= 0xE && c <= 0x1F || c >= 0x7F && c <= 0x84 || c >= 0x86 && c <= 0x9F;
95359      }
95360
95361      exports.isRestrictedChar = isRestrictedChar;
95362      /**
95363       * Determines whether a codepoint matches the ``CHAR`` production and does not
95364       * match the ``RESTRICTED_CHAR`` production. ``isCharAndNotRestricted(x)`` is
95365       * equivalent to ``isChar(x) && !isRestrictedChar(x)``. This function is faster
95366       * than running the two-call equivalent.
95367       *
95368       * @param c The code point.
95369       *
95370       * @returns ``true`` if the codepoint matches ``CHAR`` and does not match
95371       * ``RESTRICTED_CHAR``.
95372       */
95373
95374      function isCharAndNotRestricted(c) {
95375        return c === 0x9 || c === 0xA || c === 0xD || c > 0x1F && c < 0x7F || c === 0x85 || c > 0x9F && c <= 0xD7FF || c >= 0xE000 && c <= 0xFFFD || c >= 0x10000 && c <= 0x10FFFF;
95376      }
95377
95378      exports.isCharAndNotRestricted = isCharAndNotRestricted;
95379      /**
95380       * Determines whether a codepoint matches the ``S`` (space) production.
95381       *
95382       * @param c The code point.
95383       *
95384       * @returns ``true`` if the codepoint matches ``S``.
95385       */
95386
95387      function isS(c) {
95388        return c === SPACE || c === NL || c === CR || c === TAB;
95389      }
95390
95391      exports.isS = isS;
95392      /**
95393       * Determines whether a codepoint matches the ``NAME_START_CHAR`` production.
95394       *
95395       * @param c The code point.
95396       *
95397       * @returns ``true`` if the codepoint matches ``NAME_START_CHAR``.
95398       */
95399      // tslint:disable-next-line:cyclomatic-complexity
95400
95401      function isNameStartChar(c) {
95402        return c >= 0x41 && c <= 0x5A || c >= 0x61 && c <= 0x7A || c === 0x3A || c === 0x5F || c === 0x200C || c === 0x200D || c >= 0xC0 && c <= 0xD6 || c >= 0xD8 && c <= 0xF6 || c >= 0x00F8 && c <= 0x02FF || c >= 0x0370 && c <= 0x037D || c >= 0x037F && c <= 0x1FFF || c >= 0x2070 && c <= 0x218F || c >= 0x2C00 && c <= 0x2FEF || c >= 0x3001 && c <= 0xD7FF || c >= 0xF900 && c <= 0xFDCF || c >= 0xFDF0 && c <= 0xFFFD || c >= 0x10000 && c <= 0xEFFFF;
95403      }
95404
95405      exports.isNameStartChar = isNameStartChar;
95406      /**
95407       * Determines whether a codepoint matches the ``NAME_CHAR`` production.
95408       *
95409       * @param c The code point.
95410       *
95411       * @returns ``true`` if the codepoint matches ``NAME_CHAR``.
95412       */
95413
95414      function isNameChar(c) {
95415        return isNameStartChar(c) || c >= 0x30 && c <= 0x39 || c === 0x2D || c === 0x2E || c === 0xB7 || c >= 0x0300 && c <= 0x036F || c >= 0x203F && c <= 0x2040;
95416      }
95417
95418      exports.isNameChar = isNameChar;
95419    }, {}],
95420    514: [function (require, module, exports) {
95421      "use strict";
95422      /**
95423       * Character class utilities for XML NS 1.0 edition 3.
95424       *
95425       * @author Louis-Dominique Dubeau
95426       * @license MIT
95427       * @copyright Louis-Dominique Dubeau
95428       */
95429
95430      Object.defineProperty(exports, "__esModule", {
95431        value: true
95432      }); //
95433      // Fragments.
95434      //
95435      // tslint:disable-next-line:max-line-length
95436
95437      exports.NC_NAME_START_CHAR = "A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\uD800\uDC00-\uDB7F\uDFFF";
95438      exports.NC_NAME_CHAR = "-" + exports.NC_NAME_START_CHAR + ".0-9\xB7\u0300-\u036F\u203F-\u2040"; //
95439      // Regular expressions.
95440      //
95441
95442      exports.NC_NAME_START_CHAR_RE = new RegExp("^[" + exports.NC_NAME_START_CHAR + "]$", "u");
95443      exports.NC_NAME_CHAR_RE = new RegExp("^[" + exports.NC_NAME_CHAR + "]$", "u");
95444      exports.NC_NAME_RE = new RegExp("^[" + exports.NC_NAME_START_CHAR + "][" + exports.NC_NAME_CHAR + "]*$", "u");
95445      /**
95446       * Determines whether a codepoint matches [[NC_NAME_START_CHAR]].
95447       *
95448       * @param c The code point.
95449       *
95450       * @returns ``true`` if the codepoint matches.
95451       */
95452      // tslint:disable-next-line:cyclomatic-complexity
95453
95454      function isNCNameStartChar(c) {
95455        return c >= 0x41 && c <= 0x5A || c === 0x5F || c >= 0x61 && c <= 0x7A || c >= 0xC0 && c <= 0xD6 || c >= 0xD8 && c <= 0xF6 || c >= 0x00F8 && c <= 0x02FF || c >= 0x0370 && c <= 0x037D || c >= 0x037F && c <= 0x1FFF || c >= 0x200C && c <= 0x200D || c >= 0x2070 && c <= 0x218F || c >= 0x2C00 && c <= 0x2FEF || c >= 0x3001 && c <= 0xD7FF || c >= 0xF900 && c <= 0xFDCF || c >= 0xFDF0 && c <= 0xFFFD || c >= 0x10000 && c <= 0xEFFFF;
95456      }
95457
95458      exports.isNCNameStartChar = isNCNameStartChar;
95459      /**
95460       * Determines whether a codepoint matches [[NC_NAME_CHAR]].
95461       *
95462       * @param c The code point.
95463       *
95464       * @returns ``true`` if the codepoint matches.
95465       */
95466
95467      function isNCNameChar(c) {
95468        return isNCNameStartChar(c) || c === 0x2D || c === 0x2E || c >= 0x30 && c <= 0x39 || c === 0x00B7 || c >= 0x0300 && c <= 0x036F || c >= 0x203F && c <= 0x2040;
95469      }
95470
95471      exports.isNCNameChar = isNCNameChar;
95472    }, {}]
95473  }, {}, [15])(15);
95474});
95475//# sourceMappingURL=exceljs.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.