{“ast”:null,“code”:“/*!n * The buffer module from node.js, for the browser.n *n * @author Feross Aboukhadijeh <feross@feross.org> <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 evenn * 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: 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 ofn * incorrect length in some situations.nn * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so theyn * get the Object
implementation, which is slower but behaves correctly.n */nnBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined ? global.TYPED_ARRAY_SUPPORT : typedArraySupport();n/*n * Export kMaxLength after typed array support is determined.n */nnexports.kMaxLength = kMaxLength();nnfunction typedArraySupport() {n try {n var arr = new Uint8Array(1);n arr.__proto__ = {n __proto__: Uint8Array.prototype,n foo: function foo() {n return 42;n }n };n return arr.foo() === 42 && // typed array instances can be augmentedn 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}nnfunction kMaxLength() {n return Buffer.TYPED_ARRAY_SUPPORT ? 0x7fffffff : 0x3fffffff;n}nnfunction createBuffer(that, length) {n if (kMaxLength() < length) {n throw new RangeError('Invalid typed array length');n }nn if (Buffer.TYPED_ARRAY_SUPPORT) {n // Return an augmented `Uint8Array` instance, for best performancen that = new Uint8Array(length);n that.__proto__ = Buffer.prototype;n } else {n // Fallback: Return an object instance of the Buffer classn if (that === null) {n that = new Buffer(length);n }nn that.length = length;n }nn return that;n}n/**n * The Buffer constructor returns instances of `Uint8Array` that have theirn * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass ofn * `Uint8Array`, so the returned instances will have all the node `Buffer` methodsn * and the `Uint8Array` methods. Square bracket notation works as expected – itn * returns a single octet.n *n * The `Uint8Array` prototype remains unmodified.n */nnnfunction Buffer(arg, encodingOrOffset, length) {n if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {n return new Buffer(arg, encodingOrOffset, length);n } // Common case.nnn if (typeof arg === 'number') {n if (typeof encodingOrOffset === 'string') {n throw new Error('If encoding is specified then the first argument must be a string');n }nn return allocUnsafe(this, arg);n }nn return from(this, arg, encodingOrOffset, length);n}nnBuffer.poolSize = 8192; // not used by this implementationn// TODO: Legacy, not needed anymore. Remove in next major version.nnBuffer._augment = function (arr) {n arr.__proto__ = Buffer.prototype;n return arr;n};nnfunction from(that, value, encodingOrOffset, length) {n if (typeof value === 'number') {n throw new TypeError('"value" argument must not be a number');n }nn if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {n return fromArrayBuffer(that, value, encodingOrOffset, length);n }nn if (typeof value === 'string') {n return fromString(that, value, encodingOrOffset);n }nn return fromObject(that, value);n}n/**n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeErrorn * 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 **/nnnBuffer.from = function (value, encodingOrOffset, length) {n return from(null, value, encodingOrOffset, length);n};nnif (Buffer.TYPED_ARRAY_SUPPORT) {n Buffer.prototype.__proto__ = Uint8Array.prototype;n Buffer.__proto__ = Uint8Array;nn if (typeof Symbol !== 'undefined' && Symbol.species && Buffer === Buffer) {n // Fix subarray() in ES2016. See: github.com/feross/buffer/pull/97n Object.defineProperty(Buffer, Symbol.species, {n value: null,n configurable: truen });n }n}nnfunction 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}nnfunction alloc(that, size, fill, encoding) {n assertSize(size);nn if (size <= 0) {n return createBuffer(that, size);n }nn if (fill !== undefined) {n // Only pay attention to encoding if it's a string. Thisn // prevents accidentally sending in a number that wouldn // be interpretted as a start offset.n return typeof encoding === 'string' ? createBuffer(that, size).fill(fill, encoding) : createBuffer(that, size).fill(fill);n }nn return createBuffer(that, size);n}n/**n * Creates a new filled Buffer instance.n * alloc(size[, fill[, encoding]])n **/nnnBuffer.alloc = function (size, fill, encoding) {n return alloc(null, size, fill, encoding);n};nnfunction allocUnsafe(that, size) {n assertSize(size);n that = createBuffer(that, size < 0 ? 0 : checked(size) | 0);nn if (!Buffer.TYPED_ARRAY_SUPPORT) {n for (var i = 0; i < size; ++i) {n that = 0;n }n }nn return that;n}n/**n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.n * */nnnBuffer.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 */nnnBuffer.allocUnsafeSlow = function (size) {n return allocUnsafe(null, size);n};nnfunction fromString(that, string, encoding) {n if (typeof encoding !== 'string' || encoding === '') {n encoding = 'utf8';n }nn if (!Buffer.isEncoding(encoding)) {n throw new TypeError('"encoding" must be a valid string encoding');n }nn var length = byteLength(string, encoding) | 0;n that = createBuffer(that, length);n var actual = that.write(string, encoding);nn if (actual !== length) {n // Writing a hex string, for example, that contains invalid characters willn // 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 }nn return that;n}nnfunction fromArrayLike(that, array) {n var length = array.length < 0 ? 0 : checked(array.length) | 0;n that = createBuffer(that, length);nn for (var i = 0; i < length; i += 1) {n that = array & 255;n }nn return that;n}nnfunction fromArrayBuffer(that, array, byteOffset, length) {n array.byteLength; // this throws if `array` is not a valid ArrayBuffernn if (byteOffset < 0 || array.byteLength < byteOffset) {n throw new RangeError('\'offset\' is out of bounds');n }nn if (array.byteLength < byteOffset + (length || 0)) {n throw new RangeError('\'length\' is out of bounds');n }nn 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 }nn if (Buffer.TYPED_ARRAY_SUPPORT) {n // Return an augmented `Uint8Array` instance, for best performancen that = array;n that.__proto__ = Buffer.prototype;n } else {n // Fallback: Return an object instance of the Buffer classn that = fromArrayLike(that, array);n }nn return that;n}nnfunction fromObject(that, obj) {n if (Buffer.isBuffer(obj)) {n var len = checked(obj.length) | 0;n that = createBuffer(that, len);nn if (that.length === 0) {n return that;n }nn obj.copy(that, 0, 0, len);n return that;n }nn if (obj) {n if (typeof ArrayBuffer !== 'undefined' && obj.buffer instanceof ArrayBuffer || 'length' in obj) {n if (typeof obj.length !== 'number' || isnan(obj.length)) {n return createBuffer(that, 0);n }nn return fromArrayLike(that, obj);n }nn if (obj.type === 'Buffer' && isArray(obj.data)) {n return fromArrayLike(that, obj.data);n }n }nn throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.');n}nnfunction checked(length) {n // Note: cannot use `length < kMaxLength()` here because that fails whenn // length is NaN (which is otherwise coerced to zero.)n if (length >= kMaxLength()) {n throw new RangeError('Attempt to allocate Buffer larger than maximum ' + 'size: 0x' + kMaxLength().toString(16) + ' bytes');n }nn return length | 0;n}nnfunction SlowBuffer(length) {n if (+length != length) {n // eslint-disable-line eqeqeqn length = 0;n }nn return Buffer.alloc(+length);n}nnBuffer.isBuffer = function isBuffer(b) {n return !!(b != null && b._isBuffer);n};nnBuffer.compare = function compare(a, b) {n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {n throw new TypeError('Arguments must be Buffers');n }nn if (a === b) return 0;n var x = a.length;n var y = b.length;nn for (var i = 0, len = Math.min(x, y); i < len; ++i) {n if (a !== b) {n x = a;n y = b;n break;n }n }nn if (x < y) return -1;n if (y < x) return 1;n return 0;n};nnBuffer.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;nn default:n return false;n }n};nnBuffer.concat = function concat(list, length) {n if (!isArray(list)) {n throw new TypeError('"list" argument must be an Array of Buffers');n }nn if (list.length === 0) {n return Buffer.alloc(0);n }nn var i;nn if (length === undefined) {n length = 0;nn for (i = 0; i < list.length; ++i) {n length += list.length;n }n }nn var buffer = Buffer.allocUnsafe(length);n var pos = 0;nn for (i = 0; i < list.length; ++i) {n var buf = list;nn if (!Buffer.isBuffer(buf)) {n throw new TypeError('"list" argument must be an Array of Buffers');n }nn buf.copy(buffer, pos);n pos += buf.length;n }nn return buffer;n};nnfunction byteLength(string, encoding) {n if (Buffer.isBuffer(string)) {n return string.length;n }nn if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' && (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {n return string.byteLength;n }nn if (typeof string !== 'string') {n string = '' + string;n }nn var len = string.length;n if (len === 0) return 0; // Use a for loop to avoid recursionnn var loweredCase = false;nn for (;;) {n switch (encoding) {n case 'ascii':n case 'latin1':n case 'binary':n return len;nn case 'utf8':n case 'utf-8':n case undefined:n return utf8ToBytes(string).length;nn case 'ucs2':n case 'ucs-2':n case 'utf16le':n case 'utf-16le':n return len * 2;nn case 'hex':n return len >>> 1;nn case 'base64':n return base64ToBytes(string).length;nn default:n if (loweredCase) return utf8ToBytes(string).length; // assume utf8nn encoding = ('' + encoding).toLowerCase();n loweredCase = true;n }n }n}nnBuffer.byteLength = byteLength;nnfunction slowToString(encoding, start, end) {n var loweredCase = false; // No need to verify that "this.length <= MAX_UINT32" since it's a read-onlyn // property of a typed array.n // This behaves neither like String nor Uint8Array in that we set start/endn // 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.nn if (start === undefined || start < 0) {n start = 0;n } // Return early if start > this.length. Done here to prevent potential uint32n // coercion fail below.nnn if (start > this.length) {n return '';n }nn if (end === undefined || end > this.length) {n end = this.length;n }nn if (end <= 0) {n return '';n } // Force coersion to uint32. This will also coerce falsey/NaN values to 0.nnn end >>>= 0;n start >>>= 0;nn if (end <= start) {n return '';n }nn if (!encoding) encoding = 'utf8';nn while (true) {n switch (encoding) {n case 'hex':n return hexSlice(this, start, end);nn case 'utf8':n case 'utf-8':n return utf8Slice(this, start, end);nn case 'ascii':n return asciiSlice(this, start, end);nn case 'latin1':n case 'binary':n return latin1Slice(this, start, end);nn case 'base64':n return base64Slice(this, start, end);nn case 'ucs2':n case 'ucs-2':n case 'utf16le':n case 'utf-16le':n return utf16leSlice(this, start, end);nn default:n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding);n encoding = (encoding + '').toLowerCase();n loweredCase = true;n }n }n} // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detectn// Buffer instances.nnnBuffer.prototype._isBuffer = true;nnfunction swap(b, n, m) {n var i = b;n b = b;n b = i;n}nnBuffer.prototype.swap16 = function swap16() {n var len = this.length;nn if (len % 2 !== 0) {n throw new RangeError('Buffer size must be a multiple of 16-bits');n }nn for (var i = 0; i < len; i += 2) {n swap(this, i, i + 1);n }nn return this;n};nnBuffer.prototype.swap32 = function swap32() {n var len = this.length;nn if (len % 4 !== 0) {n throw new RangeError('Buffer size must be a multiple of 32-bits');n }nn for (var i = 0; i < len; i += 4) {n swap(this, i, i + 3);n swap(this, i + 1, i + 2);n }nn return this;n};nnBuffer.prototype.swap64 = function swap64() {n var len = this.length;nn if (len % 8 !== 0) {n throw new RangeError('Buffer size must be a multiple of 64-bits');n }nn 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 }nn return this;n};nnBuffer.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};nnBuffer.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};nnBuffer.prototype.inspect = function inspect() {n var str = '';n var max = exports.INSPECT_MAX_BYTES;nn if (this.length > 0) {n str = this.toString('hex', 0, max).match(/.{2}/g).join(' ');n if (this.length > max) str += ' … ';n }nn return '<Buffer ' + str + '>';n};nnBuffer.prototype.compare = function compare(target, start, end, thisStart, thisEnd) {n if (!Buffer.isBuffer(target)) {n throw new TypeError('Argument must be a Buffer');n }nn if (start === undefined) {n start = 0;n }nn if (end === undefined) {n end = target ? target.length : 0;n }nn if (thisStart === undefined) {n thisStart = 0;n }nn if (thisEnd === undefined) {n thisEnd = this.length;n }nn if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {n throw new RangeError('out of range index');n }nn if (thisStart >= thisEnd && start >= end) {n return 0;n }nn if (thisStart >= thisEnd) {n return -1;n }nn if (start >= end) {n return 1;n }nn start >>>= 0;n end >>>= 0;n thisStart >>>= 0;n thisEnd >>>= 0;n if (this === target) return 0;n var x = thisEnd - thisStart;n var y = end - start;n var len = Math.min(x, y);n var thisCopy = this.slice(thisStart, thisEnd);n var targetCopy = target.slice(start, end);nn for (var i = 0; i < len; ++i) {n if (thisCopy !== targetCopy) {n x = thisCopy;n y = targetCopy;n break;n }n }nn if (x < y) return -1;n if (y < x) return 1;n return 0;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 searchn// - val - a string, Buffer, or numbern// - byteOffset - an index into `buffer`; will be clamped to an int32n// - encoding - an optional encoding, relevant is val is a stringn// - dir - true for indexOf, false for lastIndexOfnnnfunction bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {n // Empty buffer means no matchn if (buffer.length === 0) return -1; // Normalize byteOffsetnn 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 }nn byteOffset = +byteOffset; // Coerce to Number
.nn if (isNaN(byteOffset)) {n // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffern byteOffset = dir ? 0 : buffer.length - 1;n } // Normalize byteOffset: negative offsets start from the end of the buffernnn if (byteOffset < 0) byteOffset = buffer.length + byteOffset;nn if (byteOffset >= buffer.length) {n if (dir) return -1;else byteOffset = buffer.length - 1;n } else if (byteOffset < 0) {n if (dir) byteOffset = 0;else return -1;n } // Normalize valnnn if (typeof val === 'string') {n val = Buffer.from(val, encoding);n } // Finally, search either indexOf (if dir is true) or lastIndexOfnnn if (Buffer.isBuffer(val)) {n // Special case: looking for empty string/buffer always failsn if (val.length === 0) {n return -1;n }nn return arrayIndexOf(buffer, val, byteOffset, encoding, dir);n } else if (typeof val === 'number') {n val = val & 0xFF; // Search
for a byte value [0-255]nn if (Buffer.TYPED_ARRAY_SUPPORT && 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 }nn return arrayIndexOf(buffer, [val], byteOffset, encoding, dir);n }nn throw new TypeError('val must be string, number or Buffer');n}nnfunction arrayIndexOf(arr, val, byteOffset, encoding, dir) {n var indexSize = 1;n var arrLength = arr.length;n var valLength = val.length;nn if (encoding !== undefined) {n encoding = String(encoding).toLowerCase();nn if (encoding === 'ucs2' || encoding === 'ucs-2' || encoding === 'utf16le' || encoding === 'utf-16le') {n if (arr.length < 2 || val.length < 2) {n return -1;n }nn indexSize = 2;n arrLength /= 2;n valLength /= 2;n byteOffset /= 2;n }n }nn function read(buf, i) {n if (indexSize === 1) {n return buf;n } else {n return buf.readUInt16BE(i * indexSize);n }n }nn var i;nn if (dir) {n var foundIndex = -1;nn 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;nn for (i = byteOffset; i >= 0; i–) {n var found = true;nn for (var j = 0; j < valLength; j++) {n if (read(arr, i + j) !== read(val, j)) {n found = false;n break;n }n }nn if (found) return i;n }n }nn return -1;n}nnBuffer.prototype.includes = function includes(val, byteOffset, encoding) {n return this.indexOf(val, byteOffset, encoding) !== -1;n};nnBuffer.prototype.indexOf = function indexOf(val, byteOffset, encoding) {n return bidirectionalIndexOf(this, val, byteOffset, encoding, true);n};nnBuffer.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) {n return bidirectionalIndexOf(this, val, byteOffset, encoding, false);n};nnfunction hexWrite(buf, string, offset, length) {n offset = Number(offset) || 0;n var remaining = buf.length - offset;nn if (!length) {n length = remaining;n } else {n length = Number(length);nn if (length > remaining) {n length = remaining;n }n } // must be an even number of digitsnnn var strLen = string.length;n if (strLen % 2 !== 0) throw new TypeError('Invalid hex string');nn if (length > strLen / 2) {n length = strLen / 2;n }nn 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 }nn return i;n}nnfunction utf8Write(buf, string, offset, length) {n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length);n}nnfunction asciiWrite(buf, string, offset, length) {n return blitBuffer(asciiToBytes(string), buf, offset, length);n}nnfunction latin1Write(buf, string, offset, length) {n return asciiWrite(buf, string, offset, length);n}nnfunction base64Write(buf, string, offset, length) {n return blitBuffer(base64ToBytes(string), buf, offset, length);n}nnfunction ucs2Write(buf, string, offset, length) {n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length);n}nnBuffer.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; // Buffer#write(string, encoding)n } else if (length === undefined && typeof offset === 'string') {n encoding = offset;n length = this.length;n offset = 0; // Buffer#write(string, offset[, length][, encoding])n } else if (isFinite(offset)) {n offset = offset | 0;nn if (isFinite(length)) {n length = length | 0;n if (encoding === undefined) encoding = 'utf8';n } else {n encoding = length;n length = undefined;n } // legacy write(string, encoding, offset, length) - remove in v0.13nn } else {n throw new Error('Buffer.write(string, encoding, offset[, length]) is no longer supported');n }nn var remaining = this.length - offset;n if (length === undefined || length > remaining) length = remaining;nn if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) {n throw new RangeError('Attempt to write outside buffer bounds');n }nn if (!encoding) encoding = 'utf8';n var loweredCase = false;nn for (;;) {n switch (encoding) {n case 'hex':n return hexWrite(this, string, offset, length);nn case 'utf8':n case 'utf-8':n return utf8Write(this, string, offset, length);nn case 'ascii':n return asciiWrite(this, string, offset, length);nn case 'latin1':n case 'binary':n return latin1Write(this, string, offset, length);nn case 'base64':n // Warning: maxLength not taken into account in base64Writen return base64Write(this, string, offset, length);nn case 'ucs2':n case 'ucs-2':n case 'utf16le':n case 'utf-16le':n return ucs2Write(this, string, offset, length);nn default:n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding);n encoding = ('' + encoding).toLowerCase();n loweredCase = true;n }n }n};nnBuffer.prototype.toJSON = function toJSON() {n return {n type: 'Buffer',n data: Array.prototype.slice.call(this._arr || this, 0)n };n};nnfunction 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}nnfunction utf8Slice(buf, start, end) {n end = Math.min(buf.length, end);n var res = [];n var i = start;nn while (i < end) {n var firstByte = buf;n var codePoint = null;n var bytesPerSequence = firstByte > 0xEF ? 4 : firstByte > 0xDF ? 3 : firstByte > 0xBF ? 2 : 1;nn if (i + bytesPerSequence <= end) {n var secondByte, thirdByte, fourthByte, tempCodePoint;nn switch (bytesPerSequence) {n case 1:n if (firstByte < 0x80) {n codePoint = firstByte;n }nn break;nn case 2:n secondByte = buf[i + 1];nn if ((secondByte & 0xC0) === 0x80) {n tempCodePoint = (firstByte & 0x1F) << 0x6 | secondByte & 0x3F;nn if (tempCodePoint > 0x7F) {n codePoint = tempCodePoint;n }n }nn break;nn case 3:n secondByte = buf[i + 1];n thirdByte = buf[i + 2];nn if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | thirdByte & 0x3F;nn if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {n codePoint = tempCodePoint;n }n }nn break;nn case 4:n secondByte = buf[i + 1];n thirdByte = buf[i + 2];n fourthByte = buf[i + 3];nn if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | fourthByte & 0x3F;nn if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {n codePoint = tempCodePoint;n }n }nn }n }nn if (codePoint === null) {n // we did not generate a valid codePoint so insert an // replacement char (U+FFFD) and advance only 1 byten 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 }nn res.push(codePoint);n i += bytesPerSequence;n }nn return decodeCodePointsArray(res);n} // Based on stackoverflow.com/a/22747272/680742, the browser withn// the lowest limit is Chrome, with 0x10000 args.n// We go 1 magnitude less, for safetynnnvar MAX_ARGUMENTS_LENGTH = 0x1000;nnfunction decodeCodePointsArray(codePoints) {n var len = codePoints.length;nn if (len <= MAX_ARGUMENTS_LENGTH) {n return String.fromCharCode.apply(String, codePoints); // avoid extra slice()n } // Decode in chunks to avoid "call stack size exceeded".nnn var res = '';n var i = 0;nn while (i < len) {n res += String.fromCharCode.apply(String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH));n }nn return res;n}nnfunction asciiSlice(buf, start, end) {n var ret = '';n end = Math.min(buf.length, end);nn for (var i = start; i < end; ++i) {n ret += String.fromCharCode(buf & 0x7F);n }nn return ret;n}nnfunction latin1Slice(buf, start, end) {n var ret = '';n end = Math.min(buf.length, end);nn for (var i = start; i < end; ++i) {n ret += String.fromCharCode(buf);n }nn return ret;n}nnfunction hexSlice(buf, start, end) {n var len = buf.length;n if (!start || start < 0) start = 0;n if (!end || end < 0 || end > len) end = len;n var out = '';nn for (var i = start; i < end; ++i) {n out += toHex(buf);n }nn return out;n}nnfunction utf16leSlice(buf, start, end) {n var bytes = buf.slice(start, end);n var res = '';nn for (var i = 0; i < bytes.length; i += 2) {n res += String.fromCharCode(bytes + bytes[i + 1] * 256);n }nn return res;n}nnBuffer.prototype.slice = function slice(start, end) {n var len = this.length;n start = ~~start;n end = end === undefined ? len : ~~end;nn if (start < 0) {n start += len;n if (start < 0) start = 0;n } else if (start > len) {n start = len;n }nn if (end < 0) {n end += len;n if (end < 0) end = 0;n } else if (end > len) {n end = len;n }nn if (end < start) end = start;n var newBuf;nn 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);nn for (var i = 0; i < sliceLen; ++i) {n newBuf = this[i + start];n }n }nn return newBuf;n};n/*n * Need to make sure that buffer isn't trying to write out of bounds.n */nnnfunction 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}nnBuffer.prototype.readUIntLE = function readUIntLE(offset, byteLength, noAssert) {n offset = offset | 0;n byteLength = byteLength | 0;n if (!noAssert) checkOffset(offset, byteLength, this.length);n var val = this;n var mul = 1;n var i = 0;nn while (++i < byteLength && (mul *= 0x100)) {n val += this[offset + i] * mul;n }nn return val;n};nnBuffer.prototype.readUIntBE = function readUIntBE(offset, byteLength, noAssert) {n offset = offset | 0;n byteLength = byteLength | 0;nn if (!noAssert) {n checkOffset(offset, byteLength, this.length);n }nn var val = this[offset + –byteLength];n var mul = 1;nn while (byteLength > 0 && (mul *= 0x100)) {n val += this[offset + –byteLength] * mul;n }nn return val;n};nnBuffer.prototype.readUInt8 = function readUInt8(offset, noAssert) {n if (!noAssert) checkOffset(offset, 1, this.length);n return this;n};nnBuffer.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) {n if (!noAssert) checkOffset(offset, 2, this.length);n return this | this[offset + 1] << 8;n};nnBuffer.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) {n if (!noAssert) checkOffset(offset, 2, this.length);n return this << 8 | this[offset + 1];n};nnBuffer.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) {n if (!noAssert) checkOffset(offset, 4, this.length);n return (this | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 0x1000000;n};nnBuffer.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {n if (!noAssert) checkOffset(offset, 4, this.length);n return this * 0x1000000 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);n};nnBuffer.prototype.readIntLE = function readIntLE(offset, byteLength, noAssert) {n offset = offset | 0;n byteLength = byteLength | 0;n if (!noAssert) checkOffset(offset, byteLength, this.length);n var val = this;n var mul = 1;n var i = 0;nn while (++i < byteLength && (mul *= 0x100)) {n val += this[offset + i] * mul;n }nn mul *= 0x80;n if (val >= mul) val -= Math.pow(2, 8 * byteLength);n return val;n};nnBuffer.prototype.readIntBE = function readIntBE(offset, byteLength, noAssert) {n offset = offset | 0;n byteLength = byteLength | 0;n if (!noAssert) checkOffset(offset, byteLength, this.length);n var i = byteLength;n var mul = 1;n var val = this[offset + –i];nn while (i > 0 && (mul *= 0x100)) {n val += this[offset + –i] * mul;n }nn mul *= 0x80;n if (val >= mul) val -= Math.pow(2, 8 * byteLength);n return val;n};nnBuffer.prototype.readInt8 = function readInt8(offset, noAssert) {n if (!noAssert) checkOffset(offset, 1, this.length);n if (!(this & 0x80)) return this;n return (0xff - this + 1) * -1;n};nnBuffer.prototype.readInt16LE = function readInt16LE(offset, noAssert) {n if (!noAssert) checkOffset(offset, 2, this.length);n var val = this | this[offset + 1] << 8;n return val & 0x8000 ? val | 0xFFFF0000 : val;n};nnBuffer.prototype.readInt16BE = function readInt16BE(offset, noAssert) {n if (!noAssert) checkOffset(offset, 2, this.length);n var val = this[offset + 1] | this << 8;n return val & 0x8000 ? val | 0xFFFF0000 : val;n};nnBuffer.prototype.readInt32LE = function readInt32LE(offset, noAssert) {n if (!noAssert) checkOffset(offset, 4, this.length);n return this | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;n};nnBuffer.prototype.readInt32BE = function readInt32BE(offset, noAssert) {n if (!noAssert) checkOffset(offset, 4, this.length);n return this << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];n};nnBuffer.prototype.readFloatLE = function readFloatLE(offset, noAssert) {n if (!noAssert) checkOffset(offset, 4, this.length);n return ieee754.read(this, offset, true, 23, 4);n};nnBuffer.prototype.readFloatBE = function readFloatBE(offset, noAssert) {n if (!noAssert) checkOffset(offset, 4, this.length);n return ieee754.read(this, offset, false, 23, 4);n};nnBuffer.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {n if (!noAssert) checkOffset(offset, 8, this.length);n return ieee754.read(this, offset, true, 52, 8);n};nnBuffer.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {n if (!noAssert) checkOffset(offset, 8, this.length);n return ieee754.read(this, offset, false, 52, 8);n};nnfunction 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}nnBuffer.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength, noAssert) {n value = +value;n offset = offset | 0;n byteLength = byteLength | 0;nn if (!noAssert) {n var maxBytes = Math.pow(2, 8 * byteLength) - 1;n checkInt(this, value, offset, byteLength, maxBytes, 0);n }nn var mul = 1;n var i = 0;n this = value & 0xFF;nn while (++i < byteLength && (mul *= 0x100)) {n this[offset + i] = value / mul & 0xFF;n }nn return offset + byteLength;n};nnBuffer.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength, noAssert) {n value = +value;n offset = offset | 0;n byteLength = byteLength | 0;nn if (!noAssert) {n var maxBytes = Math.pow(2, 8 * byteLength) - 1;n checkInt(this, value, offset, byteLength, maxBytes, 0);n }nn var i = byteLength - 1;n var mul = 1;n this[offset + i] = value & 0xFF;nn while (–i >= 0 && (mul *= 0x100)) {n this[offset + i] = value / mul & 0xFF;n }nn return offset + byteLength;n};nnBuffer.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 = value & 0xff;n return offset + 1;n};nnfunction objectWriteUInt16(buf, value, offset, littleEndian) {n if (value < 0) value = 0xffff + value + 1;nn 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)) >>> (littleEndian ? i : 1 - i) * 8;n }n}nnBuffer.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) {n value = +value;n offset = offset | 0;n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);nn if (Buffer.TYPED_ARRAY_SUPPORT) {n this = value & 0xff;n this[offset + 1] = value >>> 8;n } else {n objectWriteUInt16(this, value, offset, true);n }nn return offset + 2;n};nnBuffer.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) {n value = +value;n offset = offset | 0;n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);nn if (Buffer.TYPED_ARRAY_SUPPORT) {n this = value >>> 8;n this[offset + 1] = value & 0xff;n } else {n objectWriteUInt16(this, value, offset, false);n }nn return offset + 2;n};nnfunction objectWriteUInt32(buf, value, offset, littleEndian) {n if (value < 0) value = 0xffffffff + value + 1;nn 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}nnBuffer.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) {n value = +value;n offset = offset | 0;n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);nn 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 = value & 0xff;n } else {n objectWriteUInt32(this, value, offset, true);n }nn return offset + 4;n};nnBuffer.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) {n value = +value;n offset = offset | 0;n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);nn if (Buffer.TYPED_ARRAY_SUPPORT) {n this = 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 }nn return offset + 4;n};nnBuffer.prototype.writeIntLE = function writeIntLE(value, offset, byteLength, noAssert) {n value = +value;n offset = offset | 0;nn if (!noAssert) {n var limit = Math.pow(2, 8 * byteLength - 1);n checkInt(this, value, offset, byteLength, limit - 1, -limit);n }nn var i = 0;n var mul = 1;n var sub = 0;n this = value & 0xFF;nn while (++i < byteLength && (mul *= 0x100)) {n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {n sub = 1;n }nn this[offset + i] = (value / mul >> 0) - sub & 0xFF;n }nn return offset + byteLength;n};nnBuffer.prototype.writeIntBE = function writeIntBE(value, offset, byteLength, noAssert) {n value = +value;n offset = offset | 0;nn if (!noAssert) {n var limit = Math.pow(2, 8 * byteLength - 1);n checkInt(this, value, offset, byteLength, limit - 1, -limit);n }nn var i = byteLength - 1;n var mul = 1;n var sub = 0;n this[offset + i] = value & 0xFF;nn while (–i >= 0 && (mul *= 0x100)) {n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {n sub = 1;n }nn this[offset + i] = (value / mul >> 0) - sub & 0xFF;n }nn return offset + byteLength;n};nnBuffer.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 = value & 0xff;n return offset + 1;n};nnBuffer.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) {n value = +value;n offset = offset | 0;n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);nn if (Buffer.TYPED_ARRAY_SUPPORT) {n this = value & 0xff;n this[offset + 1] = value >>> 8;n } else {n objectWriteUInt16(this, value, offset, true);n }nn return offset + 2;n};nnBuffer.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) {n value = +value;n offset = offset | 0;n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);nn if (Buffer.TYPED_ARRAY_SUPPORT) {n this = value >>> 8;n this[offset + 1] = value & 0xff;n } else {n objectWriteUInt16(this, value, offset, false);n }nn return offset + 2;n};nnBuffer.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) {n value = +value;n offset = offset | 0;n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);nn if (Buffer.TYPED_ARRAY_SUPPORT) {n this = 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 }nn return offset + 4;n};nnBuffer.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;nn if (Buffer.TYPED_ARRAY_SUPPORT) {n this = 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 }nn return offset + 4;n};nnfunction 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}nnfunction writeFloat(buf, value, offset, littleEndian, noAssert) {n if (!noAssert) {n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38);n }nn ieee754.write(buf, value, offset, littleEndian, 23, 4);n return offset + 4;n}nnBuffer.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) {n return writeFloat(this, value, offset, true, noAssert);n};nnBuffer.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) {n return writeFloat(this, value, offset, false, noAssert);n};nnfunction writeDouble(buf, value, offset, littleEndian, noAssert) {n if (!noAssert) {n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308);n }nn ieee754.write(buf, value, offset, littleEndian, 52, 8);n return offset + 8;n}nnBuffer.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) {n return writeDouble(this, value, offset, true, noAssert);n};nnBuffer.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) {n return writeDouble(this, value, offset, false, noAssert);n}; // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)nnnBuffer.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; // Copy
0 bytes; we're donenn if (end === start) return 0;n if (target.length === 0 || this.length === 0) return 0; // Fatal error conditionsnn if (targetStart < 0) {n throw new RangeError('targetStart out of bounds');n }nn if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds');n if (end < 0) throw new RangeError('sourceEnd out of bounds'); // Are we oob?nn if (end > this.length) end = this.length;nn if (target.length - targetStart < end - start) {n end = target.length - targetStart + start;n }nn var len = end - start;n var i;nn if (this === target && start < targetStart && targetStart < end) {n // descending copy from endn 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 startn for (i = 0; i < len; ++i) {n target[i + targetStart] = this[i + start];n }n } else {n Uint8Array.prototype.set.call(target, this.subarray(start, start + len), targetStart);n }nn return len;n}; // Usage:n// buffer.fill(number[, offset[, end]])n// buffer.fill(buffer[, offset[, end]])n// buffer.fill(string[, offset[, end]][, encoding])nnnBuffer.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 }nn if (val.length === 1) {n var code = val.charCodeAt(0);nn if (code < 256) {n val = code;n }n }nn if (encoding !== undefined && typeof encoding !== 'string') {n throw new TypeError('encoding must be a string');n }nn 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 } // Invalid ranges are not set to a default, so can range check early.nnn if (start < 0 || this.length < start || this.length < end) {n throw new RangeError('Out of range index');n }nn if (end <= start) {n return this;n }nn start = start >>> 0;n end = end === undefined ? this.length : end >>> 0;n if (!val) val = 0;n var i;nn if (typeof val === 'number') {n for (i = start; i < end; ++i) {n this = val;n }n } else {n var bytes = Buffer.isBuffer(val) ? val : utf8ToBytes(new Buffer(val, encoding).toString());n var len = bytes.length;nn for (i = 0; i < end - start; ++i) {n this[i + start] = bytes[i % len];n }n }nn return this;n}; // HELPER FUNCTIONSn// ================nnnvar INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g;nnfunction base64clean(str) {n // Node strips out invalid characters like \n and \t from the string, base64-js does notn str = stringtrim(str).replace(INVALID_BASE64_RE, ''); // Node converts strings with length < 2 to ''nn if (str.length < 2) return ''; // Node allows for non-padded base64 strings (missing trailing ===), base64-js does notnn while (str.length % 4 !== 0) {n str = str + '=';n }nn return str;n}nnfunction stringtrim(str) {n if (str.trim) return str.trim();n return str.replace(/^\s+|\s+$/g, '');n}nnfunction toHex(n) {n if (n < 16) return '0' + n.toString(16);n return n.toString(16);n}nnfunction utf8ToBytes(string, units) {n units = units || Infinity;n var codePoint;n var length = string.length;n var leadSurrogate = null;n var bytes = [];nn for (var i = 0; i < length; ++i) {n codePoint = string.charCodeAt(i); // is surrogate componentnn if (codePoint > 0xD7FF && codePoint < 0xE000) {n // last char was a leadn if (!leadSurrogate) {n // no lead yetn if (codePoint > 0xDBFF) {n // unexpected trailn if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);n continue;n } else if (i + 1 === length) {n // unpaired leadn if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);n continue;n } // valid leadnnn leadSurrogate = codePoint;n continue;n } // 2 leads in a rownnn if (codePoint < 0xDC00) {n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);n leadSurrogate = codePoint;n continue;n } // valid surrogate pairnnn codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000;n } else if (leadSurrogate) {n // valid bmp char, but last char was a leadn if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);n }nn leadSurrogate = null; // encode utf8nn 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(codePoint >> 0x6 | 0xC0, codePoint & 0x3F | 0x80);n } else if (codePoint < 0x10000) {n if ((units -= 3) < 0) break;n bytes.push(codePoint >> 0xC | 0xE0, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80);n } else if (codePoint < 0x110000) {n if ((units -= 4) < 0) break;n bytes.push(codePoint >> 0x12 | 0xF0, codePoint >> 0xC & 0x3F | 0x80, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80);n } else {n throw new Error('Invalid code point');n }n }nn return bytes;n}nnfunction asciiToBytes(str) {n var byteArray = [];nn 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 }nn return byteArray;n}nnfunction utf16leToBytes(str, units) {n var c, hi, lo;n var byteArray = [];nn for (var i = 0; i < str.length; ++i) {n if ((units -= 2) < 0) break;n c = str.charCodeAt(i);n hi = c >> 8;n lo = c % 256;n byteArray.push(lo);n byteArray.push(hi);n }nn return byteArray;n}nnfunction base64ToBytes(str) {n return base64.toByteArray(base64clean(str));n}nnfunction 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;n }nn return i;n}nnfunction isnan(val) {n return val !== val; // eslint-disable-line no-self-comparen}“,”map“:null,”metadata“:{},”sourceType“:”module“}