Skip to content

Instantly share code, notes, and snippets.

@stevenweaver
Last active August 15, 2018 11:08
Show Gist options
  • Save stevenweaver/c1c7199fa67b349c8f429bd91f24bfd0 to your computer and use it in GitHub Desktop.
Save stevenweaver/c1c7199fa67b349c8f429bd91f24bfd0 to your computer and use it in GitHub Desktop.
ATI
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global.d3 = global.d3 || {})));
}(this, function (exports) { 'use strict';
/**
* A parser for augur. This is a separate function
* Compatible with augur schema v2
* strain - name
*/
var augur_parser = function(json, options) {
var tree = json.tree;
// iterate through each child and annotate
function decorate_nodes(node, index) {
node.annotation = "";
node.id = node.strain;
node.label = node.strain;
node.name = node.strain;
if (node.children) {
node.children.forEach(decorate_nodes);
}
}
decorate_nodes(tree);
tree.root = "true";
return {
json: tree,
error: null
};
};
exports.augur = augur_parser;
Object.defineProperty(exports, '__esModule', { value: true });
}));
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = "./src/main.js");
/******/ })
/************************************************************************/
/******/ ({
/***/ "./node_modules/base64-js/index.js":
/*!*****************************************!*\
!*** ./node_modules/base64-js/index.js ***!
\*****************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction getLens (b64) {\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=')\n if (validLen === -1) validLen = len\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4)\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction byteLength (b64) {\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))\n\n var curByte = 0\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen\n\n for (var i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)]\n arr[curByte++] = (tmp >> 16) & 0xFF\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF)\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(\n uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)\n ))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n )\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1]\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n )\n }\n\n return parts.join('')\n}\n\n\n//# sourceURL=webpack:///./node_modules/base64-js/index.js?");
/***/ }),
/***/ "./node_modules/buffer/index.js":
/*!**************************************!*\
!*** ./node_modules/buffer/index.js ***!
\**************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("/* WEBPACK VAR INJECTION */(function(global) {/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>\n * @license MIT\n */\n/* eslint-disable no-proto */\n\n\n\nvar base64 = __webpack_require__(/*! base64-js */ \"./node_modules/base64-js/index.js\")\nvar ieee754 = __webpack_require__(/*! ieee754 */ \"./node_modules/ieee754/index.js\")\nvar isArray = __webpack_require__(/*! isarray */ \"./node_modules/isarray/index.js\")\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Due to various browser bugs, sometimes the Object implementation will be used even\n * when the browser supports typed arrays.\n *\n * Note:\n *\n * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n * incorrect length in some situations.\n\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n * get the Object implementation, which is slower but behaves correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n ? global.TYPED_ARRAY_SUPPORT\n : typedArraySupport()\n\n/*\n * Export kMaxLength after typed array support is determined.\n */\nexports.kMaxLength = kMaxLength()\n\nfunction typedArraySupport () {\n try {\n var arr = new Uint8Array(1)\n arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}\n return arr.foo() === 42 && // typed array instances can be augmented\n typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n } catch (e) {\n return false\n }\n}\n\nfunction kMaxLength () {\n return Buffer.TYPED_ARRAY_SUPPORT\n ? 0x7fffffff\n : 0x3fffffff\n}\n\nfunction createBuffer (that, length) {\n if (kMaxLength() < length) {\n throw new RangeError('Invalid typed array length')\n }\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = new Uint8Array(length)\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n if (that === null) {\n that = new Buffer(length)\n }\n that.length = length\n }\n\n return that\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n return new Buffer(arg, encodingOrOffset, length)\n }\n\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(this, arg)\n }\n return from(this, arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\n// TODO: Legacy, not needed anymore. Remove in next major version.\nBuffer._augment = function (arr) {\n arr.__proto__ = Buffer.prototype\n return arr\n}\n\nfunction from (that, value, encodingOrOffset, length) {\n if (typeof value === 'number') {\n throw new TypeError('\"value\" argument must not be a number')\n }\n\n if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {\n return fromArrayBuffer(that, value, encodingOrOffset, length)\n }\n\n if (typeof value === 'string') {\n return fromString(that, value, encodingOrOffset)\n }\n\n return fromObject(that, value)\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(null, value, encodingOrOffset, length)\n}\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n Buffer.prototype.__proto__ = Uint8Array.prototype\n Buffer.__proto__ = Uint8Array\n if (typeof Symbol !== 'undefined' && Symbol.species &&\n Buffer[Symbol.species] === Buffer) {\n // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97\n Object.defineProperty(Buffer, Symbol.species, {\n value: null,\n configurable: true\n })\n }\n}\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be a number')\n } else if (size < 0) {\n throw new RangeError('\"size\" argument must not be negative')\n }\n}\n\nfunction alloc (that, size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(that, size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpretted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(that, size).fill(fill, encoding)\n : createBuffer(that, size).fill(fill)\n }\n return createBuffer(that, size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(null, size, fill, encoding)\n}\n\nfunction allocUnsafe (that, size) {\n assertSize(size)\n that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n for (var i = 0; i < size; ++i) {\n that[i] = 0\n }\n }\n return that\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(null, size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(null, size)\n}\n\nfunction fromString (that, string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('\"encoding\" must be a valid string encoding')\n }\n\n var length = byteLength(string, encoding) | 0\n that = createBuffer(that, length)\n\n var actual = that.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n that = that.slice(0, actual)\n }\n\n return that\n}\n\nfunction fromArrayLike (that, array) {\n var length = array.length < 0 ? 0 : checked(array.length) | 0\n that = createBuffer(that, length)\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\nfunction fromArrayBuffer (that, array, byteOffset, length) {\n array.byteLength // this throws if `array` is not a valid ArrayBuffer\n\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\\'offset\\' is out of bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\\'length\\' is out of bounds')\n }\n\n if (byteOffset === undefined && length === undefined) {\n array = new Uint8Array(array)\n } else if (length === undefined) {\n array = new Uint8Array(array, byteOffset)\n } else {\n array = new Uint8Array(array, byteOffset, length)\n }\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = array\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n that = fromArrayLike(that, array)\n }\n return that\n}\n\nfunction fromObject (that, obj) {\n if (Buffer.isBuffer(obj)) {\n var len = checked(obj.length) | 0\n that = createBuffer(that, len)\n\n if (that.length === 0) {\n return that\n }\n\n obj.copy(that, 0, 0, len)\n return that\n }\n\n if (obj) {\n if ((typeof ArrayBuffer !== 'undefined' &&\n obj.buffer instanceof ArrayBuffer) || 'length' in obj) {\n if (typeof obj.length !== 'number' || isnan(obj.length)) {\n return createBuffer(that, 0)\n }\n return fromArrayLike(that, obj)\n }\n\n if (obj.type === 'Buffer' && isArray(obj.data)) {\n return fromArrayLike(that, obj.data)\n }\n }\n\n throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')\n}\n\nfunction checked (length) {\n // Note: cannot use `length < kMaxLength()` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= kMaxLength()) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + kMaxLength().toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return !!(b != null && b._isBuffer)\n}\n\nBuffer.compare = function compare (a, b) {\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError('Arguments must be Buffers')\n }\n\n if (a === b) return 0\n\n var x = a.length\n var y = b.length\n\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n var i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n var buffer = Buffer.allocUnsafe(length)\n var pos = 0\n for (i = 0; i < list.length; ++i) {\n var buf = list[i]\n if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n buf.copy(buffer, pos)\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&\n (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n string = '' + string\n }\n\n var len = string.length\n if (len === 0) return 0\n\n // Use a for loop to avoid recursion\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n case undefined:\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) return utf8ToBytes(string).length // assume utf8\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n var loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coersion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect\n// Buffer instances.\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n var i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n var len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (var i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n var len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (var i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n var len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (var i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n var length = this.length | 0\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n var str = ''\n var max = exports.INSPECT_MAX_BYTES\n if (this.length > 0) {\n str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n if (this.length > max) str += ' ... '\n }\n return '<Buffer ' + str + '>'\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (!Buffer.isBuffer(target)) {\n throw new TypeError('Argument must be a Buffer')\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n var x = thisEnd - thisStart\n var y = end - start\n var len = Math.min(x, y)\n\n var thisCopy = this.slice(thisStart, thisEnd)\n var targetCopy = target.slice(start, end)\n\n for (var i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (isNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (Buffer.TYPED_ARRAY_SUPPORT &&\n typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n var indexSize = 1\n var arrLength = arr.length\n var valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n var i\n if (dir) {\n var foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n var found = true\n for (var j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n var remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n // must be an even number of digits\n var strLen = string.length\n if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n for (var i = 0; i < length; ++i) {\n var parsed = parseInt(string.substr(i * 2, 2), 16)\n if (isNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction latin1Write (buf, string, offset, length) {\n return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset | 0\n if (isFinite(length)) {\n length = length | 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n // legacy write(string, encoding, offset, length) - remove in v0.13\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n var remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n return asciiWrite(this, string, offset, length)\n\n case 'latin1':\n case 'binary':\n return latin1Write(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n var res = []\n\n var i = start\n while (i < end) {\n var firstByte = buf[i]\n var codePoint = null\n var bytesPerSequence = (firstByte > 0xEF) ? 4\n : (firstByte > 0xDF) ? 3\n : (firstByte > 0xBF) ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n var secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nvar MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n var len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n var res = ''\n var i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n var len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n var out = ''\n for (var i = start; i < end; ++i) {\n out += toHex(buf[i])\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n var bytes = buf.slice(start, end)\n var res = ''\n for (var i = 0; i < bytes.length; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n var len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n var newBuf\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n newBuf = this.subarray(start, end)\n newBuf.__proto__ = Buffer.prototype\n } else {\n var sliceLen = end - start\n newBuf = new Buffer(sliceLen, undefined)\n for (var i = 0; i < sliceLen; ++i) {\n newBuf[i] = this[i + start]\n }\n }\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n var val = this[offset + --byteLength]\n var mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var i = byteLength\n var mul = 1\n var val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var mul = 1\n var i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var i = byteLength - 1\n var mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {\n buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n (littleEndian ? i : 1 - i) * 8\n }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffffffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {\n buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = 0\n var mul = 1\n var sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = byteLength - 1\n var mul = 1\n var sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n var len = end - start\n var i\n\n if (this === target && start < targetStart && targetStart < end) {\n // descending copy from end\n for (i = len - 1; i >= 0; --i) {\n target[i + targetStart] = this[i + start]\n }\n } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n // ascending copy from start\n for (i = 0; i < len; ++i) {\n target[i + targetStart] = this[i + start]\n }\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, start + len),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (val.length === 1) {\n var code = val.charCodeAt(0)\n if (code < 256) {\n val = code\n }\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n } else if (typeof val === 'number') {\n val = val & 255\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n var i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n var bytes = Buffer.isBuffer(val)\n ? val\n : utf8ToBytes(new Buffer(val, encoding).toString())\n var len = bytes.length\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction stringtrim (str) {\n if (str.trim) return str.trim()\n return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction toHex (n) {\n if (n < 16) return '0' + n.toString(16)\n return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n var codePoint\n var length = string.length\n var leadSurrogate = null\n var bytes = []\n\n for (var i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n var c, hi, lo\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n for (var i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\nfunction isnan (val) {\n return val !== val // eslint-disable-line no-self-compare\n}\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ \"./node_modules/webpack/buildin/global.js\")))\n\n//# sourceURL=webpack:///./node_modules/buffer/index.js?");
/***/ }),
/***/ "./node_modules/core-util-is/lib/util.js":
/*!***********************************************!*\
!*** ./node_modules/core-util-is/lib/util.js ***!
\***********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("/* WEBPACK VAR INJECTION */(function(Buffer) {// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\n\nfunction isArray(arg) {\n if (Array.isArray) {\n return Array.isArray(arg);\n }\n return objectToString(arg) === '[object Array]';\n}\nexports.isArray = isArray;\n\nfunction isBoolean(arg) {\n return typeof arg === 'boolean';\n}\nexports.isBoolean = isBoolean;\n\nfunction isNull(arg) {\n return arg === null;\n}\nexports.isNull = isNull;\n\nfunction isNullOrUndefined(arg) {\n return arg == null;\n}\nexports.isNullOrUndefined = isNullOrUndefined;\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\nexports.isNumber = isNumber;\n\nfunction isString(arg) {\n return typeof arg === 'string';\n}\nexports.isString = isString;\n\nfunction isSymbol(arg) {\n return typeof arg === 'symbol';\n}\nexports.isSymbol = isSymbol;\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\nexports.isUndefined = isUndefined;\n\nfunction isRegExp(re) {\n return objectToString(re) === '[object RegExp]';\n}\nexports.isRegExp = isRegExp;\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\nexports.isObject = isObject;\n\nfunction isDate(d) {\n return objectToString(d) === '[object Date]';\n}\nexports.isDate = isDate;\n\nfunction isError(e) {\n return (objectToString(e) === '[object Error]' || e instanceof Error);\n}\nexports.isError = isError;\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\nexports.isFunction = isFunction;\n\nfunction isPrimitive(arg) {\n return arg === null ||\n typeof arg === 'boolean' ||\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n}\nexports.isPrimitive = isPrimitive;\n\nexports.isBuffer = Buffer.isBuffer;\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../buffer/index.js */ \"./node_modules/buffer/index.js\").Buffer))\n\n//# sourceURL=webpack:///./node_modules/core-util-is/lib/util.js?");
/***/ }),
/***/ "./node_modules/events/events.js":
/*!***************************************!*\
!*** ./node_modules/events/events.js ***!
\***************************************/
/*! no static exports found */
/***/ (function(module, exports) {
eval("// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nfunction EventEmitter() {\n this._events = this._events || {};\n this._maxListeners = this._maxListeners || undefined;\n}\nmodule.exports = EventEmitter;\n\n// Backwards-compat with node 0.10.x\nEventEmitter.EventEmitter = EventEmitter;\n\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._maxListeners = undefined;\n\n// By default EventEmitters will print a warning if more than 10 listeners are\n// added to it. This is a useful default which helps finding memory leaks.\nEventEmitter.defaultMaxListeners = 10;\n\n// Obviously not all Emitters should be limited to 10. This function allows\n// that to be increased. Set to zero for unlimited.\nEventEmitter.prototype.setMaxListeners = function(n) {\n if (!isNumber(n) || n < 0 || isNaN(n))\n throw TypeError('n must be a positive number');\n this._maxListeners = n;\n return this;\n};\n\nEventEmitter.prototype.emit = function(type) {\n var er, handler, len, args, i, listeners;\n\n if (!this._events)\n this._events = {};\n\n // If there is no 'error' event listener then throw.\n if (type === 'error') {\n if (!this._events.error ||\n (isObject(this._events.error) && !this._events.error.length)) {\n er = arguments[1];\n if (er instanceof Error) {\n throw er; // Unhandled 'error' event\n } else {\n // At least give some kind of context to the user\n var err = new Error('Uncaught, unspecified \"error\" event. (' + er + ')');\n err.context = er;\n throw err;\n }\n }\n }\n\n handler = this._events[type];\n\n if (isUndefined(handler))\n return false;\n\n if (isFunction(handler)) {\n switch (arguments.length) {\n // fast cases\n case 1:\n handler.call(this);\n break;\n case 2:\n handler.call(this, arguments[1]);\n break;\n case 3:\n handler.call(this, arguments[1], arguments[2]);\n break;\n // slower\n default:\n args = Array.prototype.slice.call(arguments, 1);\n handler.apply(this, args);\n }\n } else if (isObject(handler)) {\n args = Array.prototype.slice.call(arguments, 1);\n listeners = handler.slice();\n len = listeners.length;\n for (i = 0; i < len; i++)\n listeners[i].apply(this, args);\n }\n\n return true;\n};\n\nEventEmitter.prototype.addListener = function(type, listener) {\n var m;\n\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n if (!this._events)\n this._events = {};\n\n // To avoid recursion in the case that type === \"newListener\"! Before\n // adding it to the listeners, first emit \"newListener\".\n if (this._events.newListener)\n this.emit('newListener', type,\n isFunction(listener.listener) ?\n listener.listener : listener);\n\n if (!this._events[type])\n // Optimize the case of one listener. Don't need the extra array object.\n this._events[type] = listener;\n else if (isObject(this._events[type]))\n // If we've already got an array, just append.\n this._events[type].push(listener);\n else\n // Adding the second element, need to change to array.\n this._events[type] = [this._events[type], listener];\n\n // Check for listener leak\n if (isObject(this._events[type]) && !this._events[type].warned) {\n if (!isUndefined(this._maxListeners)) {\n m = this._maxListeners;\n } else {\n m = EventEmitter.defaultMaxListeners;\n }\n\n if (m && m > 0 && this._events[type].length > m) {\n this._events[type].warned = true;\n console.error('(node) warning: possible EventEmitter memory ' +\n 'leak detected. %d listeners added. ' +\n 'Use emitter.setMaxListeners() to increase limit.',\n this._events[type].length);\n if (typeof console.trace === 'function') {\n // not supported in IE 10\n console.trace();\n }\n }\n }\n\n return this;\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.once = function(type, listener) {\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n var fired = false;\n\n function g() {\n this.removeListener(type, g);\n\n if (!fired) {\n fired = true;\n listener.apply(this, arguments);\n }\n }\n\n g.listener = listener;\n this.on(type, g);\n\n return this;\n};\n\n// emits a 'removeListener' event iff the listener was removed\nEventEmitter.prototype.removeListener = function(type, listener) {\n var list, position, length, i;\n\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n if (!this._events || !this._events[type])\n return this;\n\n list = this._events[type];\n length = list.length;\n position = -1;\n\n if (list === listener ||\n (isFunction(list.listener) && list.listener === listener)) {\n delete this._events[type];\n if (this._events.removeListener)\n this.emit('removeListener', type, listener);\n\n } else if (isObject(list)) {\n for (i = length; i-- > 0;) {\n if (list[i] === listener ||\n (list[i].listener && list[i].listener === listener)) {\n position = i;\n break;\n }\n }\n\n if (position < 0)\n return this;\n\n if (list.length === 1) {\n list.length = 0;\n delete this._events[type];\n } else {\n list.splice(position, 1);\n }\n\n if (this._events.removeListener)\n this.emit('removeListener', type, listener);\n }\n\n return this;\n};\n\nEventEmitter.prototype.removeAllListeners = function(type) {\n var key, listeners;\n\n if (!this._events)\n return this;\n\n // not listening for removeListener, no need to emit\n if (!this._events.removeListener) {\n if (arguments.length === 0)\n this._events = {};\n else if (this._events[type])\n delete this._events[type];\n return this;\n }\n\n // emit removeListener for all listeners on all events\n if (arguments.length === 0) {\n for (key in this._events) {\n if (key === 'removeListener') continue;\n this.removeAllListeners(key);\n }\n this.removeAllListeners('removeListener');\n this._events = {};\n return this;\n }\n\n listeners = this._events[type];\n\n if (isFunction(listeners)) {\n this.removeListener(type, listeners);\n } else if (listeners) {\n // LIFO order\n while (listeners.length)\n this.removeListener(type, listeners[listeners.length - 1]);\n }\n delete this._events[type];\n\n return this;\n};\n\nEventEmitter.prototype.listeners = function(type) {\n var ret;\n if (!this._events || !this._events[type])\n ret = [];\n else if (isFunction(this._events[type]))\n ret = [this._events[type]];\n else\n ret = this._events[type].slice();\n return ret;\n};\n\nEventEmitter.prototype.listenerCount = function(type) {\n if (this._events) {\n var evlistener = this._events[type];\n\n if (isFunction(evlistener))\n return 1;\n else if (evlistener)\n return evlistener.length;\n }\n return 0;\n};\n\nEventEmitter.listenerCount = function(emitter, type) {\n return emitter.listenerCount(type);\n};\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\n\n\n//# sourceURL=webpack:///./node_modules/events/events.js?");
/***/ }),
/***/ "./node_modules/ieee754/index.js":
/*!***************************************!*\
!*** ./node_modules/ieee754/index.js ***!
\***************************************/
/*! no static exports found */
/***/ (function(module, exports) {
eval("exports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n\n\n//# sourceURL=webpack:///./node_modules/ieee754/index.js?");
/***/ }),
/***/ "./node_modules/inherits/inherits_browser.js":
/*!***************************************************!*\
!*** ./node_modules/inherits/inherits_browser.js ***!
\***************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
eval("if (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n var TempCtor = function () {}\n TempCtor.prototype = superCtor.prototype\n ctor.prototype = new TempCtor()\n ctor.prototype.constructor = ctor\n }\n}\n\n\n//# sourceURL=webpack:///./node_modules/inherits/inherits_browser.js?");
/***/ }),
/***/ "./node_modules/isarray/index.js":
/*!***************************************!*\
!*** ./node_modules/isarray/index.js ***!
\***************************************/
/*! no static exports found */
/***/ (function(module, exports) {
eval("var toString = {}.toString;\n\nmodule.exports = Array.isArray || function (arr) {\n return toString.call(arr) == '[object Array]';\n};\n\n\n//# sourceURL=webpack:///./node_modules/isarray/index.js?");
/***/ }),
/***/ "./node_modules/process-nextick-args/index.js":
/*!****************************************************!*\
!*** ./node_modules/process-nextick-args/index.js ***!
\****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("/* WEBPACK VAR INJECTION */(function(process) {\n\nif (!process.version ||\n process.version.indexOf('v0.') === 0 ||\n process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {\n module.exports = { nextTick: nextTick };\n} else {\n module.exports = process\n}\n\nfunction nextTick(fn, arg1, arg2, arg3) {\n if (typeof fn !== 'function') {\n throw new TypeError('\"callback\" argument must be a function');\n }\n var len = arguments.length;\n var args, i;\n switch (len) {\n case 0:\n case 1:\n return process.nextTick(fn);\n case 2:\n return process.nextTick(function afterTickOne() {\n fn.call(null, arg1);\n });\n case 3:\n return process.nextTick(function afterTickTwo() {\n fn.call(null, arg1, arg2);\n });\n case 4:\n return process.nextTick(function afterTickThree() {\n fn.call(null, arg1, arg2, arg3);\n });\n default:\n args = new Array(len - 1);\n i = 0;\n while (i < args.length) {\n args[i++] = arguments[i];\n }\n return process.nextTick(function afterTick() {\n fn.apply(null, args);\n });\n }\n}\n\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../process/browser.js */ \"./node_modules/process/browser.js\")))\n\n//# sourceURL=webpack:///./node_modules/process-nextick-args/index.js?");
/***/ }),
/***/ "./node_modules/process/browser.js":
/*!*****************************************!*\
!*** ./node_modules/process/browser.js ***!
\*****************************************/
/*! no static exports found */
/***/ (function(module, exports) {
eval("// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // 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\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // 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.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n\n//# sourceURL=webpack:///./node_modules/process/browser.js?");
/***/ }),
/***/ "./node_modules/readable-stream/duplex-browser.js":
/*!********************************************************!*\
!*** ./node_modules/readable-stream/duplex-browser.js ***!
\********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("module.exports = __webpack_require__(/*! ./lib/_stream_duplex.js */ \"./node_modules/readable-stream/lib/_stream_duplex.js\");\n\n\n//# sourceURL=webpack:///./node_modules/readable-stream/duplex-browser.js?");
/***/ }),
/***/ "./node_modules/readable-stream/lib/_stream_duplex.js":
/*!************************************************************!*\
!*** ./node_modules/readable-stream/lib/_stream_duplex.js ***!
\************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a duplex stream is just a stream that is both readable and writable.\n// Since JS doesn't have multiple prototypal inheritance, this class\n// prototypally inherits from Readable, and then parasitically from\n// Writable.\n\n\n\n/*<replacement>*/\n\nvar pna = __webpack_require__(/*! process-nextick-args */ \"./node_modules/process-nextick-args/index.js\");\n/*</replacement>*/\n\n/*<replacement>*/\nvar objectKeys = Object.keys || function (obj) {\n var keys = [];\n for (var key in obj) {\n keys.push(key);\n }return keys;\n};\n/*</replacement>*/\n\nmodule.exports = Duplex;\n\n/*<replacement>*/\nvar util = __webpack_require__(/*! core-util-is */ \"./node_modules/core-util-is/lib/util.js\");\nutil.inherits = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\");\n/*</replacement>*/\n\nvar Readable = __webpack_require__(/*! ./_stream_readable */ \"./node_modules/readable-stream/lib/_stream_readable.js\");\nvar Writable = __webpack_require__(/*! ./_stream_writable */ \"./node_modules/readable-stream/lib/_stream_writable.js\");\n\nutil.inherits(Duplex, Readable);\n\n{\n // avoid scope creep, the keys array can then be collected\n var keys = objectKeys(Writable.prototype);\n for (var v = 0; v < keys.length; v++) {\n var method = keys[v];\n if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];\n }\n}\n\nfunction Duplex(options) {\n if (!(this instanceof Duplex)) return new Duplex(options);\n\n Readable.call(this, options);\n Writable.call(this, options);\n\n if (options && options.readable === false) this.readable = false;\n\n if (options && options.writable === false) this.writable = false;\n\n this.allowHalfOpen = true;\n if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;\n\n this.once('end', onend);\n}\n\nObject.defineProperty(Duplex.prototype, 'writableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function () {\n return this._writableState.highWaterMark;\n }\n});\n\n// the no-half-open enforcer\nfunction onend() {\n // if we allow half-open state, or if the writable side ended,\n // then we're ok.\n if (this.allowHalfOpen || this._writableState.ended) return;\n\n // no more data can be written.\n // But allow more writes to happen in this tick.\n pna.nextTick(onEndNT, this);\n}\n\nfunction onEndNT(self) {\n self.end();\n}\n\nObject.defineProperty(Duplex.prototype, 'destroyed', {\n get: function () {\n if (this._readableState === undefined || this._writableState === undefined) {\n return false;\n }\n return this._readableState.destroyed && this._writableState.destroyed;\n },\n set: function (value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (this._readableState === undefined || this._writableState === undefined) {\n return;\n }\n\n // backward compatibility, the user is explicitly\n // managing destroyed\n this._readableState.destroyed = value;\n this._writableState.destroyed = value;\n }\n});\n\nDuplex.prototype._destroy = function (err, cb) {\n this.push(null);\n this.end();\n\n pna.nextTick(cb, err);\n};\n\n//# sourceURL=webpack:///./node_modules/readable-stream/lib/_stream_duplex.js?");
/***/ }),
/***/ "./node_modules/readable-stream/lib/_stream_passthrough.js":
/*!*****************************************************************!*\
!*** ./node_modules/readable-stream/lib/_stream_passthrough.js ***!
\*****************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a passthrough stream.\n// basically just the most minimal sort of Transform stream.\n// Every written chunk gets output as-is.\n\n\n\nmodule.exports = PassThrough;\n\nvar Transform = __webpack_require__(/*! ./_stream_transform */ \"./node_modules/readable-stream/lib/_stream_transform.js\");\n\n/*<replacement>*/\nvar util = __webpack_require__(/*! core-util-is */ \"./node_modules/core-util-is/lib/util.js\");\nutil.inherits = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\");\n/*</replacement>*/\n\nutil.inherits(PassThrough, Transform);\n\nfunction PassThrough(options) {\n if (!(this instanceof PassThrough)) return new PassThrough(options);\n\n Transform.call(this, options);\n}\n\nPassThrough.prototype._transform = function (chunk, encoding, cb) {\n cb(null, chunk);\n};\n\n//# sourceURL=webpack:///./node_modules/readable-stream/lib/_stream_passthrough.js?");
/***/ }),
/***/ "./node_modules/readable-stream/lib/_stream_readable.js":
/*!**************************************************************!*\
!*** ./node_modules/readable-stream/lib/_stream_readable.js ***!
\**************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("/* WEBPACK VAR INJECTION */(function(global, process) {// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n\n/*<replacement>*/\n\nvar pna = __webpack_require__(/*! process-nextick-args */ \"./node_modules/process-nextick-args/index.js\");\n/*</replacement>*/\n\nmodule.exports = Readable;\n\n/*<replacement>*/\nvar isArray = __webpack_require__(/*! isarray */ \"./node_modules/isarray/index.js\");\n/*</replacement>*/\n\n/*<replacement>*/\nvar Duplex;\n/*</replacement>*/\n\nReadable.ReadableState = ReadableState;\n\n/*<replacement>*/\nvar EE = __webpack_require__(/*! events */ \"./node_modules/events/events.js\").EventEmitter;\n\nvar EElistenerCount = function (emitter, type) {\n return emitter.listeners(type).length;\n};\n/*</replacement>*/\n\n/*<replacement>*/\nvar Stream = __webpack_require__(/*! ./internal/streams/stream */ \"./node_modules/readable-stream/lib/internal/streams/stream-browser.js\");\n/*</replacement>*/\n\n/*<replacement>*/\n\nvar Buffer = __webpack_require__(/*! safe-buffer */ \"./node_modules/safe-buffer/index.js\").Buffer;\nvar OurUint8Array = global.Uint8Array || function () {};\nfunction _uint8ArrayToBuffer(chunk) {\n return Buffer.from(chunk);\n}\nfunction _isUint8Array(obj) {\n return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;\n}\n\n/*</replacement>*/\n\n/*<replacement>*/\nvar util = __webpack_require__(/*! core-util-is */ \"./node_modules/core-util-is/lib/util.js\");\nutil.inherits = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\");\n/*</replacement>*/\n\n/*<replacement>*/\nvar debugUtil = __webpack_require__(/*! util */ 0);\nvar debug = void 0;\nif (debugUtil && debugUtil.debuglog) {\n debug = debugUtil.debuglog('stream');\n} else {\n debug = function () {};\n}\n/*</replacement>*/\n\nvar BufferList = __webpack_require__(/*! ./internal/streams/BufferList */ \"./node_modules/readable-stream/lib/internal/streams/BufferList.js\");\nvar destroyImpl = __webpack_require__(/*! ./internal/streams/destroy */ \"./node_modules/readable-stream/lib/internal/streams/destroy.js\");\nvar StringDecoder;\n\nutil.inherits(Readable, Stream);\n\nvar kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];\n\nfunction prependListener(emitter, event, fn) {\n // Sadly this is not cacheable as some libraries bundle their own\n // event emitter implementation with them.\n if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn);\n\n // This is a hack to make sure that our error handler is attached before any\n // userland ones. NEVER DO THIS. This is here only because this code needs\n // to continue to work with older versions of Node.js that do not include\n // the prependListener() method. The goal is to eventually remove this hack.\n if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];\n}\n\nfunction ReadableState(options, stream) {\n Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ \"./node_modules/readable-stream/lib/_stream_duplex.js\");\n\n options = options || {};\n\n // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream.\n // These options can be provided separately as readableXXX and writableXXX.\n var isDuplex = stream instanceof Duplex;\n\n // object stream flag. Used to make read(n) ignore n and to\n // make all the buffer merging and length checks go away\n this.objectMode = !!options.objectMode;\n\n if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;\n\n // the point at which it stops calling _read() to fill the buffer\n // Note: 0 is a valid value, means \"don't call _read preemptively ever\"\n var hwm = options.highWaterMark;\n var readableHwm = options.readableHighWaterMark;\n var defaultHwm = this.objectMode ? 16 : 16 * 1024;\n\n if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm;\n\n // cast to ints.\n this.highWaterMark = Math.floor(this.highWaterMark);\n\n // A linked list is used to store data chunks instead of an array because the\n // linked list can remove elements from the beginning faster than\n // array.shift()\n this.buffer = new BufferList();\n this.length = 0;\n this.pipes = null;\n this.pipesCount = 0;\n this.flowing = null;\n this.ended = false;\n this.endEmitted = false;\n this.reading = false;\n\n // a flag to be able to tell if the event 'readable'/'data' is emitted\n // immediately, or on a later tick. We set this to true at first, because\n // any actions that shouldn't happen until \"later\" should generally also\n // not happen before the first read call.\n this.sync = true;\n\n // whenever we return null, then we set a flag to say\n // that we're awaiting a 'readable' event emission.\n this.needReadable = false;\n this.emittedReadable = false;\n this.readableListening = false;\n this.resumeScheduled = false;\n\n // has it been destroyed\n this.destroyed = false;\n\n // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n this.defaultEncoding = options.defaultEncoding || 'utf8';\n\n // the number of writers that are awaiting a drain event in .pipe()s\n this.awaitDrain = 0;\n\n // if true, a maybeReadMore has been scheduled\n this.readingMore = false;\n\n this.decoder = null;\n this.encoding = null;\n if (options.encoding) {\n if (!StringDecoder) StringDecoder = __webpack_require__(/*! string_decoder/ */ \"./node_modules/string_decoder/lib/string_decoder.js\").StringDecoder;\n this.decoder = new StringDecoder(options.encoding);\n this.encoding = options.encoding;\n }\n}\n\nfunction Readable(options) {\n Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ \"./node_modules/readable-stream/lib/_stream_duplex.js\");\n\n if (!(this instanceof Readable)) return new Readable(options);\n\n this._readableState = new ReadableState(options, this);\n\n // legacy\n this.readable = true;\n\n if (options) {\n if (typeof options.read === 'function') this._read = options.read;\n\n if (typeof options.destroy === 'function') this._destroy = options.destroy;\n }\n\n Stream.call(this);\n}\n\nObject.defineProperty(Readable.prototype, 'destroyed', {\n get: function () {\n if (this._readableState === undefined) {\n return false;\n }\n return this._readableState.destroyed;\n },\n set: function (value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (!this._readableState) {\n return;\n }\n\n // backward compatibility, the user is explicitly\n // managing destroyed\n this._readableState.destroyed = value;\n }\n});\n\nReadable.prototype.destroy = destroyImpl.destroy;\nReadable.prototype._undestroy = destroyImpl.undestroy;\nReadable.prototype._destroy = function (err, cb) {\n this.push(null);\n cb(err);\n};\n\n// Manually shove something into the read() buffer.\n// This returns true if the highWaterMark has not been hit yet,\n// similar to how Writable.write() returns true if you should\n// write() some more.\nReadable.prototype.push = function (chunk, encoding) {\n var state = this._readableState;\n var skipChunkCheck;\n\n if (!state.objectMode) {\n if (typeof chunk === 'string') {\n encoding = encoding || state.defaultEncoding;\n if (encoding !== state.encoding) {\n chunk = Buffer.from(chunk, encoding);\n encoding = '';\n }\n skipChunkCheck = true;\n }\n } else {\n skipChunkCheck = true;\n }\n\n return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);\n};\n\n// Unshift should *always* be something directly out of read()\nReadable.prototype.unshift = function (chunk) {\n return readableAddChunk(this, chunk, null, true, false);\n};\n\nfunction readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {\n var state = stream._readableState;\n if (chunk === null) {\n state.reading = false;\n onEofChunk(stream, state);\n } else {\n var er;\n if (!skipChunkCheck) er = chunkInvalid(state, chunk);\n if (er) {\n stream.emit('error', er);\n } else if (state.objectMode || chunk && chunk.length > 0) {\n if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n\n if (addToFront) {\n if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true);\n } else if (state.ended) {\n stream.emit('error', new Error('stream.push() after EOF'));\n } else {\n state.reading = false;\n if (state.decoder && !encoding) {\n chunk = state.decoder.write(chunk);\n if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);\n } else {\n addChunk(stream, state, chunk, false);\n }\n }\n } else if (!addToFront) {\n state.reading = false;\n }\n }\n\n return needMoreData(state);\n}\n\nfunction addChunk(stream, state, chunk, addToFront) {\n if (state.flowing && state.length === 0 && !state.sync) {\n stream.emit('data', chunk);\n stream.read(0);\n } else {\n // update the buffer info.\n state.length += state.objectMode ? 1 : chunk.length;\n if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);\n\n if (state.needReadable) emitReadable(stream);\n }\n maybeReadMore(stream, state);\n}\n\nfunction chunkInvalid(state, chunk) {\n var er;\n if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n return er;\n}\n\n// if it's past the high water mark, we can push in some more.\n// Also, if we have no data yet, we can stand some\n// more bytes. This is to work around cases where hwm=0,\n// such as the repl. Also, if the push() triggered a\n// readable event, and the user called read(largeNumber) such that\n// needReadable was set, then we ought to push more, so that another\n// 'readable' event will be triggered.\nfunction needMoreData(state) {\n return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);\n}\n\nReadable.prototype.isPaused = function () {\n return this._readableState.flowing === false;\n};\n\n// backwards compatibility.\nReadable.prototype.setEncoding = function (enc) {\n if (!StringDecoder) StringDecoder = __webpack_require__(/*! string_decoder/ */ \"./node_modules/string_decoder/lib/string_decoder.js\").StringDecoder;\n this._readableState.decoder = new StringDecoder(enc);\n this._readableState.encoding = enc;\n return this;\n};\n\n// Don't raise the hwm > 8MB\nvar MAX_HWM = 0x800000;\nfunction computeNewHighWaterMark(n) {\n if (n >= MAX_HWM) {\n n = MAX_HWM;\n } else {\n // Get the next highest power of 2 to prevent increasing hwm excessively in\n // tiny amounts\n n--;\n n |= n >>> 1;\n n |= n >>> 2;\n n |= n >>> 4;\n n |= n >>> 8;\n n |= n >>> 16;\n n++;\n }\n return n;\n}\n\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\nfunction howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n }\n // If we're asking for more than the current hwm, then raise the hwm.\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n;\n // Don't have enough\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n return state.length;\n}\n\n// you can override either this method, or the async _read(n) below.\nReadable.prototype.read = function (n) {\n debug('read', n);\n n = parseInt(n, 10);\n var state = this._readableState;\n var nOrig = n;\n\n if (n !== 0) state.emittedReadable = false;\n\n // if we're doing read(0) to trigger a readable event, but we\n // already have a bunch of data in the buffer, then just trigger\n // the 'readable' event and move on.\n if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {\n debug('read: emitReadable', state.length, state.ended);\n if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);\n return null;\n }\n\n n = howMuchToRead(n, state);\n\n // if we've ended, and we're now clear, then finish it up.\n if (n === 0 && state.ended) {\n if (state.length === 0) endReadable(this);\n return null;\n }\n\n // All the actual chunk generation logic needs to be\n // *below* the call to _read. The reason is that in certain\n // synthetic stream cases, such as passthrough streams, _read\n // may be a completely synchronous operation which may change\n // the state of the read buffer, providing enough data when\n // before there was *not* enough.\n //\n // So, the steps are:\n // 1. Figure out what the state of things will be after we do\n // a read from the buffer.\n //\n // 2. If that resulting state will trigger a _read, then call _read.\n // Note that this may be asynchronous, or synchronous. Yes, it is\n // deeply ugly to write APIs this way, but that still doesn't mean\n // that the Readable class should behave improperly, as streams are\n // designed to be sync/async agnostic.\n // Take note if the _read call is sync or async (ie, if the read call\n // has returned yet), so that we know whether or not it's safe to emit\n // 'readable' etc.\n //\n // 3. Actually pull the requested chunks out of the buffer and return.\n\n // if we need a readable event, then we need to do some reading.\n var doRead = state.needReadable;\n debug('need readable', doRead);\n\n // if we currently have less than the highWaterMark, then also read some\n if (state.length === 0 || state.length - n < state.highWaterMark) {\n doRead = true;\n debug('length less than watermark', doRead);\n }\n\n // however, if we've ended, then there's no point, and if we're already\n // reading, then it's unnecessary.\n if (state.ended || state.reading) {\n doRead = false;\n debug('reading or ended', doRead);\n } else if (doRead) {\n debug('do read');\n state.reading = true;\n state.sync = true;\n // if the length is currently zero, then we *need* a readable event.\n if (state.length === 0) state.needReadable = true;\n // call internal read method\n this._read(state.highWaterMark);\n state.sync = false;\n // If _read pushed data synchronously, then `reading` will be false,\n // and we need to re-evaluate how much data we can return to the user.\n if (!state.reading) n = howMuchToRead(nOrig, state);\n }\n\n var ret;\n if (n > 0) ret = fromList(n, state);else ret = null;\n\n if (ret === null) {\n state.needReadable = true;\n n = 0;\n } else {\n state.length -= n;\n }\n\n if (state.length === 0) {\n // If we have nothing in the buffer, then we want to know\n // as soon as we *do* get something into the buffer.\n if (!state.ended) state.needReadable = true;\n\n // If we tried to read() past the EOF, then emit end on the next tick.\n if (nOrig !== n && state.ended) endReadable(this);\n }\n\n if (ret !== null) this.emit('data', ret);\n\n return ret;\n};\n\nfunction onEofChunk(stream, state) {\n if (state.ended) return;\n if (state.decoder) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) {\n state.buffer.push(chunk);\n state.length += state.objectMode ? 1 : chunk.length;\n }\n }\n state.ended = true;\n\n // emit 'readable' now to make sure it gets picked up.\n emitReadable(stream);\n}\n\n// Don't emit readable right away in sync mode, because this can trigger\n// another read() call => stack overflow. This way, it might trigger\n// a nextTick recursion warning, but that's not so bad.\nfunction emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream);\n }\n}\n\nfunction emitReadable_(stream) {\n debug('emit readable');\n stream.emit('readable');\n flow(stream);\n}\n\n// at this point, the user has presumably seen the 'readable' event,\n// and called read() to consume some data. that may have triggered\n// in turn another _read(n) call, in which case reading = true if\n// it's in progress.\n// However, if we're not ended, or reading, and the length < hwm,\n// then go ahead and try to read some more preemptively.\nfunction maybeReadMore(stream, state) {\n if (!state.readingMore) {\n state.readingMore = true;\n pna.nextTick(maybeReadMore_, stream, state);\n }\n}\n\nfunction maybeReadMore_(stream, state) {\n var len = state.length;\n while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {\n debug('maybeReadMore read 0');\n stream.read(0);\n if (len === state.length)\n // didn't get any data, stop spinning.\n break;else len = state.length;\n }\n state.readingMore = false;\n}\n\n// abstract method. to be overridden in specific implementation classes.\n// call cb(er, data) where data is <= n in length.\n// for virtual (non-string, non-buffer) streams, \"length\" is somewhat\n// arbitrary, and perhaps not very meaningful.\nReadable.prototype._read = function (n) {\n this.emit('error', new Error('_read() is not implemented'));\n};\n\nReadable.prototype.pipe = function (dest, pipeOpts) {\n var src = this;\n var state = this._readableState;\n\n switch (state.pipesCount) {\n case 0:\n state.pipes = dest;\n break;\n case 1:\n state.pipes = [state.pipes, dest];\n break;\n default:\n state.pipes.push(dest);\n break;\n }\n state.pipesCount += 1;\n debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);\n\n var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;\n\n var endFn = doEnd ? onend : unpipe;\n if (state.endEmitted) pna.nextTick(endFn);else src.once('end', endFn);\n\n dest.on('unpipe', onunpipe);\n function onunpipe(readable, unpipeInfo) {\n debug('onunpipe');\n if (readable === src) {\n if (unpipeInfo && unpipeInfo.hasUnpiped === false) {\n unpipeInfo.hasUnpiped = true;\n cleanup();\n }\n }\n }\n\n function onend() {\n debug('onend');\n dest.end();\n }\n\n // when the dest drains, it reduces the awaitDrain counter\n // on the source. This would be more elegant with a .once()\n // handler in flow(), but adding and removing repeatedly is\n // too slow.\n var ondrain = pipeOnDrain(src);\n dest.on('drain', ondrain);\n\n var cleanedUp = false;\n function cleanup() {\n debug('cleanup');\n // cleanup event handlers once the pipe is broken\n dest.removeListener('close', onclose);\n dest.removeListener('finish', onfinish);\n dest.removeListener('drain', ondrain);\n dest.removeListener('error', onerror);\n dest.removeListener('unpipe', onunpipe);\n src.removeListener('end', onend);\n src.removeListener('end', unpipe);\n src.removeListener('data', ondata);\n\n cleanedUp = true;\n\n // if the reader is waiting for a drain event from this\n // specific writer, then it would cause it to never start\n // flowing again.\n // So, if this is awaiting a drain, then we just call it now.\n // If we don't know, then assume that we are waiting for one.\n if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();\n }\n\n // If the user pushes more data while we're writing to dest then we'll end up\n // in ondata again. However, we only want to increase awaitDrain once because\n // dest will only emit one 'drain' event for the multiple writes.\n // => Introduce a guard on increasing awaitDrain.\n var increasedAwaitDrain = false;\n src.on('data', ondata);\n function ondata(chunk) {\n debug('ondata');\n increasedAwaitDrain = false;\n var ret = dest.write(chunk);\n if (false === ret && !increasedAwaitDrain) {\n // If the user unpiped during `dest.write()`, it is possible\n // to get stuck in a permanently paused state if that write\n // also returned false.\n // => Check whether `dest` is still a piping destination.\n if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {\n debug('false write response, pause', src._readableState.awaitDrain);\n src._readableState.awaitDrain++;\n increasedAwaitDrain = true;\n }\n src.pause();\n }\n }\n\n // if the dest has an error, then stop piping into it.\n // however, don't suppress the throwing behavior for this.\n function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);\n }\n\n // Make sure our error handler is attached before userland ones.\n prependListener(dest, 'error', onerror);\n\n // Both close and finish should trigger unpipe, but only once.\n function onclose() {\n dest.removeListener('finish', onfinish);\n unpipe();\n }\n dest.once('close', onclose);\n function onfinish() {\n debug('onfinish');\n dest.removeListener('close', onclose);\n unpipe();\n }\n dest.once('finish', onfinish);\n\n function unpipe() {\n debug('unpipe');\n src.unpipe(dest);\n }\n\n // tell the dest that it's being piped to\n dest.emit('pipe', src);\n\n // start the flow if it hasn't been started already.\n if (!state.flowing) {\n debug('pipe resume');\n src.resume();\n }\n\n return dest;\n};\n\nfunction pipeOnDrain(src) {\n return function () {\n var state = src._readableState;\n debug('pipeOnDrain', state.awaitDrain);\n if (state.awaitDrain) state.awaitDrain--;\n if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {\n state.flowing = true;\n flow(src);\n }\n };\n}\n\nReadable.prototype.unpipe = function (dest) {\n var state = this._readableState;\n var unpipeInfo = { hasUnpiped: false };\n\n // if we're not piping anywhere, then do nothing.\n if (state.pipesCount === 0) return this;\n\n // just one destination. most common case.\n if (state.pipesCount === 1) {\n // passed in one, but it's not the right one.\n if (dest && dest !== state.pipes) return this;\n\n if (!dest) dest = state.pipes;\n\n // got a match.\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n if (dest) dest.emit('unpipe', this, unpipeInfo);\n return this;\n }\n\n // slow case. multiple pipe destinations.\n\n if (!dest) {\n // remove all.\n var dests = state.pipes;\n var len = state.pipesCount;\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n\n for (var i = 0; i < len; i++) {\n dests[i].emit('unpipe', this, unpipeInfo);\n }return this;\n }\n\n // try to find the right one.\n var index = indexOf(state.pipes, dest);\n if (index === -1) return this;\n\n state.pipes.splice(index, 1);\n state.pipesCount -= 1;\n if (state.pipesCount === 1) state.pipes = state.pipes[0];\n\n dest.emit('unpipe', this, unpipeInfo);\n\n return this;\n};\n\n// set up data events if they are asked for\n// Ensure readable listeners eventually get something\nReadable.prototype.on = function (ev, fn) {\n var res = Stream.prototype.on.call(this, ev, fn);\n\n if (ev === 'data') {\n // Start flowing on next tick if stream isn't explicitly paused\n if (this._readableState.flowing !== false) this.resume();\n } else if (ev === 'readable') {\n var state = this._readableState;\n if (!state.endEmitted && !state.readableListening) {\n state.readableListening = state.needReadable = true;\n state.emittedReadable = false;\n if (!state.reading) {\n pna.nextTick(nReadingNextTick, this);\n } else if (state.length) {\n emitReadable(this);\n }\n }\n }\n\n return res;\n};\nReadable.prototype.addListener = Readable.prototype.on;\n\nfunction nReadingNextTick(self) {\n debug('readable nexttick read 0');\n self.read(0);\n}\n\n// pause() and resume() are remnants of the legacy readable stream API\n// If the user uses them, then switch into old mode.\nReadable.prototype.resume = function () {\n var state = this._readableState;\n if (!state.flowing) {\n debug('resume');\n state.flowing = true;\n resume(this, state);\n }\n return this;\n};\n\nfunction resume(stream, state) {\n if (!state.resumeScheduled) {\n state.resumeScheduled = true;\n pna.nextTick(resume_, stream, state);\n }\n}\n\nfunction resume_(stream, state) {\n if (!state.reading) {\n debug('resume read 0');\n stream.read(0);\n }\n\n state.resumeScheduled = false;\n state.awaitDrain = 0;\n stream.emit('resume');\n flow(stream);\n if (state.flowing && !state.reading) stream.read(0);\n}\n\nReadable.prototype.pause = function () {\n debug('call pause flowing=%j', this._readableState.flowing);\n if (false !== this._readableState.flowing) {\n debug('pause');\n this._readableState.flowing = false;\n this.emit('pause');\n }\n return this;\n};\n\nfunction flow(stream) {\n var state = stream._readableState;\n debug('flow', state.flowing);\n while (state.flowing && stream.read() !== null) {}\n}\n\n// wrap an old-style stream as the async data source.\n// This is *not* part of the readable stream interface.\n// It is an ugly unfortunate mess of history.\nReadable.prototype.wrap = function (stream) {\n var _this = this;\n\n var state = this._readableState;\n var paused = false;\n\n stream.on('end', function () {\n debug('wrapped end');\n if (state.decoder && !state.ended) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) _this.push(chunk);\n }\n\n _this.push(null);\n });\n\n stream.on('data', function (chunk) {\n debug('wrapped data');\n if (state.decoder) chunk = state.decoder.write(chunk);\n\n // don't skip over falsy values in objectMode\n if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;\n\n var ret = _this.push(chunk);\n if (!ret) {\n paused = true;\n stream.pause();\n }\n });\n\n // proxy all the other methods.\n // important when wrapping filters and duplexes.\n for (var i in stream) {\n if (this[i] === undefined && typeof stream[i] === 'function') {\n this[i] = function (method) {\n return function () {\n return stream[method].apply(stream, arguments);\n };\n }(i);\n }\n }\n\n // proxy certain important events.\n for (var n = 0; n < kProxyEvents.length; n++) {\n stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));\n }\n\n // when we try to consume some more bytes, simply unpause the\n // underlying stream.\n this._read = function (n) {\n debug('wrapped _read', n);\n if (paused) {\n paused = false;\n stream.resume();\n }\n };\n\n return this;\n};\n\nObject.defineProperty(Readable.prototype, 'readableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function () {\n return this._readableState.highWaterMark;\n }\n});\n\n// exposed for testing purposes only.\nReadable._fromList = fromList;\n\n// Pluck off n bytes from an array of buffers.\n// Length is the combined lengths of all the buffers in the list.\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\nfunction fromList(n, state) {\n // nothing buffered\n if (state.length === 0) return null;\n\n var ret;\n if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {\n // read it all, truncate the list\n 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);\n state.buffer.clear();\n } else {\n // read part of list\n ret = fromListPartial(n, state.buffer, state.decoder);\n }\n\n return ret;\n}\n\n// Extracts only enough buffered data to satisfy the amount requested.\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\nfunction fromListPartial(n, list, hasStrings) {\n var ret;\n if (n < list.head.data.length) {\n // slice is the same for buffers and strings\n ret = list.head.data.slice(0, n);\n list.head.data = list.head.data.slice(n);\n } else if (n === list.head.data.length) {\n // first chunk is a perfect match\n ret = list.shift();\n } else {\n // result spans more than one buffer\n ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);\n }\n return ret;\n}\n\n// Copies a specified amount of characters from the list of buffered data\n// chunks.\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\nfunction copyFromBufferString(n, list) {\n var p = list.head;\n var c = 1;\n var ret = p.data;\n n -= ret.length;\n while (p = p.next) {\n var str = p.data;\n var nb = n > str.length ? str.length : n;\n if (nb === str.length) ret += str;else ret += str.slice(0, n);\n n -= nb;\n if (n === 0) {\n if (nb === str.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = str.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}\n\n// Copies a specified amount of bytes from the list of buffered data chunks.\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\nfunction copyFromBuffer(n, list) {\n var ret = Buffer.allocUnsafe(n);\n var p = list.head;\n var c = 1;\n p.data.copy(ret);\n n -= p.data.length;\n while (p = p.next) {\n var buf = p.data;\n var nb = n > buf.length ? buf.length : n;\n buf.copy(ret, ret.length - n, 0, nb);\n n -= nb;\n if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}\n\nfunction endReadable(stream) {\n var state = stream._readableState;\n\n // If we get here before consuming all the bytes, then that is a\n // bug in node. Should never happen.\n if (state.length > 0) throw new Error('\"endReadable()\" called on non-empty stream');\n\n if (!state.endEmitted) {\n state.ended = true;\n pna.nextTick(endReadableNT, state, stream);\n }\n}\n\nfunction endReadableNT(state, stream) {\n // Check that we didn't get one last unshift.\n if (!state.endEmitted && state.length === 0) {\n state.endEmitted = true;\n stream.readable = false;\n stream.emit('end');\n }\n}\n\nfunction indexOf(xs, x) {\n for (var i = 0, l = xs.length; i < l; i++) {\n if (xs[i] === x) return i;\n }\n return -1;\n}\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/global.js */ \"./node_modules/webpack/buildin/global.js\"), __webpack_require__(/*! ./../../process/browser.js */ \"./node_modules/process/browser.js\")))\n\n//# sourceURL=webpack:///./node_modules/readable-stream/lib/_stream_readable.js?");
/***/ }),
/***/ "./node_modules/readable-stream/lib/_stream_transform.js":
/*!***************************************************************!*\
!*** ./node_modules/readable-stream/lib/_stream_transform.js ***!
\***************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a transform stream is a readable/writable stream where you do\n// something with the data. Sometimes it's called a \"filter\",\n// but that's not a great name for it, since that implies a thing where\n// some bits pass through, and others are simply ignored. (That would\n// be a valid example of a transform, of course.)\n//\n// While the output is causally related to the input, it's not a\n// necessarily symmetric or synchronous transformation. For example,\n// a zlib stream might take multiple plain-text writes(), and then\n// emit a single compressed chunk some time in the future.\n//\n// Here's how this works:\n//\n// The Transform stream has all the aspects of the readable and writable\n// stream classes. When you write(chunk), that calls _write(chunk,cb)\n// internally, and returns false if there's a lot of pending writes\n// buffered up. When you call read(), that calls _read(n) until\n// there's enough pending readable data buffered up.\n//\n// In a transform stream, the written data is placed in a buffer. When\n// _read(n) is called, it transforms the queued up data, calling the\n// buffered _write cb's as it consumes chunks. If consuming a single\n// written chunk would result in multiple output chunks, then the first\n// outputted bit calls the readcb, and subsequent chunks just go into\n// the read buffer, and will cause it to emit 'readable' if necessary.\n//\n// This way, back-pressure is actually determined by the reading side,\n// since _read has to be called to start processing a new chunk. However,\n// a pathological inflate type of transform can cause excessive buffering\n// here. For example, imagine a stream where every byte of input is\n// interpreted as an integer from 0-255, and then results in that many\n// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in\n// 1kb of data being output. In this case, you could write a very small\n// amount of input, and end up with a very large amount of output. In\n// such a pathological inflating mechanism, there'd be no way to tell\n// the system to stop doing the transform. A single 4MB write could\n// cause the system to run out of memory.\n//\n// However, even in such a pathological case, only a single written chunk\n// would be consumed, and then the rest would wait (un-transformed) until\n// the results of the previous transformed chunk were consumed.\n\n\n\nmodule.exports = Transform;\n\nvar Duplex = __webpack_require__(/*! ./_stream_duplex */ \"./node_modules/readable-stream/lib/_stream_duplex.js\");\n\n/*<replacement>*/\nvar util = __webpack_require__(/*! core-util-is */ \"./node_modules/core-util-is/lib/util.js\");\nutil.inherits = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\");\n/*</replacement>*/\n\nutil.inherits(Transform, Duplex);\n\nfunction afterTransform(er, data) {\n var ts = this._transformState;\n ts.transforming = false;\n\n var cb = ts.writecb;\n\n if (!cb) {\n return this.emit('error', new Error('write callback called multiple times'));\n }\n\n ts.writechunk = null;\n ts.writecb = null;\n\n if (data != null) // single equals check for both `null` and `undefined`\n this.push(data);\n\n cb(er);\n\n var rs = this._readableState;\n rs.reading = false;\n if (rs.needReadable || rs.length < rs.highWaterMark) {\n this._read(rs.highWaterMark);\n }\n}\n\nfunction Transform(options) {\n if (!(this instanceof Transform)) return new Transform(options);\n\n Duplex.call(this, options);\n\n this._transformState = {\n afterTransform: afterTransform.bind(this),\n needTransform: false,\n transforming: false,\n writecb: null,\n writechunk: null,\n writeencoding: null\n };\n\n // start out asking for a readable event once data is transformed.\n this._readableState.needReadable = true;\n\n // we have implemented the _read method, and done the other things\n // that Readable wants before the first _read call, so unset the\n // sync guard flag.\n this._readableState.sync = false;\n\n if (options) {\n if (typeof options.transform === 'function') this._transform = options.transform;\n\n if (typeof options.flush === 'function') this._flush = options.flush;\n }\n\n // When the writable side finishes, then flush out anything remaining.\n this.on('prefinish', prefinish);\n}\n\nfunction prefinish() {\n var _this = this;\n\n if (typeof this._flush === 'function') {\n this._flush(function (er, data) {\n done(_this, er, data);\n });\n } else {\n done(this, null, null);\n }\n}\n\nTransform.prototype.push = function (chunk, encoding) {\n this._transformState.needTransform = false;\n return Duplex.prototype.push.call(this, chunk, encoding);\n};\n\n// This is the part where you do stuff!\n// override this function in implementation classes.\n// 'chunk' is an input chunk.\n//\n// Call `push(newChunk)` to pass along transformed output\n// to the readable side. You may call 'push' zero or more times.\n//\n// Call `cb(err)` when you are done with this chunk. If you pass\n// an error, then that'll put the hurt on the whole operation. If you\n// never call cb(), then you'll never get another chunk.\nTransform.prototype._transform = function (chunk, encoding, cb) {\n throw new Error('_transform() is not implemented');\n};\n\nTransform.prototype._write = function (chunk, encoding, cb) {\n var ts = this._transformState;\n ts.writecb = cb;\n ts.writechunk = chunk;\n ts.writeencoding = encoding;\n if (!ts.transforming) {\n var rs = this._readableState;\n if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);\n }\n};\n\n// Doesn't matter what the args are here.\n// _transform does all the work.\n// That we got here means that the readable side wants more data.\nTransform.prototype._read = function (n) {\n var ts = this._transformState;\n\n if (ts.writechunk !== null && ts.writecb && !ts.transforming) {\n ts.transforming = true;\n this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);\n } else {\n // mark that we need a transform, so that any data that comes in\n // will get processed, now that we've asked for it.\n ts.needTransform = true;\n }\n};\n\nTransform.prototype._destroy = function (err, cb) {\n var _this2 = this;\n\n Duplex.prototype._destroy.call(this, err, function (err2) {\n cb(err2);\n _this2.emit('close');\n });\n};\n\nfunction done(stream, er, data) {\n if (er) return stream.emit('error', er);\n\n if (data != null) // single equals check for both `null` and `undefined`\n stream.push(data);\n\n // if there's nothing in the write buffer, then that means\n // that nothing more will ever be provided\n if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0');\n\n if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming');\n\n return stream.push(null);\n}\n\n//# sourceURL=webpack:///./node_modules/readable-stream/lib/_stream_transform.js?");
/***/ }),
/***/ "./node_modules/readable-stream/lib/_stream_writable.js":
/*!**************************************************************!*\
!*** ./node_modules/readable-stream/lib/_stream_writable.js ***!
\**************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("/* WEBPACK VAR INJECTION */(function(process, setImmediate, global) {// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// A bit simpler than readable streams.\n// Implement an async ._write(chunk, encoding, cb), and it'll handle all\n// the drain event emission and buffering.\n\n\n\n/*<replacement>*/\n\nvar pna = __webpack_require__(/*! process-nextick-args */ \"./node_modules/process-nextick-args/index.js\");\n/*</replacement>*/\n\nmodule.exports = Writable;\n\n/* <replacement> */\nfunction WriteReq(chunk, encoding, cb) {\n this.chunk = chunk;\n this.encoding = encoding;\n this.callback = cb;\n this.next = null;\n}\n\n// It seems a linked list but it is not\n// there will be only 2 of these for each stream\nfunction CorkedRequest(state) {\n var _this = this;\n\n this.next = null;\n this.entry = null;\n this.finish = function () {\n onCorkedFinish(_this, state);\n };\n}\n/* </replacement> */\n\n/*<replacement>*/\nvar asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick;\n/*</replacement>*/\n\n/*<replacement>*/\nvar Duplex;\n/*</replacement>*/\n\nWritable.WritableState = WritableState;\n\n/*<replacement>*/\nvar util = __webpack_require__(/*! core-util-is */ \"./node_modules/core-util-is/lib/util.js\");\nutil.inherits = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\");\n/*</replacement>*/\n\n/*<replacement>*/\nvar internalUtil = {\n deprecate: __webpack_require__(/*! util-deprecate */ \"./node_modules/util-deprecate/browser.js\")\n};\n/*</replacement>*/\n\n/*<replacement>*/\nvar Stream = __webpack_require__(/*! ./internal/streams/stream */ \"./node_modules/readable-stream/lib/internal/streams/stream-browser.js\");\n/*</replacement>*/\n\n/*<replacement>*/\n\nvar Buffer = __webpack_require__(/*! safe-buffer */ \"./node_modules/safe-buffer/index.js\").Buffer;\nvar OurUint8Array = global.Uint8Array || function () {};\nfunction _uint8ArrayToBuffer(chunk) {\n return Buffer.from(chunk);\n}\nfunction _isUint8Array(obj) {\n return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;\n}\n\n/*</replacement>*/\n\nvar destroyImpl = __webpack_require__(/*! ./internal/streams/destroy */ \"./node_modules/readable-stream/lib/internal/streams/destroy.js\");\n\nutil.inherits(Writable, Stream);\n\nfunction nop() {}\n\nfunction WritableState(options, stream) {\n Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ \"./node_modules/readable-stream/lib/_stream_duplex.js\");\n\n options = options || {};\n\n // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream.\n // These options can be provided separately as readableXXX and writableXXX.\n var isDuplex = stream instanceof Duplex;\n\n // object stream flag to indicate whether or not this stream\n // contains buffers or objects.\n this.objectMode = !!options.objectMode;\n\n if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;\n\n // the point at which write() starts returning false\n // Note: 0 is a valid value, means that we always return false if\n // the entire buffer is not flushed immediately on write()\n var hwm = options.highWaterMark;\n var writableHwm = options.writableHighWaterMark;\n var defaultHwm = this.objectMode ? 16 : 16 * 1024;\n\n if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm;\n\n // cast to ints.\n this.highWaterMark = Math.floor(this.highWaterMark);\n\n // if _final has been called\n this.finalCalled = false;\n\n // drain event flag.\n this.needDrain = false;\n // at the start of calling end()\n this.ending = false;\n // when end() has been called, and returned\n this.ended = false;\n // when 'finish' is emitted\n this.finished = false;\n\n // has it been destroyed\n this.destroyed = false;\n\n // should we decode strings into buffers before passing to _write?\n // this is here so that some node-core streams can optimize string\n // handling at a lower level.\n var noDecode = options.decodeStrings === false;\n this.decodeStrings = !noDecode;\n\n // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n this.defaultEncoding = options.defaultEncoding || 'utf8';\n\n // not an actual buffer we keep track of, but a measurement\n // of how much we're waiting to get pushed to some underlying\n // socket or file.\n this.length = 0;\n\n // a flag to see when we're in the middle of a write.\n this.writing = false;\n\n // when true all writes will be buffered until .uncork() call\n this.corked = 0;\n\n // a flag to be able to tell if the onwrite cb is called immediately,\n // or on a later tick. We set this to true at first, because any\n // actions that shouldn't happen until \"later\" should generally also\n // not happen before the first write call.\n this.sync = true;\n\n // a flag to know if we're processing previously buffered items, which\n // may call the _write() callback in the same tick, so that we don't\n // end up in an overlapped onwrite situation.\n this.bufferProcessing = false;\n\n // the callback that's passed to _write(chunk,cb)\n this.onwrite = function (er) {\n onwrite(stream, er);\n };\n\n // the callback that the user supplies to write(chunk,encoding,cb)\n this.writecb = null;\n\n // the amount that is being written when _write is called.\n this.writelen = 0;\n\n this.bufferedRequest = null;\n this.lastBufferedRequest = null;\n\n // number of pending user-supplied write callbacks\n // this must be 0 before 'finish' can be emitted\n this.pendingcb = 0;\n\n // emit prefinish if the only thing we're waiting for is _write cbs\n // This is relevant for synchronous Transform streams\n this.prefinished = false;\n\n // True if the error was already emitted and should not be thrown again\n this.errorEmitted = false;\n\n // count buffered requests\n this.bufferedRequestCount = 0;\n\n // allocate the first CorkedRequest, there is always\n // one allocated and free to use, and we maintain at most two\n this.corkedRequestsFree = new CorkedRequest(this);\n}\n\nWritableState.prototype.getBuffer = function getBuffer() {\n var current = this.bufferedRequest;\n var out = [];\n while (current) {\n out.push(current);\n current = current.next;\n }\n return out;\n};\n\n(function () {\n try {\n Object.defineProperty(WritableState.prototype, 'buffer', {\n get: internalUtil.deprecate(function () {\n return this.getBuffer();\n }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')\n });\n } catch (_) {}\n})();\n\n// Test _writableState for inheritance to account for Duplex streams,\n// whose prototype chain only points to Readable.\nvar realHasInstance;\nif (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {\n realHasInstance = Function.prototype[Symbol.hasInstance];\n Object.defineProperty(Writable, Symbol.hasInstance, {\n value: function (object) {\n if (realHasInstance.call(this, object)) return true;\n if (this !== Writable) return false;\n\n return object && object._writableState instanceof WritableState;\n }\n });\n} else {\n realHasInstance = function (object) {\n return object instanceof this;\n };\n}\n\nfunction Writable(options) {\n Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ \"./node_modules/readable-stream/lib/_stream_duplex.js\");\n\n // Writable ctor is applied to Duplexes, too.\n // `realHasInstance` is necessary because using plain `instanceof`\n // would return false, as no `_writableState` property is attached.\n\n // Trying to use the custom `instanceof` for Writable here will also break the\n // Node.js LazyTransform implementation, which has a non-trivial getter for\n // `_writableState` that would lead to infinite recursion.\n if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {\n return new Writable(options);\n }\n\n this._writableState = new WritableState(options, this);\n\n // legacy.\n this.writable = true;\n\n if (options) {\n if (typeof options.write === 'function') this._write = options.write;\n\n if (typeof options.writev === 'function') this._writev = options.writev;\n\n if (typeof options.destroy === 'function') this._destroy = options.destroy;\n\n if (typeof options.final === 'function') this._final = options.final;\n }\n\n Stream.call(this);\n}\n\n// Otherwise people can pipe Writable streams, which is just wrong.\nWritable.prototype.pipe = function () {\n this.emit('error', new Error('Cannot pipe, not readable'));\n};\n\nfunction writeAfterEnd(stream, cb) {\n var er = new Error('write after end');\n // TODO: defer error events consistently everywhere, not just the cb\n stream.emit('error', er);\n pna.nextTick(cb, er);\n}\n\n// Checks that a user-supplied chunk is valid, especially for the particular\n// mode the stream is in. Currently this means that `null` is never accepted\n// and undefined/non-string values are only allowed in object mode.\nfunction validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n pna.nextTick(cb, er);\n valid = false;\n }\n return valid;\n}\n\nWritable.prototype.write = function (chunk, encoding, cb) {\n var state = this._writableState;\n var ret = false;\n var isBuf = !state.objectMode && _isUint8Array(chunk);\n\n if (isBuf && !Buffer.isBuffer(chunk)) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n\n if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n\n if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;\n\n if (typeof cb !== 'function') cb = nop;\n\n if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {\n state.pendingcb++;\n ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);\n }\n\n return ret;\n};\n\nWritable.prototype.cork = function () {\n var state = this._writableState;\n\n state.corked++;\n};\n\nWritable.prototype.uncork = function () {\n var state = this._writableState;\n\n if (state.corked) {\n state.corked--;\n\n if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);\n }\n};\n\nWritable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {\n // node::ParseEncoding() requires lower case.\n if (typeof encoding === 'string') encoding = encoding.toLowerCase();\n 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);\n this._writableState.defaultEncoding = encoding;\n return this;\n};\n\nfunction decodeChunk(state, chunk, encoding) {\n if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {\n chunk = Buffer.from(chunk, encoding);\n }\n return chunk;\n}\n\nObject.defineProperty(Writable.prototype, 'writableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function () {\n return this._writableState.highWaterMark;\n }\n});\n\n// if we're already writing something, then just put this\n// in the queue, and wait our turn. Otherwise, call _write\n// If we return false, then we need a drain event, so set that flag.\nfunction writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {\n if (!isBuf) {\n var newChunk = decodeChunk(state, chunk, encoding);\n if (chunk !== newChunk) {\n isBuf = true;\n encoding = 'buffer';\n chunk = newChunk;\n }\n }\n var len = state.objectMode ? 1 : chunk.length;\n\n state.length += len;\n\n var ret = state.length < state.highWaterMark;\n // we must ensure that previous needDrain will not be reset to false.\n if (!ret) state.needDrain = true;\n\n if (state.writing || state.corked) {\n var last = state.lastBufferedRequest;\n state.lastBufferedRequest = {\n chunk: chunk,\n encoding: encoding,\n isBuf: isBuf,\n callback: cb,\n next: null\n };\n if (last) {\n last.next = state.lastBufferedRequest;\n } else {\n state.bufferedRequest = state.lastBufferedRequest;\n }\n state.bufferedRequestCount += 1;\n } else {\n doWrite(stream, state, false, len, chunk, encoding, cb);\n }\n\n return ret;\n}\n\nfunction doWrite(stream, state, writev, len, chunk, encoding, cb) {\n state.writelen = len;\n state.writecb = cb;\n state.writing = true;\n state.sync = true;\n if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);\n state.sync = false;\n}\n\nfunction onwriteError(stream, state, sync, er, cb) {\n --state.pendingcb;\n\n if (sync) {\n // defer the callback if we are being called synchronously\n // to avoid piling up things on the stack\n pna.nextTick(cb, er);\n // this can emit finish, and it will always happen\n // after error\n pna.nextTick(finishMaybe, stream, state);\n stream._writableState.errorEmitted = true;\n stream.emit('error', er);\n } else {\n // the caller expect this to happen before if\n // it is async\n cb(er);\n stream._writableState.errorEmitted = true;\n stream.emit('error', er);\n // this can emit finish, but finish must\n // always follow error\n finishMaybe(stream, state);\n }\n}\n\nfunction onwriteStateUpdate(state) {\n state.writing = false;\n state.writecb = null;\n state.length -= state.writelen;\n state.writelen = 0;\n}\n\nfunction onwrite(stream, er) {\n var state = stream._writableState;\n var sync = state.sync;\n var cb = state.writecb;\n\n onwriteStateUpdate(state);\n\n if (er) onwriteError(stream, state, sync, er, cb);else {\n // Check if we're actually ready to finish, but don't emit yet\n var finished = needFinish(state);\n\n if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {\n clearBuffer(stream, state);\n }\n\n if (sync) {\n /*<replacement>*/\n asyncWrite(afterWrite, stream, state, finished, cb);\n /*</replacement>*/\n } else {\n afterWrite(stream, state, finished, cb);\n }\n }\n}\n\nfunction afterWrite(stream, state, finished, cb) {\n if (!finished) onwriteDrain(stream, state);\n state.pendingcb--;\n cb();\n finishMaybe(stream, state);\n}\n\n// Must force callback to be called on nextTick, so that we don't\n// emit 'drain' before the write() consumer gets the 'false' return\n// value, and has a chance to attach a 'drain' listener.\nfunction onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n}\n\n// if there's something in the buffer waiting, then process it\nfunction clearBuffer(stream, state) {\n state.bufferProcessing = true;\n var entry = state.bufferedRequest;\n\n if (stream._writev && entry && entry.next) {\n // Fast case, write everything using _writev()\n var l = state.bufferedRequestCount;\n var buffer = new Array(l);\n var holder = state.corkedRequestsFree;\n holder.entry = entry;\n\n var count = 0;\n var allBuffers = true;\n while (entry) {\n buffer[count] = entry;\n if (!entry.isBuf) allBuffers = false;\n entry = entry.next;\n count += 1;\n }\n buffer.allBuffers = allBuffers;\n\n doWrite(stream, state, true, state.length, buffer, '', holder.finish);\n\n // doWrite is almost always async, defer these to save a bit of time\n // as the hot path ends with doWrite\n state.pendingcb++;\n state.lastBufferedRequest = null;\n if (holder.next) {\n state.corkedRequestsFree = holder.next;\n holder.next = null;\n } else {\n state.corkedRequestsFree = new CorkedRequest(state);\n }\n state.bufferedRequestCount = 0;\n } else {\n // Slow case, write chunks one-by-one\n while (entry) {\n var chunk = entry.chunk;\n var encoding = entry.encoding;\n var cb = entry.callback;\n var len = state.objectMode ? 1 : chunk.length;\n\n doWrite(stream, state, false, len, chunk, encoding, cb);\n entry = entry.next;\n state.bufferedRequestCount--;\n // if we didn't call the onwrite immediately, then\n // it means that we need to wait until it does.\n // also, that means that the chunk and cb are currently\n // being processed, so move the buffer counter past them.\n if (state.writing) {\n break;\n }\n }\n\n if (entry === null) state.lastBufferedRequest = null;\n }\n\n state.bufferedRequest = entry;\n state.bufferProcessing = false;\n}\n\nWritable.prototype._write = function (chunk, encoding, cb) {\n cb(new Error('_write() is not implemented'));\n};\n\nWritable.prototype._writev = null;\n\nWritable.prototype.end = function (chunk, encoding, cb) {\n var state = this._writableState;\n\n if (typeof chunk === 'function') {\n cb = chunk;\n chunk = null;\n encoding = null;\n } else if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n\n if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);\n\n // .end() fully uncorks\n if (state.corked) {\n state.corked = 1;\n this.uncork();\n }\n\n // ignore unnecessary end() calls.\n if (!state.ending && !state.finished) endWritable(this, state, cb);\n};\n\nfunction needFinish(state) {\n return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;\n}\nfunction callFinal(stream, state) {\n stream._final(function (err) {\n state.pendingcb--;\n if (err) {\n stream.emit('error', err);\n }\n state.prefinished = true;\n stream.emit('prefinish');\n finishMaybe(stream, state);\n });\n}\nfunction prefinish(stream, state) {\n if (!state.prefinished && !state.finalCalled) {\n if (typeof stream._final === 'function') {\n state.pendingcb++;\n state.finalCalled = true;\n pna.nextTick(callFinal, stream, state);\n } else {\n state.prefinished = true;\n stream.emit('prefinish');\n }\n }\n}\n\nfunction finishMaybe(stream, state) {\n var need = needFinish(state);\n if (need) {\n prefinish(stream, state);\n if (state.pendingcb === 0) {\n state.finished = true;\n stream.emit('finish');\n }\n }\n return need;\n}\n\nfunction endWritable(stream, state, cb) {\n state.ending = true;\n finishMaybe(stream, state);\n if (cb) {\n if (state.finished) pna.nextTick(cb);else stream.once('finish', cb);\n }\n state.ended = true;\n stream.writable = false;\n}\n\nfunction onCorkedFinish(corkReq, state, err) {\n var entry = corkReq.entry;\n corkReq.entry = null;\n while (entry) {\n var cb = entry.callback;\n state.pendingcb--;\n cb(err);\n entry = entry.next;\n }\n if (state.corkedRequestsFree) {\n state.corkedRequestsFree.next = corkReq;\n } else {\n state.corkedRequestsFree = corkReq;\n }\n}\n\nObject.defineProperty(Writable.prototype, 'destroyed', {\n get: function () {\n if (this._writableState === undefined) {\n return false;\n }\n return this._writableState.destroyed;\n },\n set: function (value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (!this._writableState) {\n return;\n }\n\n // backward compatibility, the user is explicitly\n // managing destroyed\n this._writableState.destroyed = value;\n }\n});\n\nWritable.prototype.destroy = destroyImpl.destroy;\nWritable.prototype._undestroy = destroyImpl.undestroy;\nWritable.prototype._destroy = function (err, cb) {\n this.end();\n cb(err);\n};\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../process/browser.js */ \"./node_modules/process/browser.js\"), __webpack_require__(/*! ./../../timers-browserify/main.js */ \"./node_modules/timers-browserify/main.js\").setImmediate, __webpack_require__(/*! ./../../webpack/buildin/global.js */ \"./node_modules/webpack/buildin/global.js\")))\n\n//# sourceURL=webpack:///./node_modules/readable-stream/lib/_stream_writable.js?");
/***/ }),
/***/ "./node_modules/readable-stream/lib/internal/streams/BufferList.js":
/*!*************************************************************************!*\
!*** ./node_modules/readable-stream/lib/internal/streams/BufferList.js ***!
\*************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar Buffer = __webpack_require__(/*! safe-buffer */ \"./node_modules/safe-buffer/index.js\").Buffer;\nvar util = __webpack_require__(/*! util */ 1);\n\nfunction copyBuffer(src, target, offset) {\n src.copy(target, offset);\n}\n\nmodule.exports = function () {\n function BufferList() {\n _classCallCheck(this, BufferList);\n\n this.head = null;\n this.tail = null;\n this.length = 0;\n }\n\n BufferList.prototype.push = function push(v) {\n var entry = { data: v, next: null };\n if (this.length > 0) this.tail.next = entry;else this.head = entry;\n this.tail = entry;\n ++this.length;\n };\n\n BufferList.prototype.unshift = function unshift(v) {\n var entry = { data: v, next: this.head };\n if (this.length === 0) this.tail = entry;\n this.head = entry;\n ++this.length;\n };\n\n BufferList.prototype.shift = function shift() {\n if (this.length === 0) return;\n var ret = this.head.data;\n if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;\n --this.length;\n return ret;\n };\n\n BufferList.prototype.clear = function clear() {\n this.head = this.tail = null;\n this.length = 0;\n };\n\n BufferList.prototype.join = function join(s) {\n if (this.length === 0) return '';\n var p = this.head;\n var ret = '' + p.data;\n while (p = p.next) {\n ret += s + p.data;\n }return ret;\n };\n\n BufferList.prototype.concat = function concat(n) {\n if (this.length === 0) return Buffer.alloc(0);\n if (this.length === 1) return this.head.data;\n var ret = Buffer.allocUnsafe(n >>> 0);\n var p = this.head;\n var i = 0;\n while (p) {\n copyBuffer(p.data, ret, i);\n i += p.data.length;\n p = p.next;\n }\n return ret;\n };\n\n return BufferList;\n}();\n\nif (util && util.inspect && util.inspect.custom) {\n module.exports.prototype[util.inspect.custom] = function () {\n var obj = util.inspect({ length: this.length });\n return this.constructor.name + ' ' + obj;\n };\n}\n\n//# sourceURL=webpack:///./node_modules/readable-stream/lib/internal/streams/BufferList.js?");
/***/ }),
/***/ "./node_modules/readable-stream/lib/internal/streams/destroy.js":
/*!**********************************************************************!*\
!*** ./node_modules/readable-stream/lib/internal/streams/destroy.js ***!
\**********************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("\n\n/*<replacement>*/\n\nvar pna = __webpack_require__(/*! process-nextick-args */ \"./node_modules/process-nextick-args/index.js\");\n/*</replacement>*/\n\n// undocumented cb() API, needed for core, not for public API\nfunction destroy(err, cb) {\n var _this = this;\n\n var readableDestroyed = this._readableState && this._readableState.destroyed;\n var writableDestroyed = this._writableState && this._writableState.destroyed;\n\n if (readableDestroyed || writableDestroyed) {\n if (cb) {\n cb(err);\n } else if (err && (!this._writableState || !this._writableState.errorEmitted)) {\n pna.nextTick(emitErrorNT, this, err);\n }\n return this;\n }\n\n // we set destroyed to true before firing error callbacks in order\n // to make it re-entrance safe in case destroy() is called within callbacks\n\n if (this._readableState) {\n this._readableState.destroyed = true;\n }\n\n // if this is a duplex stream mark the writable part as destroyed as well\n if (this._writableState) {\n this._writableState.destroyed = true;\n }\n\n this._destroy(err || null, function (err) {\n if (!cb && err) {\n pna.nextTick(emitErrorNT, _this, err);\n if (_this._writableState) {\n _this._writableState.errorEmitted = true;\n }\n } else if (cb) {\n cb(err);\n }\n });\n\n return this;\n}\n\nfunction undestroy() {\n if (this._readableState) {\n this._readableState.destroyed = false;\n this._readableState.reading = false;\n this._readableState.ended = false;\n this._readableState.endEmitted = false;\n }\n\n if (this._writableState) {\n this._writableState.destroyed = false;\n this._writableState.ended = false;\n this._writableState.ending = false;\n this._writableState.finished = false;\n this._writableState.errorEmitted = false;\n }\n}\n\nfunction emitErrorNT(self, err) {\n self.emit('error', err);\n}\n\nmodule.exports = {\n destroy: destroy,\n undestroy: undestroy\n};\n\n//# sourceURL=webpack:///./node_modules/readable-stream/lib/internal/streams/destroy.js?");
/***/ }),
/***/ "./node_modules/readable-stream/lib/internal/streams/stream-browser.js":
/*!*****************************************************************************!*\
!*** ./node_modules/readable-stream/lib/internal/streams/stream-browser.js ***!
\*****************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("module.exports = __webpack_require__(/*! events */ \"./node_modules/events/events.js\").EventEmitter;\n\n\n//# sourceURL=webpack:///./node_modules/readable-stream/lib/internal/streams/stream-browser.js?");
/***/ }),
/***/ "./node_modules/readable-stream/passthrough.js":
/*!*****************************************************!*\
!*** ./node_modules/readable-stream/passthrough.js ***!
\*****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("module.exports = __webpack_require__(/*! ./readable */ \"./node_modules/readable-stream/readable-browser.js\").PassThrough\n\n\n//# sourceURL=webpack:///./node_modules/readable-stream/passthrough.js?");
/***/ }),
/***/ "./node_modules/readable-stream/readable-browser.js":
/*!**********************************************************!*\
!*** ./node_modules/readable-stream/readable-browser.js ***!
\**********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("exports = module.exports = __webpack_require__(/*! ./lib/_stream_readable.js */ \"./node_modules/readable-stream/lib/_stream_readable.js\");\nexports.Stream = exports;\nexports.Readable = exports;\nexports.Writable = __webpack_require__(/*! ./lib/_stream_writable.js */ \"./node_modules/readable-stream/lib/_stream_writable.js\");\nexports.Duplex = __webpack_require__(/*! ./lib/_stream_duplex.js */ \"./node_modules/readable-stream/lib/_stream_duplex.js\");\nexports.Transform = __webpack_require__(/*! ./lib/_stream_transform.js */ \"./node_modules/readable-stream/lib/_stream_transform.js\");\nexports.PassThrough = __webpack_require__(/*! ./lib/_stream_passthrough.js */ \"./node_modules/readable-stream/lib/_stream_passthrough.js\");\n\n\n//# sourceURL=webpack:///./node_modules/readable-stream/readable-browser.js?");
/***/ }),
/***/ "./node_modules/readable-stream/transform.js":
/*!***************************************************!*\
!*** ./node_modules/readable-stream/transform.js ***!
\***************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("module.exports = __webpack_require__(/*! ./readable */ \"./node_modules/readable-stream/readable-browser.js\").Transform\n\n\n//# sourceURL=webpack:///./node_modules/readable-stream/transform.js?");
/***/ }),
/***/ "./node_modules/readable-stream/writable-browser.js":
/*!**********************************************************!*\
!*** ./node_modules/readable-stream/writable-browser.js ***!
\**********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("module.exports = __webpack_require__(/*! ./lib/_stream_writable.js */ \"./node_modules/readable-stream/lib/_stream_writable.js\");\n\n\n//# sourceURL=webpack:///./node_modules/readable-stream/writable-browser.js?");
/***/ }),
/***/ "./node_modules/safe-buffer/index.js":
/*!*******************************************!*\
!*** ./node_modules/safe-buffer/index.js ***!
\*******************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("/* eslint-disable node/no-deprecated-api */\nvar buffer = __webpack_require__(/*! buffer */ \"./node_modules/buffer/index.js\")\nvar Buffer = buffer.Buffer\n\n// alternative to using Object.keys for old browsers\nfunction copyProps (src, dst) {\n for (var key in src) {\n dst[key] = src[key]\n }\n}\nif (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {\n module.exports = buffer\n} else {\n // Copy properties from require('buffer')\n copyProps(buffer, exports)\n exports.Buffer = SafeBuffer\n}\n\nfunction SafeBuffer (arg, encodingOrOffset, length) {\n return Buffer(arg, encodingOrOffset, length)\n}\n\n// Copy static methods from Buffer\ncopyProps(Buffer, SafeBuffer)\n\nSafeBuffer.from = function (arg, encodingOrOffset, length) {\n if (typeof arg === 'number') {\n throw new TypeError('Argument must not be a number')\n }\n return Buffer(arg, encodingOrOffset, length)\n}\n\nSafeBuffer.alloc = function (size, fill, encoding) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n var buf = Buffer(size)\n if (fill !== undefined) {\n if (typeof encoding === 'string') {\n buf.fill(fill, encoding)\n } else {\n buf.fill(fill)\n }\n } else {\n buf.fill(0)\n }\n return buf\n}\n\nSafeBuffer.allocUnsafe = function (size) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n return Buffer(size)\n}\n\nSafeBuffer.allocUnsafeSlow = function (size) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n return buffer.SlowBuffer(size)\n}\n\n\n//# sourceURL=webpack:///./node_modules/safe-buffer/index.js?");
/***/ }),
/***/ "./node_modules/sax/lib/sax.js":
/*!*************************************!*\
!*** ./node_modules/sax/lib/sax.js ***!
\*************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("/* WEBPACK VAR INJECTION */(function(Buffer) {;(function (sax) { // wrapper for non-node envs\n sax.parser = function (strict, opt) { return new SAXParser(strict, opt) }\n sax.SAXParser = SAXParser\n sax.SAXStream = SAXStream\n sax.createStream = createStream\n\n // When we pass the MAX_BUFFER_LENGTH position, start checking for buffer overruns.\n // When we check, schedule the next check for MAX_BUFFER_LENGTH - (max(buffer lengths)),\n // since that's the earliest that a buffer overrun could occur. This way, checks are\n // as rare as required, but as often as necessary to ensure never crossing this bound.\n // Furthermore, buffers are only tested at most once per write(), so passing a very\n // large string into write() might have undesirable effects, but this is manageable by\n // the caller, so it is assumed to be safe. Thus, a call to write() may, in the extreme\n // edge case, result in creating at most one complete copy of the string passed in.\n // Set to Infinity to have unlimited buffers.\n sax.MAX_BUFFER_LENGTH = 64 * 1024\n\n var buffers = [\n 'comment', 'sgmlDecl', 'textNode', 'tagName', 'doctype',\n 'procInstName', 'procInstBody', 'entity', 'attribName',\n 'attribValue', 'cdata', 'script'\n ]\n\n sax.EVENTS = [\n 'text',\n 'processinginstruction',\n 'sgmldeclaration',\n 'doctype',\n 'comment',\n 'opentagstart',\n 'attribute',\n 'opentag',\n 'closetag',\n 'opencdata',\n 'cdata',\n 'closecdata',\n 'error',\n 'end',\n 'ready',\n 'script',\n 'opennamespace',\n 'closenamespace'\n ]\n\n function SAXParser (strict, opt) {\n if (!(this instanceof SAXParser)) {\n return new SAXParser(strict, opt)\n }\n\n var parser = this\n clearBuffers(parser)\n parser.q = parser.c = ''\n parser.bufferCheckPosition = sax.MAX_BUFFER_LENGTH\n parser.opt = opt || {}\n parser.opt.lowercase = parser.opt.lowercase || parser.opt.lowercasetags\n parser.looseCase = parser.opt.lowercase ? 'toLowerCase' : 'toUpperCase'\n parser.tags = []\n parser.closed = parser.closedRoot = parser.sawRoot = false\n parser.tag = parser.error = null\n parser.strict = !!strict\n parser.noscript = !!(strict || parser.opt.noscript)\n parser.state = S.BEGIN\n parser.strictEntities = parser.opt.strictEntities\n parser.ENTITIES = parser.strictEntities ? Object.create(sax.XML_ENTITIES) : Object.create(sax.ENTITIES)\n parser.attribList = []\n\n // namespaces form a prototype chain.\n // it always points at the current tag,\n // which protos to its parent tag.\n if (parser.opt.xmlns) {\n parser.ns = Object.create(rootNS)\n }\n\n // mostly just for error reporting\n parser.trackPosition = parser.opt.position !== false\n if (parser.trackPosition) {\n parser.position = parser.line = parser.column = 0\n }\n emit(parser, 'onready')\n }\n\n if (!Object.create) {\n Object.create = function (o) {\n function F () {}\n F.prototype = o\n var newf = new F()\n return newf\n }\n }\n\n if (!Object.keys) {\n Object.keys = function (o) {\n var a = []\n for (var i in o) if (o.hasOwnProperty(i)) a.push(i)\n return a\n }\n }\n\n function checkBufferLength (parser) {\n var maxAllowed = Math.max(sax.MAX_BUFFER_LENGTH, 10)\n var maxActual = 0\n for (var i = 0, l = buffers.length; i < l; i++) {\n var len = parser[buffers[i]].length\n if (len > maxAllowed) {\n // Text/cdata nodes can get big, and since they're buffered,\n // we can get here under normal conditions.\n // Avoid issues by emitting the text node now,\n // so at least it won't get any bigger.\n switch (buffers[i]) {\n case 'textNode':\n closeText(parser)\n break\n\n case 'cdata':\n emitNode(parser, 'oncdata', parser.cdata)\n parser.cdata = ''\n break\n\n case 'script':\n emitNode(parser, 'onscript', parser.script)\n parser.script = ''\n break\n\n default:\n error(parser, 'Max buffer length exceeded: ' + buffers[i])\n }\n }\n maxActual = Math.max(maxActual, len)\n }\n // schedule the next check for the earliest possible buffer overrun.\n var m = sax.MAX_BUFFER_LENGTH - maxActual\n parser.bufferCheckPosition = m + parser.position\n }\n\n function clearBuffers (parser) {\n for (var i = 0, l = buffers.length; i < l; i++) {\n parser[buffers[i]] = ''\n }\n }\n\n function flushBuffers (parser) {\n closeText(parser)\n if (parser.cdata !== '') {\n emitNode(parser, 'oncdata', parser.cdata)\n parser.cdata = ''\n }\n if (parser.script !== '') {\n emitNode(parser, 'onscript', parser.script)\n parser.script = ''\n }\n }\n\n SAXParser.prototype = {\n end: function () { end(this) },\n write: write,\n resume: function () { this.error = null; return this },\n close: function () { return this.write(null) },\n flush: function () { flushBuffers(this) }\n }\n\n var Stream\n try {\n Stream = __webpack_require__(/*! stream */ \"./node_modules/stream-browserify/index.js\").Stream\n } catch (ex) {\n Stream = function () {}\n }\n\n var streamWraps = sax.EVENTS.filter(function (ev) {\n return ev !== 'error' && ev !== 'end'\n })\n\n function createStream (strict, opt) {\n return new SAXStream(strict, opt)\n }\n\n function SAXStream (strict, opt) {\n if (!(this instanceof SAXStream)) {\n return new SAXStream(strict, opt)\n }\n\n Stream.apply(this)\n\n this._parser = new SAXParser(strict, opt)\n this.writable = true\n this.readable = true\n\n var me = this\n\n this._parser.onend = function () {\n me.emit('end')\n }\n\n this._parser.onerror = function (er) {\n me.emit('error', er)\n\n // if didn't throw, then means error was handled.\n // go ahead and clear error, so we can write again.\n me._parser.error = null\n }\n\n this._decoder = null\n\n streamWraps.forEach(function (ev) {\n Object.defineProperty(me, 'on' + ev, {\n get: function () {\n return me._parser['on' + ev]\n },\n set: function (h) {\n if (!h) {\n me.removeAllListeners(ev)\n me._parser['on' + ev] = h\n return h\n }\n me.on(ev, h)\n },\n enumerable: true,\n configurable: false\n })\n })\n }\n\n SAXStream.prototype = Object.create(Stream.prototype, {\n constructor: {\n value: SAXStream\n }\n })\n\n SAXStream.prototype.write = function (data) {\n if (typeof Buffer === 'function' &&\n typeof Buffer.isBuffer === 'function' &&\n Buffer.isBuffer(data)) {\n if (!this._decoder) {\n var SD = __webpack_require__(/*! string_decoder */ \"./node_modules/string_decoder/lib/string_decoder.js\").StringDecoder\n this._decoder = new SD('utf8')\n }\n data = this._decoder.write(data)\n }\n\n this._parser.write(data.toString())\n this.emit('data', data)\n return true\n }\n\n SAXStream.prototype.end = function (chunk) {\n if (chunk && chunk.length) {\n this.write(chunk)\n }\n this._parser.end()\n return true\n }\n\n SAXStream.prototype.on = function (ev, handler) {\n var me = this\n if (!me._parser['on' + ev] && streamWraps.indexOf(ev) !== -1) {\n me._parser['on' + ev] = function () {\n var args = arguments.length === 1 ? [arguments[0]] : Array.apply(null, arguments)\n args.splice(0, 0, ev)\n me.emit.apply(me, args)\n }\n }\n\n return Stream.prototype.on.call(me, ev, handler)\n }\n\n // this really needs to be replaced with character classes.\n // XML allows all manner of ridiculous numbers and digits.\n var CDATA = '[CDATA['\n var DOCTYPE = 'DOCTYPE'\n var XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace'\n var XMLNS_NAMESPACE = 'http://www.w3.org/2000/xmlns/'\n var rootNS = { xml: XML_NAMESPACE, xmlns: XMLNS_NAMESPACE }\n\n // http://www.w3.org/TR/REC-xml/#NT-NameStartChar\n // This implementation works on strings, a single character at a time\n // as such, it cannot ever support astral-plane characters (10000-EFFFF)\n // without a significant breaking change to either this parser, or the\n // JavaScript language. Implementation of an emoji-capable xml parser\n // is left as an exercise for the reader.\n var nameStart = /[:_A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]/\n\n var nameBody = /[:_A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\u00B7\\u0300-\\u036F\\u203F-\\u2040.\\d-]/\n\n var entityStart = /[#:_A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]/\n var entityBody = /[#:_A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\u00B7\\u0300-\\u036F\\u203F-\\u2040.\\d-]/\n\n function isWhitespace (c) {\n return c === ' ' || c === '\\n' || c === '\\r' || c === '\\t'\n }\n\n function isQuote (c) {\n return c === '\"' || c === '\\''\n }\n\n function isAttribEnd (c) {\n return c === '>' || isWhitespace(c)\n }\n\n function isMatch (regex, c) {\n return regex.test(c)\n }\n\n function notMatch (regex, c) {\n return !isMatch(regex, c)\n }\n\n var S = 0\n sax.STATE = {\n BEGIN: S++, // leading byte order mark or whitespace\n BEGIN_WHITESPACE: S++, // leading whitespace\n TEXT: S++, // general stuff\n TEXT_ENTITY: S++, // &amp and such.\n OPEN_WAKA: S++, // <\n SGML_DECL: S++, // <!BLARG\n SGML_DECL_QUOTED: S++, // <!BLARG foo \"bar\n DOCTYPE: S++, // <!DOCTYPE\n DOCTYPE_QUOTED: S++, // <!DOCTYPE \"//blah\n DOCTYPE_DTD: S++, // <!DOCTYPE \"//blah\" [ ...\n DOCTYPE_DTD_QUOTED: S++, // <!DOCTYPE \"//blah\" [ \"foo\n COMMENT_STARTING: S++, // <!-\n COMMENT: S++, // <!--\n COMMENT_ENDING: S++, // <!-- blah -\n COMMENT_ENDED: S++, // <!-- blah --\n CDATA: S++, // <![CDATA[ something\n CDATA_ENDING: S++, // ]\n CDATA_ENDING_2: S++, // ]]\n PROC_INST: S++, // <?hi\n PROC_INST_BODY: S++, // <?hi there\n PROC_INST_ENDING: S++, // <?hi \"there\" ?\n OPEN_TAG: S++, // <strong\n OPEN_TAG_SLASH: S++, // <strong /\n ATTRIB: S++, // <a\n ATTRIB_NAME: S++, // <a foo\n ATTRIB_NAME_SAW_WHITE: S++, // <a foo _\n ATTRIB_VALUE: S++, // <a foo=\n ATTRIB_VALUE_QUOTED: S++, // <a foo=\"bar\n ATTRIB_VALUE_CLOSED: S++, // <a foo=\"bar\"\n ATTRIB_VALUE_UNQUOTED: S++, // <a foo=bar\n ATTRIB_VALUE_ENTITY_Q: S++, // <foo bar=\"&quot;\"\n ATTRIB_VALUE_ENTITY_U: S++, // <foo bar=&quot\n CLOSE_TAG: S++, // </a\n CLOSE_TAG_SAW_WHITE: S++, // </a >\n SCRIPT: S++, // <script> ...\n SCRIPT_ENDING: S++ // <script> ... <\n }\n\n sax.XML_ENTITIES = {\n 'amp': '&',\n 'gt': '>',\n 'lt': '<',\n 'quot': '\"',\n 'apos': \"'\"\n }\n\n sax.ENTITIES = {\n 'amp': '&',\n 'gt': '>',\n 'lt': '<',\n 'quot': '\"',\n 'apos': \"'\",\n 'AElig': 198,\n 'Aacute': 193,\n 'Acirc': 194,\n 'Agrave': 192,\n 'Aring': 197,\n 'Atilde': 195,\n 'Auml': 196,\n 'Ccedil': 199,\n 'ETH': 208,\n 'Eacute': 201,\n 'Ecirc': 202,\n 'Egrave': 200,\n 'Euml': 203,\n 'Iacute': 205,\n 'Icirc': 206,\n 'Igrave': 204,\n 'Iuml': 207,\n 'Ntilde': 209,\n 'Oacute': 211,\n 'Ocirc': 212,\n 'Ograve': 210,\n 'Oslash': 216,\n 'Otilde': 213,\n 'Ouml': 214,\n 'THORN': 222,\n 'Uacute': 218,\n 'Ucirc': 219,\n 'Ugrave': 217,\n 'Uuml': 220,\n 'Yacute': 221,\n 'aacute': 225,\n 'acirc': 226,\n 'aelig': 230,\n 'agrave': 224,\n 'aring': 229,\n 'atilde': 227,\n 'auml': 228,\n 'ccedil': 231,\n 'eacute': 233,\n 'ecirc': 234,\n 'egrave': 232,\n 'eth': 240,\n 'euml': 235,\n 'iacute': 237,\n 'icirc': 238,\n 'igrave': 236,\n 'iuml': 239,\n 'ntilde': 241,\n 'oacute': 243,\n 'ocirc': 244,\n 'ograve': 242,\n 'oslash': 248,\n 'otilde': 245,\n 'ouml': 246,\n 'szlig': 223,\n 'thorn': 254,\n 'uacute': 250,\n 'ucirc': 251,\n 'ugrave': 249,\n 'uuml': 252,\n 'yacute': 253,\n 'yuml': 255,\n 'copy': 169,\n 'reg': 174,\n 'nbsp': 160,\n 'iexcl': 161,\n 'cent': 162,\n 'pound': 163,\n 'curren': 164,\n 'yen': 165,\n 'brvbar': 166,\n 'sect': 167,\n 'uml': 168,\n 'ordf': 170,\n 'laquo': 171,\n 'not': 172,\n 'shy': 173,\n 'macr': 175,\n 'deg': 176,\n 'plusmn': 177,\n 'sup1': 185,\n 'sup2': 178,\n 'sup3': 179,\n 'acute': 180,\n 'micro': 181,\n 'para': 182,\n 'middot': 183,\n 'cedil': 184,\n 'ordm': 186,\n 'raquo': 187,\n 'frac14': 188,\n 'frac12': 189,\n 'frac34': 190,\n 'iquest': 191,\n 'times': 215,\n 'divide': 247,\n 'OElig': 338,\n 'oelig': 339,\n 'Scaron': 352,\n 'scaron': 353,\n 'Yuml': 376,\n 'fnof': 402,\n 'circ': 710,\n 'tilde': 732,\n 'Alpha': 913,\n 'Beta': 914,\n 'Gamma': 915,\n 'Delta': 916,\n 'Epsilon': 917,\n 'Zeta': 918,\n 'Eta': 919,\n 'Theta': 920,\n 'Iota': 921,\n 'Kappa': 922,\n 'Lambda': 923,\n 'Mu': 924,\n 'Nu': 925,\n 'Xi': 926,\n 'Omicron': 927,\n 'Pi': 928,\n 'Rho': 929,\n 'Sigma': 931,\n 'Tau': 932,\n 'Upsilon': 933,\n 'Phi': 934,\n 'Chi': 935,\n 'Psi': 936,\n 'Omega': 937,\n 'alpha': 945,\n 'beta': 946,\n 'gamma': 947,\n 'delta': 948,\n 'epsilon': 949,\n 'zeta': 950,\n 'eta': 951,\n 'theta': 952,\n 'iota': 953,\n 'kappa': 954,\n 'lambda': 955,\n 'mu': 956,\n 'nu': 957,\n 'xi': 958,\n 'omicron': 959,\n 'pi': 960,\n 'rho': 961,\n 'sigmaf': 962,\n 'sigma': 963,\n 'tau': 964,\n 'upsilon': 965,\n 'phi': 966,\n 'chi': 967,\n 'psi': 968,\n 'omega': 969,\n 'thetasym': 977,\n 'upsih': 978,\n 'piv': 982,\n 'ensp': 8194,\n 'emsp': 8195,\n 'thinsp': 8201,\n 'zwnj': 8204,\n 'zwj': 8205,\n 'lrm': 8206,\n 'rlm': 8207,\n 'ndash': 8211,\n 'mdash': 8212,\n 'lsquo': 8216,\n 'rsquo': 8217,\n 'sbquo': 8218,\n 'ldquo': 8220,\n 'rdquo': 8221,\n 'bdquo': 8222,\n 'dagger': 8224,\n 'Dagger': 8225,\n 'bull': 8226,\n 'hellip': 8230,\n 'permil': 8240,\n 'prime': 8242,\n 'Prime': 8243,\n 'lsaquo': 8249,\n 'rsaquo': 8250,\n 'oline': 8254,\n 'frasl': 8260,\n 'euro': 8364,\n 'image': 8465,\n 'weierp': 8472,\n 'real': 8476,\n 'trade': 8482,\n 'alefsym': 8501,\n 'larr': 8592,\n 'uarr': 8593,\n 'rarr': 8594,\n 'darr': 8595,\n 'harr': 8596,\n 'crarr': 8629,\n 'lArr': 8656,\n 'uArr': 8657,\n 'rArr': 8658,\n 'dArr': 8659,\n 'hArr': 8660,\n 'forall': 8704,\n 'part': 8706,\n 'exist': 8707,\n 'empty': 8709,\n 'nabla': 8711,\n 'isin': 8712,\n 'notin': 8713,\n 'ni': 8715,\n 'prod': 8719,\n 'sum': 8721,\n 'minus': 8722,\n 'lowast': 8727,\n 'radic': 8730,\n 'prop': 8733,\n 'infin': 8734,\n 'ang': 8736,\n 'and': 8743,\n 'or': 8744,\n 'cap': 8745,\n 'cup': 8746,\n 'int': 8747,\n 'there4': 8756,\n 'sim': 8764,\n 'cong': 8773,\n 'asymp': 8776,\n 'ne': 8800,\n 'equiv': 8801,\n 'le': 8804,\n 'ge': 8805,\n 'sub': 8834,\n 'sup': 8835,\n 'nsub': 8836,\n 'sube': 8838,\n 'supe': 8839,\n 'oplus': 8853,\n 'otimes': 8855,\n 'perp': 8869,\n 'sdot': 8901,\n 'lceil': 8968,\n 'rceil': 8969,\n 'lfloor': 8970,\n 'rfloor': 8971,\n 'lang': 9001,\n 'rang': 9002,\n 'loz': 9674,\n 'spades': 9824,\n 'clubs': 9827,\n 'hearts': 9829,\n 'diams': 9830\n }\n\n Object.keys(sax.ENTITIES).forEach(function (key) {\n var e = sax.ENTITIES[key]\n var s = typeof e === 'number' ? String.fromCharCode(e) : e\n sax.ENTITIES[key] = s\n })\n\n for (var s in sax.STATE) {\n sax.STATE[sax.STATE[s]] = s\n }\n\n // shorthand\n S = sax.STATE\n\n function emit (parser, event, data) {\n parser[event] && parser[event](data)\n }\n\n function emitNode (parser, nodeType, data) {\n if (parser.textNode) closeText(parser)\n emit(parser, nodeType, data)\n }\n\n function closeText (parser) {\n parser.textNode = textopts(parser.opt, parser.textNode)\n if (parser.textNode) emit(parser, 'ontext', parser.textNode)\n parser.textNode = ''\n }\n\n function textopts (opt, text) {\n if (opt.trim) text = text.trim()\n if (opt.normalize) text = text.replace(/\\s+/g, ' ')\n return text\n }\n\n function error (parser, er) {\n closeText(parser)\n if (parser.trackPosition) {\n er += '\\nLine: ' + parser.line +\n '\\nColumn: ' + parser.column +\n '\\nChar: ' + parser.c\n }\n er = new Error(er)\n parser.error = er\n emit(parser, 'onerror', er)\n return parser\n }\n\n function end (parser) {\n if (parser.sawRoot && !parser.closedRoot) strictFail(parser, 'Unclosed root tag')\n if ((parser.state !== S.BEGIN) &&\n (parser.state !== S.BEGIN_WHITESPACE) &&\n (parser.state !== S.TEXT)) {\n error(parser, 'Unexpected end')\n }\n closeText(parser)\n parser.c = ''\n parser.closed = true\n emit(parser, 'onend')\n SAXParser.call(parser, parser.strict, parser.opt)\n return parser\n }\n\n function strictFail (parser, message) {\n if (typeof parser !== 'object' || !(parser instanceof SAXParser)) {\n throw new Error('bad call to strictFail')\n }\n if (parser.strict) {\n error(parser, message)\n }\n }\n\n function newTag (parser) {\n if (!parser.strict) parser.tagName = parser.tagName[parser.looseCase]()\n var parent = parser.tags[parser.tags.length - 1] || parser\n var tag = parser.tag = { name: parser.tagName, attributes: {} }\n\n // will be overridden if tag contails an xmlns=\"foo\" or xmlns:foo=\"bar\"\n if (parser.opt.xmlns) {\n tag.ns = parent.ns\n }\n parser.attribList.length = 0\n emitNode(parser, 'onopentagstart', tag)\n }\n\n function qname (name, attribute) {\n var i = name.indexOf(':')\n var qualName = i < 0 ? [ '', name ] : name.split(':')\n var prefix = qualName[0]\n var local = qualName[1]\n\n // <x \"xmlns\"=\"http://foo\">\n if (attribute && name === 'xmlns') {\n prefix = 'xmlns'\n local = ''\n }\n\n return { prefix: prefix, local: local }\n }\n\n function attrib (parser) {\n if (!parser.strict) {\n parser.attribName = parser.attribName[parser.looseCase]()\n }\n\n if (parser.attribList.indexOf(parser.attribName) !== -1 ||\n parser.tag.attributes.hasOwnProperty(parser.attribName)) {\n parser.attribName = parser.attribValue = ''\n return\n }\n\n if (parser.opt.xmlns) {\n var qn = qname(parser.attribName, true)\n var prefix = qn.prefix\n var local = qn.local\n\n if (prefix === 'xmlns') {\n // namespace binding attribute. push the binding into scope\n if (local === 'xml' && parser.attribValue !== XML_NAMESPACE) {\n strictFail(parser,\n 'xml: prefix must be bound to ' + XML_NAMESPACE + '\\n' +\n 'Actual: ' + parser.attribValue)\n } else if (local === 'xmlns' && parser.attribValue !== XMLNS_NAMESPACE) {\n strictFail(parser,\n 'xmlns: prefix must be bound to ' + XMLNS_NAMESPACE + '\\n' +\n 'Actual: ' + parser.attribValue)\n } else {\n var tag = parser.tag\n var parent = parser.tags[parser.tags.length - 1] || parser\n if (tag.ns === parent.ns) {\n tag.ns = Object.create(parent.ns)\n }\n tag.ns[local] = parser.attribValue\n }\n }\n\n // defer onattribute events until all attributes have been seen\n // so any new bindings can take effect. preserve attribute order\n // so deferred events can be emitted in document order\n parser.attribList.push([parser.attribName, parser.attribValue])\n } else {\n // in non-xmlns mode, we can emit the event right away\n parser.tag.attributes[parser.attribName] = parser.attribValue\n emitNode(parser, 'onattribute', {\n name: parser.attribName,\n value: parser.attribValue\n })\n }\n\n parser.attribName = parser.attribValue = ''\n }\n\n function openTag (parser, selfClosing) {\n if (parser.opt.xmlns) {\n // emit namespace binding events\n var tag = parser.tag\n\n // add namespace info to tag\n var qn = qname(parser.tagName)\n tag.prefix = qn.prefix\n tag.local = qn.local\n tag.uri = tag.ns[qn.prefix] || ''\n\n if (tag.prefix && !tag.uri) {\n strictFail(parser, 'Unbound namespace prefix: ' +\n JSON.stringify(parser.tagName))\n tag.uri = qn.prefix\n }\n\n var parent = parser.tags[parser.tags.length - 1] || parser\n if (tag.ns && parent.ns !== tag.ns) {\n Object.keys(tag.ns).forEach(function (p) {\n emitNode(parser, 'onopennamespace', {\n prefix: p,\n uri: tag.ns[p]\n })\n })\n }\n\n // handle deferred onattribute events\n // Note: do not apply default ns to attributes:\n // http://www.w3.org/TR/REC-xml-names/#defaulting\n for (var i = 0, l = parser.attribList.length; i < l; i++) {\n var nv = parser.attribList[i]\n var name = nv[0]\n var value = nv[1]\n var qualName = qname(name, true)\n var prefix = qualName.prefix\n var local = qualName.local\n var uri = prefix === '' ? '' : (tag.ns[prefix] || '')\n var a = {\n name: name,\n value: value,\n prefix: prefix,\n local: local,\n uri: uri\n }\n\n // if there's any attributes with an undefined namespace,\n // then fail on them now.\n if (prefix && prefix !== 'xmlns' && !uri) {\n strictFail(parser, 'Unbound namespace prefix: ' +\n JSON.stringify(prefix))\n a.uri = prefix\n }\n parser.tag.attributes[name] = a\n emitNode(parser, 'onattribute', a)\n }\n parser.attribList.length = 0\n }\n\n parser.tag.isSelfClosing = !!selfClosing\n\n // process the tag\n parser.sawRoot = true\n parser.tags.push(parser.tag)\n emitNode(parser, 'onopentag', parser.tag)\n if (!selfClosing) {\n // special case for <script> in non-strict mode.\n if (!parser.noscript && parser.tagName.toLowerCase() === 'script') {\n parser.state = S.SCRIPT\n } else {\n parser.state = S.TEXT\n }\n parser.tag = null\n parser.tagName = ''\n }\n parser.attribName = parser.attribValue = ''\n parser.attribList.length = 0\n }\n\n function closeTag (parser) {\n if (!parser.tagName) {\n strictFail(parser, 'Weird empty close tag.')\n parser.textNode += '</>'\n parser.state = S.TEXT\n return\n }\n\n if (parser.script) {\n if (parser.tagName !== 'script') {\n parser.script += '</' + parser.tagName + '>'\n parser.tagName = ''\n parser.state = S.SCRIPT\n return\n }\n emitNode(parser, 'onscript', parser.script)\n parser.script = ''\n }\n\n // first make sure that the closing tag actually exists.\n // <a><b></c></b></a> will close everything, otherwise.\n var t = parser.tags.length\n var tagName = parser.tagName\n if (!parser.strict) {\n tagName = tagName[parser.looseCase]()\n }\n var closeTo = tagName\n while (t--) {\n var close = parser.tags[t]\n if (close.name !== closeTo) {\n // fail the first time in strict mode\n strictFail(parser, 'Unexpected close tag')\n } else {\n break\n }\n }\n\n // didn't find it. we already failed for strict, so just abort.\n if (t < 0) {\n strictFail(parser, 'Unmatched closing tag: ' + parser.tagName)\n parser.textNode += '</' + parser.tagName + '>'\n parser.state = S.TEXT\n return\n }\n parser.tagName = tagName\n var s = parser.tags.length\n while (s-- > t) {\n var tag = parser.tag = parser.tags.pop()\n parser.tagName = parser.tag.name\n emitNode(parser, 'onclosetag', parser.tagName)\n\n var x = {}\n for (var i in tag.ns) {\n x[i] = tag.ns[i]\n }\n\n var parent = parser.tags[parser.tags.length - 1] || parser\n if (parser.opt.xmlns && tag.ns !== parent.ns) {\n // remove namespace bindings introduced by tag\n Object.keys(tag.ns).forEach(function (p) {\n var n = tag.ns[p]\n emitNode(parser, 'onclosenamespace', { prefix: p, uri: n })\n })\n }\n }\n if (t === 0) parser.closedRoot = true\n parser.tagName = parser.attribValue = parser.attribName = ''\n parser.attribList.length = 0\n parser.state = S.TEXT\n }\n\n function parseEntity (parser) {\n var entity = parser.entity\n var entityLC = entity.toLowerCase()\n var num\n var numStr = ''\n\n if (parser.ENTITIES[entity]) {\n return parser.ENTITIES[entity]\n }\n if (parser.ENTITIES[entityLC]) {\n return parser.ENTITIES[entityLC]\n }\n entity = entityLC\n if (entity.charAt(0) === '#') {\n if (entity.charAt(1) === 'x') {\n entity = entity.slice(2)\n num = parseInt(entity, 16)\n numStr = num.toString(16)\n } else {\n entity = entity.slice(1)\n num = parseInt(entity, 10)\n numStr = num.toString(10)\n }\n }\n entity = entity.replace(/^0+/, '')\n if (isNaN(num) || numStr.toLowerCase() !== entity) {\n strictFail(parser, 'Invalid character entity')\n return '&' + parser.entity + ';'\n }\n\n return String.fromCodePoint(num)\n }\n\n function beginWhiteSpace (parser, c) {\n if (c === '<') {\n parser.state = S.OPEN_WAKA\n parser.startTagPosition = parser.position\n } else if (!isWhitespace(c)) {\n // have to process this as a text node.\n // weird, but happens.\n strictFail(parser, 'Non-whitespace before first tag.')\n parser.textNode = c\n parser.state = S.TEXT\n }\n }\n\n function charAt (chunk, i) {\n var result = ''\n if (i < chunk.length) {\n result = chunk.charAt(i)\n }\n return result\n }\n\n function write (chunk) {\n var parser = this\n if (this.error) {\n throw this.error\n }\n if (parser.closed) {\n return error(parser,\n 'Cannot write after close. Assign an onready handler.')\n }\n if (chunk === null) {\n return end(parser)\n }\n if (typeof chunk === 'object') {\n chunk = chunk.toString()\n }\n var i = 0\n var c = ''\n while (true) {\n c = charAt(chunk, i++)\n parser.c = c\n\n if (!c) {\n break\n }\n\n if (parser.trackPosition) {\n parser.position++\n if (c === '\\n') {\n parser.line++\n parser.column = 0\n } else {\n parser.column++\n }\n }\n\n switch (parser.state) {\n case S.BEGIN:\n parser.state = S.BEGIN_WHITESPACE\n if (c === '\\uFEFF') {\n continue\n }\n beginWhiteSpace(parser, c)\n continue\n\n case S.BEGIN_WHITESPACE:\n beginWhiteSpace(parser, c)\n continue\n\n case S.TEXT:\n if (parser.sawRoot && !parser.closedRoot) {\n var starti = i - 1\n while (c && c !== '<' && c !== '&') {\n c = charAt(chunk, i++)\n if (c && parser.trackPosition) {\n parser.position++\n if (c === '\\n') {\n parser.line++\n parser.column = 0\n } else {\n parser.column++\n }\n }\n }\n parser.textNode += chunk.substring(starti, i - 1)\n }\n if (c === '<' && !(parser.sawRoot && parser.closedRoot && !parser.strict)) {\n parser.state = S.OPEN_WAKA\n parser.startTagPosition = parser.position\n } else {\n if (!isWhitespace(c) && (!parser.sawRoot || parser.closedRoot)) {\n strictFail(parser, 'Text data outside of root node.')\n }\n if (c === '&') {\n parser.state = S.TEXT_ENTITY\n } else {\n parser.textNode += c\n }\n }\n continue\n\n case S.SCRIPT:\n // only non-strict\n if (c === '<') {\n parser.state = S.SCRIPT_ENDING\n } else {\n parser.script += c\n }\n continue\n\n case S.SCRIPT_ENDING:\n if (c === '/') {\n parser.state = S.CLOSE_TAG\n } else {\n parser.script += '<' + c\n parser.state = S.SCRIPT\n }\n continue\n\n case S.OPEN_WAKA:\n // either a /, ?, !, or text is coming next.\n if (c === '!') {\n parser.state = S.SGML_DECL\n parser.sgmlDecl = ''\n } else if (isWhitespace(c)) {\n // wait for it...\n } else if (isMatch(nameStart, c)) {\n parser.state = S.OPEN_TAG\n parser.tagName = c\n } else if (c === '/') {\n parser.state = S.CLOSE_TAG\n parser.tagName = ''\n } else if (c === '?') {\n parser.state = S.PROC_INST\n parser.procInstName = parser.procInstBody = ''\n } else {\n strictFail(parser, 'Unencoded <')\n // if there was some whitespace, then add that in.\n if (parser.startTagPosition + 1 < parser.position) {\n var pad = parser.position - parser.startTagPosition\n c = new Array(pad).join(' ') + c\n }\n parser.textNode += '<' + c\n parser.state = S.TEXT\n }\n continue\n\n case S.SGML_DECL:\n if ((parser.sgmlDecl + c).toUpperCase() === CDATA) {\n emitNode(parser, 'onopencdata')\n parser.state = S.CDATA\n parser.sgmlDecl = ''\n parser.cdata = ''\n } else if (parser.sgmlDecl + c === '--') {\n parser.state = S.COMMENT\n parser.comment = ''\n parser.sgmlDecl = ''\n } else if ((parser.sgmlDecl + c).toUpperCase() === DOCTYPE) {\n parser.state = S.DOCTYPE\n if (parser.doctype || parser.sawRoot) {\n strictFail(parser,\n 'Inappropriately located doctype declaration')\n }\n parser.doctype = ''\n parser.sgmlDecl = ''\n } else if (c === '>') {\n emitNode(parser, 'onsgmldeclaration', parser.sgmlDecl)\n parser.sgmlDecl = ''\n parser.state = S.TEXT\n } else if (isQuote(c)) {\n parser.state = S.SGML_DECL_QUOTED\n parser.sgmlDecl += c\n } else {\n parser.sgmlDecl += c\n }\n continue\n\n case S.SGML_DECL_QUOTED:\n if (c === parser.q) {\n parser.state = S.SGML_DECL\n parser.q = ''\n }\n parser.sgmlDecl += c\n continue\n\n case S.DOCTYPE:\n if (c === '>') {\n parser.state = S.TEXT\n emitNode(parser, 'ondoctype', parser.doctype)\n parser.doctype = true // just remember that we saw it.\n } else {\n parser.doctype += c\n if (c === '[') {\n parser.state = S.DOCTYPE_DTD\n } else if (isQuote(c)) {\n parser.state = S.DOCTYPE_QUOTED\n parser.q = c\n }\n }\n continue\n\n case S.DOCTYPE_QUOTED:\n parser.doctype += c\n if (c === parser.q) {\n parser.q = ''\n parser.state = S.DOCTYPE\n }\n continue\n\n case S.DOCTYPE_DTD:\n parser.doctype += c\n if (c === ']') {\n parser.state = S.DOCTYPE\n } else if (isQuote(c)) {\n parser.state = S.DOCTYPE_DTD_QUOTED\n parser.q = c\n }\n continue\n\n case S.DOCTYPE_DTD_QUOTED:\n parser.doctype += c\n if (c === parser.q) {\n parser.state = S.DOCTYPE_DTD\n parser.q = ''\n }\n continue\n\n case S.COMMENT:\n if (c === '-') {\n parser.state = S.COMMENT_ENDING\n } else {\n parser.comment += c\n }\n continue\n\n case S.COMMENT_ENDING:\n if (c === '-') {\n parser.state = S.COMMENT_ENDED\n parser.comment = textopts(parser.opt, parser.comment)\n if (parser.comment) {\n emitNode(parser, 'oncomment', parser.comment)\n }\n parser.comment = ''\n } else {\n parser.comment += '-' + c\n parser.state = S.COMMENT\n }\n continue\n\n case S.COMMENT_ENDED:\n if (c !== '>') {\n strictFail(parser, 'Malformed comment')\n // allow <!-- blah -- bloo --> in non-strict mode,\n // which is a comment of \" blah -- bloo \"\n parser.comment += '--' + c\n parser.state = S.COMMENT\n } else {\n parser.state = S.TEXT\n }\n continue\n\n case S.CDATA:\n if (c === ']') {\n parser.state = S.CDATA_ENDING\n } else {\n parser.cdata += c\n }\n continue\n\n case S.CDATA_ENDING:\n if (c === ']') {\n parser.state = S.CDATA_ENDING_2\n } else {\n parser.cdata += ']' + c\n parser.state = S.CDATA\n }\n continue\n\n case S.CDATA_ENDING_2:\n if (c === '>') {\n if (parser.cdata) {\n emitNode(parser, 'oncdata', parser.cdata)\n }\n emitNode(parser, 'onclosecdata')\n parser.cdata = ''\n parser.state = S.TEXT\n } else if (c === ']') {\n parser.cdata += ']'\n } else {\n parser.cdata += ']]' + c\n parser.state = S.CDATA\n }\n continue\n\n case S.PROC_INST:\n if (c === '?') {\n parser.state = S.PROC_INST_ENDING\n } else if (isWhitespace(c)) {\n parser.state = S.PROC_INST_BODY\n } else {\n parser.procInstName += c\n }\n continue\n\n case S.PROC_INST_BODY:\n if (!parser.procInstBody && isWhitespace(c)) {\n continue\n } else if (c === '?') {\n parser.state = S.PROC_INST_ENDING\n } else {\n parser.procInstBody += c\n }\n continue\n\n case S.PROC_INST_ENDING:\n if (c === '>') {\n emitNode(parser, 'onprocessinginstruction', {\n name: parser.procInstName,\n body: parser.procInstBody\n })\n parser.procInstName = parser.procInstBody = ''\n parser.state = S.TEXT\n } else {\n parser.procInstBody += '?' + c\n parser.state = S.PROC_INST_BODY\n }\n continue\n\n case S.OPEN_TAG:\n if (isMatch(nameBody, c)) {\n parser.tagName += c\n } else {\n newTag(parser)\n if (c === '>') {\n openTag(parser)\n } else if (c === '/') {\n parser.state = S.OPEN_TAG_SLASH\n } else {\n if (!isWhitespace(c)) {\n strictFail(parser, 'Invalid character in tag name')\n }\n parser.state = S.ATTRIB\n }\n }\n continue\n\n case S.OPEN_TAG_SLASH:\n if (c === '>') {\n openTag(parser, true)\n closeTag(parser)\n } else {\n strictFail(parser, 'Forward-slash in opening tag not followed by >')\n parser.state = S.ATTRIB\n }\n continue\n\n case S.ATTRIB:\n // haven't read the attribute name yet.\n if (isWhitespace(c)) {\n continue\n } else if (c === '>') {\n openTag(parser)\n } else if (c === '/') {\n parser.state = S.OPEN_TAG_SLASH\n } else if (isMatch(nameStart, c)) {\n parser.attribName = c\n parser.attribValue = ''\n parser.state = S.ATTRIB_NAME\n } else {\n strictFail(parser, 'Invalid attribute name')\n }\n continue\n\n case S.ATTRIB_NAME:\n if (c === '=') {\n parser.state = S.ATTRIB_VALUE\n } else if (c === '>') {\n strictFail(parser, 'Attribute without value')\n parser.attribValue = parser.attribName\n attrib(parser)\n openTag(parser)\n } else if (isWhitespace(c)) {\n parser.state = S.ATTRIB_NAME_SAW_WHITE\n } else if (isMatch(nameBody, c)) {\n parser.attribName += c\n } else {\n strictFail(parser, 'Invalid attribute name')\n }\n continue\n\n case S.ATTRIB_NAME_SAW_WHITE:\n if (c === '=') {\n parser.state = S.ATTRIB_VALUE\n } else if (isWhitespace(c)) {\n continue\n } else {\n strictFail(parser, 'Attribute without value')\n parser.tag.attributes[parser.attribName] = ''\n parser.attribValue = ''\n emitNode(parser, 'onattribute', {\n name: parser.attribName,\n value: ''\n })\n parser.attribName = ''\n if (c === '>') {\n openTag(parser)\n } else if (isMatch(nameStart, c)) {\n parser.attribName = c\n parser.state = S.ATTRIB_NAME\n } else {\n strictFail(parser, 'Invalid attribute name')\n parser.state = S.ATTRIB\n }\n }\n continue\n\n case S.ATTRIB_VALUE:\n if (isWhitespace(c)) {\n continue\n } else if (isQuote(c)) {\n parser.q = c\n parser.state = S.ATTRIB_VALUE_QUOTED\n } else {\n strictFail(parser, 'Unquoted attribute value')\n parser.state = S.ATTRIB_VALUE_UNQUOTED\n parser.attribValue = c\n }\n continue\n\n case S.ATTRIB_VALUE_QUOTED:\n if (c !== parser.q) {\n if (c === '&') {\n parser.state = S.ATTRIB_VALUE_ENTITY_Q\n } else {\n parser.attribValue += c\n }\n continue\n }\n attrib(parser)\n parser.q = ''\n parser.state = S.ATTRIB_VALUE_CLOSED\n continue\n\n case S.ATTRIB_VALUE_CLOSED:\n if (isWhitespace(c)) {\n parser.state = S.ATTRIB\n } else if (c === '>') {\n openTag(parser)\n } else if (c === '/') {\n parser.state = S.OPEN_TAG_SLASH\n } else if (isMatch(nameStart, c)) {\n strictFail(parser, 'No whitespace between attributes')\n parser.attribName = c\n parser.attribValue = ''\n parser.state = S.ATTRIB_NAME\n } else {\n strictFail(parser, 'Invalid attribute name')\n }\n continue\n\n case S.ATTRIB_VALUE_UNQUOTED:\n if (!isAttribEnd(c)) {\n if (c === '&') {\n parser.state = S.ATTRIB_VALUE_ENTITY_U\n } else {\n parser.attribValue += c\n }\n continue\n }\n attrib(parser)\n if (c === '>') {\n openTag(parser)\n } else {\n parser.state = S.ATTRIB\n }\n continue\n\n case S.CLOSE_TAG:\n if (!parser.tagName) {\n if (isWhitespace(c)) {\n continue\n } else if (notMatch(nameStart, c)) {\n if (parser.script) {\n parser.script += '</' + c\n parser.state = S.SCRIPT\n } else {\n strictFail(parser, 'Invalid tagname in closing tag.')\n }\n } else {\n parser.tagName = c\n }\n } else if (c === '>') {\n closeTag(parser)\n } else if (isMatch(nameBody, c)) {\n parser.tagName += c\n } else if (parser.script) {\n parser.script += '</' + parser.tagName\n parser.tagName = ''\n parser.state = S.SCRIPT\n } else {\n if (!isWhitespace(c)) {\n strictFail(parser, 'Invalid tagname in closing tag')\n }\n parser.state = S.CLOSE_TAG_SAW_WHITE\n }\n continue\n\n case S.CLOSE_TAG_SAW_WHITE:\n if (isWhitespace(c)) {\n continue\n }\n if (c === '>') {\n closeTag(parser)\n } else {\n strictFail(parser, 'Invalid characters in closing tag')\n }\n continue\n\n case S.TEXT_ENTITY:\n case S.ATTRIB_VALUE_ENTITY_Q:\n case S.ATTRIB_VALUE_ENTITY_U:\n var returnState\n var buffer\n switch (parser.state) {\n case S.TEXT_ENTITY:\n returnState = S.TEXT\n buffer = 'textNode'\n break\n\n case S.ATTRIB_VALUE_ENTITY_Q:\n returnState = S.ATTRIB_VALUE_QUOTED\n buffer = 'attribValue'\n break\n\n case S.ATTRIB_VALUE_ENTITY_U:\n returnState = S.ATTRIB_VALUE_UNQUOTED\n buffer = 'attribValue'\n break\n }\n\n if (c === ';') {\n parser[buffer] += parseEntity(parser)\n parser.entity = ''\n parser.state = returnState\n } else if (isMatch(parser.entity.length ? entityBody : entityStart, c)) {\n parser.entity += c\n } else {\n strictFail(parser, 'Invalid character in entity name')\n parser[buffer] += '&' + parser.entity + c\n parser.entity = ''\n parser.state = returnState\n }\n\n continue\n\n default:\n throw new Error(parser, 'Unknown state: ' + parser.state)\n }\n } // while\n\n if (parser.position >= parser.bufferCheckPosition) {\n checkBufferLength(parser)\n }\n return parser\n }\n\n /*! http://mths.be/fromcodepoint v0.1.0 by @mathias */\n /* istanbul ignore next */\n if (!String.fromCodePoint) {\n (function () {\n var stringFromCharCode = String.fromCharCode\n var floor = Math.floor\n var fromCodePoint = function () {\n var MAX_SIZE = 0x4000\n var codeUnits = []\n var highSurrogate\n var lowSurrogate\n var index = -1\n var length = arguments.length\n if (!length) {\n return ''\n }\n var result = ''\n while (++index < length) {\n var codePoint = Number(arguments[index])\n if (\n !isFinite(codePoint) || // `NaN`, `+Infinity`, or `-Infinity`\n codePoint < 0 || // not a valid Unicode code point\n codePoint > 0x10FFFF || // not a valid Unicode code point\n floor(codePoint) !== codePoint // not an integer\n ) {\n throw RangeError('Invalid code point: ' + codePoint)\n }\n if (codePoint <= 0xFFFF) { // BMP code point\n codeUnits.push(codePoint)\n } else { // Astral code point; split in surrogate halves\n // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae\n codePoint -= 0x10000\n highSurrogate = (codePoint >> 10) + 0xD800\n lowSurrogate = (codePoint % 0x400) + 0xDC00\n codeUnits.push(highSurrogate, lowSurrogate)\n }\n if (index + 1 === length || codeUnits.length > MAX_SIZE) {\n result += stringFromCharCode.apply(null, codeUnits)\n codeUnits.length = 0\n }\n }\n return result\n }\n /* istanbul ignore next */\n if (Object.defineProperty) {\n Object.defineProperty(String, 'fromCodePoint', {\n value: fromCodePoint,\n configurable: true,\n writable: true\n })\n } else {\n String.fromCodePoint = fromCodePoint\n }\n }())\n }\n})( false ? undefined : exports)\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../buffer/index.js */ \"./node_modules/buffer/index.js\").Buffer))\n\n//# sourceURL=webpack:///./node_modules/sax/lib/sax.js?");
/***/ }),
/***/ "./node_modules/setimmediate/setImmediate.js":
/*!***************************************************!*\
!*** ./node_modules/setimmediate/setImmediate.js ***!
\***************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("/* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {\n \"use strict\";\n\n if (global.setImmediate) {\n return;\n }\n\n var nextHandle = 1; // Spec says greater than zero\n var tasksByHandle = {};\n var currentlyRunningATask = false;\n var doc = global.document;\n var registerImmediate;\n\n function setImmediate(callback) {\n // Callback can either be a function or a string\n if (typeof callback !== \"function\") {\n callback = new Function(\"\" + callback);\n }\n // Copy function arguments\n var args = new Array(arguments.length - 1);\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i + 1];\n }\n // Store and register the task\n var task = { callback: callback, args: args };\n tasksByHandle[nextHandle] = task;\n registerImmediate(nextHandle);\n return nextHandle++;\n }\n\n function clearImmediate(handle) {\n delete tasksByHandle[handle];\n }\n\n function run(task) {\n var callback = task.callback;\n var args = task.args;\n switch (args.length) {\n case 0:\n callback();\n break;\n case 1:\n callback(args[0]);\n break;\n case 2:\n callback(args[0], args[1]);\n break;\n case 3:\n callback(args[0], args[1], args[2]);\n break;\n default:\n callback.apply(undefined, args);\n break;\n }\n }\n\n function runIfPresent(handle) {\n // From the spec: \"Wait until any invocations of this algorithm started before this one have completed.\"\n // So if we're currently running a task, we'll need to delay this invocation.\n if (currentlyRunningATask) {\n // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a\n // \"too much recursion\" error.\n setTimeout(runIfPresent, 0, handle);\n } else {\n var task = tasksByHandle[handle];\n if (task) {\n currentlyRunningATask = true;\n try {\n run(task);\n } finally {\n clearImmediate(handle);\n currentlyRunningATask = false;\n }\n }\n }\n }\n\n function installNextTickImplementation() {\n registerImmediate = function(handle) {\n process.nextTick(function () { runIfPresent(handle); });\n };\n }\n\n function canUsePostMessage() {\n // The test against `importScripts` prevents this implementation from being installed inside a web worker,\n // where `global.postMessage` means something completely different and can't be used for this purpose.\n if (global.postMessage && !global.importScripts) {\n var postMessageIsAsynchronous = true;\n var oldOnMessage = global.onmessage;\n global.onmessage = function() {\n postMessageIsAsynchronous = false;\n };\n global.postMessage(\"\", \"*\");\n global.onmessage = oldOnMessage;\n return postMessageIsAsynchronous;\n }\n }\n\n function installPostMessageImplementation() {\n // Installs an event handler on `global` for the `message` event: see\n // * https://developer.mozilla.org/en/DOM/window.postMessage\n // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages\n\n var messagePrefix = \"setImmediate$\" + Math.random() + \"$\";\n var onGlobalMessage = function(event) {\n if (event.source === global &&\n typeof event.data === \"string\" &&\n event.data.indexOf(messagePrefix) === 0) {\n runIfPresent(+event.data.slice(messagePrefix.length));\n }\n };\n\n if (global.addEventListener) {\n global.addEventListener(\"message\", onGlobalMessage, false);\n } else {\n global.attachEvent(\"onmessage\", onGlobalMessage);\n }\n\n registerImmediate = function(handle) {\n global.postMessage(messagePrefix + handle, \"*\");\n };\n }\n\n function installMessageChannelImplementation() {\n var channel = new MessageChannel();\n channel.port1.onmessage = function(event) {\n var handle = event.data;\n runIfPresent(handle);\n };\n\n registerImmediate = function(handle) {\n channel.port2.postMessage(handle);\n };\n }\n\n function installReadyStateChangeImplementation() {\n var html = doc.documentElement;\n registerImmediate = function(handle) {\n // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted\n // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.\n var script = doc.createElement(\"script\");\n script.onreadystatechange = function () {\n runIfPresent(handle);\n script.onreadystatechange = null;\n html.removeChild(script);\n script = null;\n };\n html.appendChild(script);\n };\n }\n\n function installSetTimeoutImplementation() {\n registerImmediate = function(handle) {\n setTimeout(runIfPresent, 0, handle);\n };\n }\n\n // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.\n var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);\n attachTo = attachTo && attachTo.setTimeout ? attachTo : global;\n\n // Don't get fooled by e.g. browserify environments.\n if ({}.toString.call(global.process) === \"[object process]\") {\n // For Node.js before 0.9\n installNextTickImplementation();\n\n } else if (canUsePostMessage()) {\n // For non-IE10 modern browsers\n installPostMessageImplementation();\n\n } else if (global.MessageChannel) {\n // For web workers, where supported\n installMessageChannelImplementation();\n\n } else if (doc && \"onreadystatechange\" in doc.createElement(\"script\")) {\n // For IE 6–8\n installReadyStateChangeImplementation();\n\n } else {\n // For older browsers\n installSetTimeoutImplementation();\n }\n\n attachTo.setImmediate = setImmediate;\n attachTo.clearImmediate = clearImmediate;\n}(typeof self === \"undefined\" ? typeof global === \"undefined\" ? this : global : self));\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ \"./node_modules/webpack/buildin/global.js\"), __webpack_require__(/*! ./../process/browser.js */ \"./node_modules/process/browser.js\")))\n\n//# sourceURL=webpack:///./node_modules/setimmediate/setImmediate.js?");
/***/ }),
/***/ "./node_modules/stream-browserify/index.js":
/*!*************************************************!*\
!*** ./node_modules/stream-browserify/index.js ***!
\*************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nmodule.exports = Stream;\n\nvar EE = __webpack_require__(/*! events */ \"./node_modules/events/events.js\").EventEmitter;\nvar inherits = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\");\n\ninherits(Stream, EE);\nStream.Readable = __webpack_require__(/*! readable-stream/readable.js */ \"./node_modules/readable-stream/readable-browser.js\");\nStream.Writable = __webpack_require__(/*! readable-stream/writable.js */ \"./node_modules/readable-stream/writable-browser.js\");\nStream.Duplex = __webpack_require__(/*! readable-stream/duplex.js */ \"./node_modules/readable-stream/duplex-browser.js\");\nStream.Transform = __webpack_require__(/*! readable-stream/transform.js */ \"./node_modules/readable-stream/transform.js\");\nStream.PassThrough = __webpack_require__(/*! readable-stream/passthrough.js */ \"./node_modules/readable-stream/passthrough.js\");\n\n// Backwards-compat with node 0.4.x\nStream.Stream = Stream;\n\n\n\n// old-style streams. Note that the pipe method (the only relevant\n// part of this class) is overridden in the Readable class.\n\nfunction Stream() {\n EE.call(this);\n}\n\nStream.prototype.pipe = function(dest, options) {\n var source = this;\n\n function ondata(chunk) {\n if (dest.writable) {\n if (false === dest.write(chunk) && source.pause) {\n source.pause();\n }\n }\n }\n\n source.on('data', ondata);\n\n function ondrain() {\n if (source.readable && source.resume) {\n source.resume();\n }\n }\n\n dest.on('drain', ondrain);\n\n // If the 'end' option is not supplied, dest.end() will be called when\n // source gets the 'end' or 'close' events. Only dest.end() once.\n if (!dest._isStdio && (!options || options.end !== false)) {\n source.on('end', onend);\n source.on('close', onclose);\n }\n\n var didOnEnd = false;\n function onend() {\n if (didOnEnd) return;\n didOnEnd = true;\n\n dest.end();\n }\n\n\n function onclose() {\n if (didOnEnd) return;\n didOnEnd = true;\n\n if (typeof dest.destroy === 'function') dest.destroy();\n }\n\n // don't leave dangling pipes when there are errors.\n function onerror(er) {\n cleanup();\n if (EE.listenerCount(this, 'error') === 0) {\n throw er; // Unhandled stream error in pipe.\n }\n }\n\n source.on('error', onerror);\n dest.on('error', onerror);\n\n // remove all the event listeners that were added.\n function cleanup() {\n source.removeListener('data', ondata);\n dest.removeListener('drain', ondrain);\n\n source.removeListener('end', onend);\n source.removeListener('close', onclose);\n\n source.removeListener('error', onerror);\n dest.removeListener('error', onerror);\n\n source.removeListener('end', cleanup);\n source.removeListener('close', cleanup);\n\n dest.removeListener('close', cleanup);\n }\n\n source.on('end', cleanup);\n source.on('close', cleanup);\n\n dest.on('close', cleanup);\n\n dest.emit('pipe', source);\n\n // Allow for unix-like usage: A.pipe(B).pipe(C)\n return dest;\n};\n\n\n//# sourceURL=webpack:///./node_modules/stream-browserify/index.js?");
/***/ }),
/***/ "./node_modules/string_decoder/lib/string_decoder.js":
/*!***********************************************************!*\
!*** ./node_modules/string_decoder/lib/string_decoder.js ***!
\***********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n\n/*<replacement>*/\n\nvar Buffer = __webpack_require__(/*! safe-buffer */ \"./node_modules/safe-buffer/index.js\").Buffer;\n/*</replacement>*/\n\nvar isEncoding = Buffer.isEncoding || function (encoding) {\n encoding = '' + encoding;\n switch (encoding && encoding.toLowerCase()) {\n case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw':\n return true;\n default:\n return false;\n }\n};\n\nfunction _normalizeEncoding(enc) {\n if (!enc) return 'utf8';\n var retried;\n while (true) {\n switch (enc) {\n case 'utf8':\n case 'utf-8':\n return 'utf8';\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return 'utf16le';\n case 'latin1':\n case 'binary':\n return 'latin1';\n case 'base64':\n case 'ascii':\n case 'hex':\n return enc;\n default:\n if (retried) return; // undefined\n enc = ('' + enc).toLowerCase();\n retried = true;\n }\n }\n};\n\n// Do not cache `Buffer.isEncoding` when checking encoding names as some\n// modules monkey-patch it to support additional encodings\nfunction normalizeEncoding(enc) {\n var nenc = _normalizeEncoding(enc);\n if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);\n return nenc || enc;\n}\n\n// StringDecoder provides an interface for efficiently splitting a series of\n// buffers into a series of JS strings without breaking apart multi-byte\n// characters.\nexports.StringDecoder = StringDecoder;\nfunction StringDecoder(encoding) {\n this.encoding = normalizeEncoding(encoding);\n var nb;\n switch (this.encoding) {\n case 'utf16le':\n this.text = utf16Text;\n this.end = utf16End;\n nb = 4;\n break;\n case 'utf8':\n this.fillLast = utf8FillLast;\n nb = 4;\n break;\n case 'base64':\n this.text = base64Text;\n this.end = base64End;\n nb = 3;\n break;\n default:\n this.write = simpleWrite;\n this.end = simpleEnd;\n return;\n }\n this.lastNeed = 0;\n this.lastTotal = 0;\n this.lastChar = Buffer.allocUnsafe(nb);\n}\n\nStringDecoder.prototype.write = function (buf) {\n if (buf.length === 0) return '';\n var r;\n var i;\n if (this.lastNeed) {\n r = this.fillLast(buf);\n if (r === undefined) return '';\n i = this.lastNeed;\n this.lastNeed = 0;\n } else {\n i = 0;\n }\n if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);\n return r || '';\n};\n\nStringDecoder.prototype.end = utf8End;\n\n// Returns only complete characters in a Buffer\nStringDecoder.prototype.text = utf8Text;\n\n// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer\nStringDecoder.prototype.fillLast = function (buf) {\n if (this.lastNeed <= buf.length) {\n buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);\n return this.lastChar.toString(this.encoding, 0, this.lastTotal);\n }\n buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);\n this.lastNeed -= buf.length;\n};\n\n// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a\n// continuation byte. If an invalid byte is detected, -2 is returned.\nfunction utf8CheckByte(byte) {\n 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;\n return byte >> 6 === 0x02 ? -1 : -2;\n}\n\n// Checks at most 3 bytes at the end of a Buffer in order to detect an\n// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)\n// needed to complete the UTF-8 character (if applicable) are returned.\nfunction utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i || nb === -2) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i || nb === -2) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}\n\n// Validates as many continuation bytes for a multi-byte UTF-8 character as\n// needed or are available. If we see a non-continuation byte where we expect\n// one, we \"replace\" the validated continuation bytes we've seen so far with\n// a single UTF-8 replacement character ('\\ufffd'), to match v8's UTF-8 decoding\n// behavior. The continuation byte check is included three times in the case\n// where all of the continuation bytes for a character exist in the same buffer.\n// It is also done this way as a slight performance increase instead of using a\n// loop.\nfunction utf8CheckExtraBytes(self, buf, p) {\n if ((buf[0] & 0xC0) !== 0x80) {\n self.lastNeed = 0;\n return '\\ufffd';\n }\n if (self.lastNeed > 1 && buf.length > 1) {\n if ((buf[1] & 0xC0) !== 0x80) {\n self.lastNeed = 1;\n return '\\ufffd';\n }\n if (self.lastNeed > 2 && buf.length > 2) {\n if ((buf[2] & 0xC0) !== 0x80) {\n self.lastNeed = 2;\n return '\\ufffd';\n }\n }\n }\n}\n\n// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.\nfunction utf8FillLast(buf) {\n var p = this.lastTotal - this.lastNeed;\n var r = utf8CheckExtraBytes(this, buf, p);\n if (r !== undefined) return r;\n if (this.lastNeed <= buf.length) {\n buf.copy(this.lastChar, p, 0, this.lastNeed);\n return this.lastChar.toString(this.encoding, 0, this.lastTotal);\n }\n buf.copy(this.lastChar, p, 0, buf.length);\n this.lastNeed -= buf.length;\n}\n\n// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a\n// partial character, the character's bytes are buffered until the required\n// number of bytes are available.\nfunction utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}\n\n// For UTF-8, a replacement character is added when ending on a partial\n// character.\nfunction utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd';\n return r;\n}\n\n// UTF-16LE typically needs two bytes per character, but even if we have an even\n// number of bytes available, we need to check if we end on a leading/high\n// surrogate. In that case, we need to wait for the next two bytes in order to\n// decode the last character properly.\nfunction utf16Text(buf, i) {\n if ((buf.length - i) % 2 === 0) {\n var r = buf.toString('utf16le', i);\n if (r) {\n var c = r.charCodeAt(r.length - 1);\n if (c >= 0xD800 && c <= 0xDBFF) {\n this.lastNeed = 2;\n this.lastTotal = 4;\n this.lastChar[0] = buf[buf.length - 2];\n this.lastChar[1] = buf[buf.length - 1];\n return r.slice(0, -1);\n }\n }\n return r;\n }\n this.lastNeed = 1;\n this.lastTotal = 2;\n this.lastChar[0] = buf[buf.length - 1];\n return buf.toString('utf16le', i, buf.length - 1);\n}\n\n// For UTF-16LE we do not explicitly append special replacement characters if we\n// end on a partial character, we simply let v8 handle that.\nfunction utf16End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) {\n var end = this.lastTotal - this.lastNeed;\n return r + this.lastChar.toString('utf16le', 0, end);\n }\n return r;\n}\n\nfunction base64Text(buf, i) {\n var n = (buf.length - i) % 3;\n if (n === 0) return buf.toString('base64', i);\n this.lastNeed = 3 - n;\n this.lastTotal = 3;\n if (n === 1) {\n this.lastChar[0] = buf[buf.length - 1];\n } else {\n this.lastChar[0] = buf[buf.length - 2];\n this.lastChar[1] = buf[buf.length - 1];\n }\n return buf.toString('base64', i, buf.length - n);\n}\n\nfunction base64End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);\n return r;\n}\n\n// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)\nfunction simpleWrite(buf) {\n return buf.toString(this.encoding);\n}\n\nfunction simpleEnd(buf) {\n return buf && buf.length ? this.write(buf) : '';\n}\n\n//# sourceURL=webpack:///./node_modules/string_decoder/lib/string_decoder.js?");
/***/ }),
/***/ "./node_modules/timers-browserify/main.js":
/*!************************************************!*\
!*** ./node_modules/timers-browserify/main.js ***!
\************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("/* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== \"undefined\" && global) ||\n (typeof self !== \"undefined\" && self) ||\n window;\nvar apply = Function.prototype.apply;\n\n// DOM APIs, for completeness\n\nexports.setTimeout = function() {\n return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);\n};\nexports.setInterval = function() {\n return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);\n};\nexports.clearTimeout =\nexports.clearInterval = function(timeout) {\n if (timeout) {\n timeout.close();\n }\n};\n\nfunction Timeout(id, clearFn) {\n this._id = id;\n this._clearFn = clearFn;\n}\nTimeout.prototype.unref = Timeout.prototype.ref = function() {};\nTimeout.prototype.close = function() {\n this._clearFn.call(scope, this._id);\n};\n\n// Does not start the time, just sets up the members needed.\nexports.enroll = function(item, msecs) {\n clearTimeout(item._idleTimeoutId);\n item._idleTimeout = msecs;\n};\n\nexports.unenroll = function(item) {\n clearTimeout(item._idleTimeoutId);\n item._idleTimeout = -1;\n};\n\nexports._unrefActive = exports.active = function(item) {\n clearTimeout(item._idleTimeoutId);\n\n var msecs = item._idleTimeout;\n if (msecs >= 0) {\n item._idleTimeoutId = setTimeout(function onTimeout() {\n if (item._onTimeout)\n item._onTimeout();\n }, msecs);\n }\n};\n\n// setimmediate attaches itself to the global object\n__webpack_require__(/*! setimmediate */ \"./node_modules/setimmediate/setImmediate.js\");\n// On some exotic environments, it's not clear which object `setimmediate` was\n// able to install onto. Search each possibility in the same order as the\n// `setimmediate` library.\nexports.setImmediate = (typeof self !== \"undefined\" && self.setImmediate) ||\n (typeof global !== \"undefined\" && global.setImmediate) ||\n (this && this.setImmediate);\nexports.clearImmediate = (typeof self !== \"undefined\" && self.clearImmediate) ||\n (typeof global !== \"undefined\" && global.clearImmediate) ||\n (this && this.clearImmediate);\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ \"./node_modules/webpack/buildin/global.js\")))\n\n//# sourceURL=webpack:///./node_modules/timers-browserify/main.js?");
/***/ }),
/***/ "./node_modules/util-deprecate/browser.js":
/*!************************************************!*\
!*** ./node_modules/util-deprecate/browser.js ***!
\************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("/* WEBPACK VAR INJECTION */(function(global) {\n/**\n * Module exports.\n */\n\nmodule.exports = deprecate;\n\n/**\n * Mark that a method should not be used.\n * Returns a modified function which warns once by default.\n *\n * If `localStorage.noDeprecation = true` is set, then it is a no-op.\n *\n * If `localStorage.throwDeprecation = true` is set, then deprecated functions\n * will throw an Error when invoked.\n *\n * If `localStorage.traceDeprecation = true` is set, then deprecated functions\n * will invoke `console.trace()` instead of `console.error()`.\n *\n * @param {Function} fn - the function to deprecate\n * @param {String} msg - the string to print to the console when `fn` is invoked\n * @returns {Function} a new \"deprecated\" version of `fn`\n * @api public\n */\n\nfunction deprecate (fn, msg) {\n if (config('noDeprecation')) {\n return fn;\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (config('throwDeprecation')) {\n throw new Error(msg);\n } else if (config('traceDeprecation')) {\n console.trace(msg);\n } else {\n console.warn(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n}\n\n/**\n * Checks `localStorage` for boolean values for the given `name`.\n *\n * @param {String} name\n * @returns {Boolean}\n * @api private\n */\n\nfunction config (name) {\n // accessing global.localStorage can trigger a DOMException in sandboxed iframes\n try {\n if (!global.localStorage) return false;\n } catch (_) {\n return false;\n }\n var val = global.localStorage[name];\n if (null == val) return false;\n return String(val).toLowerCase() === 'true';\n}\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ \"./node_modules/webpack/buildin/global.js\")))\n\n//# sourceURL=webpack:///./node_modules/util-deprecate/browser.js?");
/***/ }),
/***/ "./node_modules/webpack/buildin/global.js":
/*!***********************************!*\
!*** (webpack)/buildin/global.js ***!
\***********************************/
/*! no static exports found */
/***/ (function(module, exports) {
eval("var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn this;\n})();\n\ntry {\n\t// This works if eval is allowed (see CSP)\n\tg = g || Function(\"return this\")() || (1, eval)(\"this\");\n} catch (e) {\n\t// This works if the window reference is available\n\tif (typeof window === \"object\") g = window;\n}\n\n// g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it's\n// easier to handle this case. if(!global) { ...}\n\nmodule.exports = g;\n\n\n//# sourceURL=webpack:///(webpack)/buildin/global.js?");
/***/ }),
/***/ "./node_modules/xml2js/lib/bom.js":
/*!****************************************!*\
!*** ./node_modules/xml2js/lib/bom.js ***!
\****************************************/
/*! no static exports found */
/***/ (function(module, exports) {
eval("// Generated by CoffeeScript 1.12.7\n(function() {\n \"use strict\";\n exports.stripBOM = function(str) {\n if (str[0] === '\\uFEFF') {\n return str.substring(1);\n } else {\n return str;\n }\n };\n\n}).call(this);\n\n\n//# sourceURL=webpack:///./node_modules/xml2js/lib/bom.js?");
/***/ }),
/***/ "./node_modules/xml2js/lib/builder.js":
/*!********************************************!*\
!*** ./node_modules/xml2js/lib/builder.js ***!
\********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("// Generated by CoffeeScript 1.12.7\n(function() {\n \"use strict\";\n var builder, defaults, escapeCDATA, requiresCDATA, wrapCDATA,\n hasProp = {}.hasOwnProperty;\n\n builder = __webpack_require__(/*! xmlbuilder */ \"./node_modules/xmlbuilder/lib/index.js\");\n\n defaults = __webpack_require__(/*! ./defaults */ \"./node_modules/xml2js/lib/defaults.js\").defaults;\n\n requiresCDATA = function(entry) {\n return typeof entry === \"string\" && (entry.indexOf('&') >= 0 || entry.indexOf('>') >= 0 || entry.indexOf('<') >= 0);\n };\n\n wrapCDATA = function(entry) {\n return \"<![CDATA[\" + (escapeCDATA(entry)) + \"]]>\";\n };\n\n escapeCDATA = function(entry) {\n return entry.replace(']]>', ']]]]><![CDATA[>');\n };\n\n exports.Builder = (function() {\n function Builder(opts) {\n var key, ref, value;\n this.options = {};\n ref = defaults[\"0.2\"];\n for (key in ref) {\n if (!hasProp.call(ref, key)) continue;\n value = ref[key];\n this.options[key] = value;\n }\n for (key in opts) {\n if (!hasProp.call(opts, key)) continue;\n value = opts[key];\n this.options[key] = value;\n }\n }\n\n Builder.prototype.buildObject = function(rootObj) {\n var attrkey, charkey, render, rootElement, rootName;\n attrkey = this.options.attrkey;\n charkey = this.options.charkey;\n if ((Object.keys(rootObj).length === 1) && (this.options.rootName === defaults['0.2'].rootName)) {\n rootName = Object.keys(rootObj)[0];\n rootObj = rootObj[rootName];\n } else {\n rootName = this.options.rootName;\n }\n render = (function(_this) {\n return function(element, obj) {\n var attr, child, entry, index, key, value;\n if (typeof obj !== 'object') {\n if (_this.options.cdata && requiresCDATA(obj)) {\n element.raw(wrapCDATA(obj));\n } else {\n element.txt(obj);\n }\n } else if (Array.isArray(obj)) {\n for (index in obj) {\n if (!hasProp.call(obj, index)) continue;\n child = obj[index];\n for (key in child) {\n entry = child[key];\n element = render(element.ele(key), entry).up();\n }\n }\n } else {\n for (key in obj) {\n if (!hasProp.call(obj, key)) continue;\n child = obj[key];\n if (key === attrkey) {\n if (typeof child === \"object\") {\n for (attr in child) {\n value = child[attr];\n element = element.att(attr, value);\n }\n }\n } else if (key === charkey) {\n if (_this.options.cdata && requiresCDATA(child)) {\n element = element.raw(wrapCDATA(child));\n } else {\n element = element.txt(child);\n }\n } else if (Array.isArray(child)) {\n for (index in child) {\n if (!hasProp.call(child, index)) continue;\n entry = child[index];\n if (typeof entry === 'string') {\n if (_this.options.cdata && requiresCDATA(entry)) {\n element = element.ele(key).raw(wrapCDATA(entry)).up();\n } else {\n element = element.ele(key, entry).up();\n }\n } else {\n element = render(element.ele(key), entry).up();\n }\n }\n } else if (typeof child === \"object\") {\n element = render(element.ele(key), child).up();\n } else {\n if (typeof child === 'string' && _this.options.cdata && requiresCDATA(child)) {\n element = element.ele(key).raw(wrapCDATA(child)).up();\n } else {\n if (child == null) {\n child = '';\n }\n element = element.ele(key, child.toString()).up();\n }\n }\n }\n }\n return element;\n };\n })(this);\n rootElement = builder.create(rootName, this.options.xmldec, this.options.doctype, {\n headless: this.options.headless,\n allowSurrogateChars: this.options.allowSurrogateChars\n });\n return render(rootElement, rootObj).end(this.options.renderOpts);\n };\n\n return Builder;\n\n })();\n\n}).call(this);\n\n\n//# sourceURL=webpack:///./node_modules/xml2js/lib/builder.js?");
/***/ }),
/***/ "./node_modules/xml2js/lib/defaults.js":
/*!*********************************************!*\
!*** ./node_modules/xml2js/lib/defaults.js ***!
\*********************************************/
/*! no static exports found */
/***/ (function(module, exports) {
eval("// Generated by CoffeeScript 1.12.7\n(function() {\n exports.defaults = {\n \"0.1\": {\n explicitCharkey: false,\n trim: true,\n normalize: true,\n normalizeTags: false,\n attrkey: \"@\",\n charkey: \"#\",\n explicitArray: false,\n ignoreAttrs: false,\n mergeAttrs: false,\n explicitRoot: false,\n validator: null,\n xmlns: false,\n explicitChildren: false,\n childkey: '@@',\n charsAsChildren: false,\n includeWhiteChars: false,\n async: false,\n strict: true,\n attrNameProcessors: null,\n attrValueProcessors: null,\n tagNameProcessors: null,\n valueProcessors: null,\n emptyTag: ''\n },\n \"0.2\": {\n explicitCharkey: false,\n trim: false,\n normalize: false,\n normalizeTags: false,\n attrkey: \"$\",\n charkey: \"_\",\n explicitArray: true,\n ignoreAttrs: false,\n mergeAttrs: false,\n explicitRoot: true,\n validator: null,\n xmlns: false,\n explicitChildren: false,\n preserveChildrenOrder: false,\n childkey: '$$',\n charsAsChildren: false,\n includeWhiteChars: false,\n async: false,\n strict: true,\n attrNameProcessors: null,\n attrValueProcessors: null,\n tagNameProcessors: null,\n valueProcessors: null,\n rootName: 'root',\n xmldec: {\n 'version': '1.0',\n 'encoding': 'UTF-8',\n 'standalone': true\n },\n doctype: null,\n renderOpts: {\n 'pretty': true,\n 'indent': ' ',\n 'newline': '\\n'\n },\n headless: false,\n chunkSize: 10000,\n emptyTag: '',\n cdata: false\n }\n };\n\n}).call(this);\n\n\n//# sourceURL=webpack:///./node_modules/xml2js/lib/defaults.js?");
/***/ }),
/***/ "./node_modules/xml2js/lib/parser.js":
/*!*******************************************!*\
!*** ./node_modules/xml2js/lib/parser.js ***!
\*******************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("// Generated by CoffeeScript 1.12.7\n(function() {\n \"use strict\";\n var bom, defaults, events, isEmpty, processItem, processors, sax, setImmediate,\n bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n sax = __webpack_require__(/*! sax */ \"./node_modules/sax/lib/sax.js\");\n\n events = __webpack_require__(/*! events */ \"./node_modules/events/events.js\");\n\n bom = __webpack_require__(/*! ./bom */ \"./node_modules/xml2js/lib/bom.js\");\n\n processors = __webpack_require__(/*! ./processors */ \"./node_modules/xml2js/lib/processors.js\");\n\n setImmediate = __webpack_require__(/*! timers */ \"./node_modules/timers-browserify/main.js\").setImmediate;\n\n defaults = __webpack_require__(/*! ./defaults */ \"./node_modules/xml2js/lib/defaults.js\").defaults;\n\n isEmpty = function(thing) {\n return typeof thing === \"object\" && (thing != null) && Object.keys(thing).length === 0;\n };\n\n processItem = function(processors, item, key) {\n var i, len, process;\n for (i = 0, len = processors.length; i < len; i++) {\n process = processors[i];\n item = process(item, key);\n }\n return item;\n };\n\n exports.Parser = (function(superClass) {\n extend(Parser, superClass);\n\n function Parser(opts) {\n this.parseString = bind(this.parseString, this);\n this.reset = bind(this.reset, this);\n this.assignOrPush = bind(this.assignOrPush, this);\n this.processAsync = bind(this.processAsync, this);\n var key, ref, value;\n if (!(this instanceof exports.Parser)) {\n return new exports.Parser(opts);\n }\n this.options = {};\n ref = defaults[\"0.2\"];\n for (key in ref) {\n if (!hasProp.call(ref, key)) continue;\n value = ref[key];\n this.options[key] = value;\n }\n for (key in opts) {\n if (!hasProp.call(opts, key)) continue;\n value = opts[key];\n this.options[key] = value;\n }\n if (this.options.xmlns) {\n this.options.xmlnskey = this.options.attrkey + \"ns\";\n }\n if (this.options.normalizeTags) {\n if (!this.options.tagNameProcessors) {\n this.options.tagNameProcessors = [];\n }\n this.options.tagNameProcessors.unshift(processors.normalize);\n }\n this.reset();\n }\n\n Parser.prototype.processAsync = function() {\n var chunk, err;\n try {\n if (this.remaining.length <= this.options.chunkSize) {\n chunk = this.remaining;\n this.remaining = '';\n this.saxParser = this.saxParser.write(chunk);\n return this.saxParser.close();\n } else {\n chunk = this.remaining.substr(0, this.options.chunkSize);\n this.remaining = this.remaining.substr(this.options.chunkSize, this.remaining.length);\n this.saxParser = this.saxParser.write(chunk);\n return setImmediate(this.processAsync);\n }\n } catch (error1) {\n err = error1;\n if (!this.saxParser.errThrown) {\n this.saxParser.errThrown = true;\n return this.emit(err);\n }\n }\n };\n\n Parser.prototype.assignOrPush = function(obj, key, newValue) {\n if (!(key in obj)) {\n if (!this.options.explicitArray) {\n return obj[key] = newValue;\n } else {\n return obj[key] = [newValue];\n }\n } else {\n if (!(obj[key] instanceof Array)) {\n obj[key] = [obj[key]];\n }\n return obj[key].push(newValue);\n }\n };\n\n Parser.prototype.reset = function() {\n var attrkey, charkey, ontext, stack;\n this.removeAllListeners();\n this.saxParser = sax.parser(this.options.strict, {\n trim: false,\n normalize: false,\n xmlns: this.options.xmlns\n });\n this.saxParser.errThrown = false;\n this.saxParser.onerror = (function(_this) {\n return function(error) {\n _this.saxParser.resume();\n if (!_this.saxParser.errThrown) {\n _this.saxParser.errThrown = true;\n return _this.emit(\"error\", error);\n }\n };\n })(this);\n this.saxParser.onend = (function(_this) {\n return function() {\n if (!_this.saxParser.ended) {\n _this.saxParser.ended = true;\n return _this.emit(\"end\", _this.resultObject);\n }\n };\n })(this);\n this.saxParser.ended = false;\n this.EXPLICIT_CHARKEY = this.options.explicitCharkey;\n this.resultObject = null;\n stack = [];\n attrkey = this.options.attrkey;\n charkey = this.options.charkey;\n this.saxParser.onopentag = (function(_this) {\n return function(node) {\n var key, newValue, obj, processedKey, ref;\n obj = {};\n obj[charkey] = \"\";\n if (!_this.options.ignoreAttrs) {\n ref = node.attributes;\n for (key in ref) {\n if (!hasProp.call(ref, key)) continue;\n if (!(attrkey in obj) && !_this.options.mergeAttrs) {\n obj[attrkey] = {};\n }\n newValue = _this.options.attrValueProcessors ? processItem(_this.options.attrValueProcessors, node.attributes[key], key) : node.attributes[key];\n processedKey = _this.options.attrNameProcessors ? processItem(_this.options.attrNameProcessors, key) : key;\n if (_this.options.mergeAttrs) {\n _this.assignOrPush(obj, processedKey, newValue);\n } else {\n obj[attrkey][processedKey] = newValue;\n }\n }\n }\n obj[\"#name\"] = _this.options.tagNameProcessors ? processItem(_this.options.tagNameProcessors, node.name) : node.name;\n if (_this.options.xmlns) {\n obj[_this.options.xmlnskey] = {\n uri: node.uri,\n local: node.local\n };\n }\n return stack.push(obj);\n };\n })(this);\n this.saxParser.onclosetag = (function(_this) {\n return function() {\n var cdata, emptyStr, key, node, nodeName, obj, objClone, old, s, xpath;\n obj = stack.pop();\n nodeName = obj[\"#name\"];\n if (!_this.options.explicitChildren || !_this.options.preserveChildrenOrder) {\n delete obj[\"#name\"];\n }\n if (obj.cdata === true) {\n cdata = obj.cdata;\n delete obj.cdata;\n }\n s = stack[stack.length - 1];\n if (obj[charkey].match(/^\\s*$/) && !cdata) {\n emptyStr = obj[charkey];\n delete obj[charkey];\n } else {\n if (_this.options.trim) {\n obj[charkey] = obj[charkey].trim();\n }\n if (_this.options.normalize) {\n obj[charkey] = obj[charkey].replace(/\\s{2,}/g, \" \").trim();\n }\n obj[charkey] = _this.options.valueProcessors ? processItem(_this.options.valueProcessors, obj[charkey], nodeName) : obj[charkey];\n if (Object.keys(obj).length === 1 && charkey in obj && !_this.EXPLICIT_CHARKEY) {\n obj = obj[charkey];\n }\n }\n if (isEmpty(obj)) {\n obj = _this.options.emptyTag !== '' ? _this.options.emptyTag : emptyStr;\n }\n if (_this.options.validator != null) {\n xpath = \"/\" + ((function() {\n var i, len, results;\n results = [];\n for (i = 0, len = stack.length; i < len; i++) {\n node = stack[i];\n results.push(node[\"#name\"]);\n }\n return results;\n })()).concat(nodeName).join(\"/\");\n (function() {\n var err;\n try {\n return obj = _this.options.validator(xpath, s && s[nodeName], obj);\n } catch (error1) {\n err = error1;\n return _this.emit(\"error\", err);\n }\n })();\n }\n if (_this.options.explicitChildren && !_this.options.mergeAttrs && typeof obj === 'object') {\n if (!_this.options.preserveChildrenOrder) {\n node = {};\n if (_this.options.attrkey in obj) {\n node[_this.options.attrkey] = obj[_this.options.attrkey];\n delete obj[_this.options.attrkey];\n }\n if (!_this.options.charsAsChildren && _this.options.charkey in obj) {\n node[_this.options.charkey] = obj[_this.options.charkey];\n delete obj[_this.options.charkey];\n }\n if (Object.getOwnPropertyNames(obj).length > 0) {\n node[_this.options.childkey] = obj;\n }\n obj = node;\n } else if (s) {\n s[_this.options.childkey] = s[_this.options.childkey] || [];\n objClone = {};\n for (key in obj) {\n if (!hasProp.call(obj, key)) continue;\n objClone[key] = obj[key];\n }\n s[_this.options.childkey].push(objClone);\n delete obj[\"#name\"];\n if (Object.keys(obj).length === 1 && charkey in obj && !_this.EXPLICIT_CHARKEY) {\n obj = obj[charkey];\n }\n }\n }\n if (stack.length > 0) {\n return _this.assignOrPush(s, nodeName, obj);\n } else {\n if (_this.options.explicitRoot) {\n old = obj;\n obj = {};\n obj[nodeName] = old;\n }\n _this.resultObject = obj;\n _this.saxParser.ended = true;\n return _this.emit(\"end\", _this.resultObject);\n }\n };\n })(this);\n ontext = (function(_this) {\n return function(text) {\n var charChild, s;\n s = stack[stack.length - 1];\n if (s) {\n s[charkey] += text;\n if (_this.options.explicitChildren && _this.options.preserveChildrenOrder && _this.options.charsAsChildren && (_this.options.includeWhiteChars || text.replace(/\\\\n/g, '').trim() !== '')) {\n s[_this.options.childkey] = s[_this.options.childkey] || [];\n charChild = {\n '#name': '__text__'\n };\n charChild[charkey] = text;\n if (_this.options.normalize) {\n charChild[charkey] = charChild[charkey].replace(/\\s{2,}/g, \" \").trim();\n }\n s[_this.options.childkey].push(charChild);\n }\n return s;\n }\n };\n })(this);\n this.saxParser.ontext = ontext;\n return this.saxParser.oncdata = (function(_this) {\n return function(text) {\n var s;\n s = ontext(text);\n if (s) {\n return s.cdata = true;\n }\n };\n })(this);\n };\n\n Parser.prototype.parseString = function(str, cb) {\n var err;\n if ((cb != null) && typeof cb === \"function\") {\n this.on(\"end\", function(result) {\n this.reset();\n return cb(null, result);\n });\n this.on(\"error\", function(err) {\n this.reset();\n return cb(err);\n });\n }\n try {\n str = str.toString();\n if (str.trim() === '') {\n this.emit(\"end\", null);\n return true;\n }\n str = bom.stripBOM(str);\n if (this.options.async) {\n this.remaining = str;\n setImmediate(this.processAsync);\n return this.saxParser;\n }\n return this.saxParser.write(str).close();\n } catch (error1) {\n err = error1;\n if (!(this.saxParser.errThrown || this.saxParser.ended)) {\n this.emit('error', err);\n return this.saxParser.errThrown = true;\n } else if (this.saxParser.ended) {\n throw err;\n }\n }\n };\n\n return Parser;\n\n })(events.EventEmitter);\n\n exports.parseString = function(str, a, b) {\n var cb, options, parser;\n if (b != null) {\n if (typeof b === 'function') {\n cb = b;\n }\n if (typeof a === 'object') {\n options = a;\n }\n } else {\n if (typeof a === 'function') {\n cb = a;\n }\n options = {};\n }\n parser = new exports.Parser(options);\n return parser.parseString(str, cb);\n };\n\n}).call(this);\n\n\n//# sourceURL=webpack:///./node_modules/xml2js/lib/parser.js?");
/***/ }),
/***/ "./node_modules/xml2js/lib/processors.js":
/*!***********************************************!*\
!*** ./node_modules/xml2js/lib/processors.js ***!
\***********************************************/
/*! no static exports found */
/***/ (function(module, exports) {
eval("// Generated by CoffeeScript 1.12.7\n(function() {\n \"use strict\";\n var prefixMatch;\n\n prefixMatch = new RegExp(/(?!xmlns)^.*:/);\n\n exports.normalize = function(str) {\n return str.toLowerCase();\n };\n\n exports.firstCharLowerCase = function(str) {\n return str.charAt(0).toLowerCase() + str.slice(1);\n };\n\n exports.stripPrefix = function(str) {\n return str.replace(prefixMatch, '');\n };\n\n exports.parseNumbers = function(str) {\n if (!isNaN(str)) {\n str = str % 1 === 0 ? parseInt(str, 10) : parseFloat(str);\n }\n return str;\n };\n\n exports.parseBooleans = function(str) {\n if (/^(?:true|false)$/i.test(str)) {\n str = str.toLowerCase() === 'true';\n }\n return str;\n };\n\n}).call(this);\n\n\n//# sourceURL=webpack:///./node_modules/xml2js/lib/processors.js?");
/***/ }),
/***/ "./node_modules/xml2js/lib/xml2js.js":
/*!*******************************************!*\
!*** ./node_modules/xml2js/lib/xml2js.js ***!
\*******************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("// Generated by CoffeeScript 1.12.7\n(function() {\n \"use strict\";\n var builder, defaults, parser, processors,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n defaults = __webpack_require__(/*! ./defaults */ \"./node_modules/xml2js/lib/defaults.js\");\n\n builder = __webpack_require__(/*! ./builder */ \"./node_modules/xml2js/lib/builder.js\");\n\n parser = __webpack_require__(/*! ./parser */ \"./node_modules/xml2js/lib/parser.js\");\n\n processors = __webpack_require__(/*! ./processors */ \"./node_modules/xml2js/lib/processors.js\");\n\n exports.defaults = defaults.defaults;\n\n exports.processors = processors;\n\n exports.ValidationError = (function(superClass) {\n extend(ValidationError, superClass);\n\n function ValidationError(message) {\n this.message = message;\n }\n\n return ValidationError;\n\n })(Error);\n\n exports.Builder = builder.Builder;\n\n exports.Parser = parser.Parser;\n\n exports.parseString = parser.parseString;\n\n}).call(this);\n\n\n//# sourceURL=webpack:///./node_modules/xml2js/lib/xml2js.js?");
/***/ }),
/***/ "./node_modules/xmlbuilder/lib/Utility.js":
/*!************************************************!*\
!*** ./node_modules/xmlbuilder/lib/Utility.js ***!
\************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
eval("// Generated by CoffeeScript 1.12.7\n(function() {\n var assign, isArray, isEmpty, isFunction, isObject, isPlainObject,\n slice = [].slice,\n hasProp = {}.hasOwnProperty;\n\n assign = function() {\n var i, key, len, source, sources, target;\n target = arguments[0], sources = 2 <= arguments.length ? slice.call(arguments, 1) : [];\n if (isFunction(Object.assign)) {\n Object.assign.apply(null, arguments);\n } else {\n for (i = 0, len = sources.length; i < len; i++) {\n source = sources[i];\n if (source != null) {\n for (key in source) {\n if (!hasProp.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n }\n }\n return target;\n };\n\n isFunction = function(val) {\n return !!val && Object.prototype.toString.call(val) === '[object Function]';\n };\n\n isObject = function(val) {\n var ref;\n return !!val && ((ref = typeof val) === 'function' || ref === 'object');\n };\n\n isArray = function(val) {\n if (isFunction(Array.isArray)) {\n return Array.isArray(val);\n } else {\n return Object.prototype.toString.call(val) === '[object Array]';\n }\n };\n\n isEmpty = function(val) {\n var key;\n if (isArray(val)) {\n return !val.length;\n } else {\n for (key in val) {\n if (!hasProp.call(val, key)) continue;\n return false;\n }\n return true;\n }\n };\n\n isPlainObject = function(val) {\n var ctor, proto;\n return isObject(val) && (proto = Object.getPrototypeOf(val)) && (ctor = proto.constructor) && (typeof ctor === 'function') && (ctor instanceof ctor) && (Function.prototype.toString.call(ctor) === Function.prototype.toString.call(Object));\n };\n\n module.exports.assign = assign;\n\n module.exports.isFunction = isFunction;\n\n module.exports.isObject = isObject;\n\n module.exports.isArray = isArray;\n\n module.exports.isEmpty = isEmpty;\n\n module.exports.isPlainObject = isPlainObject;\n\n}).call(this);\n\n\n//# sourceURL=webpack:///./node_modules/xmlbuilder/lib/Utility.js?");
/***/ }),
/***/ "./node_modules/xmlbuilder/lib/XMLAttribute.js":
/*!*****************************************************!*\
!*** ./node_modules/xmlbuilder/lib/XMLAttribute.js ***!
\*****************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
eval("// Generated by CoffeeScript 1.12.7\n(function() {\n var XMLAttribute;\n\n module.exports = XMLAttribute = (function() {\n function XMLAttribute(parent, name, value) {\n this.options = parent.options;\n this.stringify = parent.stringify;\n if (name == null) {\n throw new Error(\"Missing attribute name of element \" + parent.name);\n }\n if (value == null) {\n throw new Error(\"Missing attribute value for attribute \" + name + \" of element \" + parent.name);\n }\n this.name = this.stringify.attName(name);\n this.value = this.stringify.attValue(value);\n }\n\n XMLAttribute.prototype.clone = function() {\n return Object.create(this);\n };\n\n XMLAttribute.prototype.toString = function(options) {\n return this.options.writer.set(options).attribute(this);\n };\n\n return XMLAttribute;\n\n })();\n\n}).call(this);\n\n\n//# sourceURL=webpack:///./node_modules/xmlbuilder/lib/XMLAttribute.js?");
/***/ }),
/***/ "./node_modules/xmlbuilder/lib/XMLCData.js":
/*!*************************************************!*\
!*** ./node_modules/xmlbuilder/lib/XMLCData.js ***!
\*************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("// Generated by CoffeeScript 1.12.7\n(function() {\n var XMLCData, XMLNode,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n XMLNode = __webpack_require__(/*! ./XMLNode */ \"./node_modules/xmlbuilder/lib/XMLNode.js\");\n\n module.exports = XMLCData = (function(superClass) {\n extend(XMLCData, superClass);\n\n function XMLCData(parent, text) {\n XMLCData.__super__.constructor.call(this, parent);\n if (text == null) {\n throw new Error(\"Missing CDATA text\");\n }\n this.text = this.stringify.cdata(text);\n }\n\n XMLCData.prototype.clone = function() {\n return Object.create(this);\n };\n\n XMLCData.prototype.toString = function(options) {\n return this.options.writer.set(options).cdata(this);\n };\n\n return XMLCData;\n\n })(XMLNode);\n\n}).call(this);\n\n\n//# sourceURL=webpack:///./node_modules/xmlbuilder/lib/XMLCData.js?");
/***/ }),
/***/ "./node_modules/xmlbuilder/lib/XMLComment.js":
/*!***************************************************!*\
!*** ./node_modules/xmlbuilder/lib/XMLComment.js ***!
\***************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("// Generated by CoffeeScript 1.12.7\n(function() {\n var XMLComment, XMLNode,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n XMLNode = __webpack_require__(/*! ./XMLNode */ \"./node_modules/xmlbuilder/lib/XMLNode.js\");\n\n module.exports = XMLComment = (function(superClass) {\n extend(XMLComment, superClass);\n\n function XMLComment(parent, text) {\n XMLComment.__super__.constructor.call(this, parent);\n if (text == null) {\n throw new Error(\"Missing comment text\");\n }\n this.text = this.stringify.comment(text);\n }\n\n XMLComment.prototype.clone = function() {\n return Object.create(this);\n };\n\n XMLComment.prototype.toString = function(options) {\n return this.options.writer.set(options).comment(this);\n };\n\n return XMLComment;\n\n })(XMLNode);\n\n}).call(this);\n\n\n//# sourceURL=webpack:///./node_modules/xmlbuilder/lib/XMLComment.js?");
/***/ }),
/***/ "./node_modules/xmlbuilder/lib/XMLDTDAttList.js":
/*!******************************************************!*\
!*** ./node_modules/xmlbuilder/lib/XMLDTDAttList.js ***!
\******************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("// Generated by CoffeeScript 1.12.7\n(function() {\n var XMLDTDAttList, XMLNode,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n XMLNode = __webpack_require__(/*! ./XMLNode */ \"./node_modules/xmlbuilder/lib/XMLNode.js\");\n\n module.exports = XMLDTDAttList = (function(superClass) {\n extend(XMLDTDAttList, superClass);\n\n function XMLDTDAttList(parent, elementName, attributeName, attributeType, defaultValueType, defaultValue) {\n XMLDTDAttList.__super__.constructor.call(this, parent);\n if (elementName == null) {\n throw new Error(\"Missing DTD element name\");\n }\n if (attributeName == null) {\n throw new Error(\"Missing DTD attribute name\");\n }\n if (!attributeType) {\n throw new Error(\"Missing DTD attribute type\");\n }\n if (!defaultValueType) {\n throw new Error(\"Missing DTD attribute default\");\n }\n if (defaultValueType.indexOf('#') !== 0) {\n defaultValueType = '#' + defaultValueType;\n }\n if (!defaultValueType.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/)) {\n throw new Error(\"Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT\");\n }\n if (defaultValue && !defaultValueType.match(/^(#FIXED|#DEFAULT)$/)) {\n throw new Error(\"Default value only applies to #FIXED or #DEFAULT\");\n }\n this.elementName = this.stringify.eleName(elementName);\n this.attributeName = this.stringify.attName(attributeName);\n this.attributeType = this.stringify.dtdAttType(attributeType);\n this.defaultValue = this.stringify.dtdAttDefault(defaultValue);\n this.defaultValueType = defaultValueType;\n }\n\n XMLDTDAttList.prototype.toString = function(options) {\n return this.options.writer.set(options).dtdAttList(this);\n };\n\n return XMLDTDAttList;\n\n })(XMLNode);\n\n}).call(this);\n\n\n//# sourceURL=webpack:///./node_modules/xmlbuilder/lib/XMLDTDAttList.js?");
/***/ }),
/***/ "./node_modules/xmlbuilder/lib/XMLDTDElement.js":
/*!******************************************************!*\
!*** ./node_modules/xmlbuilder/lib/XMLDTDElement.js ***!
\******************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("// Generated by CoffeeScript 1.12.7\n(function() {\n var XMLDTDElement, XMLNode,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n XMLNode = __webpack_require__(/*! ./XMLNode */ \"./node_modules/xmlbuilder/lib/XMLNode.js\");\n\n module.exports = XMLDTDElement = (function(superClass) {\n extend(XMLDTDElement, superClass);\n\n function XMLDTDElement(parent, name, value) {\n XMLDTDElement.__super__.constructor.call(this, parent);\n if (name == null) {\n throw new Error(\"Missing DTD element name\");\n }\n if (!value) {\n value = '(#PCDATA)';\n }\n if (Array.isArray(value)) {\n value = '(' + value.join(',') + ')';\n }\n this.name = this.stringify.eleName(name);\n this.value = this.stringify.dtdElementValue(value);\n }\n\n XMLDTDElement.prototype.toString = function(options) {\n return this.options.writer.set(options).dtdElement(this);\n };\n\n return XMLDTDElement;\n\n })(XMLNode);\n\n}).call(this);\n\n\n//# sourceURL=webpack:///./node_modules/xmlbuilder/lib/XMLDTDElement.js?");
/***/ }),
/***/ "./node_modules/xmlbuilder/lib/XMLDTDEntity.js":
/*!*****************************************************!*\
!*** ./node_modules/xmlbuilder/lib/XMLDTDEntity.js ***!
\*****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("// Generated by CoffeeScript 1.12.7\n(function() {\n var XMLDTDEntity, XMLNode, isObject,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n isObject = __webpack_require__(/*! ./Utility */ \"./node_modules/xmlbuilder/lib/Utility.js\").isObject;\n\n XMLNode = __webpack_require__(/*! ./XMLNode */ \"./node_modules/xmlbuilder/lib/XMLNode.js\");\n\n module.exports = XMLDTDEntity = (function(superClass) {\n extend(XMLDTDEntity, superClass);\n\n function XMLDTDEntity(parent, pe, name, value) {\n XMLDTDEntity.__super__.constructor.call(this, parent);\n if (name == null) {\n throw new Error(\"Missing entity name\");\n }\n if (value == null) {\n throw new Error(\"Missing entity value\");\n }\n this.pe = !!pe;\n this.name = this.stringify.eleName(name);\n if (!isObject(value)) {\n this.value = this.stringify.dtdEntityValue(value);\n } else {\n if (!value.pubID && !value.sysID) {\n throw new Error(\"Public and/or system identifiers are required for an external entity\");\n }\n if (value.pubID && !value.sysID) {\n throw new Error(\"System identifier is required for a public external entity\");\n }\n if (value.pubID != null) {\n this.pubID = this.stringify.dtdPubID(value.pubID);\n }\n if (value.sysID != null) {\n this.sysID = this.stringify.dtdSysID(value.sysID);\n }\n if (value.nData != null) {\n this.nData = this.stringify.dtdNData(value.nData);\n }\n if (this.pe && this.nData) {\n throw new Error(\"Notation declaration is not allowed in a parameter entity\");\n }\n }\n }\n\n XMLDTDEntity.prototype.toString = function(options) {\n return this.options.writer.set(options).dtdEntity(this);\n };\n\n return XMLDTDEntity;\n\n })(XMLNode);\n\n}).call(this);\n\n\n//# sourceURL=webpack:///./node_modules/xmlbuilder/lib/XMLDTDEntity.js?");
/***/ }),
/***/ "./node_modules/xmlbuilder/lib/XMLDTDNotation.js":
/*!*******************************************************!*\
!*** ./node_modules/xmlbuilder/lib/XMLDTDNotation.js ***!
\*******************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("// Generated by CoffeeScript 1.12.7\n(function() {\n var XMLDTDNotation, XMLNode,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n XMLNode = __webpack_require__(/*! ./XMLNode */ \"./node_modules/xmlbuilder/lib/XMLNode.js\");\n\n module.exports = XMLDTDNotation = (function(superClass) {\n extend(XMLDTDNotation, superClass);\n\n function XMLDTDNotation(parent, name, value) {\n XMLDTDNotation.__super__.constructor.call(this, parent);\n if (name == null) {\n throw new Error(\"Missing notation name\");\n }\n if (!value.pubID && !value.sysID) {\n throw new Error(\"Public or system identifiers are required for an external entity\");\n }\n this.name = this.stringify.eleName(name);\n if (value.pubID != null) {\n this.pubID = this.stringify.dtdPubID(value.pubID);\n }\n if (value.sysID != null) {\n this.sysID = this.stringify.dtdSysID(value.sysID);\n }\n }\n\n XMLDTDNotation.prototype.toString = function(options) {\n return this.options.writer.set(options).dtdNotation(this);\n };\n\n return XMLDTDNotation;\n\n })(XMLNode);\n\n}).call(this);\n\n\n//# sourceURL=webpack:///./node_modules/xmlbuilder/lib/XMLDTDNotation.js?");
/***/ }),
/***/ "./node_modules/xmlbuilder/lib/XMLDeclaration.js":
/*!*******************************************************!*\
!*** ./node_modules/xmlbuilder/lib/XMLDeclaration.js ***!
\*******************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("// Generated by CoffeeScript 1.12.7\n(function() {\n var XMLDeclaration, XMLNode, isObject,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n isObject = __webpack_require__(/*! ./Utility */ \"./node_modules/xmlbuilder/lib/Utility.js\").isObject;\n\n XMLNode = __webpack_require__(/*! ./XMLNode */ \"./node_modules/xmlbuilder/lib/XMLNode.js\");\n\n module.exports = XMLDeclaration = (function(superClass) {\n extend(XMLDeclaration, superClass);\n\n function XMLDeclaration(parent, version, encoding, standalone) {\n var ref;\n XMLDeclaration.__super__.constructor.call(this, parent);\n if (isObject(version)) {\n ref = version, version = ref.version, encoding = ref.encoding, standalone = ref.standalone;\n }\n if (!version) {\n version = '1.0';\n }\n this.version = this.stringify.xmlVersion(version);\n if (encoding != null) {\n this.encoding = this.stringify.xmlEncoding(encoding);\n }\n if (standalone != null) {\n this.standalone = this.stringify.xmlStandalone(standalone);\n }\n }\n\n XMLDeclaration.prototype.toString = function(options) {\n return this.options.writer.set(options).declaration(this);\n };\n\n return XMLDeclaration;\n\n })(XMLNode);\n\n}).call(this);\n\n\n//# sourceURL=webpack:///./node_modules/xmlbuilder/lib/XMLDeclaration.js?");
/***/ }),
/***/ "./node_modules/xmlbuilder/lib/XMLDocType.js":
/*!***************************************************!*\
!*** ./node_modules/xmlbuilder/lib/XMLDocType.js ***!
\***************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("// Generated by CoffeeScript 1.12.7\n(function() {\n var XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDocType, XMLNode, isObject,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n isObject = __webpack_require__(/*! ./Utility */ \"./node_modules/xmlbuilder/lib/Utility.js\").isObject;\n\n XMLNode = __webpack_require__(/*! ./XMLNode */ \"./node_modules/xmlbuilder/lib/XMLNode.js\");\n\n XMLDTDAttList = __webpack_require__(/*! ./XMLDTDAttList */ \"./node_modules/xmlbuilder/lib/XMLDTDAttList.js\");\n\n XMLDTDEntity = __webpack_require__(/*! ./XMLDTDEntity */ \"./node_modules/xmlbuilder/lib/XMLDTDEntity.js\");\n\n XMLDTDElement = __webpack_require__(/*! ./XMLDTDElement */ \"./node_modules/xmlbuilder/lib/XMLDTDElement.js\");\n\n XMLDTDNotation = __webpack_require__(/*! ./XMLDTDNotation */ \"./node_modules/xmlbuilder/lib/XMLDTDNotation.js\");\n\n module.exports = XMLDocType = (function(superClass) {\n extend(XMLDocType, superClass);\n\n function XMLDocType(parent, pubID, sysID) {\n var ref, ref1;\n XMLDocType.__super__.constructor.call(this, parent);\n this.documentObject = parent;\n if (isObject(pubID)) {\n ref = pubID, pubID = ref.pubID, sysID = ref.sysID;\n }\n if (sysID == null) {\n ref1 = [pubID, sysID], sysID = ref1[0], pubID = ref1[1];\n }\n if (pubID != null) {\n this.pubID = this.stringify.dtdPubID(pubID);\n }\n if (sysID != null) {\n this.sysID = this.stringify.dtdSysID(sysID);\n }\n }\n\n XMLDocType.prototype.element = function(name, value) {\n var child;\n child = new XMLDTDElement(this, name, value);\n this.children.push(child);\n return this;\n };\n\n XMLDocType.prototype.attList = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {\n var child;\n child = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue);\n this.children.push(child);\n return this;\n };\n\n XMLDocType.prototype.entity = function(name, value) {\n var child;\n child = new XMLDTDEntity(this, false, name, value);\n this.children.push(child);\n return this;\n };\n\n XMLDocType.prototype.pEntity = function(name, value) {\n var child;\n child = new XMLDTDEntity(this, true, name, value);\n this.children.push(child);\n return this;\n };\n\n XMLDocType.prototype.notation = function(name, value) {\n var child;\n child = new XMLDTDNotation(this, name, value);\n this.children.push(child);\n return this;\n };\n\n XMLDocType.prototype.toString = function(options) {\n return this.options.writer.set(options).docType(this);\n };\n\n XMLDocType.prototype.ele = function(name, value) {\n return this.element(name, value);\n };\n\n XMLDocType.prototype.att = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {\n return this.attList(elementName, attributeName, attributeType, defaultValueType, defaultValue);\n };\n\n XMLDocType.prototype.ent = function(name, value) {\n return this.entity(name, value);\n };\n\n XMLDocType.prototype.pent = function(name, value) {\n return this.pEntity(name, value);\n };\n\n XMLDocType.prototype.not = function(name, value) {\n return this.notation(name, value);\n };\n\n XMLDocType.prototype.up = function() {\n return this.root() || this.documentObject;\n };\n\n return XMLDocType;\n\n })(XMLNode);\n\n}).call(this);\n\n\n//# sourceURL=webpack:///./node_modules/xmlbuilder/lib/XMLDocType.js?");
/***/ }),
/***/ "./node_modules/xmlbuilder/lib/XMLDocument.js":
/*!****************************************************!*\
!*** ./node_modules/xmlbuilder/lib/XMLDocument.js ***!
\****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("// Generated by CoffeeScript 1.12.7\n(function() {\n var XMLDocument, XMLNode, XMLStringWriter, XMLStringifier, isPlainObject,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n isPlainObject = __webpack_require__(/*! ./Utility */ \"./node_modules/xmlbuilder/lib/Utility.js\").isPlainObject;\n\n XMLNode = __webpack_require__(/*! ./XMLNode */ \"./node_modules/xmlbuilder/lib/XMLNode.js\");\n\n XMLStringifier = __webpack_require__(/*! ./XMLStringifier */ \"./node_modules/xmlbuilder/lib/XMLStringifier.js\");\n\n XMLStringWriter = __webpack_require__(/*! ./XMLStringWriter */ \"./node_modules/xmlbuilder/lib/XMLStringWriter.js\");\n\n module.exports = XMLDocument = (function(superClass) {\n extend(XMLDocument, superClass);\n\n function XMLDocument(options) {\n XMLDocument.__super__.constructor.call(this, null);\n options || (options = {});\n if (!options.writer) {\n options.writer = new XMLStringWriter();\n }\n this.options = options;\n this.stringify = new XMLStringifier(options);\n this.isDocument = true;\n }\n\n XMLDocument.prototype.end = function(writer) {\n var writerOptions;\n if (!writer) {\n writer = this.options.writer;\n } else if (isPlainObject(writer)) {\n writerOptions = writer;\n writer = this.options.writer.set(writerOptions);\n }\n return writer.document(this);\n };\n\n XMLDocument.prototype.toString = function(options) {\n return this.options.writer.set(options).document(this);\n };\n\n return XMLDocument;\n\n })(XMLNode);\n\n}).call(this);\n\n\n//# sourceURL=webpack:///./node_modules/xmlbuilder/lib/XMLDocument.js?");
/***/ }),
/***/ "./node_modules/xmlbuilder/lib/XMLDocumentCB.js":
/*!******************************************************!*\
!*** ./node_modules/xmlbuilder/lib/XMLDocumentCB.js ***!
\******************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("// Generated by CoffeeScript 1.12.7\n(function() {\n var XMLAttribute, XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLDocumentCB, XMLElement, XMLProcessingInstruction, XMLRaw, XMLStringWriter, XMLStringifier, XMLText, isFunction, isObject, isPlainObject, ref,\n hasProp = {}.hasOwnProperty;\n\n ref = __webpack_require__(/*! ./Utility */ \"./node_modules/xmlbuilder/lib/Utility.js\"), isObject = ref.isObject, isFunction = ref.isFunction, isPlainObject = ref.isPlainObject;\n\n XMLElement = __webpack_require__(/*! ./XMLElement */ \"./node_modules/xmlbuilder/lib/XMLElement.js\");\n\n XMLCData = __webpack_require__(/*! ./XMLCData */ \"./node_modules/xmlbuilder/lib/XMLCData.js\");\n\n XMLComment = __webpack_require__(/*! ./XMLComment */ \"./node_modules/xmlbuilder/lib/XMLComment.js\");\n\n XMLRaw = __webpack_require__(/*! ./XMLRaw */ \"./node_modules/xmlbuilder/lib/XMLRaw.js\");\n\n XMLText = __webpack_require__(/*! ./XMLText */ \"./node_modules/xmlbuilder/lib/XMLText.js\");\n\n XMLProcessingInstruction = __webpack_require__(/*! ./XMLProcessingInstruction */ \"./node_modules/xmlbuilder/lib/XMLProcessingInstruction.js\");\n\n XMLDeclaration = __webpack_require__(/*! ./XMLDeclaration */ \"./node_modules/xmlbuilder/lib/XMLDeclaration.js\");\n\n XMLDocType = __webpack_require__(/*! ./XMLDocType */ \"./node_modules/xmlbuilder/lib/XMLDocType.js\");\n\n XMLDTDAttList = __webpack_require__(/*! ./XMLDTDAttList */ \"./node_modules/xmlbuilder/lib/XMLDTDAttList.js\");\n\n XMLDTDEntity = __webpack_require__(/*! ./XMLDTDEntity */ \"./node_modules/xmlbuilder/lib/XMLDTDEntity.js\");\n\n XMLDTDElement = __webpack_require__(/*! ./XMLDTDElement */ \"./node_modules/xmlbuilder/lib/XMLDTDElement.js\");\n\n XMLDTDNotation = __webpack_require__(/*! ./XMLDTDNotation */ \"./node_modules/xmlbuilder/lib/XMLDTDNotation.js\");\n\n XMLAttribute = __webpack_require__(/*! ./XMLAttribute */ \"./node_modules/xmlbuilder/lib/XMLAttribute.js\");\n\n XMLStringifier = __webpack_require__(/*! ./XMLStringifier */ \"./node_modules/xmlbuilder/lib/XMLStringifier.js\");\n\n XMLStringWriter = __webpack_require__(/*! ./XMLStringWriter */ \"./node_modules/xmlbuilder/lib/XMLStringWriter.js\");\n\n module.exports = XMLDocumentCB = (function() {\n function XMLDocumentCB(options, onData, onEnd) {\n var writerOptions;\n options || (options = {});\n if (!options.writer) {\n options.writer = new XMLStringWriter(options);\n } else if (isPlainObject(options.writer)) {\n writerOptions = options.writer;\n options.writer = new XMLStringWriter(writerOptions);\n }\n this.options = options;\n this.writer = options.writer;\n this.stringify = new XMLStringifier(options);\n this.onDataCallback = onData || function() {};\n this.onEndCallback = onEnd || function() {};\n this.currentNode = null;\n this.currentLevel = -1;\n this.openTags = {};\n this.documentStarted = false;\n this.documentCompleted = false;\n this.root = null;\n }\n\n XMLDocumentCB.prototype.node = function(name, attributes, text) {\n var ref1;\n if (name == null) {\n throw new Error(\"Missing node name\");\n }\n if (this.root && this.currentLevel === -1) {\n throw new Error(\"Document can only have one root node\");\n }\n this.openCurrent();\n name = name.valueOf();\n if (attributes == null) {\n attributes = {};\n }\n attributes = attributes.valueOf();\n if (!isObject(attributes)) {\n ref1 = [attributes, text], text = ref1[0], attributes = ref1[1];\n }\n this.currentNode = new XMLElement(this, name, attributes);\n this.currentNode.children = false;\n this.currentLevel++;\n this.openTags[this.currentLevel] = this.currentNode;\n if (text != null) {\n this.text(text);\n }\n return this;\n };\n\n XMLDocumentCB.prototype.element = function(name, attributes, text) {\n if (this.currentNode && this.currentNode instanceof XMLDocType) {\n return this.dtdElement.apply(this, arguments);\n } else {\n return this.node(name, attributes, text);\n }\n };\n\n XMLDocumentCB.prototype.attribute = function(name, value) {\n var attName, attValue;\n if (!this.currentNode || this.currentNode.children) {\n throw new Error(\"att() can only be used immediately after an ele() call in callback mode\");\n }\n if (name != null) {\n name = name.valueOf();\n }\n if (isObject(name)) {\n for (attName in name) {\n if (!hasProp.call(name, attName)) continue;\n attValue = name[attName];\n this.attribute(attName, attValue);\n }\n } else {\n if (isFunction(value)) {\n value = value.apply();\n }\n if (!this.options.skipNullAttributes || (value != null)) {\n this.currentNode.attributes[name] = new XMLAttribute(this, name, value);\n }\n }\n return this;\n };\n\n XMLDocumentCB.prototype.text = function(value) {\n var node;\n this.openCurrent();\n node = new XMLText(this, value);\n this.onData(this.writer.text(node, this.currentLevel + 1));\n return this;\n };\n\n XMLDocumentCB.prototype.cdata = function(value) {\n var node;\n this.openCurrent();\n node = new XMLCData(this, value);\n this.onData(this.writer.cdata(node, this.currentLevel + 1));\n return this;\n };\n\n XMLDocumentCB.prototype.comment = function(value) {\n var node;\n this.openCurrent();\n node = new XMLComment(this, value);\n this.onData(this.writer.comment(node, this.currentLevel + 1));\n return this;\n };\n\n XMLDocumentCB.prototype.raw = function(value) {\n var node;\n this.openCurrent();\n node = new XMLRaw(this, value);\n this.onData(this.writer.raw(node, this.currentLevel + 1));\n return this;\n };\n\n XMLDocumentCB.prototype.instruction = function(target, value) {\n var i, insTarget, insValue, len, node;\n this.openCurrent();\n if (target != null) {\n target = target.valueOf();\n }\n if (value != null) {\n value = value.valueOf();\n }\n if (Array.isArray(target)) {\n for (i = 0, len = target.length; i < len; i++) {\n insTarget = target[i];\n this.instruction(insTarget);\n }\n } else if (isObject(target)) {\n for (insTarget in target) {\n if (!hasProp.call(target, insTarget)) continue;\n insValue = target[insTarget];\n this.instruction(insTarget, insValue);\n }\n } else {\n if (isFunction(value)) {\n value = value.apply();\n }\n node = new XMLProcessingInstruction(this, target, value);\n this.onData(this.writer.processingInstruction(node, this.currentLevel + 1));\n }\n return this;\n };\n\n XMLDocumentCB.prototype.declaration = function(version, encoding, standalone) {\n var node;\n this.openCurrent();\n if (this.documentStarted) {\n throw new Error(\"declaration() must be the first node\");\n }\n node = new XMLDeclaration(this, version, encoding, standalone);\n this.onData(this.writer.declaration(node, this.currentLevel + 1));\n return this;\n };\n\n XMLDocumentCB.prototype.doctype = function(root, pubID, sysID) {\n this.openCurrent();\n if (root == null) {\n throw new Error(\"Missing root node name\");\n }\n if (this.root) {\n throw new Error(\"dtd() must come before the root node\");\n }\n this.currentNode = new XMLDocType(this, pubID, sysID);\n this.currentNode.rootNodeName = root;\n this.currentNode.children = false;\n this.currentLevel++;\n this.openTags[this.currentLevel] = this.currentNode;\n return this;\n };\n\n XMLDocumentCB.prototype.dtdElement = function(name, value) {\n var node;\n this.openCurrent();\n node = new XMLDTDElement(this, name, value);\n this.onData(this.writer.dtdElement(node, this.currentLevel + 1));\n return this;\n };\n\n XMLDocumentCB.prototype.attList = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {\n var node;\n this.openCurrent();\n node = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue);\n this.onData(this.writer.dtdAttList(node, this.currentLevel + 1));\n return this;\n };\n\n XMLDocumentCB.prototype.entity = function(name, value) {\n var node;\n this.openCurrent();\n node = new XMLDTDEntity(this, false, name, value);\n this.onData(this.writer.dtdEntity(node, this.currentLevel + 1));\n return this;\n };\n\n XMLDocumentCB.prototype.pEntity = function(name, value) {\n var node;\n this.openCurrent();\n node = new XMLDTDEntity(this, true, name, value);\n this.onData(this.writer.dtdEntity(node, this.currentLevel + 1));\n return this;\n };\n\n XMLDocumentCB.prototype.notation = function(name, value) {\n var node;\n this.openCurrent();\n node = new XMLDTDNotation(this, name, value);\n this.onData(this.writer.dtdNotation(node, this.currentLevel + 1));\n return this;\n };\n\n XMLDocumentCB.prototype.up = function() {\n if (this.currentLevel < 0) {\n throw new Error(\"The document node has no parent\");\n }\n if (this.currentNode) {\n if (this.currentNode.children) {\n this.closeNode(this.currentNode);\n } else {\n this.openNode(this.currentNode);\n }\n this.currentNode = null;\n } else {\n this.closeNode(this.openTags[this.currentLevel]);\n }\n delete this.openTags[this.currentLevel];\n this.currentLevel--;\n return this;\n };\n\n XMLDocumentCB.prototype.end = function() {\n while (this.currentLevel >= 0) {\n this.up();\n }\n return this.onEnd();\n };\n\n XMLDocumentCB.prototype.openCurrent = function() {\n if (this.currentNode) {\n this.currentNode.children = true;\n return this.openNode(this.currentNode);\n }\n };\n\n XMLDocumentCB.prototype.openNode = function(node) {\n if (!node.isOpen) {\n if (!this.root && this.currentLevel === 0 && node instanceof XMLElement) {\n this.root = node;\n }\n this.onData(this.writer.openNode(node, this.currentLevel));\n return node.isOpen = true;\n }\n };\n\n XMLDocumentCB.prototype.closeNode = function(node) {\n if (!node.isClosed) {\n this.onData(this.writer.closeNode(node, this.currentLevel));\n return node.isClosed = true;\n }\n };\n\n XMLDocumentCB.prototype.onData = function(chunk) {\n this.documentStarted = true;\n return this.onDataCallback(chunk);\n };\n\n XMLDocumentCB.prototype.onEnd = function() {\n this.documentCompleted = true;\n return this.onEndCallback();\n };\n\n XMLDocumentCB.prototype.ele = function() {\n return this.element.apply(this, arguments);\n };\n\n XMLDocumentCB.prototype.nod = function(name, attributes, text) {\n return this.node(name, attributes, text);\n };\n\n XMLDocumentCB.prototype.txt = function(value) {\n return this.text(value);\n };\n\n XMLDocumentCB.prototype.dat = function(value) {\n return this.cdata(value);\n };\n\n XMLDocumentCB.prototype.com = function(value) {\n return this.comment(value);\n };\n\n XMLDocumentCB.prototype.ins = function(target, value) {\n return this.instruction(target, value);\n };\n\n XMLDocumentCB.prototype.dec = function(version, encoding, standalone) {\n return this.declaration(version, encoding, standalone);\n };\n\n XMLDocumentCB.prototype.dtd = function(root, pubID, sysID) {\n return this.doctype(root, pubID, sysID);\n };\n\n XMLDocumentCB.prototype.e = function(name, attributes, text) {\n return this.element(name, attributes, text);\n };\n\n XMLDocumentCB.prototype.n = function(name, attributes, text) {\n return this.node(name, attributes, text);\n };\n\n XMLDocumentCB.prototype.t = function(value) {\n return this.text(value);\n };\n\n XMLDocumentCB.prototype.d = function(value) {\n return this.cdata(value);\n };\n\n XMLDocumentCB.prototype.c = function(value) {\n return this.comment(value);\n };\n\n XMLDocumentCB.prototype.r = function(value) {\n return this.raw(value);\n };\n\n XMLDocumentCB.prototype.i = function(target, value) {\n return this.instruction(target, value);\n };\n\n XMLDocumentCB.prototype.att = function() {\n if (this.currentNode && this.currentNode instanceof XMLDocType) {\n return this.attList.apply(this, arguments);\n } else {\n return this.attribute.apply(this, arguments);\n }\n };\n\n XMLDocumentCB.prototype.a = function() {\n if (this.currentNode && this.currentNode instanceof XMLDocType) {\n return this.attList.apply(this, arguments);\n } else {\n return this.attribute.apply(this, arguments);\n }\n };\n\n XMLDocumentCB.prototype.ent = function(name, value) {\n return this.entity(name, value);\n };\n\n XMLDocumentCB.prototype.pent = function(name, value) {\n return this.pEntity(name, value);\n };\n\n XMLDocumentCB.prototype.not = function(name, value) {\n return this.notation(name, value);\n };\n\n return XMLDocumentCB;\n\n })();\n\n}).call(this);\n\n\n//# sourceURL=webpack:///./node_modules/xmlbuilder/lib/XMLDocumentCB.js?");
/***/ }),
/***/ "./node_modules/xmlbuilder/lib/XMLElement.js":
/*!***************************************************!*\
!*** ./node_modules/xmlbuilder/lib/XMLElement.js ***!
\***************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("// Generated by CoffeeScript 1.12.7\n(function() {\n var XMLAttribute, XMLElement, XMLNode, isFunction, isObject, ref,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n ref = __webpack_require__(/*! ./Utility */ \"./node_modules/xmlbuilder/lib/Utility.js\"), isObject = ref.isObject, isFunction = ref.isFunction;\n\n XMLNode = __webpack_require__(/*! ./XMLNode */ \"./node_modules/xmlbuilder/lib/XMLNode.js\");\n\n XMLAttribute = __webpack_require__(/*! ./XMLAttribute */ \"./node_modules/xmlbuilder/lib/XMLAttribute.js\");\n\n module.exports = XMLElement = (function(superClass) {\n extend(XMLElement, superClass);\n\n function XMLElement(parent, name, attributes) {\n XMLElement.__super__.constructor.call(this, parent);\n if (name == null) {\n throw new Error(\"Missing element name\");\n }\n this.name = this.stringify.eleName(name);\n this.attributes = {};\n if (attributes != null) {\n this.attribute(attributes);\n }\n if (parent.isDocument) {\n this.isRoot = true;\n this.documentObject = parent;\n parent.rootObject = this;\n }\n }\n\n XMLElement.prototype.clone = function() {\n var att, attName, clonedSelf, ref1;\n clonedSelf = Object.create(this);\n if (clonedSelf.isRoot) {\n clonedSelf.documentObject = null;\n }\n clonedSelf.attributes = {};\n ref1 = this.attributes;\n for (attName in ref1) {\n if (!hasProp.call(ref1, attName)) continue;\n att = ref1[attName];\n clonedSelf.attributes[attName] = att.clone();\n }\n clonedSelf.children = [];\n this.children.forEach(function(child) {\n var clonedChild;\n clonedChild = child.clone();\n clonedChild.parent = clonedSelf;\n return clonedSelf.children.push(clonedChild);\n });\n return clonedSelf;\n };\n\n XMLElement.prototype.attribute = function(name, value) {\n var attName, attValue;\n if (name != null) {\n name = name.valueOf();\n }\n if (isObject(name)) {\n for (attName in name) {\n if (!hasProp.call(name, attName)) continue;\n attValue = name[attName];\n this.attribute(attName, attValue);\n }\n } else {\n if (isFunction(value)) {\n value = value.apply();\n }\n if (!this.options.skipNullAttributes || (value != null)) {\n this.attributes[name] = new XMLAttribute(this, name, value);\n }\n }\n return this;\n };\n\n XMLElement.prototype.removeAttribute = function(name) {\n var attName, i, len;\n if (name == null) {\n throw new Error(\"Missing attribute name\");\n }\n name = name.valueOf();\n if (Array.isArray(name)) {\n for (i = 0, len = name.length; i < len; i++) {\n attName = name[i];\n delete this.attributes[attName];\n }\n } else {\n delete this.attributes[name];\n }\n return this;\n };\n\n XMLElement.prototype.toString = function(options) {\n return this.options.writer.set(options).element(this);\n };\n\n XMLElement.prototype.att = function(name, value) {\n return this.attribute(name, value);\n };\n\n XMLElement.prototype.a = function(name, value) {\n return this.attribute(name, value);\n };\n\n return XMLElement;\n\n })(XMLNode);\n\n}).call(this);\n\n\n//# sourceURL=webpack:///./node_modules/xmlbuilder/lib/XMLElement.js?");
/***/ }),
/***/ "./node_modules/xmlbuilder/lib/XMLNode.js":
/*!************************************************!*\
!*** ./node_modules/xmlbuilder/lib/XMLNode.js ***!
\************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("// Generated by CoffeeScript 1.12.7\n(function() {\n var XMLCData, XMLComment, XMLDeclaration, XMLDocType, XMLElement, XMLNode, XMLProcessingInstruction, XMLRaw, XMLText, isEmpty, isFunction, isObject, ref,\n hasProp = {}.hasOwnProperty;\n\n ref = __webpack_require__(/*! ./Utility */ \"./node_modules/xmlbuilder/lib/Utility.js\"), isObject = ref.isObject, isFunction = ref.isFunction, isEmpty = ref.isEmpty;\n\n XMLElement = null;\n\n XMLCData = null;\n\n XMLComment = null;\n\n XMLDeclaration = null;\n\n XMLDocType = null;\n\n XMLRaw = null;\n\n XMLText = null;\n\n XMLProcessingInstruction = null;\n\n module.exports = XMLNode = (function() {\n function XMLNode(parent) {\n this.parent = parent;\n if (this.parent) {\n this.options = this.parent.options;\n this.stringify = this.parent.stringify;\n }\n this.children = [];\n if (!XMLElement) {\n XMLElement = __webpack_require__(/*! ./XMLElement */ \"./node_modules/xmlbuilder/lib/XMLElement.js\");\n XMLCData = __webpack_require__(/*! ./XMLCData */ \"./node_modules/xmlbuilder/lib/XMLCData.js\");\n XMLComment = __webpack_require__(/*! ./XMLComment */ \"./node_modules/xmlbuilder/lib/XMLComment.js\");\n XMLDeclaration = __webpack_require__(/*! ./XMLDeclaration */ \"./node_modules/xmlbuilder/lib/XMLDeclaration.js\");\n XMLDocType = __webpack_require__(/*! ./XMLDocType */ \"./node_modules/xmlbuilder/lib/XMLDocType.js\");\n XMLRaw = __webpack_require__(/*! ./XMLRaw */ \"./node_modules/xmlbuilder/lib/XMLRaw.js\");\n XMLText = __webpack_require__(/*! ./XMLText */ \"./node_modules/xmlbuilder/lib/XMLText.js\");\n XMLProcessingInstruction = __webpack_require__(/*! ./XMLProcessingInstruction */ \"./node_modules/xmlbuilder/lib/XMLProcessingInstruction.js\");\n }\n }\n\n XMLNode.prototype.element = function(name, attributes, text) {\n var childNode, item, j, k, key, lastChild, len, len1, ref1, val;\n lastChild = null;\n if (attributes == null) {\n attributes = {};\n }\n attributes = attributes.valueOf();\n if (!isObject(attributes)) {\n ref1 = [attributes, text], text = ref1[0], attributes = ref1[1];\n }\n if (name != null) {\n name = name.valueOf();\n }\n if (Array.isArray(name)) {\n for (j = 0, len = name.length; j < len; j++) {\n item = name[j];\n lastChild = this.element(item);\n }\n } else if (isFunction(name)) {\n lastChild = this.element(name.apply());\n } else if (isObject(name)) {\n for (key in name) {\n if (!hasProp.call(name, key)) continue;\n val = name[key];\n if (isFunction(val)) {\n val = val.apply();\n }\n if ((isObject(val)) && (isEmpty(val))) {\n val = null;\n }\n if (!this.options.ignoreDecorators && this.stringify.convertAttKey && key.indexOf(this.stringify.convertAttKey) === 0) {\n lastChild = this.attribute(key.substr(this.stringify.convertAttKey.length), val);\n } else if (!this.options.separateArrayItems && Array.isArray(val)) {\n for (k = 0, len1 = val.length; k < len1; k++) {\n item = val[k];\n childNode = {};\n childNode[key] = item;\n lastChild = this.element(childNode);\n }\n } else if (isObject(val)) {\n lastChild = this.element(key);\n lastChild.element(val);\n } else {\n lastChild = this.element(key, val);\n }\n }\n } else {\n if (!this.options.ignoreDecorators && this.stringify.convertTextKey && name.indexOf(this.stringify.convertTextKey) === 0) {\n lastChild = this.text(text);\n } else if (!this.options.ignoreDecorators && this.stringify.convertCDataKey && name.indexOf(this.stringify.convertCDataKey) === 0) {\n lastChild = this.cdata(text);\n } else if (!this.options.ignoreDecorators && this.stringify.convertCommentKey && name.indexOf(this.stringify.convertCommentKey) === 0) {\n lastChild = this.comment(text);\n } else if (!this.options.ignoreDecorators && this.stringify.convertRawKey && name.indexOf(this.stringify.convertRawKey) === 0) {\n lastChild = this.raw(text);\n } else if (!this.options.ignoreDecorators && this.stringify.convertPIKey && name.indexOf(this.stringify.convertPIKey) === 0) {\n lastChild = this.instruction(name.substr(this.stringify.convertPIKey.length), text);\n } else {\n lastChild = this.node(name, attributes, text);\n }\n }\n if (lastChild == null) {\n throw new Error(\"Could not create any elements with: \" + name);\n }\n return lastChild;\n };\n\n XMLNode.prototype.insertBefore = function(name, attributes, text) {\n var child, i, removed;\n if (this.isRoot) {\n throw new Error(\"Cannot insert elements at root level\");\n }\n i = this.parent.children.indexOf(this);\n removed = this.parent.children.splice(i);\n child = this.parent.element(name, attributes, text);\n Array.prototype.push.apply(this.parent.children, removed);\n return child;\n };\n\n XMLNode.prototype.insertAfter = function(name, attributes, text) {\n var child, i, removed;\n if (this.isRoot) {\n throw new Error(\"Cannot insert elements at root level\");\n }\n i = this.parent.children.indexOf(this);\n removed = this.parent.children.splice(i + 1);\n child = this.parent.element(name, attributes, text);\n Array.prototype.push.apply(this.parent.children, removed);\n return child;\n };\n\n XMLNode.prototype.remove = function() {\n var i, ref1;\n if (this.isRoot) {\n throw new Error(\"Cannot remove the root element\");\n }\n i = this.parent.children.indexOf(this);\n [].splice.apply(this.parent.children, [i, i - i + 1].concat(ref1 = [])), ref1;\n return this.parent;\n };\n\n XMLNode.prototype.node = function(name, attributes, text) {\n var child, ref1;\n if (name != null) {\n name = name.valueOf();\n }\n attributes || (attributes = {});\n attributes = attributes.valueOf();\n if (!isObject(attributes)) {\n ref1 = [attributes, text], text = ref1[0], attributes = ref1[1];\n }\n child = new XMLElement(this, name, attributes);\n if (text != null) {\n child.text(text);\n }\n this.children.push(child);\n return child;\n };\n\n XMLNode.prototype.text = function(value) {\n var child;\n child = new XMLText(this, value);\n this.children.push(child);\n return this;\n };\n\n XMLNode.prototype.cdata = function(value) {\n var child;\n child = new XMLCData(this, value);\n this.children.push(child);\n return this;\n };\n\n XMLNode.prototype.comment = function(value) {\n var child;\n child = new XMLComment(this, value);\n this.children.push(child);\n return this;\n };\n\n XMLNode.prototype.commentBefore = function(value) {\n var child, i, removed;\n i = this.parent.children.indexOf(this);\n removed = this.parent.children.splice(i);\n child = this.parent.comment(value);\n Array.prototype.push.apply(this.parent.children, removed);\n return this;\n };\n\n XMLNode.prototype.commentAfter = function(value) {\n var child, i, removed;\n i = this.parent.children.indexOf(this);\n removed = this.parent.children.splice(i + 1);\n child = this.parent.comment(value);\n Array.prototype.push.apply(this.parent.children, removed);\n return this;\n };\n\n XMLNode.prototype.raw = function(value) {\n var child;\n child = new XMLRaw(this, value);\n this.children.push(child);\n return this;\n };\n\n XMLNode.prototype.instruction = function(target, value) {\n var insTarget, insValue, instruction, j, len;\n if (target != null) {\n target = target.valueOf();\n }\n if (value != null) {\n value = value.valueOf();\n }\n if (Array.isArray(target)) {\n for (j = 0, len = target.length; j < len; j++) {\n insTarget = target[j];\n this.instruction(insTarget);\n }\n } else if (isObject(target)) {\n for (insTarget in target) {\n if (!hasProp.call(target, insTarget)) continue;\n insValue = target[insTarget];\n this.instruction(insTarget, insValue);\n }\n } else {\n if (isFunction(value)) {\n value = value.apply();\n }\n instruction = new XMLProcessingInstruction(this, target, value);\n this.children.push(instruction);\n }\n return this;\n };\n\n XMLNode.prototype.instructionBefore = function(target, value) {\n var child, i, removed;\n i = this.parent.children.indexOf(this);\n removed = this.parent.children.splice(i);\n child = this.parent.instruction(target, value);\n Array.prototype.push.apply(this.parent.children, removed);\n return this;\n };\n\n XMLNode.prototype.instructionAfter = function(target, value) {\n var child, i, removed;\n i = this.parent.children.indexOf(this);\n removed = this.parent.children.splice(i + 1);\n child = this.parent.instruction(target, value);\n Array.prototype.push.apply(this.parent.children, removed);\n return this;\n };\n\n XMLNode.prototype.declaration = function(version, encoding, standalone) {\n var doc, xmldec;\n doc = this.document();\n xmldec = new XMLDeclaration(doc, version, encoding, standalone);\n if (doc.children[0] instanceof XMLDeclaration) {\n doc.children[0] = xmldec;\n } else {\n doc.children.unshift(xmldec);\n }\n return doc.root() || doc;\n };\n\n XMLNode.prototype.doctype = function(pubID, sysID) {\n var child, doc, doctype, i, j, k, len, len1, ref1, ref2;\n doc = this.document();\n doctype = new XMLDocType(doc, pubID, sysID);\n ref1 = doc.children;\n for (i = j = 0, len = ref1.length; j < len; i = ++j) {\n child = ref1[i];\n if (child instanceof XMLDocType) {\n doc.children[i] = doctype;\n return doctype;\n }\n }\n ref2 = doc.children;\n for (i = k = 0, len1 = ref2.length; k < len1; i = ++k) {\n child = ref2[i];\n if (child.isRoot) {\n doc.children.splice(i, 0, doctype);\n return doctype;\n }\n }\n doc.children.push(doctype);\n return doctype;\n };\n\n XMLNode.prototype.up = function() {\n if (this.isRoot) {\n throw new Error(\"The root node has no parent. Use doc() if you need to get the document object.\");\n }\n return this.parent;\n };\n\n XMLNode.prototype.root = function() {\n var node;\n node = this;\n while (node) {\n if (node.isDocument) {\n return node.rootObject;\n } else if (node.isRoot) {\n return node;\n } else {\n node = node.parent;\n }\n }\n };\n\n XMLNode.prototype.document = function() {\n var node;\n node = this;\n while (node) {\n if (node.isDocument) {\n return node;\n } else {\n node = node.parent;\n }\n }\n };\n\n XMLNode.prototype.end = function(options) {\n return this.document().end(options);\n };\n\n XMLNode.prototype.prev = function() {\n var i;\n i = this.parent.children.indexOf(this);\n if (i < 1) {\n throw new Error(\"Already at the first node\");\n }\n return this.parent.children[i - 1];\n };\n\n XMLNode.prototype.next = function() {\n var i;\n i = this.parent.children.indexOf(this);\n if (i === -1 || i === this.parent.children.length - 1) {\n throw new Error(\"Already at the last node\");\n }\n return this.parent.children[i + 1];\n };\n\n XMLNode.prototype.importDocument = function(doc) {\n var clonedRoot;\n clonedRoot = doc.root().clone();\n clonedRoot.parent = this;\n clonedRoot.isRoot = false;\n this.children.push(clonedRoot);\n return this;\n };\n\n XMLNode.prototype.ele = function(name, attributes, text) {\n return this.element(name, attributes, text);\n };\n\n XMLNode.prototype.nod = function(name, attributes, text) {\n return this.node(name, attributes, text);\n };\n\n XMLNode.prototype.txt = function(value) {\n return this.text(value);\n };\n\n XMLNode.prototype.dat = function(value) {\n return this.cdata(value);\n };\n\n XMLNode.prototype.com = function(value) {\n return this.comment(value);\n };\n\n XMLNode.prototype.ins = function(target, value) {\n return this.instruction(target, value);\n };\n\n XMLNode.prototype.doc = function() {\n return this.document();\n };\n\n XMLNode.prototype.dec = function(version, encoding, standalone) {\n return this.declaration(version, encoding, standalone);\n };\n\n XMLNode.prototype.dtd = function(pubID, sysID) {\n return this.doctype(pubID, sysID);\n };\n\n XMLNode.prototype.e = function(name, attributes, text) {\n return this.element(name, attributes, text);\n };\n\n XMLNode.prototype.n = function(name, attributes, text) {\n return this.node(name, attributes, text);\n };\n\n XMLNode.prototype.t = function(value) {\n return this.text(value);\n };\n\n XMLNode.prototype.d = function(value) {\n return this.cdata(value);\n };\n\n XMLNode.prototype.c = function(value) {\n return this.comment(value);\n };\n\n XMLNode.prototype.r = function(value) {\n return this.raw(value);\n };\n\n XMLNode.prototype.i = function(target, value) {\n return this.instruction(target, value);\n };\n\n XMLNode.prototype.u = function() {\n return this.up();\n };\n\n XMLNode.prototype.importXMLBuilder = function(doc) {\n return this.importDocument(doc);\n };\n\n return XMLNode;\n\n })();\n\n}).call(this);\n\n\n//# sourceURL=webpack:///./node_modules/xmlbuilder/lib/XMLNode.js?");
/***/ }),
/***/ "./node_modules/xmlbuilder/lib/XMLProcessingInstruction.js":
/*!*****************************************************************!*\
!*** ./node_modules/xmlbuilder/lib/XMLProcessingInstruction.js ***!
\*****************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("// Generated by CoffeeScript 1.12.7\n(function() {\n var XMLNode, XMLProcessingInstruction,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n XMLNode = __webpack_require__(/*! ./XMLNode */ \"./node_modules/xmlbuilder/lib/XMLNode.js\");\n\n module.exports = XMLProcessingInstruction = (function(superClass) {\n extend(XMLProcessingInstruction, superClass);\n\n function XMLProcessingInstruction(parent, target, value) {\n XMLProcessingInstruction.__super__.constructor.call(this, parent);\n if (target == null) {\n throw new Error(\"Missing instruction target\");\n }\n this.target = this.stringify.insTarget(target);\n if (value) {\n this.value = this.stringify.insValue(value);\n }\n }\n\n XMLProcessingInstruction.prototype.clone = function() {\n return Object.create(this);\n };\n\n XMLProcessingInstruction.prototype.toString = function(options) {\n return this.options.writer.set(options).processingInstruction(this);\n };\n\n return XMLProcessingInstruction;\n\n })(XMLNode);\n\n}).call(this);\n\n\n//# sourceURL=webpack:///./node_modules/xmlbuilder/lib/XMLProcessingInstruction.js?");
/***/ }),
/***/ "./node_modules/xmlbuilder/lib/XMLRaw.js":
/*!***********************************************!*\
!*** ./node_modules/xmlbuilder/lib/XMLRaw.js ***!
\***********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("// Generated by CoffeeScript 1.12.7\n(function() {\n var XMLNode, XMLRaw,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n XMLNode = __webpack_require__(/*! ./XMLNode */ \"./node_modules/xmlbuilder/lib/XMLNode.js\");\n\n module.exports = XMLRaw = (function(superClass) {\n extend(XMLRaw, superClass);\n\n function XMLRaw(parent, text) {\n XMLRaw.__super__.constructor.call(this, parent);\n if (text == null) {\n throw new Error(\"Missing raw text\");\n }\n this.value = this.stringify.raw(text);\n }\n\n XMLRaw.prototype.clone = function() {\n return Object.create(this);\n };\n\n XMLRaw.prototype.toString = function(options) {\n return this.options.writer.set(options).raw(this);\n };\n\n return XMLRaw;\n\n })(XMLNode);\n\n}).call(this);\n\n\n//# sourceURL=webpack:///./node_modules/xmlbuilder/lib/XMLRaw.js?");
/***/ }),
/***/ "./node_modules/xmlbuilder/lib/XMLStreamWriter.js":
/*!********************************************************!*\
!*** ./node_modules/xmlbuilder/lib/XMLStreamWriter.js ***!
\********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("// Generated by CoffeeScript 1.12.7\n(function() {\n var XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLElement, XMLProcessingInstruction, XMLRaw, XMLStreamWriter, XMLText, XMLWriterBase,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n XMLDeclaration = __webpack_require__(/*! ./XMLDeclaration */ \"./node_modules/xmlbuilder/lib/XMLDeclaration.js\");\n\n XMLDocType = __webpack_require__(/*! ./XMLDocType */ \"./node_modules/xmlbuilder/lib/XMLDocType.js\");\n\n XMLCData = __webpack_require__(/*! ./XMLCData */ \"./node_modules/xmlbuilder/lib/XMLCData.js\");\n\n XMLComment = __webpack_require__(/*! ./XMLComment */ \"./node_modules/xmlbuilder/lib/XMLComment.js\");\n\n XMLElement = __webpack_require__(/*! ./XMLElement */ \"./node_modules/xmlbuilder/lib/XMLElement.js\");\n\n XMLRaw = __webpack_require__(/*! ./XMLRaw */ \"./node_modules/xmlbuilder/lib/XMLRaw.js\");\n\n XMLText = __webpack_require__(/*! ./XMLText */ \"./node_modules/xmlbuilder/lib/XMLText.js\");\n\n XMLProcessingInstruction = __webpack_require__(/*! ./XMLProcessingInstruction */ \"./node_modules/xmlbuilder/lib/XMLProcessingInstruction.js\");\n\n XMLDTDAttList = __webpack_require__(/*! ./XMLDTDAttList */ \"./node_modules/xmlbuilder/lib/XMLDTDAttList.js\");\n\n XMLDTDElement = __webpack_require__(/*! ./XMLDTDElement */ \"./node_modules/xmlbuilder/lib/XMLDTDElement.js\");\n\n XMLDTDEntity = __webpack_require__(/*! ./XMLDTDEntity */ \"./node_modules/xmlbuilder/lib/XMLDTDEntity.js\");\n\n XMLDTDNotation = __webpack_require__(/*! ./XMLDTDNotation */ \"./node_modules/xmlbuilder/lib/XMLDTDNotation.js\");\n\n XMLWriterBase = __webpack_require__(/*! ./XMLWriterBase */ \"./node_modules/xmlbuilder/lib/XMLWriterBase.js\");\n\n module.exports = XMLStreamWriter = (function(superClass) {\n extend(XMLStreamWriter, superClass);\n\n function XMLStreamWriter(stream, options) {\n XMLStreamWriter.__super__.constructor.call(this, options);\n this.stream = stream;\n }\n\n XMLStreamWriter.prototype.document = function(doc) {\n var child, i, j, len, len1, ref, ref1, results;\n ref = doc.children;\n for (i = 0, len = ref.length; i < len; i++) {\n child = ref[i];\n child.isLastRootNode = false;\n }\n doc.children[doc.children.length - 1].isLastRootNode = true;\n ref1 = doc.children;\n results = [];\n for (j = 0, len1 = ref1.length; j < len1; j++) {\n child = ref1[j];\n switch (false) {\n case !(child instanceof XMLDeclaration):\n results.push(this.declaration(child));\n break;\n case !(child instanceof XMLDocType):\n results.push(this.docType(child));\n break;\n case !(child instanceof XMLComment):\n results.push(this.comment(child));\n break;\n case !(child instanceof XMLProcessingInstruction):\n results.push(this.processingInstruction(child));\n break;\n default:\n results.push(this.element(child));\n }\n }\n return results;\n };\n\n XMLStreamWriter.prototype.attribute = function(att) {\n return this.stream.write(' ' + att.name + '=\"' + att.value + '\"');\n };\n\n XMLStreamWriter.prototype.cdata = function(node, level) {\n return this.stream.write(this.space(level) + '<![CDATA[' + node.text + ']]>' + this.endline(node));\n };\n\n XMLStreamWriter.prototype.comment = function(node, level) {\n return this.stream.write(this.space(level) + '<!-- ' + node.text + ' -->' + this.endline(node));\n };\n\n XMLStreamWriter.prototype.declaration = function(node, level) {\n this.stream.write(this.space(level));\n this.stream.write('<?xml version=\"' + node.version + '\"');\n if (node.encoding != null) {\n this.stream.write(' encoding=\"' + node.encoding + '\"');\n }\n if (node.standalone != null) {\n this.stream.write(' standalone=\"' + node.standalone + '\"');\n }\n this.stream.write(this.spacebeforeslash + '?>');\n return this.stream.write(this.endline(node));\n };\n\n XMLStreamWriter.prototype.docType = function(node, level) {\n var child, i, len, ref;\n level || (level = 0);\n this.stream.write(this.space(level));\n this.stream.write('<!DOCTYPE ' + node.root().name);\n if (node.pubID && node.sysID) {\n this.stream.write(' PUBLIC \"' + node.pubID + '\" \"' + node.sysID + '\"');\n } else if (node.sysID) {\n this.stream.write(' SYSTEM \"' + node.sysID + '\"');\n }\n if (node.children.length > 0) {\n this.stream.write(' [');\n this.stream.write(this.endline(node));\n ref = node.children;\n for (i = 0, len = ref.length; i < len; i++) {\n child = ref[i];\n switch (false) {\n case !(child instanceof XMLDTDAttList):\n this.dtdAttList(child, level + 1);\n break;\n case !(child instanceof XMLDTDElement):\n this.dtdElement(child, level + 1);\n break;\n case !(child instanceof XMLDTDEntity):\n this.dtdEntity(child, level + 1);\n break;\n case !(child instanceof XMLDTDNotation):\n this.dtdNotation(child, level + 1);\n break;\n case !(child instanceof XMLCData):\n this.cdata(child, level + 1);\n break;\n case !(child instanceof XMLComment):\n this.comment(child, level + 1);\n break;\n case !(child instanceof XMLProcessingInstruction):\n this.processingInstruction(child, level + 1);\n break;\n default:\n throw new Error(\"Unknown DTD node type: \" + child.constructor.name);\n }\n }\n this.stream.write(']');\n }\n this.stream.write(this.spacebeforeslash + '>');\n return this.stream.write(this.endline(node));\n };\n\n XMLStreamWriter.prototype.element = function(node, level) {\n var att, child, i, len, name, ref, ref1, space;\n level || (level = 0);\n space = this.space(level);\n this.stream.write(space + '<' + node.name);\n ref = node.attributes;\n for (name in ref) {\n if (!hasProp.call(ref, name)) continue;\n att = ref[name];\n this.attribute(att);\n }\n if (node.children.length === 0 || node.children.every(function(e) {\n return e.value === '';\n })) {\n if (this.allowEmpty) {\n this.stream.write('></' + node.name + '>');\n } else {\n this.stream.write(this.spacebeforeslash + '/>');\n }\n } else if (this.pretty && node.children.length === 1 && (node.children[0].value != null)) {\n this.stream.write('>');\n this.stream.write(node.children[0].value);\n this.stream.write('</' + node.name + '>');\n } else {\n this.stream.write('>' + this.newline);\n ref1 = node.children;\n for (i = 0, len = ref1.length; i < len; i++) {\n child = ref1[i];\n switch (false) {\n case !(child instanceof XMLCData):\n this.cdata(child, level + 1);\n break;\n case !(child instanceof XMLComment):\n this.comment(child, level + 1);\n break;\n case !(child instanceof XMLElement):\n this.element(child, level + 1);\n break;\n case !(child instanceof XMLRaw):\n this.raw(child, level + 1);\n break;\n case !(child instanceof XMLText):\n this.text(child, level + 1);\n break;\n case !(child instanceof XMLProcessingInstruction):\n this.processingInstruction(child, level + 1);\n break;\n default:\n throw new Error(\"Unknown XML node type: \" + child.constructor.name);\n }\n }\n this.stream.write(space + '</' + node.name + '>');\n }\n return this.stream.write(this.endline(node));\n };\n\n XMLStreamWriter.prototype.processingInstruction = function(node, level) {\n this.stream.write(this.space(level) + '<?' + node.target);\n if (node.value) {\n this.stream.write(' ' + node.value);\n }\n return this.stream.write(this.spacebeforeslash + '?>' + this.endline(node));\n };\n\n XMLStreamWriter.prototype.raw = function(node, level) {\n return this.stream.write(this.space(level) + node.value + this.endline(node));\n };\n\n XMLStreamWriter.prototype.text = function(node, level) {\n return this.stream.write(this.space(level) + node.value + this.endline(node));\n };\n\n XMLStreamWriter.prototype.dtdAttList = function(node, level) {\n this.stream.write(this.space(level) + '<!ATTLIST ' + node.elementName + ' ' + node.attributeName + ' ' + node.attributeType);\n if (node.defaultValueType !== '#DEFAULT') {\n this.stream.write(' ' + node.defaultValueType);\n }\n if (node.defaultValue) {\n this.stream.write(' \"' + node.defaultValue + '\"');\n }\n return this.stream.write(this.spacebeforeslash + '>' + this.endline(node));\n };\n\n XMLStreamWriter.prototype.dtdElement = function(node, level) {\n this.stream.write(this.space(level) + '<!ELEMENT ' + node.name + ' ' + node.value);\n return this.stream.write(this.spacebeforeslash + '>' + this.endline(node));\n };\n\n XMLStreamWriter.prototype.dtdEntity = function(node, level) {\n this.stream.write(this.space(level) + '<!ENTITY');\n if (node.pe) {\n this.stream.write(' %');\n }\n this.stream.write(' ' + node.name);\n if (node.value) {\n this.stream.write(' \"' + node.value + '\"');\n } else {\n if (node.pubID && node.sysID) {\n this.stream.write(' PUBLIC \"' + node.pubID + '\" \"' + node.sysID + '\"');\n } else if (node.sysID) {\n this.stream.write(' SYSTEM \"' + node.sysID + '\"');\n }\n if (node.nData) {\n this.stream.write(' NDATA ' + node.nData);\n }\n }\n return this.stream.write(this.spacebeforeslash + '>' + this.endline(node));\n };\n\n XMLStreamWriter.prototype.dtdNotation = function(node, level) {\n this.stream.write(this.space(level) + '<!NOTATION ' + node.name);\n if (node.pubID && node.sysID) {\n this.stream.write(' PUBLIC \"' + node.pubID + '\" \"' + node.sysID + '\"');\n } else if (node.pubID) {\n this.stream.write(' PUBLIC \"' + node.pubID + '\"');\n } else if (node.sysID) {\n this.stream.write(' SYSTEM \"' + node.sysID + '\"');\n }\n return this.stream.write(this.spacebeforeslash + '>' + this.endline(node));\n };\n\n XMLStreamWriter.prototype.endline = function(node) {\n if (!node.isLastRootNode) {\n return this.newline;\n } else {\n return '';\n }\n };\n\n return XMLStreamWriter;\n\n })(XMLWriterBase);\n\n}).call(this);\n\n\n//# sourceURL=webpack:///./node_modules/xmlbuilder/lib/XMLStreamWriter.js?");
/***/ }),
/***/ "./node_modules/xmlbuilder/lib/XMLStringWriter.js":
/*!********************************************************!*\
!*** ./node_modules/xmlbuilder/lib/XMLStringWriter.js ***!
\********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("// Generated by CoffeeScript 1.12.7\n(function() {\n var XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLElement, XMLProcessingInstruction, XMLRaw, XMLStringWriter, XMLText, XMLWriterBase,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n XMLDeclaration = __webpack_require__(/*! ./XMLDeclaration */ \"./node_modules/xmlbuilder/lib/XMLDeclaration.js\");\n\n XMLDocType = __webpack_require__(/*! ./XMLDocType */ \"./node_modules/xmlbuilder/lib/XMLDocType.js\");\n\n XMLCData = __webpack_require__(/*! ./XMLCData */ \"./node_modules/xmlbuilder/lib/XMLCData.js\");\n\n XMLComment = __webpack_require__(/*! ./XMLComment */ \"./node_modules/xmlbuilder/lib/XMLComment.js\");\n\n XMLElement = __webpack_require__(/*! ./XMLElement */ \"./node_modules/xmlbuilder/lib/XMLElement.js\");\n\n XMLRaw = __webpack_require__(/*! ./XMLRaw */ \"./node_modules/xmlbuilder/lib/XMLRaw.js\");\n\n XMLText = __webpack_require__(/*! ./XMLText */ \"./node_modules/xmlbuilder/lib/XMLText.js\");\n\n XMLProcessingInstruction = __webpack_require__(/*! ./XMLProcessingInstruction */ \"./node_modules/xmlbuilder/lib/XMLProcessingInstruction.js\");\n\n XMLDTDAttList = __webpack_require__(/*! ./XMLDTDAttList */ \"./node_modules/xmlbuilder/lib/XMLDTDAttList.js\");\n\n XMLDTDElement = __webpack_require__(/*! ./XMLDTDElement */ \"./node_modules/xmlbuilder/lib/XMLDTDElement.js\");\n\n XMLDTDEntity = __webpack_require__(/*! ./XMLDTDEntity */ \"./node_modules/xmlbuilder/lib/XMLDTDEntity.js\");\n\n XMLDTDNotation = __webpack_require__(/*! ./XMLDTDNotation */ \"./node_modules/xmlbuilder/lib/XMLDTDNotation.js\");\n\n XMLWriterBase = __webpack_require__(/*! ./XMLWriterBase */ \"./node_modules/xmlbuilder/lib/XMLWriterBase.js\");\n\n module.exports = XMLStringWriter = (function(superClass) {\n extend(XMLStringWriter, superClass);\n\n function XMLStringWriter(options) {\n XMLStringWriter.__super__.constructor.call(this, options);\n }\n\n XMLStringWriter.prototype.document = function(doc) {\n var child, i, len, r, ref;\n this.textispresent = false;\n r = '';\n ref = doc.children;\n for (i = 0, len = ref.length; i < len; i++) {\n child = ref[i];\n r += (function() {\n switch (false) {\n case !(child instanceof XMLDeclaration):\n return this.declaration(child);\n case !(child instanceof XMLDocType):\n return this.docType(child);\n case !(child instanceof XMLComment):\n return this.comment(child);\n case !(child instanceof XMLProcessingInstruction):\n return this.processingInstruction(child);\n default:\n return this.element(child, 0);\n }\n }).call(this);\n }\n if (this.pretty && r.slice(-this.newline.length) === this.newline) {\n r = r.slice(0, -this.newline.length);\n }\n return r;\n };\n\n XMLStringWriter.prototype.attribute = function(att) {\n return ' ' + att.name + '=\"' + att.value + '\"';\n };\n\n XMLStringWriter.prototype.cdata = function(node, level) {\n return this.space(level) + '<![CDATA[' + node.text + ']]>' + this.newline;\n };\n\n XMLStringWriter.prototype.comment = function(node, level) {\n return this.space(level) + '<!-- ' + node.text + ' -->' + this.newline;\n };\n\n XMLStringWriter.prototype.declaration = function(node, level) {\n var r;\n r = this.space(level);\n r += '<?xml version=\"' + node.version + '\"';\n if (node.encoding != null) {\n r += ' encoding=\"' + node.encoding + '\"';\n }\n if (node.standalone != null) {\n r += ' standalone=\"' + node.standalone + '\"';\n }\n r += this.spacebeforeslash + '?>';\n r += this.newline;\n return r;\n };\n\n XMLStringWriter.prototype.docType = function(node, level) {\n var child, i, len, r, ref;\n level || (level = 0);\n r = this.space(level);\n r += '<!DOCTYPE ' + node.root().name;\n if (node.pubID && node.sysID) {\n r += ' PUBLIC \"' + node.pubID + '\" \"' + node.sysID + '\"';\n } else if (node.sysID) {\n r += ' SYSTEM \"' + node.sysID + '\"';\n }\n if (node.children.length > 0) {\n r += ' [';\n r += this.newline;\n ref = node.children;\n for (i = 0, len = ref.length; i < len; i++) {\n child = ref[i];\n r += (function() {\n switch (false) {\n case !(child instanceof XMLDTDAttList):\n return this.dtdAttList(child, level + 1);\n case !(child instanceof XMLDTDElement):\n return this.dtdElement(child, level + 1);\n case !(child instanceof XMLDTDEntity):\n return this.dtdEntity(child, level + 1);\n case !(child instanceof XMLDTDNotation):\n return this.dtdNotation(child, level + 1);\n case !(child instanceof XMLCData):\n return this.cdata(child, level + 1);\n case !(child instanceof XMLComment):\n return this.comment(child, level + 1);\n case !(child instanceof XMLProcessingInstruction):\n return this.processingInstruction(child, level + 1);\n default:\n throw new Error(\"Unknown DTD node type: \" + child.constructor.name);\n }\n }).call(this);\n }\n r += ']';\n }\n r += this.spacebeforeslash + '>';\n r += this.newline;\n return r;\n };\n\n XMLStringWriter.prototype.element = function(node, level) {\n var att, child, i, j, len, len1, name, r, ref, ref1, ref2, space, textispresentwasset;\n level || (level = 0);\n textispresentwasset = false;\n if (this.textispresent) {\n this.newline = '';\n this.pretty = false;\n } else {\n this.newline = this.newlinedefault;\n this.pretty = this.prettydefault;\n }\n space = this.space(level);\n r = '';\n r += space + '<' + node.name;\n ref = node.attributes;\n for (name in ref) {\n if (!hasProp.call(ref, name)) continue;\n att = ref[name];\n r += this.attribute(att);\n }\n if (node.children.length === 0 || node.children.every(function(e) {\n return e.value === '';\n })) {\n if (this.allowEmpty) {\n r += '></' + node.name + '>' + this.newline;\n } else {\n r += this.spacebeforeslash + '/>' + this.newline;\n }\n } else if (this.pretty && node.children.length === 1 && (node.children[0].value != null)) {\n r += '>';\n r += node.children[0].value;\n r += '</' + node.name + '>' + this.newline;\n } else {\n if (this.dontprettytextnodes) {\n ref1 = node.children;\n for (i = 0, len = ref1.length; i < len; i++) {\n child = ref1[i];\n if (child.value != null) {\n this.textispresent++;\n textispresentwasset = true;\n break;\n }\n }\n }\n if (this.textispresent) {\n this.newline = '';\n this.pretty = false;\n space = this.space(level);\n }\n r += '>' + this.newline;\n ref2 = node.children;\n for (j = 0, len1 = ref2.length; j < len1; j++) {\n child = ref2[j];\n r += (function() {\n switch (false) {\n case !(child instanceof XMLCData):\n return this.cdata(child, level + 1);\n case !(child instanceof XMLComment):\n return this.comment(child, level + 1);\n case !(child instanceof XMLElement):\n return this.element(child, level + 1);\n case !(child instanceof XMLRaw):\n return this.raw(child, level + 1);\n case !(child instanceof XMLText):\n return this.text(child, level + 1);\n case !(child instanceof XMLProcessingInstruction):\n return this.processingInstruction(child, level + 1);\n default:\n throw new Error(\"Unknown XML node type: \" + child.constructor.name);\n }\n }).call(this);\n }\n if (textispresentwasset) {\n this.textispresent--;\n }\n if (!this.textispresent) {\n this.newline = this.newlinedefault;\n this.pretty = this.prettydefault;\n }\n r += space + '</' + node.name + '>' + this.newline;\n }\n return r;\n };\n\n XMLStringWriter.prototype.processingInstruction = function(node, level) {\n var r;\n r = this.space(level) + '<?' + node.target;\n if (node.value) {\n r += ' ' + node.value;\n }\n r += this.spacebeforeslash + '?>' + this.newline;\n return r;\n };\n\n XMLStringWriter.prototype.raw = function(node, level) {\n return this.space(level) + node.value + this.newline;\n };\n\n XMLStringWriter.prototype.text = function(node, level) {\n return this.space(level) + node.value + this.newline;\n };\n\n XMLStringWriter.prototype.dtdAttList = function(node, level) {\n var r;\n r = this.space(level) + '<!ATTLIST ' + node.elementName + ' ' + node.attributeName + ' ' + node.attributeType;\n if (node.defaultValueType !== '#DEFAULT') {\n r += ' ' + node.defaultValueType;\n }\n if (node.defaultValue) {\n r += ' \"' + node.defaultValue + '\"';\n }\n r += this.spacebeforeslash + '>' + this.newline;\n return r;\n };\n\n XMLStringWriter.prototype.dtdElement = function(node, level) {\n return this.space(level) + '<!ELEMENT ' + node.name + ' ' + node.value + this.spacebeforeslash + '>' + this.newline;\n };\n\n XMLStringWriter.prototype.dtdEntity = function(node, level) {\n var r;\n r = this.space(level) + '<!ENTITY';\n if (node.pe) {\n r += ' %';\n }\n r += ' ' + node.name;\n if (node.value) {\n r += ' \"' + node.value + '\"';\n } else {\n if (node.pubID && node.sysID) {\n r += ' PUBLIC \"' + node.pubID + '\" \"' + node.sysID + '\"';\n } else if (node.sysID) {\n r += ' SYSTEM \"' + node.sysID + '\"';\n }\n if (node.nData) {\n r += ' NDATA ' + node.nData;\n }\n }\n r += this.spacebeforeslash + '>' + this.newline;\n return r;\n };\n\n XMLStringWriter.prototype.dtdNotation = function(node, level) {\n var r;\n r = this.space(level) + '<!NOTATION ' + node.name;\n if (node.pubID && node.sysID) {\n r += ' PUBLIC \"' + node.pubID + '\" \"' + node.sysID + '\"';\n } else if (node.pubID) {\n r += ' PUBLIC \"' + node.pubID + '\"';\n } else if (node.sysID) {\n r += ' SYSTEM \"' + node.sysID + '\"';\n }\n r += this.spacebeforeslash + '>' + this.newline;\n return r;\n };\n\n XMLStringWriter.prototype.openNode = function(node, level) {\n var att, name, r, ref;\n level || (level = 0);\n if (node instanceof XMLElement) {\n r = this.space(level) + '<' + node.name;\n ref = node.attributes;\n for (name in ref) {\n if (!hasProp.call(ref, name)) continue;\n att = ref[name];\n r += this.attribute(att);\n }\n r += (node.children ? '>' : '/>') + this.newline;\n return r;\n } else {\n r = this.space(level) + '<!DOCTYPE ' + node.rootNodeName;\n if (node.pubID && node.sysID) {\n r += ' PUBLIC \"' + node.pubID + '\" \"' + node.sysID + '\"';\n } else if (node.sysID) {\n r += ' SYSTEM \"' + node.sysID + '\"';\n }\n r += (node.children ? ' [' : '>') + this.newline;\n return r;\n }\n };\n\n XMLStringWriter.prototype.closeNode = function(node, level) {\n level || (level = 0);\n switch (false) {\n case !(node instanceof XMLElement):\n return this.space(level) + '</' + node.name + '>' + this.newline;\n case !(node instanceof XMLDocType):\n return this.space(level) + ']>' + this.newline;\n }\n };\n\n return XMLStringWriter;\n\n })(XMLWriterBase);\n\n}).call(this);\n\n\n//# sourceURL=webpack:///./node_modules/xmlbuilder/lib/XMLStringWriter.js?");
/***/ }),
/***/ "./node_modules/xmlbuilder/lib/XMLStringifier.js":
/*!*******************************************************!*\
!*** ./node_modules/xmlbuilder/lib/XMLStringifier.js ***!
\*******************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
eval("// Generated by CoffeeScript 1.12.7\n(function() {\n var XMLStringifier,\n bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },\n hasProp = {}.hasOwnProperty;\n\n module.exports = XMLStringifier = (function() {\n function XMLStringifier(options) {\n this.assertLegalChar = bind(this.assertLegalChar, this);\n var key, ref, value;\n options || (options = {});\n this.noDoubleEncoding = options.noDoubleEncoding;\n ref = options.stringify || {};\n for (key in ref) {\n if (!hasProp.call(ref, key)) continue;\n value = ref[key];\n this[key] = value;\n }\n }\n\n XMLStringifier.prototype.eleName = function(val) {\n val = '' + val || '';\n return this.assertLegalChar(val);\n };\n\n XMLStringifier.prototype.eleText = function(val) {\n val = '' + val || '';\n return this.assertLegalChar(this.elEscape(val));\n };\n\n XMLStringifier.prototype.cdata = function(val) {\n val = '' + val || '';\n val = val.replace(']]>', ']]]]><![CDATA[>');\n return this.assertLegalChar(val);\n };\n\n XMLStringifier.prototype.comment = function(val) {\n val = '' + val || '';\n if (val.match(/--/)) {\n throw new Error(\"Comment text cannot contain double-hypen: \" + val);\n }\n return this.assertLegalChar(val);\n };\n\n XMLStringifier.prototype.raw = function(val) {\n return '' + val || '';\n };\n\n XMLStringifier.prototype.attName = function(val) {\n return val = '' + val || '';\n };\n\n XMLStringifier.prototype.attValue = function(val) {\n val = '' + val || '';\n return this.attEscape(val);\n };\n\n XMLStringifier.prototype.insTarget = function(val) {\n return '' + val || '';\n };\n\n XMLStringifier.prototype.insValue = function(val) {\n val = '' + val || '';\n if (val.match(/\\?>/)) {\n throw new Error(\"Invalid processing instruction value: \" + val);\n }\n return val;\n };\n\n XMLStringifier.prototype.xmlVersion = function(val) {\n val = '' + val || '';\n if (!val.match(/1\\.[0-9]+/)) {\n throw new Error(\"Invalid version number: \" + val);\n }\n return val;\n };\n\n XMLStringifier.prototype.xmlEncoding = function(val) {\n val = '' + val || '';\n if (!val.match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/)) {\n throw new Error(\"Invalid encoding: \" + val);\n }\n return val;\n };\n\n XMLStringifier.prototype.xmlStandalone = function(val) {\n if (val) {\n return \"yes\";\n } else {\n return \"no\";\n }\n };\n\n XMLStringifier.prototype.dtdPubID = function(val) {\n return '' + val || '';\n };\n\n XMLStringifier.prototype.dtdSysID = function(val) {\n return '' + val || '';\n };\n\n XMLStringifier.prototype.dtdElementValue = function(val) {\n return '' + val || '';\n };\n\n XMLStringifier.prototype.dtdAttType = function(val) {\n return '' + val || '';\n };\n\n XMLStringifier.prototype.dtdAttDefault = function(val) {\n if (val != null) {\n return '' + val || '';\n } else {\n return val;\n }\n };\n\n XMLStringifier.prototype.dtdEntityValue = function(val) {\n return '' + val || '';\n };\n\n XMLStringifier.prototype.dtdNData = function(val) {\n return '' + val || '';\n };\n\n XMLStringifier.prototype.convertAttKey = '@';\n\n XMLStringifier.prototype.convertPIKey = '?';\n\n XMLStringifier.prototype.convertTextKey = '#text';\n\n XMLStringifier.prototype.convertCDataKey = '#cdata';\n\n XMLStringifier.prototype.convertCommentKey = '#comment';\n\n XMLStringifier.prototype.convertRawKey = '#raw';\n\n XMLStringifier.prototype.assertLegalChar = function(str) {\n var res;\n res = str.match(/[\\0\\uFFFE\\uFFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF]/);\n if (res) {\n throw new Error(\"Invalid character in string: \" + str + \" at index \" + res.index);\n }\n return str;\n };\n\n XMLStringifier.prototype.elEscape = function(str) {\n var ampregex;\n ampregex = this.noDoubleEncoding ? /(?!&\\S+;)&/g : /&/g;\n return str.replace(ampregex, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/\\r/g, '&#xD;');\n };\n\n XMLStringifier.prototype.attEscape = function(str) {\n var ampregex;\n ampregex = this.noDoubleEncoding ? /(?!&\\S+;)&/g : /&/g;\n return str.replace(ampregex, '&amp;').replace(/</g, '&lt;').replace(/\"/g, '&quot;').replace(/\\t/g, '&#x9;').replace(/\\n/g, '&#xA;').replace(/\\r/g, '&#xD;');\n };\n\n return XMLStringifier;\n\n })();\n\n}).call(this);\n\n\n//# sourceURL=webpack:///./node_modules/xmlbuilder/lib/XMLStringifier.js?");
/***/ }),
/***/ "./node_modules/xmlbuilder/lib/XMLText.js":
/*!************************************************!*\
!*** ./node_modules/xmlbuilder/lib/XMLText.js ***!
\************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("// Generated by CoffeeScript 1.12.7\n(function() {\n var XMLNode, XMLText,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n XMLNode = __webpack_require__(/*! ./XMLNode */ \"./node_modules/xmlbuilder/lib/XMLNode.js\");\n\n module.exports = XMLText = (function(superClass) {\n extend(XMLText, superClass);\n\n function XMLText(parent, text) {\n XMLText.__super__.constructor.call(this, parent);\n if (text == null) {\n throw new Error(\"Missing element text\");\n }\n this.value = this.stringify.eleText(text);\n }\n\n XMLText.prototype.clone = function() {\n return Object.create(this);\n };\n\n XMLText.prototype.toString = function(options) {\n return this.options.writer.set(options).text(this);\n };\n\n return XMLText;\n\n })(XMLNode);\n\n}).call(this);\n\n\n//# sourceURL=webpack:///./node_modules/xmlbuilder/lib/XMLText.js?");
/***/ }),
/***/ "./node_modules/xmlbuilder/lib/XMLWriterBase.js":
/*!******************************************************!*\
!*** ./node_modules/xmlbuilder/lib/XMLWriterBase.js ***!
\******************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
eval("// Generated by CoffeeScript 1.12.7\n(function() {\n var XMLWriterBase,\n hasProp = {}.hasOwnProperty;\n\n module.exports = XMLWriterBase = (function() {\n function XMLWriterBase(options) {\n var key, ref, ref1, ref2, ref3, ref4, ref5, ref6, value;\n options || (options = {});\n this.pretty = options.pretty || false;\n this.allowEmpty = (ref = options.allowEmpty) != null ? ref : false;\n if (this.pretty) {\n this.indent = (ref1 = options.indent) != null ? ref1 : ' ';\n this.newline = (ref2 = options.newline) != null ? ref2 : '\\n';\n this.offset = (ref3 = options.offset) != null ? ref3 : 0;\n this.dontprettytextnodes = (ref4 = options.dontprettytextnodes) != null ? ref4 : 0;\n } else {\n this.indent = '';\n this.newline = '';\n this.offset = 0;\n this.dontprettytextnodes = 0;\n }\n this.spacebeforeslash = (ref5 = options.spacebeforeslash) != null ? ref5 : '';\n if (this.spacebeforeslash === true) {\n this.spacebeforeslash = ' ';\n }\n this.newlinedefault = this.newline;\n this.prettydefault = this.pretty;\n ref6 = options.writer || {};\n for (key in ref6) {\n if (!hasProp.call(ref6, key)) continue;\n value = ref6[key];\n this[key] = value;\n }\n }\n\n XMLWriterBase.prototype.set = function(options) {\n var key, ref, value;\n options || (options = {});\n if (\"pretty\" in options) {\n this.pretty = options.pretty;\n }\n if (\"allowEmpty\" in options) {\n this.allowEmpty = options.allowEmpty;\n }\n if (this.pretty) {\n this.indent = \"indent\" in options ? options.indent : ' ';\n this.newline = \"newline\" in options ? options.newline : '\\n';\n this.offset = \"offset\" in options ? options.offset : 0;\n this.dontprettytextnodes = \"dontprettytextnodes\" in options ? options.dontprettytextnodes : 0;\n } else {\n this.indent = '';\n this.newline = '';\n this.offset = 0;\n this.dontprettytextnodes = 0;\n }\n this.spacebeforeslash = \"spacebeforeslash\" in options ? options.spacebeforeslash : '';\n if (this.spacebeforeslash === true) {\n this.spacebeforeslash = ' ';\n }\n this.newlinedefault = this.newline;\n this.prettydefault = this.pretty;\n ref = options.writer || {};\n for (key in ref) {\n if (!hasProp.call(ref, key)) continue;\n value = ref[key];\n this[key] = value;\n }\n return this;\n };\n\n XMLWriterBase.prototype.space = function(level) {\n var indent;\n if (this.pretty) {\n indent = (level || 0) + this.offset + 1;\n if (indent > 0) {\n return new Array(indent).join(this.indent);\n } else {\n return '';\n }\n } else {\n return '';\n }\n };\n\n return XMLWriterBase;\n\n })();\n\n}).call(this);\n\n\n//# sourceURL=webpack:///./node_modules/xmlbuilder/lib/XMLWriterBase.js?");
/***/ }),
/***/ "./node_modules/xmlbuilder/lib/index.js":
/*!**********************************************!*\
!*** ./node_modules/xmlbuilder/lib/index.js ***!
\**********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("// Generated by CoffeeScript 1.12.7\n(function() {\n var XMLDocument, XMLDocumentCB, XMLStreamWriter, XMLStringWriter, assign, isFunction, ref;\n\n ref = __webpack_require__(/*! ./Utility */ \"./node_modules/xmlbuilder/lib/Utility.js\"), assign = ref.assign, isFunction = ref.isFunction;\n\n XMLDocument = __webpack_require__(/*! ./XMLDocument */ \"./node_modules/xmlbuilder/lib/XMLDocument.js\");\n\n XMLDocumentCB = __webpack_require__(/*! ./XMLDocumentCB */ \"./node_modules/xmlbuilder/lib/XMLDocumentCB.js\");\n\n XMLStringWriter = __webpack_require__(/*! ./XMLStringWriter */ \"./node_modules/xmlbuilder/lib/XMLStringWriter.js\");\n\n XMLStreamWriter = __webpack_require__(/*! ./XMLStreamWriter */ \"./node_modules/xmlbuilder/lib/XMLStreamWriter.js\");\n\n module.exports.create = function(name, xmldec, doctype, options) {\n var doc, root;\n if (name == null) {\n throw new Error(\"Root element needs a name\");\n }\n options = assign({}, xmldec, doctype, options);\n doc = new XMLDocument(options);\n root = doc.element(name);\n if (!options.headless) {\n doc.declaration(options);\n if ((options.pubID != null) || (options.sysID != null)) {\n doc.doctype(options);\n }\n }\n return root;\n };\n\n module.exports.begin = function(options, onData, onEnd) {\n var ref1;\n if (isFunction(options)) {\n ref1 = [options, onData], onData = ref1[0], onEnd = ref1[1];\n options = {};\n }\n if (onData) {\n return new XMLDocumentCB(options, onData, onEnd);\n } else {\n return new XMLDocument(options);\n }\n };\n\n module.exports.stringWriter = function(options) {\n return new XMLStringWriter(options);\n };\n\n module.exports.streamWriter = function(stream, options) {\n return new XMLStreamWriter(stream, options);\n };\n\n}).call(this);\n\n\n//# sourceURL=webpack:///./node_modules/xmlbuilder/lib/index.js?");
/***/ }),
/***/ "./src/formats/newick.js":
/*!*******************************!*\
!*** ./src/formats/newick.js ***!
\*******************************/
/*! no static exports found */
/***/ (function(module, exports) {
eval("/**\n * Parses a Newick string into an equivalent JSON representation that is\n * suitable for consumption by ``d3.layout.hierarchy``.\n *\n * Optionally accepts bootstrap values. Currently supports Newick strings with or without branch lengths,\n * as well as tagged trees such as\n * ``(a,(b{TAG},(c{TAG},d{ANOTHERTAG})))``\n *\n * @param {String} nwk_str - A string representing a phylogenetic tree in Newick format.\n * @param {Object} bootstrap_values.\n * @returns {Object} An object with keys ``json`` and ``error``.\n */\nvar newick_parser = function(nwk_str, bootstrap_values) {\n var clade_stack = [];\n\n function add_new_tree_level() {\n var new_level = {\n name: null\n };\n var the_parent = clade_stack[clade_stack.length - 1];\n if (!(\"children\" in the_parent)) {\n the_parent[\"children\"] = [];\n }\n clade_stack.push(new_level);\n the_parent[\"children\"].push(clade_stack[clade_stack.length - 1]);\n clade_stack[clade_stack.length - 1][\"original_child_order\"] =\n the_parent[\"children\"].length;\n }\n\n function finish_node_definition() {\n var this_node = clade_stack.pop();\n if (bootstrap_values && \"children\" in this_node) {\n this_node[\"bootstrap_values\"] = current_node_name;\n } else {\n this_node[\"name\"] = current_node_name;\n }\n this_node[\"attribute\"] = current_node_attribute;\n this_node[\"annotation\"] = current_node_annotation;\n current_node_name = \"\";\n current_node_attribute = \"\";\n current_node_annotation = \"\";\n }\n\n function generate_error(location) {\n return {\n json: null,\n error:\n \"Unexpected '\" +\n nwk_str[location] +\n \"' in '\" +\n nwk_str.substring(location - 20, location + 1) +\n \"[ERROR HERE]\" +\n nwk_str.substring(location + 1, location + 20) +\n \"'\"\n };\n }\n\n var automaton_state = 0;\n var current_node_name = \"\";\n var current_node_attribute = \"\";\n var current_node_annotation = \"\";\n var quote_delimiter = null;\n var name_quotes = {\n \"'\": 1,\n '\"': 1\n };\n\n var tree_json = {\n name: \"root\"\n };\n clade_stack.push(tree_json);\n\n var space = /\\s/;\n\n for (var char_index = 0; char_index < nwk_str.length; char_index++) {\n try {\n var current_char = nwk_str[char_index];\n switch (automaton_state) {\n case 0: {\n // look for the first opening parenthesis\n if (current_char == \"(\") {\n add_new_tree_level();\n automaton_state = 1; // expecting node name\n }\n break;\n }\n case 1: // name\n case 3: {\n // branch length\n // reading name\n if (current_char == \":\") {\n automaton_state = 3;\n } else if (current_char == \",\" || current_char == \")\") {\n try {\n finish_node_definition();\n automaton_state = 1;\n if (current_char == \",\") {\n add_new_tree_level();\n }\n } catch (e) {\n return generate_error(char_index);\n }\n } else if (current_char == \"(\") {\n if (current_node_name.length > 0) {\n return generate_error(char_index);\n } else {\n add_new_tree_level();\n }\n } else if (current_char in name_quotes) {\n if (\n automaton_state == 1 &&\n current_node_name.length === 0 &&\n current_node_attribute.length === 0 &&\n current_node_annotation.length === 0\n ) {\n automaton_state = 2;\n quote_delimiter = current_char;\n continue;\n }\n return generate_error(char_index);\n } else {\n if (current_char == \"[\") {\n if (current_node_annotation.length) {\n return generate_error(char_index);\n } else {\n automaton_state = 4;\n }\n } else {\n if (automaton_state == 3) {\n current_node_attribute += current_char;\n } else {\n if (space.test(current_char)) {\n continue;\n }\n if (current_char == \";\") {\n // semicolon terminates tree definition\n char_index = nwk_str.length;\n break;\n }\n current_node_name += current_char;\n }\n }\n }\n\n break;\n }\n case 2: {\n // inside a quoted expression\n if (current_char == quote_delimiter) {\n if (char_index < nwk_str.length - 1) {\n if (nwk_str[char_index + 1] == quote_delimiter) {\n char_index++;\n current_node_name += quote_delimiter;\n continue;\n }\n }\n quote_delimiter = 0;\n automaton_state = 1;\n continue;\n } else {\n current_node_name += current_char;\n }\n break;\n }\n case 4: {\n // inside a comment / attribute\n if (current_char == \"]\") {\n automaton_state = 3;\n } else {\n if (current_char == \"[\") {\n return generate_error(char_index);\n }\n current_node_annotation += current_char;\n }\n break;\n }\n }\n } catch (e) {\n return generate_error(char_index);\n }\n }\n\n if (clade_stack.length != 1) {\n return generate_error(nwk_str.length - 1);\n }\n\n if (current_node_name.length) {\n tree_json.name = current_node_name;\n }\n\n return {\n json: tree_json,\n error: null\n };\n};\n\nmodule.exports = newick_parser;\n\n\n//# sourceURL=webpack:///./src/formats/newick.js?");
/***/ }),
/***/ "./src/formats/nexml.js":
/*!******************************!*\
!*** ./src/formats/nexml.js ***!
\******************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("const parseString = __webpack_require__(/*! xml2js */ \"./node_modules/xml2js/lib/xml2js.js\").parseString;\n\n/**\n * A parser for NexML. This is a separate function, since NeXML objects\n * can contain multiple trees. Results should be passed into a phylotree\n * object, as shown in the examples.\n *\n * @param {Object} nexml - A NeXML string.\n * @returns {Object} trees - An array of trees contained in the NeXML object.\n */\nvar nexml_parser = function(xml_string, options) {\n var trees;\n parseString(xml_string, function(error, xml) {\n trees = xml[\"nex:nexml\"].trees[0].tree.map(function(nexml_tree) {\n var node_list = nexml_tree.node.map(d => d.$),\n node_hash = node_list.reduce(function(a, b) {\n b.edges = [];\n b.name = b.id;\n a[b.id] = b;\n return a;\n }, {}),\n roots = node_list.filter(d => d.root),\n root_id = roots > 0 ? roots[0].id : node_list[0].id;\n node_hash[root_id].name = \"root\";\n\n nexml_tree.edge.map(d => d.$).forEach(function(edge) {\n node_hash[edge.source].edges.push(edge);\n });\n\n function parse_nexml(node, index) {\n if (node.edges) {\n var targets = _.pluck(node.edges, \"target\");\n node.children = _.values(_.pick(node_hash, targets));\n node.children.forEach(function(child, i) {\n child.attribute = node.edges[i].length || \"\";\n });\n node.children.forEach(parse_nexml);\n node.annotation = \"\";\n }\n }\n\n parse_nexml(node_hash[root_id]);\n return node_hash[root_id];\n });\n });\n return trees;\n};\n\nmodule.exports = nexml_parser;\n\n\n//# sourceURL=webpack:///./src/formats/nexml.js?");
/***/ }),
/***/ "./src/formats/phyloxml.js":
/*!*********************************!*\
!*** ./src/formats/phyloxml.js ***!
\*********************************/
/*! no static exports found */
/***/ (function(module, exports) {
eval("var phyloxml_parser = function(xml_string, options) {\n function parse_phyloxml(node, index) {\n if (node.clade) {\n node.clade.forEach(parse_phyloxml);\n node.children = node.clade;\n delete node.clade;\n }\n node.original_child_order = index + 1;\n\n if (node.branch_length) {\n node.attribute = node.branch_length[0];\n }\n if (node.taxonomy) {\n node.name = node.taxonomy[0].scientific_name[0];\n }\n node.annotation = \"\";\n }\n\n var tree_json;\n\n parseString(xml_string, function(error, xml) {\n tree_json = xml.phyloxml.phylogeny[0].clade[0];\n tree_json.name = \"root\";\n parse_phyloxml(tree_json);\n });\n\n return {\n json: tree_json,\n error: null\n };\n};\n\nmodule.exports = phyloxml_parser;\n\n\n//# sourceURL=webpack:///./src/formats/phyloxml.js?");
/***/ }),
/***/ "./src/formats/registry.js":
/*!*********************************!*\
!*** ./src/formats/registry.js ***!
\*********************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("const nexml_parser = __webpack_require__(/*! ./nexml */ \"./src/formats/nexml.js\");\nconst newick_parser = __webpack_require__(/*! ./newick */ \"./src/formats/newick.js\");\nconst phyloxml_parser = __webpack_require__(/*! ./phyloxml */ \"./src/formats/phyloxml.js\");\n\n/* \n * A parser must have two fields, the object and\n * options\n */\nvar format_registry = {\n nexml: nexml_parser,\n phyloxml: phyloxml_parser,\n nwk: newick_parser\n};\n\nmodule.exports = format_registry;\n\n\n//# sourceURL=webpack:///./src/formats/registry.js?");
/***/ }),
/***/ "./src/main.js":
/*!*********************!*\
!*** ./src/main.js ***!
\*********************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("// SW20180814 TODO: Condense all parser requires to just the parser_registry\nconst parser_registry = __webpack_require__(/*! ./formats/registry */ \"./src/formats/registry.js\");\nconst nexml_parser = __webpack_require__(/*! ./formats/nexml */ \"./src/formats/nexml.js\");\nconst d3_phylotree_newick_parser = __webpack_require__(/*! ./formats/newick */ \"./src/formats/newick.js\");\nconst d3_phylotree_phyloxml_parser = __webpack_require__(/*! ./formats/phyloxml */ \"./src/formats/phyloxml.js\");\n\nvar d3_layout_phylotree_event_id = \"d3.layout.phylotree.event\",\n d3_layout_phylotree_context_menu_id = \"d3_layout_phylotree_context_menu\";\n\n// SW20180814 TODO: Remove; Registry functions should be private\nd3.layout.newick_parser = function(nwk_str, bootstrap_values) {\n return d3_phylotree_newick_parser(nwk_str, {\n bootstrap_values: bootstrap_values\n });\n};\n\n/**\n * Instantiate a phylotree.\n *\n * @param {d3-selection} container - Specify a container, for things like menu\n * and tooltip placement. Defaults to body (optional).\n * @returns {Function} phylotree - an instance of a Phylotree.\n */\nd3.layout.phylotree = function(container) {\n var item_selected = d3_phylotree_item_selected,\n node_visible = d3_phylotree_node_visible,\n node_notshown = d3_phylotree_node_notshown,\n edge_visible = d3_phylotree_edge_visible,\n item_tagged = d3_phylotree_item_tagged,\n resize_svg = d3_phylotree_resize_svg,\n is_leafnode = d3_phylotree_is_leafnode,\n has_hidden_nodes = d3_phylotree_has_hidden_nodes,\n is_node_collapsed = d3_phylotree_is_node_collapsed,\n node_css_selectors = d3_phylotree_node_css_selectors,\n edge_css_selectors = d3_phylotree_edge_css_selectors,\n clade_css_selectors = d3_phylotree_clade_css_selectors,\n newick_parser = d3_phylotree_newick_parser,\n rootpath = d3_phylotree_rootpath,\n rescale = d3_phylotree_rescale,\n trigger_refresh = d3_phylotree_trigger_refresh,\n trigger_count_update = d3_phylotree_trigger_count_update,\n event_listener = d3_phylotree_event_listener,\n add_event_listener = d3_phylotree_add_event_listener,\n svg_translate = d3_phylotree_svg_translate,\n svg_rotate = d3_phylotree_svg_rotate;\n\n var self = {},\n d3_hierarchy = d3.layout\n .hierarchy()\n .sort(null)\n .value(null),\n size = [1, 1],\n phylo_attr = [1, 1],\n newick_string = null,\n separation = function(_node, _previos) {\n return 0;\n },\n node_span = function(_node) {\n return 1;\n },\n relative_node_span = function(_node) {\n return node_span(_node) / rescale_node_span;\n },\n def_branch_length_accessor = function(_node) {\n if (\n \"attribute\" in _node &&\n _node[\"attribute\"] &&\n _node[\"attribute\"].length\n ) {\n var bl = parseFloat(_node[\"attribute\"]);\n if (!isNaN(bl)) {\n return Math.max(0, bl);\n }\n }\n return undefined;\n },\n branch_length_accessor = def_branch_length_accessor,\n def_node_label = function(_node) {\n if (d3_phylotree_is_leafnode(_node)) {\n return _node.name || \"\";\n } else {\n if (phylotree.show_internal_name(_node)) {\n return _node.name;\n }\n }\n return \"\";\n },\n node_label = def_node_label,\n length_attribute = null,\n scale_attribute = \"y_scaled\",\n needs_redraw = true,\n svg = null,\n selection_callback = null,\n options = {\n layout: \"left-to-right\",\n logger: console,\n branches: \"step\",\n scaling: true,\n bootstrap: false,\n \"color-fill\": true,\n \"internal-names\": false,\n selectable: true,\n // restricted-selectable can take an array of predetermined\n // selecters that are defined in phylotree.predefined_selecters\n // only the defined functions will be allowed when selecting\n // branches\n \"restricted-selectable\": false,\n collapsible: true,\n \"left-right-spacing\": \"fixed-step\", //'fit-to-size',\n \"top-bottom-spacing\": \"fixed-step\",\n \"left-offset\": 0,\n \"show-scale\": \"top\",\n // currently not implemented to support any other positioning\n \"draw-size-bubbles\": false,\n \"binary-selectable\": false,\n \"is-radial\": false,\n \"attribute-list\": [],\n \"max-radius\": 768,\n \"annular-limit\": 0.38196601125010515,\n compression: 0.2,\n \"align-tips\": false,\n \"maximum-per-node-spacing\": 100,\n \"minimum-per-node-spacing\": 2,\n \"maximum-per-level-spacing\": 100,\n \"minimum-per-level-spacing\": 10,\n node_circle_size: d3.functor(3),\n transitions: null,\n brush: true,\n reroot: true,\n hide: true,\n \"label-nodes-with-name\": false,\n zoom: false,\n \"show-menu\": true\n },\n css_classes = {\n \"tree-container\": \"phylotree-container\",\n \"tree-scale-bar\": \"tree-scale-bar\",\n node: \"node\",\n \"internal-node\": \"internal-node\",\n \"tagged-node\": \"node-tagged\",\n \"selected-node\": \"node-selected\",\n \"collapsed-node\": \"node-collapsed\",\n \"root-node\": \"root-node\",\n branch: \"branch\",\n \"selected-branch\": \"branch-selected\",\n \"tagged-branch\": \"branch-tagged\",\n \"tree-selection-brush\": \"tree-selection-brush\",\n \"branch-tracer\": \"branch-tracer\",\n clade: \"clade\",\n node_text: \"phylotree-node-text\"\n },\n nodes = [],\n links = [],\n parsed_tags = [],\n partitions = [],\n x_coord = function(d) {\n return d.y;\n },\n y_coord = function(d) {\n return d.x;\n },\n scales = [1, 1],\n fixed_width = [15, 20],\n font_size = 12,\n scale_bar_font_size = 12,\n offsets = [0, font_size / 2],\n draw_line = d3.svg\n .line()\n .x(function(d) {\n return x_coord(d);\n })\n .y(function(d) {\n return y_coord(d);\n })\n .interpolate(\"step-before\"),\n ensure_size_is_in_px = function(value) {\n return typeof value === \"number\" ? value + \"px\" : value;\n },\n draw_arc = function(points) {\n var start = radial_mapper(points[0].radius, points[0].angle),\n end = radial_mapper(points[0].radius, points[1].angle);\n\n return (\n \"M \" +\n x_coord(start) +\n \",\" +\n y_coord(start) +\n \" A \" +\n points[0].radius +\n \",\" +\n points[0].radius +\n \" 0,0, \" +\n (points[1].angle > points[0].angle ? 1 : 0) +\n \" \" +\n x_coord(end) +\n \",\" +\n y_coord(end) +\n \" L \" +\n x_coord(points[1]) +\n \",\" +\n y_coord(points[1])\n );\n };\n\n (draw_branch = draw_line),\n (draw_scale_bar = null),\n (rescale_node_span = 1),\n (count_listener_handler = function() {}),\n (layout_listener_handler = function() {}),\n (node_styler = undefined),\n (edge_styler = undefined),\n (shown_font_size = font_size),\n (selection_attribute_name = \"selected\"),\n (popover_displayed = null),\n (right_most_leaf = 0),\n (label_width = 0),\n (radial_center = 0),\n (radius = 1),\n (radius_pad_for_bubbles = 0),\n (radial_mapper = function(r, a) {\n return {\n x: radial_center + r * Math.sin(a),\n y: radial_center + r * Math.cos(a)\n };\n }),\n (cartesian_mapper = function(x, y) {\n return polar_to_cartesian(x - radial_center, y - radial_center);\n }),\n (cartesian_to_polar = function(node, radius, radial_root_offset) {\n node.radius = radius * (node.radius + radial_root_offset);\n\n if (!node.angle) {\n node.angle = (2 * Math.PI * node.x * scales[0]) / size[0];\n }\n\n var radial = radial_mapper(node.radius, node.angle);\n\n node.x = radial.x;\n node.y = radial.y;\n\n return node;\n }),\n (polar_to_cartesian = function(x, y) {\n r = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));\n a = Math.atan2(y, x);\n return [r, a];\n });\n\n self.container = container || \"body\";\n self.logger = options.logger;\n\n /*--------------------------------------------------------------------------------------*/\n\n /**\n * Place the current nodes, i.e., determine their coordinates based\n * on current settings.\n *\n * @returns The current ``phylotree``.\n */\n phylotree.placenodes = function() {\n var x = 0.0,\n _extents = [[0, 0], [0, 0]],\n last_node = null,\n last_span = 0,\n save_x = x,\n save_span = last_span * 0.5;\n\n var do_scaling = options[\"scaling\"],\n undef_BL = false,\n is_under_collapsed_parent = false,\n max_depth = 1,\n leaf_counter = 0;\n\n function process_internal_node(a_node) {\n /** \n decide if the node will be shown, and compute it's top-to-bottom (breadthwise)\n placement \n */\n\n var count_undefined = 0;\n\n if (phylotree.show_internal_name(a_node)) {\n // do in-oder traversal to allow for proper internal node spacing\n // (x/2) >> 0 is integer division\n var half_way = (a_node.children.length / 2) >> 0;\n var displayed_children = 0;\n var managed_to_display = false;\n for (var child_id = 0; child_id < a_node.children.length; child_id++) {\n var child_x = tree_layout(a_node.children[child_id]);\n if (typeof child_x == \"number\") {\n displayed_children++;\n }\n if (displayed_children >= half_way && !managed_to_display) {\n _handle_single_node_layout(a_node);\n managed_to_display = true;\n }\n }\n\n if (displayed_children == 0) {\n a_node.notshown = true;\n a_node.x = undefined;\n } else {\n if (!managed_to_display) {\n _handle_single_node_layout(a_node);\n }\n }\n } else {\n // postorder layout\n a_node.x = a_node.children.map(tree_layout).reduce(function(a, b) {\n if (typeof b == \"number\") return a + b;\n count_undefined += 1;\n return a;\n }, 0.0);\n if (count_undefined == a_node.children.length) {\n a_node.notshown = true;\n a_node.x = undefined;\n } else {\n a_node.x /= a_node.children.length - count_undefined;\n }\n }\n }\n\n function _handle_single_node_layout(a_node) {\n var _node_span = node_span(a_node) / rescale_node_span;\n // compute the relative size of nodes (0,1)\n // sum over all nodes is 1\n\n x = a_node.x =\n x + separation(last_node, a_node) + (last_span + _node_span) * 0.5;\n\n // separation is a user-settable callback to add additional spacing on nodes\n\n _extents[1][1] = Math.max(_extents[1][1], a_node.y);\n _extents[1][0] = Math.min(_extents[1][0], a_node.y - _node_span * 0.5);\n\n if (is_under_collapsed_parent) {\n _extents[0][1] = Math.max(\n _extents[0][1],\n save_x +\n (a_node.x - save_x) * options[\"compression\"] +\n save_span +\n (_node_span * 0.5 + separation(last_node, a_node)) *\n options[\"compression\"]\n );\n } else {\n _extents[0][1] = Math.max(\n _extents[0][1],\n x + _node_span * 0.5 + separation(last_node, a_node)\n );\n }\n\n last_node = a_node;\n last_span = _node_span;\n }\n\n function tree_layout(a_node) {\n /**\n for each node: \n y: the y coordinate is root to tip\n (left to right in cladogram layout, radius is radial layout\n x : the x coordinate is top-most to bottom-most \n (top to bottom in cladogram layout, angle in radial layout)\n \n \n @return the x-coordinate of a_node or undefined in the node is not displayed\n (hidden or under a collapsed node)\n */\n\n // do not layout hidden nodes\n if (d3_phylotree_node_notshown(a_node)) {\n return undefined;\n }\n\n var is_leaf = d3_phylotree_is_leafnode(a_node);\n\n // the next four members are radial layout options\n a_node.text_angle = null; // the angle at which text is being laid out\n a_node.text_align = null; // css alignment option for node labels\n a_node.radius = null; // radial layout radius\n a_node.angle = null; // radial layout angle (in radians)\n\n /** determine the root-to-tip location of this node;\n \n the root node receives the co-ordinate of 0\n \n if the tree has branch lengths, then the placement of each node is simply the \n total branch length to the root\n \n if the tree has no branch lengths, all leaves get the same depth (\"number of internal nodes on the deepest path\")\n and all internal nodes get the depth in integer units of the # of internal nodes on the path to the root + 1\n \n */\n\n if (a_node[\"parent\"]) {\n if (do_scaling) {\n if (undef_BL) {\n return 0;\n }\n a_node.y = branch_length_accessor(a_node);\n if (typeof a_node.y === \"undefined\") {\n console.log(\"Missing BL for \", a_node);\n undef_BL = true;\n return 0;\n }\n a_node.y += a_node.parent.y;\n } else {\n a_node.y = is_leaf ? max_depth : a_node.depth;\n }\n } else {\n x = 0.0;\n _extents = [[0, 0], [0, 0]];\n\n /** _extents computes a bounding box for the tree (initially NOT in screen \n coordinates)\n \n all account for node sizes\n \n _extents [1][0] -- the minimum x coordinate (breadth)\n _extents [1][1] -- the maximum y coordinate (breadth)\n _extents [1][0] -- the minimum y coordinate (root-to-tip, or depthwise)\n _extents [1][1] -- the maximum y coordinate (root-to-tip, or depthwise)\n \n \n \n */\n\n last_node = null;\n // last node laid out in the top bottom hierarchy\n last_span = 0;\n // the span of the last node laid out in the top to bottom hierarchy\n a_node.y = 0.0;\n }\n\n /** the next block has to do with top-to-bottom spacing of nodes **/\n\n if (is_leaf) {\n // displayed internal nodes are handled in `process_internal_node`\n _handle_single_node_layout(a_node);\n }\n\n if (!is_leaf) {\n // for internal nodes\n if (\n d3_phylotree_is_node_collapsed(a_node) &&\n !is_under_collapsed_parent\n ) {\n // collapsed node\n save_x = x;\n save_span = last_span * 0.5;\n is_under_collapsed_parent = true;\n process_internal_node(a_node);\n is_under_collapsed_parent = false;\n if (typeof a_node.x === \"number\") {\n a_node.x =\n save_x + (a_node.x - save_x) * options[\"compression\"] + save_span;\n a_node.collapsed = [[a_node.x, a_node.y]];\n\n var map_me = function(n) {\n n.hidden = true;\n if (d3_phylotree_is_leafnode(n)) {\n x = n.x =\n save_x + (n.x - save_x) * options[\"compression\"] + save_span;\n a_node.collapsed.push([n.x, n.y]);\n } else {\n n.children.map(map_me);\n }\n };\n\n x = save_x;\n map_me(a_node);\n\n a_node.collapsed.splice(1, 0, [save_x, a_node.y]);\n a_node.collapsed.push([x, a_node.y]);\n a_node.collapsed.push([a_node.x, a_node.y]);\n a_node.hidden = false;\n }\n } else {\n // normal node, or under a collapsed parent\n process_internal_node(a_node);\n }\n }\n return a_node.x;\n }\n\n rescale_node_span =\n nodes\n .map(function(d) {\n if (d3_phylotree_is_leafnode(d) || phylotree.show_internal_name(d))\n return node_span(d);\n })\n .reduce(function(p, c) {\n return Math.min(c, p);\n }, Number.MAX_VALUE) || 1;\n\n nodes[0].x = tree_layout(nodes[0], do_scaling);\n\n max_depth = d3.max(nodes, function(n) {\n return n.depth;\n });\n\n if (do_scaling && undef_BL) {\n // requested scaling, but some branches had no branch lengths\n // redo layout without branch lengths\n do_scaling = false;\n nodes[0].x = tree_layout(nodes[0]);\n }\n\n var at_least_one_dimension_fixed = false;\n\n draw_scale_bar = options[\"show-scale\"] && do_scaling;\n // this is a hack so that phylotree.pad_height would return ruler spacing\n\n if (options[\"top-bottom-spacing\"] == \"fixed-step\") {\n offsets[1] = Math.max(font_size, -_extents[1][0] * fixed_width[0]);\n size[0] = _extents[0][1] * fixed_width[0];\n scales[0] = fixed_width[0];\n } else {\n scales[0] = (size[0] - phylotree.pad_height()) / _extents[0][1];\n at_least_one_dimension_fixed = true;\n }\n\n shown_font_size = Math.min(font_size, scales[0]);\n\n function do_lr() {\n if (phylotree.radial() && at_least_one_dimension_fixed) {\n offsets[1] = 0;\n }\n\n if (options[\"left-right-spacing\"] == \"fixed-step\") {\n size[1] = max_depth * fixed_width[1];\n scales[1] =\n (size[1] - offsets[1] - options[\"left-offset\"]) / _extents[1][1];\n label_width = phylotree._label_width(shown_font_size);\n if (phylotree.radial()) {\n //label_width *= 2;\n }\n } else {\n label_width = phylotree._label_width(shown_font_size);\n at_least_one_dimension_fixed = true;\n\n var available_width = size[1] - offsets[1] - options[\"left-offset\"];\n if (available_width * 0.5 < label_width) {\n shown_font_size *= (available_width * 0.5) / label_width;\n label_width = available_width * 0.5;\n }\n\n scales[1] =\n (size[1] - offsets[1] - options[\"left-offset\"] - label_width) /\n _extents[1][1];\n }\n }\n\n if (phylotree.radial()) {\n // map the nodes to polar coordinates\n\n draw_branch = draw_arc;\n\n var last_child_angle = null,\n last_circ_position = null,\n last_child_radius = null,\n min_radius = 0,\n zero_length = null,\n effective_span = _extents[0][1] * scales[0];\n\n var compute_distance = function(r1, r2, a1, a2, annular_shift) {\n annular_shift = annular_shift || 0;\n return Math.sqrt(\n (r2 - r1) * (r2 - r1) +\n 2 *\n (r1 + annular_shift) *\n (r2 + annular_shift) *\n (1 - Math.cos(a1 - a2))\n );\n };\n\n var max_r = 0;\n\n nodes.forEach(function(d) {\n var my_circ_position = d.x * scales[0];\n d.angle = (2 * Math.PI * my_circ_position) / effective_span;\n d.text_angle = d.angle - Math.PI / 2;\n d.text_angle = d.text_angle > 0 && d.text_angle < Math.PI;\n d.text_align = d.text_angle ? \"end\" : \"start\";\n d.text_angle = (d.text_angle ? 180 : 0) + (d.angle * 180) / Math.PI;\n });\n\n do_lr();\n\n nodes.forEach(function(d) {\n d.radius = (d.y * scales[1]) / size[1];\n max_r = Math.max(d.radius, max_r);\n });\n\n var annular_shift = 0,\n do_tip_offset = phylotree.align_tips() && !options[\"draw-size-bubbles\"];\n\n nodes.forEach(function(d) {\n if (!d.children) {\n var my_circ_position = d.x * scales[0];\n if (last_child_angle !== null) {\n var required_spacing = my_circ_position - last_circ_position,\n radial_dist = compute_distance(\n d.radius,\n last_child_radius,\n d.angle,\n last_child_angle,\n annular_shift\n );\n\n var local_mr =\n radial_dist > 0\n ? required_spacing / radial_dist\n : 10 * options[\"max-radius\"];\n\n if (local_mr > options[\"max-radius\"]) {\n // adjust the annular shift\n var dd = required_spacing / options[\"max-radius\"],\n b = d.radius + last_child_radius,\n c =\n d.radius * last_child_radius -\n (dd * dd -\n (last_child_radius - d.radius) *\n (last_child_radius - d.radius)) /\n 2 /\n (1 - Math.cos(last_child_angle - d.angle)),\n st = Math.sqrt(b * b - 4 * c);\n\n annular_shift = Math.min(\n options[\"annular-limit\"] * max_r,\n (-b + st) / 2\n );\n min_radius = options[\"max-radius\"];\n } else {\n min_radius = Math.max(min_radius, local_mr);\n }\n }\n\n last_child_angle = d.angle;\n last_circ_position = my_circ_position;\n last_child_radius = d.radius;\n }\n });\n\n radius = Math.min(\n options[\"max-radius\"],\n Math.max(effective_span / 2 / Math.PI, min_radius)\n );\n\n if (at_least_one_dimension_fixed) {\n radius = Math.min(\n radius,\n (Math.min(effective_span, _extents[1][1] * scales[1]) - label_width) *\n 0.5 -\n radius * annular_shift\n );\n }\n\n radial_center = radius_pad_for_bubbles = radius;\n var scaler = 1;\n\n if (annular_shift) {\n scaler = max_r / (max_r + annular_shift);\n radius *= scaler;\n }\n\n nodes.forEach(function(d) {\n cartesian_to_polar(d, radius, annular_shift);\n\n max_r = Math.max(max_r, d.radius);\n\n if (options[\"draw-size-bubbles\"]) {\n radius_pad_for_bubbles = Math.max(\n radius_pad_for_bubbles,\n d.radius + phylotree.node_bubble_size(d)\n );\n } else {\n radius_pad_for_bubbles = Math.max(radius_pad_for_bubbles, d.radius);\n }\n\n if (d.collapsed) {\n d.collapsed = d.collapsed.map(function(p) {\n var z = {};\n z.x = p[0];\n z.y = p[1];\n z = cartesian_to_polar(z, radius, annular_shift);\n return [z.x, z.y];\n });\n\n var last_point = d.collapsed[1];\n d.collapsed = d.collapsed.filter(function(p, i) {\n if (i < 3 || i > d.collapsed.length - 4) return true;\n if (\n Math.sqrt(\n Math.pow(p[0] - last_point[0], 2) +\n Math.pow(p[1] - last_point[1], 2)\n ) > 3\n ) {\n last_point = p;\n return true;\n }\n return false;\n });\n }\n });\n\n size[0] = radial_center + radius / scaler;\n size[1] = radial_center + radius / scaler;\n } else {\n do_lr();\n\n draw_branch = draw_line;\n right_most_leaf = 0;\n nodes.forEach(function(d) {\n d.x *= scales[0];\n d.y *= scales[1];\n\n if (options[\"layout\"] == \"right-to-left\") {\n d.y = _extents[1][1] * scales[1] - d.y;\n }\n\n if (d3_phylotree_is_leafnode(d)) {\n right_most_leaf = Math.max(\n right_most_leaf,\n d.y + phylotree.node_bubble_size(d)\n );\n }\n\n if (d.collapsed) {\n d.collapsed.map(function(p) {\n return [(p[0] *= scales[0]), (p[1] *= scales[1])];\n });\n var last_x = d.collapsed[1][0];\n d.collapsed = d.collapsed.filter(function(p, i) {\n if (i < 3 || i > d.collapsed.length - 4) return true;\n if (p[0] - last_x > 3) {\n last_x = p[0];\n return true;\n }\n return false;\n });\n }\n });\n }\n\n if (draw_scale_bar) {\n var domain_limit, range_limit;\n\n if (phylotree.radial()) {\n range_limit = Math.min(radius / 5, 50);\n domain_limit = Math.pow(\n 10,\n Math.ceil(\n Math.log((_extents[1][1] * range_limit) / radius) / Math.log(10)\n )\n );\n range_limit = domain_limit * (radius / _extents[1][1]);\n if (range_limit < 30) {\n var stretch = Math.ceil(30 / range_limit);\n //console.log (stretch, domain_limit, radius, _extents[1][1], range_limit, domain_limit);\n range_limit *= stretch;\n domain_limit *= stretch;\n }\n } else {\n domain_limit = _extents[1][1];\n range_limit = size[1] - offsets[1] - options[\"left-offset\"];\n }\n\n var scale = d3.scale\n .linear()\n .domain([0, domain_limit])\n .range([shown_font_size, shown_font_size + range_limit]),\n scaleTickFormatter = d3.format(\".2g\");\n draw_scale_bar = d3.svg\n .axis()\n .scale(scale)\n .orient(\"top\")\n .tickFormat(function(d) {\n if (d === 0) {\n return \"\";\n }\n return scaleTickFormatter(d);\n });\n\n if (phylotree.radial()) {\n draw_scale_bar.tickValues([domain_limit]);\n } else {\n var my_ticks = scale.ticks();\n my_ticks = my_ticks.length > 1 ? my_ticks[1] : my_ticks[0];\n draw_scale_bar.ticks(\n Math.min(\n 10,\n d3.round(\n range_limit /\n (shown_font_size * scaleTickFormatter(my_ticks).length * 0.8),\n 0\n )\n )\n );\n }\n\n //_extentsconsole.log (scale.domain(), scale.range());\n } else {\n draw_scale_bar = null;\n }\n\n return phylotree;\n };\n\n /**\n * An instance of a phylotree. Sets event listeners, parses tags, and creates links\n * that represent branches.\n *\n * @param {Object} nwk - A Newick string, PhyloXML string, or hierarchical JSON representation of a phylogenetic tree.\n * @param {Object} options\n * - boostrap_values\n * - type -\n * @returns {Phylotree} phylotree - itself, following the builder pattern.\n */\n function phylotree(nwk, options = {}) {\n\n d3_phylotree_add_event_listener();\n var bootstrap_values = options.bootstrap_values || \"\";\n var type = options.type || \"\";\n\n var _node_data;\n\n // SW20180814 : Allowing for explicit type declaration of tree provided\n\n // If the type is a string, check the parser_registry\n if (_.isString(type)) {\n if (type in parser_registry) {\n _node_data = parser_registry[type](nwk, options);\n } else {\n // Hard failure\n self.logger.error(\n \"type \" +\n type +\n \" not in registry! Available types are \" +\n _.keys(parser_registry)\n );\n }\n } else if (_.isFunction(type)) {\n\n // If the type is a function, try executing the function \n try {\n _node_data = type(nwk, options);\n } catch (e) {\n // Hard failure\n self.logger.error(\"Could not parse custom format!\");\n }\n \n } else {\n // this builds children and links;\n if (nwk.name == \"root\") {\n // already parsed by phylotree.js\n _node_data = { json: nwk, error: null };\n } else if (typeof nwk != \"string\") {\n // old default\n _node_data = nwk;\n } else if (nwk[0] == \"<\") {\n // xml\n _node_data = d3_phylotree_phyloxml_parser(nwk);\n } else {\n // newick string\n _node_data = d3_phylotree_newick_parser(nwk, bootstrap_values);\n }\n }\n\n if (!_node_data[\"json\"]) {\n nodes = [];\n } else {\n newick_string = nwk;\n nodes = d3_hierarchy.call(this, _node_data.json);\n\n // Parse tags\n var _parsed_tags = {};\n nodes.forEach(node => {\n if (node.name) {\n var left_bracket_index = node.name.indexOf(\"{\");\n if (left_bracket_index > -1) {\n var tag = node.name.slice(\n left_bracket_index + 1,\n node.name.length - 1\n );\n\n node[tag] = true;\n _parsed_tags[tag] = true;\n node.name = node.name.slice(0, left_bracket_index);\n }\n }\n });\n parsed_tags = Object.keys(_parsed_tags);\n }\n\n phylotree.placenodes();\n links = phylotree.links(nodes);\n return phylotree;\n }\n\n /**\n * Get or set the size of tree in pixels.\n *\n * @param {Array} attr (optional) An array of the form ``[height, width]``.\n * @returns {Phylotree} The current ``size`` array if getting, or the current ``phylotree``\n * if setting.\n */\n phylotree.size = function(attr) {\n if (arguments.length) {\n phylo_attr = attr;\n }\n\n if (options[\"top-bottom-spacing\"] != \"fixed-step\") {\n size[0] = phylo_attr[0];\n }\n if (options[\"left-right-spacing\"] != \"fixed-step\") {\n size[1] = phylo_attr[1];\n }\n\n if (!arguments.length) {\n return size;\n }\n\n return phylotree;\n };\n\n phylotree.pad_height = function() {\n if (draw_scale_bar) {\n return scale_bar_font_size + 25;\n }\n return 0;\n };\n\n phylotree.pad_width = function() {\n return offsets[1] + options[\"left-offset\"] + label_width;\n };\n\n /**\n * Get all descendants of a given node.\n *\n * @param {Node} node A node in the current phylotree.\n * @returns {Array} An array of descendant nodes.\n */\n phylotree.descendants = function(n) {\n var desc = [];\n\n function recurse_d(nd) {\n if (d3_phylotree_is_leafnode(nd)) {\n desc.push(nd);\n } else {\n nd.children.forEach(recurse_d);\n }\n }\n recurse_d(n);\n return desc;\n };\n\n /**\n * Collapses a given node.\n *\n * @param {Node} node A node to be collapsed.\n */\n phylotree.collapse_node = function(n) {\n if (!d3_phylotree_is_node_collapsed(n)) {\n n.collapsed = true;\n }\n };\n\n phylotree.separation = function(attr) {\n if (!arguments.length) return separation;\n separation = attr;\n return phylotree;\n };\n\n /**\n * Getter/setter for the selection label. Useful when allowing\n * users to make multiple selections.\n *\n * @param {String} attr (Optional) If setting, the new selection label.\n * @returns The current selection label if getting, or the current ``phylotree`` if setting.\n */\n phylotree.selection_label = function(attr) {\n if (!arguments.length) return selection_attribute_name;\n selection_attribute_name = attr;\n phylotree.sync_edge_labels();\n return phylotree;\n };\n\n phylotree.handle_node_click = function(node) {\n var menu_object = d3\n .select(self.container)\n .select(\"#\" + d3_layout_phylotree_context_menu_id);\n\n if (menu_object.empty()) {\n menu_object = d3\n .select(self.container)\n .append(\"ul\")\n .attr(\"id\", d3_layout_phylotree_context_menu_id)\n .attr(\"class\", \"dropdown-menu\")\n .attr(\"role\", \"menu\");\n }\n\n menu_object.selectAll(\"li\").remove();\n if (node) {\n if (\n !_.some([\n Boolean(node.menu_items),\n options[\"hide\"],\n options[\"selectable\"],\n options[\"collapsible\"]\n ]) ||\n !options[\"show-menu\"]\n )\n return;\n if (!d3_phylotree_is_leafnode(node)) {\n if (options[\"collapsible\"]) {\n menu_object\n .append(\"li\")\n .append(\"a\")\n .attr(\"tabindex\", \"-1\")\n .text(\n d3_phylotree_is_node_collapsed(node)\n ? \"Expand Subtree\"\n : \"Collapse Subtree\"\n )\n .on(\"click\", function(d) {\n menu_object.style(\"display\", \"none\");\n phylotree.toggle_collapse(node).update();\n });\n if (options[\"selectable\"]) {\n menu_object.append(\"li\").attr(\"class\", \"divider\");\n menu_object\n .append(\"li\")\n .attr(\"class\", \"dropdown-header\")\n .text(\"Toggle selection\");\n }\n }\n\n if (options[\"selectable\"]) {\n menu_object\n .append(\"li\")\n .append(\"a\")\n .attr(\"tabindex\", \"-1\")\n .text(\"All descendant branches\")\n .on(\"click\", function(d) {\n menu_object.style(\"display\", \"none\");\n phylotree.modify_selection(\n phylotree.select_all_descendants(node, true, true)\n );\n });\n\n menu_object\n .append(\"li\")\n .append(\"a\")\n .attr(\"tabindex\", \"-1\")\n .text(\"All terminal branches\")\n .on(\"click\", function(d) {\n menu_object.style(\"display\", \"none\");\n phylotree.modify_selection(\n phylotree.select_all_descendants(node, true, false)\n );\n });\n\n menu_object\n .append(\"li\")\n .append(\"a\")\n .attr(\"tabindex\", \"-1\")\n .text(\"All internal branches\")\n .on(\"click\", function(d) {\n menu_object.style(\"display\", \"none\");\n phylotree.modify_selection(\n phylotree.select_all_descendants(node, false, true)\n );\n });\n }\n }\n\n if (node.parent) {\n if (options[\"selectable\"]) {\n menu_object\n .append(\"li\")\n .append(\"a\")\n .attr(\"tabindex\", \"-1\")\n .text(\"Incident branch\")\n .on(\"click\", function(d) {\n menu_object.style(\"display\", \"none\");\n phylotree.modify_selection([node]);\n });\n\n menu_object\n .append(\"li\")\n .append(\"a\")\n .attr(\"tabindex\", \"-1\")\n .text(\"Path to root\")\n .on(\"click\", function(d) {\n menu_object.style(\"display\", \"none\");\n phylotree.modify_selection(phylotree.path_to_root(node));\n });\n\n if (options[\"reroot\"] || options[\"hide\"]) {\n menu_object.append(\"li\").attr(\"class\", \"divider\");\n }\n }\n\n if (options[\"reroot\"]) {\n menu_object\n .append(\"li\")\n .append(\"a\")\n .attr(\"tabindex\", \"-1\")\n .text(\"Reroot on this node\")\n .on(\"click\", function(d) {\n menu_object.style(\"display\", \"none\");\n phylotree.reroot(node).update();\n });\n }\n\n if (options[\"hide\"]) {\n menu_object\n .append(\"li\")\n .append(\"a\")\n .attr(\"tabindex\", \"-1\")\n .text(\n \"Hide this \" +\n (d3_phylotree_is_leafnode(node) ? \"node\" : \"subtree\")\n )\n .on(\"click\", function(d) {\n menu_object.style(\"display\", \"none\");\n phylotree\n .modify_selection([node], \"notshown\", true, true)\n .update_has_hidden_nodes()\n .update();\n });\n }\n }\n\n if (d3_phylotree_has_hidden_nodes(node)) {\n menu_object\n .append(\"li\")\n .append(\"a\")\n .attr(\"tabindex\", \"-1\")\n .text(\"Show all descendant nodes\")\n .on(\"click\", function(d) {\n menu_object.style(\"display\", \"none\");\n phylotree\n .modify_selection(\n phylotree.select_all_descendants(node, true, true),\n \"notshown\",\n true,\n true,\n \"false\"\n )\n .update_has_hidden_nodes()\n .update();\n });\n }\n\n // now see if we need to add user defined menus\n\n var has_user_elements = [];\n if (\"menu_items\" in node && typeof node[\"menu_items\"] === \"object\") {\n node[\"menu_items\"].forEach(function(d) {\n if (d.length == 3) {\n if (!d[2] || d[2](node)) {\n has_user_elements.push([d[0], d[1]]);\n }\n }\n });\n }\n\n if (has_user_elements.length) {\n const show_divider_options = [\n options[\"hide\"],\n options[\"selectable\"],\n options[\"collapsible\"]\n ];\n if (_.some(show_divider_options)) {\n menu_object.append(\"li\").attr(\"class\", \"divider\");\n }\n has_user_elements.forEach(function(d) {\n menu_object\n .append(\"li\")\n .append(\"a\")\n .attr(\"tabindex\", \"-1\")\n .text(d3.functor(d[0])(node))\n .on(\"click\", _.partial(d[1], node));\n });\n }\n\n var tree_container = $(self.container);\n var coordinates = d3.mouse(tree_container[0]);\n menu_object\n .style(\"position\", \"absolute\")\n .style(\"left\", \"\" + coordinates[0] + \"px\")\n .style(\"top\", \"\" + coordinates[1] + \"px\")\n .style(\"display\", \"block\");\n } else {\n menu_object.style(\"display\", \"none\");\n }\n };\n\n /**\n * Get or set node styler. If setting, pass a function of two arguments,\n * ``element`` and ``data``. ``data`` exposes the underlying node so that\n * its attributes can be referenced. These can be used to apply styles to\n * ``element``, which will be a D3 selection corresponding to the SVG element\n * that makes up the current node.\n *\n * @param {Function} attr - Optional; if setting, the node styler function to be set.\n * @returns The ``node_styler`` function if getting, or the current ``phylotree`` if setting.\n */\n phylotree.style_nodes = function(attr) {\n if (!arguments.length) return node_styler;\n node_styler = attr;\n return phylotree;\n };\n\n /**\n * Get or set edge styler. If setting, pass a function of two arguments,\n * ``element`` and ``data``. ``data`` exposes the underlying edge so that\n * its attributes can be referenced. These can be used to apply styles to\n * ``element``, which will be a D3 selection corresponding to the SVG element\n * that makes up the current edge.\n *\n * Note that, in accordance with the D3 hierarchy layout, edges will have\n * a ``source`` and ``target`` field, corresponding to the nodes that make up\n * up the associated branch.\n *\n * @param {Function} attr - Optional; if setting, the node styler function to be set.\n * @returns The ``edge_styler`` function if getting, or the current ``phylotree`` if setting.\n */\n phylotree.style_edges = function(attr) {\n if (!arguments.length) return edge_styler;\n edge_styler = attr.bind(this);\n return phylotree;\n };\n\n /**\n * Return Newick string representation of a phylotree.\n *\n * @param {Function} annotator - Function to apply to each node, determining\n * what label is written (optional).\n * @returns {String} newick - Phylogenetic tree serialized as a Newick string.\n */\n phylotree.get_newick = function(annotator) {\n if (!annotator) annotator = d => d.name;\n function escape_string(nn) {\n var need_escape = /[\\s\\[\\]\\,\\)\\(\\:\\'\\\"]/;\n var enquote = need_escape.test(nn);\n return enquote ? \"'\" + nn.replace(\"'\", \"''\") + \"'\" : nn;\n }\n\n function node_display(n) {\n if (!d3_phylotree_is_leafnode(n)) {\n element_array.push(\"(\");\n n.children.forEach(function(d, i) {\n if (i) {\n element_array.push(\",\");\n }\n node_display(d);\n });\n element_array.push(\")\");\n }\n\n element_array.push(escape_string(node_label(n)));\n element_array.push(annotator(n));\n\n var bl = branch_length_accessor(n);\n if (bl !== undefined) {\n element_array.push(\":\" + bl);\n }\n }\n\n var element_array = [];\n annotator = annotator || \"\";\n node_display(nodes[0]);\n return element_array.join(\"\");\n };\n\n phylotree.update_layout = function(new_json, do_hierarchy) {\n if (do_hierarchy) {\n nodes = d3_hierarchy.call(this, new_json);\n nodes.forEach(function(d) {\n d.id = null;\n });\n }\n phylotree.placenodes();\n links = phylotree.links(nodes);\n phylotree.sync_edge_labels();\n d3_phylotree_trigger_layout(phylotree);\n };\n\n phylotree.sync_edge_labels = function() {\n links.forEach(function(d) {\n d[selection_attribute_name] = d.target[selection_attribute_name] || false;\n d.tag = d.target.tag || false;\n });\n\n d3_phylotree_trigger_refresh(phylotree);\n\n if (phylotree.count_handler()) {\n var counts = {};\n counts[selection_attribute_name] = links.reduce(function(p, c) {\n return p + (c[selection_attribute_name] ? 1 : 0);\n }, 0);\n counts[\"tagged\"] = links.reduce(function(p, c) {\n return p + (d3_phylotree_item_tagged(c) ? 1 : 0);\n }, 0);\n\n d3_phylotree_trigger_count_update(\n phylotree,\n counts,\n phylotree.count_handler()\n );\n }\n };\n\n // List of all selecters that can be used with the restricted-selectable option\n phylotree.predefined_selecters = {\n all: d => {\n return true;\n },\n none: d => {\n return false;\n },\n \"all-leaf-nodes\": d => {\n return d3_phylotree_is_leafnode(d.target);\n },\n \"all-internal-nodes\": d => {\n return !d3_phylotree_is_leafnode(d.target);\n }\n };\n\n // SW 20171113 : TODO: Arguments violate clean-coding standards.\n // https://github.com/ryanmcdermott/clean-code-javascript#functions\n /**\n * Modify the current selection, via functional programming.\n *\n * @param {Function} node_selecter A function to apply to each node, which\n * determines whether they become part of the current selection. Alternatively,\n * if ``restricted-selectable`` mode is enabled, a string describing one of\n * the pre-defined restricted-selectable options.\n * @param {String} attr (Optional) The selection attribute to modify.\n * @param {Boolean} place (Optional) Whether or not ``placenodes`` should be called.\n * @param {Boolean} skip_refresh (Optional) Whether or not a refresh is called.\n * @param {String} mode (Optional) Can be ``\"toggle\"``, ``\"true\"``, or ``\"false\"``.\n * @returns The current ``phylotree``.\n */\n phylotree.modify_selection = function(\n node_selecter,\n attr,\n place,\n skip_refresh,\n mode\n ) {\n attr = attr || selection_attribute_name;\n mode = mode || \"toggle\";\n\n // check if node_selecter is a value of pre-defined selecters\n\n if (options[\"restricted-selectable\"].length) {\n // the selection must be from a list of pre-determined selections\n if (_.contains(_.keys(this.predefined_selecters), node_selecter)) {\n node_selecter = this.predefined_selecters[node_selecter];\n } else {\n return;\n }\n }\n\n if (\n (options[\"restricted-selectable\"] || options[\"selectable\"]) &&\n !options[\"binary-selectable\"]\n ) {\n var do_refresh = false;\n\n if (typeof node_selecter === \"function\") {\n links.forEach(function(d) {\n var select_me = node_selecter(d);\n d[attr] = d[attr] || false;\n if (d[attr] != select_me) {\n d[attr] = select_me;\n do_refresh = true;\n d.target[attr] = select_me;\n }\n });\n } else {\n node_selecter.forEach(function(d) {\n var new_value;\n switch (mode) {\n case \"true\":\n new_value = true;\n break;\n case \"false\":\n new_value = false;\n break;\n default:\n new_value = !d[attr];\n break;\n }\n\n if (d[attr] != new_value) {\n d[attr] = new_value;\n do_refresh = true;\n }\n });\n\n links.forEach(function(d) {\n d[attr] = d.target[attr];\n });\n }\n\n if (do_refresh) {\n if (!skip_refresh) {\n d3_phylotree_trigger_refresh(phylotree);\n }\n if (phylotree.count_handler()) {\n var counts = {};\n counts[attr] = links.reduce(function(p, c) {\n return p + (c[attr] ? 1 : 0);\n }, 0);\n d3_phylotree_trigger_count_update(\n phylotree,\n counts,\n phylotree.count_handler()\n );\n }\n\n if (place) {\n phylotree.placenodes();\n }\n }\n } else if (options[\"binary-selectable\"]) {\n if (typeof node_selecter === \"function\") {\n links.forEach(function(d) {\n var select_me = node_selecter(d);\n d[attr] = d[attr] || false;\n\n if (d[attr] != select_me) {\n d[attr] = select_me;\n do_refresh = true;\n d.target[attr] = select_me;\n }\n\n options[\"attribute-list\"].forEach(function(type) {\n if (type != attr && d[attr] === true) {\n d[type] = false;\n d.target[type] = false;\n }\n });\n });\n } else {\n node_selecter.forEach(function(d) {\n var new_value;\n new_value = !d[attr];\n\n if (d[attr] != new_value) {\n d[attr] = new_value;\n do_refresh = true;\n }\n });\n\n links.forEach(function(d) {\n d[attr] = d.target[attr];\n options[\"attribute-list\"].forEach(function(type) {\n if (type != attr && d[attr] !== true) {\n d[type] = false;\n d.target[type] = false;\n }\n });\n });\n }\n\n if (do_refresh) {\n if (!skip_refresh) {\n d3_phylotree_trigger_refresh(phylotree);\n }\n if (phylotree.count_handler()) {\n var counts = {};\n counts[attr] = links.reduce(function(p, c) {\n return p + (c[attr] ? 1 : 0);\n }, 0);\n d3_phylotree_trigger_count_update(\n phylotree,\n counts,\n phylotree.count_handler()\n );\n }\n\n if (place) {\n phylotree.placenodes();\n }\n }\n }\n if (selection_callback && attr != \"tag\") {\n selection_callback(phylotree.get_selection());\n }\n return phylotree;\n };\n\n phylotree.trigger_refresh = function() {\n trigger_refresh(phylotree);\n };\n\n /**\n * Determine whether a given node is a leaf node.\n *\n * @param {Node} node A node in the phylotree.\n * @returns {Boolean} Whether or not the argument is a leaf node.\n */\n phylotree.is_leafnode = d3_phylotree_is_leafnode;\n\n phylotree.radial = function(attr) {\n if (!arguments.length) return options[\"is-radial\"];\n options[\"is-radial\"] = attr;\n return phylotree;\n };\n\n phylotree.internal_names = function(attr) {\n if (!arguments.length) return options[\"internal-names\"];\n options[\"internal-names\"] = attr;\n return phylotree;\n };\n\n phylotree.show_internal_name = function(node) {\n var i_names = phylotree.internal_names();\n if (i_names) {\n if (typeof i_names === \"function\") {\n return i_names(node);\n }\n return i_names;\n }\n return false;\n };\n\n phylotree.align_tips = function(attr) {\n if (!arguments.length) return options[\"align-tips\"];\n options[\"align-tips\"] = attr;\n return phylotree;\n };\n\n /**\n * Return the bubble size of the current node.\n *\n * @param {Node} A node in the phylotree.\n * @returns {Float} The size of the bubble associated to this node.\n */\n phylotree.node_bubble_size = function(node) {\n return options[\"draw-size-bubbles\"]\n ? relative_node_span(node) * scales[0] * 0.5\n : 0;\n };\n\n phylotree.shift_tip = function(d) {\n if (options[\"is-radial\"]) {\n return [\n (d.text_align == \"end\" ? -1 : 1) * (radius_pad_for_bubbles - d.radius),\n 0\n ];\n }\n if (options[\"right-to-left\"]) {\n //return [d.screen_x, 0];\n return [right_most_leaf - d.screen_x, 0];\n }\n return [right_most_leaf - d.screen_x, 0];\n };\n\n /**\n * Get nodes which are currently selected.\n *\n * @returns {Array} An array of nodes that match the current selection.\n */\n phylotree.get_selection = function() {\n return nodes.filter(function(d) {\n return d[selection_attribute_name];\n });\n };\n\n phylotree.count_handler = function(attr) {\n if (!arguments.length) return count_listener_handler;\n count_listener_handler = attr;\n return phylotree;\n };\n\n phylotree.layout_handler = function(attr) {\n if (!arguments.length) return layout_listener_handler;\n layout_listener_handler = attr;\n return phylotree;\n };\n\n phylotree.internal_label = function(callback, respect_existing) {\n phylotree.clear_internal_nodes(respect_existing);\n\n for (var i = nodes.length - 1; i >= 0; i--) {\n var d = nodes[i];\n if (\n !(\n d3_phylotree_is_leafnode(d) ||\n d3_phylotree_item_selected(d, selection_attribute_name)\n )\n ) {\n d[selection_attribute_name] = callback(d.children);\n //console.log (d[selection_attribute_name]);\n }\n }\n\n phylotree.modify_selection(function(d, callback) {\n if (d3_phylotree_is_leafnode(d.target)) {\n return d.target[selection_attribute_name];\n }\n return d.target[selection_attribute_name];\n });\n };\n\n phylotree.max_parsimony = function(respect_existing) {\n phylotree.clear_internal_nodes(respect_existing);\n\n function populate_mp_matrix(d) {\n d.mp = [\n [0, 0], // score for parent selected / not selected\n [false, false]\n ]; // selected or not\n\n if (d3_phylotree_is_leafnode(d)) {\n d.mp[1][0] = d.mp[1][1] = d[selection_attribute_name] || false;\n d.mp[0][0] = d.mp[1][0] ? 1 : 0;\n d.mp[0][1] = 1 - d.mp[0][0];\n } else {\n d.children.forEach(populate_mp_matrix);\n\n var s0 = d.children.reduce(function(p, n) {\n return n.mp[0][0] + p;\n }, 0);\n // cumulative children score if this node is 0\n var s1 = d.children.reduce(function(p, n) {\n return n.mp[0][1] + p;\n }, 0);\n // cumulative children score if this node is 1\n\n // parent = 0\n\n if (d[selection_attribute_name]) {\n // respect selected\n d.mp[0][0] = s1 + 1;\n d.mp[1][0] = true;\n d.mp[0][1] = s1;\n d.mp[1][1] = true;\n } else {\n if (s0 < s1 + 1) {\n d.mp[0][0] = s0;\n d.mp[1][0] = false;\n } else {\n d.mp[0][0] = s1 + 1;\n d.mp[1][0] = true;\n }\n\n // parent = 1\n\n if (s1 < s0 + 1) {\n d.mp[0][1] = s1;\n d.mp[1][1] = true;\n } else {\n d.mp[0][1] = s0 + 1;\n d.mp[1][1] = false;\n }\n }\n }\n }\n\n populate_mp_matrix(nodes[0]);\n nodes.forEach(function(d) {\n if (d.parent) {\n d.mp = d.mp[1][d.parent.mp ? 1 : 0];\n } else {\n d.mp = d.mp[1][d.mp[0][0] < d.mp[0][1] ? 0 : 1];\n }\n });\n\n phylotree.modify_selection(function(d, callback) {\n if (d3_phylotree_is_leafnode(d.target)) {\n return d.target[selection_attribute_name];\n }\n return d.target.mp;\n });\n };\n\n /**\n * Get or set the current node span. If setting, the argument should\n * be a function of a node which returns a number, so that node spans\n * can be determined dynamically. Alternatively, the argument can be the\n * string ``\"equal\"``, to give all nodes an equal span.\n *\n * @param {Function} attr Optional; if setting, the node_span function.\n * @returns The ``node_span`` if getting, or the current ``phylotree`` if setting.\n */\n phylotree.node_span = function(attr) {\n if (!arguments.length) return node_span;\n if (typeof attr == \"string\" && attr == \"equal\") {\n node_span = function(d) {\n return 1;\n };\n } else {\n node_span = attr;\n }\n return phylotree;\n };\n\n /*phylotree.reroot = function (node) {\n\n }*/\n\n phylotree.resort_children = function(comparator, start_node, filter) {\n function sort_children(node) {\n if (filter && !filter(node)) {\n return phylotree;\n }\n if (node.children) {\n for (var k = 0; k < node.children.length; ++k) {\n sort_children(node.children[k]);\n }\n node.children.sort(comparator);\n }\n }\n\n sort_children(start_node ? start_node : nodes[0]);\n phylotree.update_layout(nodes);\n phylotree.update();\n return phylotree;\n };\n\n phylotree.graft_a_node = function(graft_at, new_child, new_parent, lengths) {\n if (graft_at.parent) {\n var node_index = nodes.indexOf(graft_at);\n if (node_index >= 0) {\n var parent_index = graft_at.parent.children.indexOf(graft_at);\n\n var new_split = {\n name: new_parent,\n parent: graft_at.parent,\n attribute: lengths ? lengths[2] : null,\n original_child_order: graft_at[\"original_child_order\"]\n },\n new_node = {\n name: new_child,\n parent: new_split,\n attribute: lengths ? lengths[1] : null,\n original_child_order: 2\n };\n\n new_split[\"children\"] = [graft_at, new_node];\n graft_at[\"parent\"].children[parent_index] = new_split;\n graft_at.parent = new_split;\n graft_at[\"attribute\"] = lengths ? lengths[0] : null;\n graft_at[\"original_child_order\"] = 1;\n\n phylotree.update_layout(nodes[0], true);\n }\n }\n return phylotree;\n };\n\n /**\n * Delete a given node.\n *\n * @param {Node} The node to be deleted, or the index of such a node.\n * @returns The current ``phylotree``.\n */\n phylotree.delete_a_node = function(index) {\n if (typeof index != \"number\") {\n return phylotree.delete_a_node(nodes.indexOf(index));\n }\n\n if (index > 0 && index < nodes.length) {\n var node = nodes[index];\n if (node.parent) {\n // can only delete nodes that are not the root\n var delete_me_idx = node.parent.children.indexOf(node);\n\n //console.log (delete_me_idx, node, index);\n\n if (delete_me_idx >= 0) {\n nodes.splice(index, 1);\n if (node.children) {\n node.children.forEach(function(d) {\n d[\"original_child_order\"] = node.parent.children.length;\n node.parent.children.push(d);\n d.parent = node.parent;\n });\n }\n\n if (node.parent.children.length > 2) {\n node.parent.children.splice(delete_me_idx, 1);\n } else {\n if (node.parent.parent) {\n node.parent.parent.children[\n node.parent.parent.children.indexOf(node.parent)\n ] = node.parent.children[1 - delete_me_idx];\n node.parent.children[1 - delete_me_idx].parent =\n node.parent.parent;\n nodes.splice(nodes.indexOf(node.parent), 1);\n } else {\n nodes.splice(0, 1);\n nodes[0].parent = null;\n delete nodes[0][\"attribute\"];\n delete nodes[0][\"annotation\"];\n delete nodes[0][\"original_child_order\"];\n nodes[0].name = \"root\";\n }\n }\n phylotree.update_layout(nodes[0], true);\n }\n }\n }\n return phylotree;\n };\n\n /**\n * Traverse the tree in a prescribed order, and compute a value at each node.\n *\n * @param {Function} callback A function to be called on each node.\n * @param {String} traversal_type Either ``\"pre-order\"`` or ``\"post-order\"``.\n */\n phylotree.traverse_and_compute = function(callback, traversal_type) {\n traversal_type = traversal_type || \"post-order\";\n\n function post_order(node) {\n if (node.children) {\n for (var k = 0; k < node.children.length; k++) {\n post_order(node.children[k]);\n }\n }\n callback(node);\n }\n\n if (traversal_type == \"post-order\") {\n traversal_type = post_order;\n }\n\n traversal_type(nodes[0]);\n return phylotree;\n };\n\n /**\n * Reroot the tree on the given node.\n *\n * @param {Node} node Node to reroot on.\n * @param {fraction} if specified, partition the branch not into 0.5 : 0.5, but according to \n the specified fraction\n \n * @returns {Phylotree} The current ``phylotree``.\n */\n phylotree.reroot = function(node, fraction) {\n /** TODO add the option to root in the middle of a branch */\n\n fraction = fraction !== undefined ? fraction : 0.5;\n\n if (node.parent) {\n new_json = {\n name: \"new_root\",\n __mapped_bl: undefined,\n children: [node]\n };\n\n nodes.forEach(function(n) {\n n.__mapped_bl = branch_length_accessor(n);\n });\n\n phylotree.branch_length(function(n) {\n return n.__mapped_bl;\n });\n\n var remove_me = node,\n current_node = node.parent,\n parent_length = current_node.__mapped_bl,\n stashed_bl = _.noop();\n\n var apportioned_bl =\n node.__mapped_bl === undefined\n ? undefined\n : node.__mapped_bl * fraction;\n stashed_bl = current_node.__mapped_bl;\n current_node.__mapped_bl =\n node.__mapped_bl === undefined\n ? undefined\n : node.__mapped_bl - apportioned_bl;\n node.__mapped_bl = apportioned_bl;\n\n if (current_node.parent) {\n new_json.children.push(current_node);\n while (current_node.parent) {\n var remove_idx = current_node.children.indexOf(remove_me);\n if (current_node.parent.parent) {\n current_node.children.splice(remove_idx, 1, current_node.parent);\n } else {\n current_node.children.splice(remove_idx, 1);\n }\n\n var t = current_node.parent.__mapped_bl;\n if (t !== undefined) {\n current_node.parent.__mapped_bl = stashed_bl;\n stashed_bl = t;\n }\n remove_me = current_node;\n current_node = current_node.parent;\n }\n var remove_idx = current_node.children.indexOf(remove_me);\n current_node.children.splice(remove_idx, 1);\n } else {\n var remove_idx = current_node.children.indexOf(remove_me);\n current_node.children.splice(remove_idx, 1);\n stashed_bl = current_node.__mapped_bl;\n remove_me = new_json;\n }\n\n // current_node is now old root, and remove_me is the root child we came up\n // the tree through\n\n if (current_node.children.length == 1) {\n if (stashed_bl) {\n current_node.children[0].__mapped_bl += stashed_bl;\n }\n remove_me.children = remove_me.children.concat(current_node.children);\n } else {\n var new_node = {\n name: \"__reroot_top_clade\"\n };\n new_node.__mapped_bl = stashed_bl;\n new_node.children = current_node.children.map(function(n) {\n return n;\n });\n\n remove_me.children.push(new_node);\n }\n\n phylotree.update_layout(new_json, true);\n }\n return phylotree;\n };\n\n /**\n * Update a given key name in each node.\n *\n * @param {String} old_key The old key name.\n * @param {String} new_key The new key name.\n * @returns The current ``phylotree``.\n */\n phylotree.update_key_name = function(old_key, new_key) {\n nodes.forEach(function(n) {\n if (old_key in n) {\n if (new_key) {\n n[new_key] = n[old_key];\n }\n delete n[old_key];\n }\n });\n phylotree.sync_edge_labels();\n return phylotree;\n };\n\n /**\n * Get or set spacing in the x-direction.\n *\n * @param {Number} attr (Optional), the new spacing value if setting.\n * @param {Boolean} skip_render (Optional), whether or not a refresh should be performed.\n * @returns The current ``spacing_x`` value if getting, or the current ``phylotree`` if setting.\n */\n phylotree.spacing_x = function(attr, skip_render) {\n if (!arguments.length) return fixed_width[0];\n if (\n fixed_width[0] != attr &&\n attr >= options[\"minimum-per-node-spacing\"] &&\n attr <= options[\"maximum-per-node-spacing\"]\n ) {\n fixed_width[0] = attr;\n if (!skip_render) {\n phylotree.placenodes();\n }\n }\n return phylotree;\n };\n\n /**\n * Get or set spacing in the y-direction.\n *\n * @param {Number} attr (Optional), the new spacing value if setting.\n * @param {Boolean} skip_render (Optional), whether or not a refresh should be performed.\n * @returns The current ``spacing_y`` value if getting, or the current ``phylotree`` if setting.\n */\n phylotree.spacing_y = function(attr, skip_render) {\n if (!arguments.length) return fixed_width[1];\n if (\n fixed_width[1] != attr &&\n attr >= options[\"minimum-per-level-spacing\"] &&\n attr <= options[\"maximum-per-level-spacing\"]\n ) {\n fixed_width[1] = attr;\n if (!skip_render) {\n phylotree.placenodes();\n }\n }\n return phylotree;\n };\n\n /**\n * Toggle collapsed view of a given node. Either collapses a clade into\n * a smaller blob for viewing large trees, or expands a node that was\n * previously collapsed.\n *\n * @param {Node} node The node to toggle.\n * @returns {Phylotree} The current ``phylotree``.\n */\n phylotree.toggle_collapse = function(node) {\n if (node.collapsed) {\n node.collapsed = false;\n\n var unhide = function(n) {\n if (!d3_phylotree_is_leafnode(n)) {\n if (!n.collapsed) {\n n.children.forEach(unhide);\n }\n }\n n.hidden = false;\n };\n\n unhide(node);\n } else {\n node.collapsed = true;\n }\n\n phylotree.placenodes();\n return phylotree;\n };\n\n phylotree.update_has_hidden_nodes = function() {\n for (k = nodes.length - 1; k >= 0; k -= 1) {\n if (d3_phylotree_is_leafnode(nodes[k])) {\n nodes[k].has_hidden_nodes = nodes[k].notshown;\n } else {\n nodes[k].has_hidden_nodes = nodes[k].children.reduce(function(p, c) {\n return c.notshown || p;\n }, false);\n }\n }\n\n return phylotree;\n };\n\n /**\n * Get or set branch length accessor.\n *\n * @param {Function} attr Empty if getting, or new branch length accessor if setting.\n * @returns {Object} The branch length accessor if getting, or the current phylotree if setting.\n */\n phylotree.branch_length = function(attr) {\n if (!arguments.length) return branch_length_accessor;\n branch_length_accessor = attr ? attr : def_branch_length_accessor;\n return phylotree;\n };\n\n /**\n * Get or set branch name accessor.\n *\n * @param {Function} attr (Optional) If setting, a function that accesses a branch name\n * from a node.\n * @returns The ``node_label`` accessor if getting, or the current ``phylotree`` if setting.\n */\n phylotree.branch_name = function(attr) {\n if (!arguments.length) return node_label;\n node_label = attr ? attr : def_node_label;\n return phylotree;\n };\n\n phylotree.length = function(attr) {\n if (!arguments.length) return default_length_attribute;\n if (default_length_attribute != attr) {\n default_length_attribute = attr;\n needs_redraw = true;\n }\n return phylotree;\n };\n\n phylotree._label_width = function(_font_size) {\n _font_size = _font_size || shown_font_size;\n\n var width = 0;\n\n nodes.filter(d3_phylotree_node_visible).forEach(function(node) {\n var node_width = node_label(node).length * _font_size * 0.6;\n if (node.angle !== null) {\n node_width *= Math.max(\n Math.abs(Math.cos(node.angle)),\n Math.abs(Math.sin(node.angle))\n );\n }\n width = Math.max(node_width, width);\n });\n\n return width;\n };\n\n /**\n * Get or set font size.\n *\n * @param {Function} attr Empty if getting, or new font size if setting.\n * @returns The current ``font_size`` accessor if getting, or the current ``phylotree`` if setting.\n */\n phylotree.font_size = function(attr) {\n if (!arguments.length) return font_size;\n font_size = attr === undefined ? 12 : attr;\n return phylotree;\n };\n\n phylotree.scale_bar_font_size = function(attr) {\n if (!arguments.length) return scale_bar_font_size;\n scale_bar_font_size = attr === undefined ? 12 : attr;\n return phylotree;\n };\n\n phylotree.node_circle_size = function(attr, attr2) {\n if (!arguments.length) return options[\"node_circle_size\"];\n options[\"node_circle_size\"] = d3.functor(attr === undefined ? 3 : attr);\n return phylotree;\n };\n\n phylotree.needs_redraw = function() {\n return needs_redraw;\n };\n\n /**\n * Getter/setter for the SVG element for the Phylotree to be rendered in.\n *\n * @param {d3-selection} svg_element (Optional) SVG element to render within, selected by D3.\n * @returns The selected SVG element if getting, or the current ``phylotree`` if setting.`\n */\n phylotree.svg = function(svg_element) {\n if (!arguments.length) return svg_element;\n if (svg !== svg_element) {\n svg = svg_element;\n if (css_classes[\"tree-container\"] == \"phylotree-container\") {\n svg.selectAll(\"*\").remove();\n svg_defs = svg.append(\"defs\");\n }\n d3.select(self.container).on(\n \"click\",\n function(d) {\n phylotree.handle_node_click(null);\n },\n true\n );\n }\n return phylotree;\n };\n\n phylotree.css = function(opt) {\n if (arguments.length === 0) return css_classes;\n if (arguments.length > 2) {\n var arg = {};\n arg[opt[0]] = opt[1];\n return phylotree.css(arg);\n }\n\n for (var key in css_classes) {\n if (key in opt && opt[key] != css_classes[key]) {\n css_classes[key] = opt[key];\n }\n }\n return phylotree;\n };\n\n /**\n * Change option settings.\n *\n * @param {Object} opt Keys are the option to toggle and values are\n * the parameters for that option.\n * @param {Boolean} run_update (optional) Whether or not the tree should update.\n * @returns The current ``phylotree``.\n */\n phylotree.options = function(opt, run_update) {\n if (!arguments.length) return options;\n\n var do_update = false;\n\n for (var key in options) {\n if (key in opt && opt[key] != options[key]) {\n do_update = true;\n options[key] = opt[key];\n switch (key) {\n case \"branches\":\n {\n switch (opt[key]) {\n case \"straight\": {\n draw_branch.interpolate(\"linear\");\n break;\n }\n default: {\n draw_branch.interpolate(\"step-before\");\n break;\n }\n }\n }\n break;\n }\n }\n }\n\n if (run_update && do_update) {\n phylotree.layout();\n }\n\n return phylotree;\n };\n\n phylotree.transitions = function(arg) {\n if (arg !== undefined) {\n return arg;\n }\n if (options[\"transitions\"] !== null) {\n return options[\"transitions\"];\n }\n\n return nodes.length <= 300;\n };\n\n /**\n * Update the current phylotree, i.e., alter the svg\n * elements.\n *\n * @param {Boolean} transitions (Optional) Toggle whether transitions should be shown.\n * @returns The current ``phylotree``.\n */\n phylotree.update = function(transitions) {\n if (!phylotree.svg) return phylotree;\n\n transitions = phylotree.transitions(transitions);\n\n var node_id = 0;\n\n var enclosure = svg\n .selectAll(\".\" + css_classes[\"tree-container\"])\n .data([0]);\n\n enclosure\n .enter()\n .append(\"g\")\n .attr(\"class\", css_classes[\"tree-container\"]);\n\n enclosure.attr(\"transform\", function(d) {\n return d3_phylotree_svg_translate([\n offsets[1] + options[\"left-offset\"],\n phylotree.pad_height()\n ]);\n });\n\n if (draw_scale_bar) {\n var scale_bar = svg\n .selectAll(\".\" + css_classes[\"tree-scale-bar\"])\n .data([0]);\n scale_bar.enter().append(\"g\");\n scale_bar\n .attr(\"class\", css_classes[\"tree-scale-bar\"])\n .style(\"font-size\", ensure_size_is_in_px(scale_bar_font_size))\n .attr(\"transform\", function(d) {\n return d3_phylotree_svg_translate([\n offsets[1] + options[\"left-offset\"],\n phylotree.pad_height() - 10\n ]);\n })\n .call(draw_scale_bar);\n scale_bar.selectAll(\"text\").style(\"text-anchor\", \"end\");\n } else {\n svg.selectAll(\".\" + css_classes[\"tree-scale-bar\"]).remove();\n }\n\n var drawn_links = enclosure\n .selectAll(d3_phylotree_edge_css_selectors(css_classes))\n .data(links.filter(d3_phylotree_edge_visible), function(d) {\n return d.target.id || (d.target.id = ++node_id);\n });\n\n if (transitions) {\n drawn_links\n .exit()\n .transition()\n .remove();\n } else {\n drawn_links.exit().remove();\n }\n drawn_links.enter().insert(\"path\", \":first-child\");\n drawn_links.each(function(d) {\n phylotree.draw_edge(this, d, transitions);\n });\n\n var collapsed_clades = enclosure\n .selectAll(d3_phylotree_clade_css_selectors(css_classes))\n .data(nodes.filter(d3_phylotree_is_node_collapsed), function(d) {\n return d.id || (d.id = ++node_id);\n });\n\n var spline = function() {};\n var spline_f = _.noop();\n\n // Collapse radial differently\n if (phylotree.radial()) {\n // create interpolator\n var interpolator = function(points) {\n points.pop();\n\n var center_node = points.shift();\n var path_string = points.join(\"L\");\n\n var polar_coords = cartesian_mapper(center_node[0], center_node[1]);\n\n var first_angle = cartesian_mapper(points[0][0], points[0][1])[1];\n var last_angle = cartesian_mapper(\n points[points.length - 1][0],\n points[points.length - 1][1]\n )[1];\n\n var connecting_arc =\n \"A \" +\n polar_coords[0] +\n \" \" +\n polar_coords[0] +\n \" \" +\n (first_angle > last_angle ? 1 : 0) +\n \" 0 0 \" +\n points[0].join(\",\");\n\n return path_string + connecting_arc;\n };\n\n spline = d3.svg\n .line()\n .interpolate(interpolator)\n .y(function(d) {\n return d[0];\n })\n .x(function(d) {\n return d[1];\n });\n\n spline_f = function(coord, i, d, init_0, init_1) {\n if (i) {\n return [\n d.screen_y + (coord[0] - init_0) / 50,\n d.screen_x + (coord[1] - init_1) / 50\n ];\n } else {\n return [d.screen_y, d.screen_x];\n }\n };\n } else {\n spline = d3.svg\n .line()\n .interpolate(\"basis\")\n .y(function(d) {\n return d[0];\n })\n .x(function(d) {\n return d[1];\n });\n\n spline_f = function(coord, i, d, init_0, init_1) {\n if (i) {\n return [\n d.screen_y + (coord[0] - init_0) / 50,\n d.screen_x + (coord[1] - init_1) / 50\n ];\n } else {\n return [d.screen_y, d.screen_x];\n }\n };\n }\n\n var cce = collapsed_clades\n .exit()\n .each(function(d) {\n d.collapsed_clade = null;\n })\n .remove();\n\n if (transitions) {\n collapsed_clades.enter().insert(\"path\", \":first-child\");\n collapsed_clades\n .attr(\"class\", css_classes[\"clade\"])\n .attr(\"d\", function(d) {\n if (d.collapsed_clade) {\n return d.collapsed_clade;\n }\n var init_0 = d.collapsed[0][0];\n var init_1 = d.collapsed[0][1];\n //#1 return spline(d.collapsed.map(spline_f, d, init_0, init_1));\n return spline(\n d.collapsed.map(function(coord, i) {\n return spline_f(coord, i, d, init_0, init_1);\n })\n );\n })\n .transition()\n .attr(\"d\", function(d) {\n return (d.collapsed_clade = spline(d.collapsed));\n });\n } else {\n collapsed_clades.enter().insert(\"path\", \":first-child\");\n collapsed_clades\n .attr(\"class\", css_classes[\"clade\"])\n .attr(\"d\", function(d) {\n return (d.collapsed_clade = spline(d.collapsed));\n });\n }\n\n var drawn_nodes = enclosure\n .selectAll(d3_phylotree_node_css_selectors(css_classes))\n .data(nodes.filter(d3_phylotree_node_visible), function(d) {\n return d.id || (d.id = ++node_id);\n });\n\n var append_here = drawn_nodes.enter().append(\"g\");\n\n if (transitions) {\n //drawn_nodes.exit().transition ().style (\"opacity\", \"0\").remove();\n drawn_nodes\n .exit()\n .transition()\n .remove();\n drawn_nodes = drawn_nodes\n .attr(\"transform\", function(d) {\n if (!_.isUndefined(d.screen_x) && !_.isUndefined(d.screen_y)) {\n return \"translate(\" + d.screen_x + \",\" + d.screen_y + \")\";\n }\n })\n .transition();\n } else {\n drawn_nodes.exit().remove();\n }\n\n drawn_nodes\n .attr(\"transform\", function(d) {\n const should_shift =\n options[\"layout\"] == \"right-to-left\" && d3_phylotree_is_leafnode(d);\n d.screen_x = x_coord(d);\n d.screen_y = y_coord(d);\n return d3_phylotree_svg_translate([\n should_shift ? 0 : d.screen_x,\n d.screen_y\n ]);\n })\n .attr(\"class\", phylotree.reclass_node)\n .each(function(d) {\n phylotree.draw_node(this, d, transitions);\n });\n\n if (options[\"label-nodes-with-name\"]) {\n drawn_nodes.attr(\"id\", function(d) {\n return \"node-\" + d.name;\n });\n }\n\n var sizes = d3_phylotree_resize_svg(phylotree, svg, transitions);\n\n if (options[\"brush\"]) {\n var brush = enclosure\n .selectAll(\".\" + css_classes[\"tree-selection-brush\"])\n .data([0]);\n brush\n .enter()\n .insert(\"g\", \":first-child\")\n .attr(\"class\", css_classes[\"tree-selection-brush\"]);\n\n var brush_object = d3.svg\n .brush()\n .x(\n d3.scale\n .identity()\n .domain([0, sizes[0] - offsets[1] - options[\"left-offset\"]])\n )\n .y(d3.scale.identity().domain([0, sizes[1] - phylotree.pad_height()]))\n .on(\"brush\", function() {\n var extent = d3.event.target.extent(),\n shown_links = links.filter(d3_phylotree_edge_visible),\n selected_links = shown_links\n .filter(function(d, i) {\n return (\n d.source.screen_x >= extent[0][0] &&\n d.source.screen_x <= extent[1][0] &&\n d.source.screen_y >= extent[0][1] &&\n d.source.screen_y <= extent[1][1] &&\n d.target.screen_x >= extent[0][0] &&\n d.target.screen_x <= extent[1][0] &&\n d.target.screen_y >= extent[0][1] &&\n d.target.screen_y <= extent[1][1]\n );\n })\n .map(function(d) {\n return d.target;\n });\n\n phylotree.modify_selection(\n links.map(function(d) {\n return d.target;\n }),\n \"tag\",\n false,\n selected_links.length > 0,\n \"false\"\n );\n phylotree.modify_selection(\n selected_links,\n \"tag\",\n false,\n false,\n \"true\"\n );\n })\n .on(\"brushend\", function() {\n brush.call(d3.event.target.clear());\n });\n\n brush.call(brush_object);\n }\n phylotree.sync_edge_labels();\n if (options[\"zoom\"]) {\n var zoom = d3.behavior\n .zoom()\n .scaleExtent([0.1, 10])\n .on(\"zoom\", function() {\n var translate = d3.event.translate;\n translate[0] += offsets[1] + options[\"left-offset\"];\n translate[1] += phylotree.pad_height();\n d3.select(\".\" + css_classes[\"tree-container\"]).attr(\n \"transform\",\n \"translate(\" + translate + \")scale(\" + d3.event.scale + \")\"\n );\n });\n svg.call(zoom);\n }\n return phylotree;\n };\n\n /**\n * Get or set CSS classes.\n *\n * @param {Object} opt Keys are the CSS class to toggle and values are\n * the parameters for that CSS class.\n * @param {Boolean} run_update (optional) Whether or not the tree should update.\n * @returns The current ``phylotree``.\n */\n phylotree.css_classes = function(opt, run_update) {\n if (!arguments.length) return css_classes;\n\n var do_update = false;\n\n for (var key in css_classes) {\n if (key in opt && opt[key] != css_classes[key]) {\n do_update = true;\n css_classes[key] = opt[key];\n }\n }\n\n if (run_update && do_update) {\n phylotree.layout();\n }\n\n return phylotree;\n };\n\n /**\n * Lay out the tree within the SVG.\n *\n * @param {Boolean} transitions Specify whether or not transitions should occur.\n * @returns The current ``phylotree``.\n */\n phylotree.layout = function(transitions) {\n if (svg) {\n svg.selectAll(\n \".\" +\n css_classes[\"tree-container\"] +\n \",.\" +\n css_classes[\"tree-scale-bar\"] +\n \",.\" +\n css_classes[\"tree-selection-brush\"]\n );\n //.remove();\n return phylotree.update(transitions);\n }\n return phylotree;\n };\n\n phylotree.refresh = function() {\n var self = this;\n\n if (svg) {\n // for re-entrancy\n\n var enclosure = svg.selectAll(\".\" + css_classes[\"tree-container\"]);\n\n var edges = enclosure.selectAll(\n d3_phylotree_edge_css_selectors(css_classes)\n );\n edges.attr(\"class\", phylotree.reclass_edge);\n\n if (edge_styler) {\n edges.each(function(d) {\n edge_styler(d3.select(this), d);\n });\n }\n\n var nodes = enclosure.selectAll(\n d3_phylotree_node_css_selectors(css_classes)\n );\n nodes.attr(\"class\", phylotree.reclass_node);\n\n if (node_styler) {\n nodes.each(function(d) {\n node_styler(d3.select(this), d);\n });\n }\n }\n };\n\n phylotree.reclass_edge = function(edge) {\n var class_var = css_classes[\"branch\"];\n if (d3_phylotree_item_tagged(edge)) {\n class_var += \" \" + css_classes[\"tagged-branch\"];\n }\n if (d3_phylotree_item_selected(edge, selection_attribute_name)) {\n class_var += \" \" + css_classes[\"selected-branch\"];\n }\n return class_var;\n };\n\n phylotree.reclass_node = function(node) {\n var class_var =\n css_classes[d3_phylotree_is_leafnode(node) ? \"node\" : \"internal-node\"];\n\n if (d3_phylotree_item_tagged(node)) {\n class_var += \" \" + css_classes[\"tagged-node\"];\n }\n\n if (d3_phylotree_item_selected(node, selection_attribute_name)) {\n class_var += \" \" + css_classes[\"selected-node\"];\n }\n\n if (!node[\"parent\"]) {\n class_var += \" \" + css_classes[\"root-node\"];\n }\n\n if (\n d3_phylotree_is_node_collapsed(node) ||\n d3_phylotree_has_hidden_nodes(node)\n ) {\n class_var += \" \" + css_classes[\"collapsed-node\"];\n }\n return class_var;\n };\n\n /**\n * Select all descendents of a given node, with options for selecting\n * terminal/internal nodes.\n *\n * @param {Node} node The node whose descendents should be selected.\n * @param {Boolean} terminal Whether to include terminal nodes.\n * @param {Boolean} internal Whther to include internal nodes.\n * @returns {Array} An array of selected nodes.\n */\n phylotree.select_all_descendants = function(node, terminal, internal) {\n var selection = [];\n\n function sel(d) {\n if (d3_phylotree_is_leafnode(d)) {\n if (terminal) {\n if (d != node) selection.push(d);\n }\n } else {\n if (internal) {\n if (d != node) selection.push(d);\n }\n d.children.forEach(sel);\n }\n }\n sel(node);\n return selection;\n };\n\n phylotree.path_to_root = function(node) {\n var selection = [];\n while (node) {\n selection.push(node);\n node = node.parent;\n }\n return selection;\n };\n\n phylotree.draw_edge = function(container, edge, transition) {\n container = d3.select(container);\n\n container.attr(\"class\", phylotree.reclass_edge).on(\"click\", function(d) {\n phylotree.modify_selection([d.target], selection_attribute_name);\n });\n\n var new_branch_path = draw_branch([edge.source, edge.target]);\n\n if (transition) {\n if (container.datum().existing_path) {\n container.attr(\"d\", function(d) {\n return d.existing_path;\n });\n }\n container.transition().attr(\"d\", new_branch_path);\n } else {\n container.attr(\"d\", new_branch_path);\n }\n edge.existing_path = new_branch_path;\n\n var bl = branch_length_accessor(edge.target);\n if (bl !== undefined) {\n var haz_title = container.selectAll(\"title\");\n if (haz_title.empty()) {\n haz_title = container.append(\"title\");\n }\n haz_title.text(\"Length = \" + bl);\n } else {\n container.selectAll(\"title\").remove();\n }\n\n if (edge_styler) {\n edge_styler(container, edge);\n }\n\n return phylotree;\n };\n\n phylotree.clear_internal_nodes = function(respect) {\n if (!respect) {\n nodes.forEach(function(d) {\n if (!d3_phylotree_is_leafnode(d)) {\n d[selection_attribute_name] = false;\n }\n });\n }\n };\n phylotree.draw_node = function(container, node, transitions) {\n container = d3.select(container);\n\n var is_leaf = d3_phylotree_is_leafnode(node);\n\n if (is_leaf) {\n container.attr(\"data-node-name\", node.name);\n }\n\n if (\n is_leaf ||\n (phylotree.show_internal_name(node) &&\n !d3_phylotree_is_node_collapsed(node))\n ) {\n var labels = container.selectAll(\"text\").data([node]),\n tracers = container.selectAll(\"line\");\n\n if (transitions) {\n labels\n .enter()\n .append(\"text\")\n .style(\"opacity\", 0)\n .transition()\n .style(\"opacity\", 1);\n } else {\n labels.enter().append(\"text\");\n }\n\n labels\n .on(\"click\", phylotree.handle_node_click)\n .classed(css_classes[\"node_text\"], true)\n .attr(\"dy\", function(d) {\n return shown_font_size * 0.33;\n })\n .text(function(d) {\n return node_label(d);\n })\n .style(\"font-size\", function(d) {\n return ensure_size_is_in_px(shown_font_size);\n });\n\n if (phylotree.radial()) {\n (transitions ? labels.transition() : labels)\n .attr(\"transform\", function(d) {\n return (\n d3_phylotree_svg_rotate(d.text_angle) +\n d3_phylotree_svg_translate(\n phylotree.align_tips() ? phylotree.shift_tip(d) : null\n )\n );\n })\n .attr(\"text-anchor\", function(d) {\n return d.text_align;\n });\n } else {\n (transitions ? labels.transition() : labels)\n .attr(\"text-anchor\", \"start\")\n .attr(\"transform\", function(d) {\n if (options[\"layout\"] == \"right-to-left\") {\n return d3_phylotree_svg_translate([-20, 0]);\n }\n return d3_phylotree_svg_translate(\n phylotree.align_tips() ? phylotree.shift_tip(d) : null\n );\n });\n }\n\n if (phylotree.align_tips()) {\n tracers = tracers.data([node]);\n if (transitions) {\n tracers\n .enter()\n .append(\"line\")\n .style(\"opacity\", 0)\n .transition()\n .style(\"opacity\", 1);\n tracers\n .attr(\"x1\", function(d) {\n return (\n (d.text_align == \"end\" ? -1 : 1) *\n phylotree.node_bubble_size(node)\n );\n })\n .attr(\"x2\", 0)\n .attr(\"y1\", 0)\n .attr(\"y2\", 0);\n tracers\n .transition()\n .attr(\"x2\", function(d) {\n if (options[\"layout\"] == \"right-to-left\") {\n return d.screen_x;\n }\n return phylotree.shift_tip(d)[0];\n })\n .attr(\"transform\", function(d) {\n return d3_phylotree_svg_rotate(d.text_angle);\n });\n } else {\n tracers.enter().append(\"line\");\n tracers\n .attr(\"x1\", function(d) {\n return (\n (d.text_align == \"end\" ? -1 : 1) *\n phylotree.node_bubble_size(node)\n );\n })\n .attr(\"y2\", 0)\n .attr(\"y1\", 0)\n .transition()\n .attr(\"x2\", function(d) {\n return phylotree.shift_tip(d)[0];\n });\n tracers.attr(\"transform\", function(d) {\n return d3_phylotree_svg_rotate(d.text_angle);\n });\n }\n tracers.classed(css_classes[\"branch-tracer\"], true);\n } else {\n tracers.remove();\n }\n\n if (options[\"draw-size-bubbles\"]) {\n var shift = phylotree.node_bubble_size(node);\n var circles = container.selectAll(\"circle\").data([shift]);\n circles.enter().append(\"circle\");\n if (transitions) {\n circles = circles.transition();\n }\n circles.attr(\"r\", function(d) {\n return d;\n });\n\n if (shown_font_size >= 5) {\n labels.attr(\"dx\", function(d) {\n return (\n (d.text_align == \"end\" ? -1 : 1) *\n ((phylotree.align_tips() ? 0 : shift) + shown_font_size * 0.33)\n );\n });\n }\n } else {\n if (shown_font_size >= 5) {\n labels.attr(\"dx\", function(d) {\n return (d.text_align == \"end\" ? -1 : 1) * shown_font_size * 0.33;\n });\n }\n }\n }\n\n if (!is_leaf) {\n var circles = container.selectAll(\"circle\").data([node]),\n radius = phylotree.node_circle_size()(node);\n\n if (radius > 0) {\n circles.enter().append(\"circle\");\n circles\n .attr(\"r\", function(d) {\n return Math.min(shown_font_size * 0.75, radius);\n })\n .on(\"click\", function(d) {\n phylotree.handle_node_click(d);\n });\n } else {\n circles.remove();\n }\n }\n\n if (node_styler) {\n node_styler(container, node);\n }\n\n return node;\n };\n\n /**\n * Get an array of all nodes.\n *\n * @returns {Array} Nodes in the current ``phylotree``.\n */\n phylotree.get_nodes = function() {\n return nodes;\n };\n\n /**\n * Get the root node.\n *\n * @returns the current root node of the ``phylotree``.\n */\n phylotree.get_root_node = function() {\n return nodes[0];\n };\n\n /**\n * Get a node by name.\n *\n * @param {String} name Name of the desired node.\n * @returns {Node} Desired node.\n */\n phylotree.get_node_by_name = function(name) {\n return _.findWhere(nodes, { name: name });\n };\n\n /**\n * Add attributes to nodes. New attributes will be placed in the\n * ``annotations`` key of any nodes that are matched.\n *\n * @param {Object} attributes An object whose keys are the names of nodes\n * to modify, and whose values are the new attributes to add.\n */\n phylotree.assign_attributes = function(attributes) {\n //return nodes;\n // add annotations to each matching node\n _.each(nodes, function(d) {\n if (_.indexOf(_.keys(attributes), d.name) >= 0) {\n d[\"annotations\"] = attributes[d.name];\n }\n });\n };\n\n phylotree.set_partitions = function(partitions) {\n this.partitions = partitions;\n };\n\n phylotree.get_partitions = function(attributes) {\n return this.partitions;\n };\n\n /**\n * Getter/setter for the selection callback. This function is called\n * every time the current selection is modified, and its argument is\n * an array of nodes that make up the current selection.\n *\n * @param {Function} callback (Optional) The selection callback function.\n * @returns The current ``selection_callback`` if getting, or the current ``phylotree`` if setting.\n */\n phylotree.selection_callback = function(callback) {\n if (!callback) return selection_callback;\n selection_callback = callback;\n return phylotree;\n };\n\n /**\n * Return tags that were read when parsing the original Newick string.\n *\n * @returns An array of strings, comprising each tag that was read.\n */\n phylotree.get_parsed_tags = function() {\n return parsed_tags;\n };\n\n d3.rebind(phylotree, d3_hierarchy, \"sort\", \"children\", \"value\");\n\n // Add an alias for nodes and links, for convenience.\n phylotree.nodes = phylotree;\n phylotree.links = d3.layout.cluster().links;\n\n return phylotree;\n};\n\n//------------------------------------------------------------------------------\n\nfunction d3_phylotree_item_selected(item, tag) {\n return item[tag] || false;\n}\n\nfunction d3_phylotree_node_visible(node) {\n return !(node.hidden || node.notshown || false);\n}\n\nfunction d3_phylotree_node_notshown(node) {\n return node.notshown;\n}\n\nfunction d3_phylotree_edge_visible(edge) {\n return !(edge.target.hidden || edge.target.notshown || false);\n}\n\nfunction d3_phylotree_item_tagged(item) {\n return item.tag || false;\n}\n\nfunction d3_phylotree_resize_svg(tree, svg, tr) {\n var sizes = tree.size();\n\n if (tree.radial()) {\n var pad_radius = tree.pad_width(),\n vertical_offset =\n tree.options()[\"top-bottom-spacing\"] != \"fit-to-size\"\n ? tree.pad_height()\n : 0;\n\n sizes = [\n sizes[1] + 2 * pad_radius,\n sizes[0] + 2 * pad_radius + vertical_offset\n ];\n\n if (svg) {\n svg\n .selectAll(\".\" + tree.css_classes()[\"tree-container\"])\n .attr(\n \"transform\",\n \"translate (\" +\n pad_radius +\n \",\" +\n (pad_radius + vertical_offset) +\n \")\"\n );\n }\n } else {\n sizes = [\n sizes[1] +\n (tree.options()[\"left-right-spacing\"] != \"fit-to-size\"\n ? tree.pad_width()\n : 0),\n sizes[0] +\n (tree.options()[\"top-bottom-spacing\"] != \"fit-to-size\"\n ? tree.pad_height()\n : 0)\n ];\n }\n\n if (svg) {\n if (tr) {\n svg = svg.transition(100);\n }\n\n svg.attr(\"height\", sizes[1]).attr(\"width\", sizes[0]);\n }\n\n return sizes;\n}\n\n/**\n * Determine if a given node is a leaf node.\n *\n * @param {Node} A node in a tree.\n * @returns {Bool} Whether or not the node is a leaf node.\n */\nfunction d3_phylotree_is_leafnode(node) {\n return !(node.children && node.children.length);\n}\n\nfunction d3_phylotree_has_hidden_nodes(node) {\n return node.has_hidden_nodes || false;\n}\n\nfunction d3_phylotree_is_node_collapsed(node) {\n return node.collapsed || false;\n}\n\nfunction d3_phylotree_node_css_selectors(css_classes) {\n return [\n css_classes[\"node\"],\n css_classes[\"internal-node\"],\n css_classes[\"collapsed-node\"],\n css_classes[\"tagged-node\"],\n css_classes[\"root-node\"]\n ].reduce(function(p, c, i, a) {\n return (p += \"g.\" + c + (i < a.length - 1 ? \",\" : \"\"));\n }, \"\");\n}\n\nfunction d3_phylotree_edge_css_selectors(css_classes) {\n return [\n css_classes[\"branch\"],\n css_classes[\"selected-branch\"],\n css_classes[\"tagged-branch\"]\n ].reduce(function(p, c, i, a) {\n return (p += \"path.\" + c + (i < a.length - 1 ? \",\" : \"\"));\n }, \"\");\n}\n\nfunction d3_phylotree_clade_css_selectors(css_classes) {\n return [css_classes[\"clade\"]].reduce(function(p, c, i, a) {\n return (p += \"path.\" + c + (i < a.length - 1 ? \",\" : \"\"));\n }, \"\");\n}\n\nfunction d3_add_custom_menu(node, name, callback, condition) {\n if (!(\"menu_items\" in node)) {\n node[\"menu_items\"] = [];\n }\n if (\n !node[\"menu_items\"].some(function(d) {\n return d[0] == name && d[1] == callback && d[2] == condition;\n })\n ) {\n node[\"menu_items\"].push([name, callback, condition]);\n }\n}\n\nfunction d3_phylotree_rootpath(attr_name, store_name) {\n attr_name = attr_name || \"attribute\";\n store_name = store_name || \"y_scaled\";\n\n if (\"parent\" in this) {\n var my_value = parseFloat(this[attr_name]);\n this[store_name] =\n this.parent[store_name] + (isNaN(my_value) ? 0.1 : my_value);\n } else {\n this[store_name] = 0.0;\n }\n\n return this[store_name];\n}\n\nfunction d3_phylotree_rescale(scale, attr_name) {\n attr_name = attr_name || \"y_scaled\";\n if (attr_name in this) {\n this[attr_name] *= scale;\n }\n}\n\nfunction d3_phylotree_trigger_refresh(tree) {\n var event = new CustomEvent(d3_layout_phylotree_event_id, {\n detail: [\"refresh\", tree]\n });\n document.dispatchEvent(event);\n}\n\nfunction d3_phylotree_trigger_count_update(tree, counts) {\n var event = new CustomEvent(d3_layout_phylotree_event_id, {\n detail: [\"count_update\", counts, tree.count_handler()]\n });\n document.dispatchEvent(event);\n}\n\nfunction d3_phylotree_trigger_layout(tree) {\n var event = new CustomEvent(d3_layout_phylotree_event_id, {\n detail: [\"layout\", tree, tree.layout_handler()]\n });\n document.dispatchEvent(event);\n}\n\nfunction d3_phylotree_event_listener(event) {\n switch (event.detail[0]) {\n case \"refresh\":\n event.detail[1].refresh();\n break;\n case \"count_update\":\n case \"layout\":\n event.detail[2](event.detail[1]);\n break;\n }\n return true;\n}\n\nfunction d3_phylotree_add_event_listener() {\n document.addEventListener(\n d3_layout_phylotree_event_id,\n d3_phylotree_event_listener,\n false\n );\n}\n\nfunction d3_phylotree_svg_translate(x) {\n if (x && (x[0] !== null || x[1] !== null))\n return (\n \"translate (\" +\n (x[0] !== null ? x[0] : 0) +\n \",\" +\n (x[1] !== null ? x[1] : 0) +\n \") \"\n );\n\n return \"\";\n}\n\nfunction d3_phylotree_svg_rotate(a) {\n if (a !== null) {\n return \"rotate (\" + a + \") \";\n }\n return \"\";\n}\n\nd3.layout.phylotree.is_leafnode = d3_phylotree_is_leafnode;\nd3.layout.phylotree.add_custom_menu = d3_add_custom_menu;\nd3.layout.phylotree.trigger_refresh = d3_phylotree_trigger_refresh;\n// SW20180814 TODO: Remove. Registry functions should be private.\nd3.layout.phylotree.nexml_parser = nexml_parser;\n\n\n//# sourceURL=webpack:///./src/main.js?");
/***/ }),
/***/ 0:
/*!**********************!*\
!*** util (ignored) ***!
\**********************/
/*! no static exports found */
/***/ (function(module, exports) {
eval("/* (ignored) */\n\n//# sourceURL=webpack:///util_(ignored)?");
/***/ }),
/***/ 1:
/*!**********************!*\
!*** util (ignored) ***!
\**********************/
/*! no static exports found */
/***/ (function(module, exports) {
eval("/* (ignored) */\n\n//# sourceURL=webpack:///util_(ignored)?");
/***/ })
/******/ });
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global.d3 = global.d3 || {})));
}(this, function (exports) { 'use strict';
/**
* A parser for augur. This is a separate function
* Compatible with augur schema v2
* strain - name
*/
var augur_parser = function(json, options) {
var tree = json.tree;
// iterate through each child and annotate
function decorate_nodes(node, index) {
node.annotation = "";
node.id = node.strain;
node.label = node.strain;
node.name = node.strain;
if (node.children) {
node.children.forEach(decorate_nodes);
}
}
decorate_nodes(tree);
tree.root = "true";
return {
json: tree,
error: null
};
};
exports.augur = augur_parser;
Object.defineProperty(exports, '__esModule', { value: true });
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment