arnaucube
arnaucube/websnarkPublic Self-hosted repository
websnark/build/websnark.js
build/websnark.jsRaw
   1(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
   2(function (Buffer){
   3
   4            exports.code = new Buffer("AGFzbQEAAAABPApgAn9/AGABfwBgAX8Bf2ACf38Bf2ADf39/AX9gA39/fwBgA39+fwBgAn9+AGAEf39/fwBgBX9/f39/AAIQAQNlbnYGbWVtb3J5AgDoBwNgXwABAgEDAwQEBQYHCAUFBQAABQAAAAEFBQAABQAAAAEFAAIBAAAFAAUAAAAIAQIAAgUICQMABQUFBQACBQUIAAgCAQEABQUFAAAAAwACAQAABQAFAAAACAECAAIFCAkFB+4IXAhpbnRfY29weQAACGludF96ZXJvAAEHaW50X29uZQADCmludF9pc1plcm8AAgZpbnRfZXEABAdpbnRfZ3RlAAUHaW50X2FkZAAGB2ludF9zdWIABwdpbnRfbXVsAAgHaW50X2RpdgALDmludF9pbnZlcnNlTW9kAAwHZjFtX2FkZAANB2YxbV9zdWIADgdmMW1fbmVnAA8LZjFtX21SZWR1Y3QAEAdmMW1fbXVsABESZjFtX2Zyb21Nb250Z29tZXJ5ABMQZjFtX3RvTW9udGdvbWVyeQASC2YxbV9pbnZlcnNlABQIZjFtX2NvcHkAAAhmMW1femVybwABCmYxbV9pc1plcm8AAgZmMW1fZXEABAdmMW1fb25lABUHZnJtX2FkZAAWB2ZybV9zdWIAFwdmcm1fbmVnABgLZnJtX21SZWR1Y3QAGQdmcm1fbXVsABoSZnJtX2Zyb21Nb250Z29tZXJ5ABwQZnJtX3RvTW9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ACAAQgA3AwAgAEIANwMIIABCADcDECAAQgA3AxgLMwAgACkDGFAEQCAAKQMQUARAIAApAwhQBEAgACkDAFAPBUEADwsFQQAPCwVBAA8LQQAPCx4AIABCATcDACAAQgA3AwggAEIANwMQIABCADcDGAtHACAAKQMYIAEpAxhRBEAgACkDECABKQMQUQRAIAApAwggASkDCFEEQCAAKQMAIAEpAwBRDwVBAA8LBUEADwsFQQAPC0EADwt9ACAAKQMYIAEpAxhUBEBBAA8FIAApAxggASkDGFYEQEEBDwUgACkDECABKQMQVARAQQAPBSAAKQMQIAEpAxBWBEBBAQ8FIAApAwggASkDCFQEQEEADwUgACkDCCABKQMIVgRAQQEPBSAAKQMAIAEpAwBaDwsLCwsLC0EADwvUAQEBfiAANQIAIAE1AgB8IQMgAiADPgIAIAA1AgQgATUCBHwgA0IgiHwhAyACIAM+AgQgADUCCCABNQIIfCADQiCIfCEDIAIgAz4CCCAANQIMIAE1Agx8IANCIIh8IQMgAiADPgIMIAA1AhAgATUCEHwgA0IgiHwhAyACIAM+AhAgADUCFCABNQIUfCADQiCIfCEDIAIgAz4CFCAANQIYIAE1Ahh8IANCIIh8IQMgAiADPgIYIAA1AhwgATUCHHwgA0IgiHwhAyACIAM+AhwgA0IgiKcLjAIBAX4gADUCACABNQIAfSEDIAIgA0L/////D4M+AgAgADUCBCABNQIEfSADQiCHfCEDIAIgA0L/////D4M+AgQgADUCCCABNQIIfSADQiCHfCEDIAIgA0L/////D4M+AgggADUCDCABNQIMfSADQiCHfCEDIAIgA0L/////D4M+AgwgADUCECABNQIQfSADQiCHfCEDIAIgA0L/////D4M+AhAgADUCFCABNQIUfSADQiCHfCEDIAIgA0L/////D4M+AhQgADUCGCABNQIYfSADQiCHfCEDIAIgA0L/////D4M+AhggADUCHCABNQIcfSADQiCHfCEDIAIgA0L/////D4M+AhwgA0Igh6cL9BABAX5BKCAANQIAIAE1AgB+NwMAQSggADUCACABNQIEfjcDCEEoIAA1AgAgATUCCH43AxBBKCAANQIAIAE1Agx+NwMYQSggADUCACABNQIQfjcDIEEoIAA1AgAgATUCFH43AyhBKCAANQIAIAE1Ahh+NwMwQSggADUCACABNQIcfjcDOEEoIAA1AgQgATUCAH43A0BBKCAANQIEIAE1AgR+NwNIQSggADUCBCABNQIIfjcDUEEoIAA1AgQgATUCDH43A1hBKCAANQIEIAE1AhB+NwNgQSggADUCBCABNQIUfjcDaEEoIAA1AgQgATUCGH43A3BBKCAANQIEIAE1Ahx+NwN4QSggADUCCCABNQIAfjcDgAFBKCAANQIIIAE1AgR+NwOIAUEoIAA1AgggATUCCH43A5ABQSggADUCCCABNQIMfjcDmAFBKCAANQIIIAE1AhB+NwOgAUEoIAA1AgggATUCFH43A6gBQSggADUCCCABNQIYfjcDsAFBKCAANQIIIAE1Ahx+NwO4AUEoIAA1AgwgATUCAH43A8ABQSggADUCDCABNQIEfjcDyAFBKCAANQIMIAE1Agh+NwPQAUEoIAA1AgwgATUCDH43A9gBQSggADUCDCABNQIQfjcD4AFBKCAANQIMIAE1AhR+NwPoAUEoIAA1AgwgATUCGH43A/ABQSggADUCDCABNQIcfjcD+AFBKCAANQIQIAE1AgB+NwOAAkEoIAA1AhAgATUCBH43A4gCQSggADUCECABNQIIfjcDkAJBKCAANQIQIAE1Agx+NwOYAkEoIAA1AhAgATUCEH43A6ACQSggADUCECABNQIUfjcDqAJBKCAANQIQIAE1Ahh+NwOwAkEoIAA1AhAgATUCHH43A7gCQSggADUCFCABNQIAfjcDwAJBKCAANQIUIAE1AgR+NwPIAkEoIAA1AhQgATUCCH43A9ACQSggADUCFCABNQIMfjcD2AJBKCAANQIUIAE1AhB+NwPgAkEoIAA1AhQgATUCFH43A+gCQSggADUCFCABNQIYfjcD8AJBKCAANQIUIAE1Ahx+NwP4AkEoIAA1AhggATUCAH43A4ADQSggADUCGCABNQIEfjcDiANBKCAANQIYIAE1Agh+NwOQA0EoIAA1AhggATUCDH43A5gDQSggADUCGCABNQIQfjcDoANBKCAANQIYIAE1AhR+NwOoA0E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gA0IgiHxB6A01AgAgBH58IQMgACADPgIEIAA1AgggA0IgiHxB6A01AgQgBH58IQMgACADPgIIIAA1AgwgA0IgiHxB6A01AgggBH58IQMgACADPgIMIAA1AhAgA0IgiHxB6A01AgwgBH58IQMgACADPgIQIAA1AhQgA0IgiHxB6A01AhAgBH58IQMgACADPgIUIAA1AhggA0IgiHxB6A01AhQgBH58IQMgACADPgIYIAA1AhwgA0IgiHxB6A01AhggBH58IQMgACADPgIcIAA1AiAgA0IgiHxB6A01AhwgBH58IQMgACADPgIgQegOIANCIIg+AgRCACEDIAA1AgggAn5C/////w+DIQQgADUCCCADQiCIfEHoDTUCACAEfnwhAyAAIAM+AgggADUCDCADQiCIfEHoDTUCBCAEfnwhAyAAIAM+AgwgADUCECADQiCIfEHoDTUCCCAEfnwhAyAAIAM+AhAgADUCFCADQiCIfEHoDTUCDCAEfnwhAyAAIAM+AhQgADUCGCADQiCIfEHoDTUCECAEfnwhAyAAIAM+AhggADUCHCADQiCIfEHoDTUCFCAEfnwhAyAAIAM+AhwgADUCICADQiCIfEHoDTUCGCAEfnwhAyAAIAM+AiAgADUCJCADQiCIfEHoDTUCHCAEfnwhAyAAIAM+AiRB6A4gA0IgiD4CCEIAIQMgADUCDCACfkL/////D4MhBCAANQIMIANCIIh8QegNNQIAIAR+fCEDIAAgAz4CDCAANQIQIANCIIh8QegNNQIEIAR+fCEDIAAgAz4CECAANQIUIANCIIh8QegNNQIIIAR+fCEDIAAgAz4CFCAANQIYIANCIIh8QegNNQIMIAR+fCEDIAAgAz4CGCAANQIcIANCIIh8QegNNQIQIAR+fCEDIAAgAz4CHCAANQIgIANCIIh8QegNNQIUIAR+fCEDIAAgAz4CICAANQIkIANCIIh8QegNNQIYIAR+fCEDIAAgAz4CJCAANQIoIANCIIh8QegNNQIcIAR+fCEDIAAgAz4CKEHoDiADQiCIPgIMQgAhAyAANQIQIAJ+Qv////8PgyEEIAA1AhAgA0IgiHxB6A01AgAgBH58IQMgACADPgIQIAA1Ah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A1AiQgA0IgiHxB6A01AgggBH58IQMgACADPgIkIAA1AiggA0IgiHxB6A01AgwgBH58IQMgACADPgIoIAA1AiwgA0IgiHxB6A01AhAgBH58IQMgACADPgIsIAA1AjAgA0IgiHxB6A01AhQgBH58IQMgACADPgIwIAA1AjQgA0IgiHxB6A01AhggBH58IQMgACADPgI0IAA1AjggA0IgiHxB6A01AhwgBH58IQMgACADPgI4QegOIANCIIg+AhxB6A4gAEEgaiABEBYLEgAgACABQegSEAhB6BIgAhAZCwsAIABBiA4gARAaCxUAIABBqBMQAEHIExABQagTIAEQGQsXACAAIAEQHCABQegNIAEQDCABIAEQGwsJAEGoDiAAEAALFQAgACABQegTEBpB6BNBiA4gAhAaCwsAIABB6A0gARAMCwoAIABBwABqEAILFQAgABABIABBIGoQFSAAQcAAahABCyIAIAAgARAAIABBIGogAUEgahAAIABBwABqIAFBwABqEAALhgIAIAAQIQRAIAAgARAjDwsgACAAQYgUEBEgAEEgaiAAQSBqQagUEBFBqBRBqBRByBQQESAAQagUQegUEA1B6BRB6BRB6BQQEUHoFEGIFEHoFBAOQegUQcgUQegUEA5B6BRB6BRB6BQQDUGIFEGIFEGIFRANQYgVQYgUQYgVEA1BiBVBiBVBqBUQESAAQSBqIABBwABqQcgVEBFB6BRB6BQgARANQagVIAEgARAOQcgUQcgUQegVEA1B6BVB6BVB6BUQDUHoFUHoFUHoFRANQegUIAEgAUEgahAOIAFBIGpBiBUgAUEgahARIAFBIGpB6BUgAUEgahAOQcgVQcgVIAFBwABqEA0LrAMCAX8BfyAAQcAAaiEDIAFBwABqIQQgABAhBEAgASACECMPCyABECEEQCAAIAIQIw8LIAMgA0GIFhARIAQgBEGoFhARIABBqBZByBYQESABQYgWQegWEBEgA0GIFkGIFxARIARBqBZBqBcQESAAQSBqQagXQcgXEBEgAUEgakGIF0HoFxARQcgWQegWEAQEQEHIF0HoFxAEBEAgACACECQPCwtB6BZByBZBiBgQDkHoF0HIF0GoGBAOQYgYQYgYQcgYEA1ByBhByBhByBgQEUGIGEHIGEHoGBARQagYQagYQYgZEA1ByBZByBhByBkQEUGIGUGIGUGoGRARQcgZQcgZQegZEA1BqBlB6BggAhAOIAJB6BkgAhAOQcgXQegYQYgaEBFBiBpBiBpBiBoQDUHIGSACIAJBIGoQDiACQSBqQYgZIAJBIGoQESACQSBqQYgaIAJBIGoQDiADIAQgAkHAAGoQDSACQcAAaiACQcAAaiACQcAAahARIAJBwABqQYgWIAJBwABqEA4gAkHAAGpBqBYgAkHAAGoQDiACQcAAakGIGCACQcAAahARCyIAIAAgARAAIABBIGogAUEgahAPIABBwABqIAFBwABqEAALEAAgASACECYgACACIAIQJQsiACAAIAEQEyAAQSBqIAFBIGoQEyAAQcAAaiABQcAAahATCyIAIAAgARASIABBIGogAUEgahASIABBwABqIAFBwABqEBILTwAgABAhBEAgARAiBSAAQcAAakGoGhAUQagaQagaQcgaEBFBqBpByBpB6BoQESAAQcgaIAEQESAAQSBqQegaIAFBIGoQESABQcAAahAVCwunAgIBfwF/IABBiBsQIyADECIgAiEEAkADQCAEQQFrIQQgASAEai0AACEFIAMgAxAkIAVBgAFPBEAgBUGAAWshBUGIGyADIAMQJQsgAyADECQgBUHAAE8EQCAFQcAAayEFQYgbIAMgAxAlCyADIAMQJCAFQSBPBEAgBUEgayEFQYgbIAMgAxAlCyADIAMQJCAFQRBPBEAgBUEQayEFQYgbIAMgAxAlCyADIAMQJCAFQQhPBEAgBUEIayEFQYgbIAMgAxAlCyADIAMQJCAFQQRPBEAgBUEEayEFQYgbIAMgAxAlCyADIAMQJCAFQQJPBEAgBUECayEFQYgbIAMgAxAlCyADIAMQJCAFQQFPBEAgBUEBayEFQYgbIAMgAxAlCyAERQ0BDAALCwsrAgF/AX8gAEEFdkECdCEBQQEgAEEfcXQhAiABIAEoAujbASACcjYC6NsBCyQCAX8BfyAAQQV2QQJ0IQFBASAAQR9xdCECIAEoAujbASACcQugAQQBfwF/AX8BfyAAIQJB6BsQIkEAIQQCQANAIAQgAUYNAUH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CAwMDAAQEBIQFBQUEBgYGBgYGBwAICAiICQkJCAoKCgoKCgsIDAwMDAwMDQwMDA4MDg4OABAQEJAREREQEhISEhISExAUFBQUFBQVFBQUFhQWFhYQGBgYGBgYGRgYGBoYGhoaGBgYHBgcHBwYHBwcHBwcHgAgICCgISEhICIiIiIiIiMgJCQkJCQkJSQkJCYkJiYmICgoKCgoKCkoKCgqKCoqKigoKCwoLCwsKCwsLCwsLC4gMDAwMDAwMTAwMDIwMjIyMDAwNDA0NDQwNDQ0NDQ0NjAwMDgwODg4MDg4ODg4ODowODg4ODg4PDg4ODw4PDw8ABB6IgFC4ACAAAAAQABAgEAAQIBBAECAwABAgEEAQIDCAECAwQFBgMAAQIBBAECAwgBAgMEBQYDEAECAwQFBgMICQoDDAUGBwABAgEEAQIDCAECAwQFBgMQAQIDBAUGAwgJCgMMBQYHIAECAwQFBgMICQoDDAUGBxAREgMUBQYHGAkKCwwNDgcAAQIBBAECAwgBAgMEBQYDEAECAwQFBgMICQoDDAUGByABAgMEBQYDCAkKAwwFBgcQERIDFAUGBxgJCgsMDQ4HQAECAwQFBgMICQoDDAUGBxAREgMUBQYHGAkKCwwNDgcgISIDJAUGBygJCgsMDQ4HMBESExQVFgcYGRoLHA0ODw==", "base64");
   5            exports.pq = 1000;
   6            exports.pr = 1768;
   7        
   8}).call(this,require("buffer").Buffer)
   9},{"buffer":10}],2:[function(require,module,exports){
  10/*
  11    Copyright 2019 0KIMS association.
  12
  13    This file is part of websnark (Web Assembly zkSnark Prover).
  14
  15    websnark is a free software: you can redistribute it and/or modify it
  16    under the terms of the GNU General Public License as published by
  17    the Free Software Foundation, either version 3 of the License, or
  18    (at your option) any later version.
  19
  20    websnark is distributed in the hope that it will be useful, but WITHOUT
  21    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  22    or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
  23    License for more details.
  24
  25    You should have received a copy of the GNU General Public License
  26    along with websnark. If not, see <https://www.gnu.org/licenses/>.
  27*/
  28
  29/* globals window */
  30
  31const buildGroth16 = require("./src/groth16.js");
  32
  33buildGroth16().then( (groth16) => {
  34    window.genZKSnarkProof = function(witness, provingKey, cb) {
  35
  36        const p = groth16.proof(witness, provingKey);
  37
  38        if (cb) {
  39            p.then( (proof) => {
  40                cb(null, proof);
  41            }, (err) => {
  42                cb(err);
  43            });
  44        } else {
  45            return p;
  46        }
  47    };
  48});
  49
  50
  51
  52},{"./src/groth16.js":4}],3:[function(require,module,exports){
  53var bigInt = (function (undefined) {
  54    "use strict";
  55
  56    var BASE = 1e7,
  57        LOG_BASE = 7,
  58        MAX_INT = 9007199254740992,
  59        MAX_INT_ARR = smallToArray(MAX_INT),
  60        DEFAULT_ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyz";
  61
  62    var supportsNativeBigInt = typeof BigInt === "function";
  63
  64    function Integer(v, radix, alphabet, caseSensitive) {
  65        if (typeof v === "undefined") return Integer[0];
  66        if (typeof radix !== "undefined") return +radix === 10 && !alphabet ? parseValue(v) : parseBase(v, radix, alphabet, caseSensitive);
  67        return parseValue(v);
  68    }
  69
  70    function BigInteger(value, sign) {
  71        this.value = value;
  72        this.sign = sign;
  73        this.isSmall = false;
  74    }
  75    BigInteger.prototype = Object.create(Integer.prototype);
  76
  77    function SmallInteger(value) {
  78        this.value = value;
  79        this.sign = value < 0;
  80        this.isSmall = true;
  81    }
  82    SmallInteger.prototype = Object.create(Integer.prototype);
  83
  84    function NativeBigInt(value) {
  85        this.value = value;
  86    }
  87    NativeBigInt.prototype = Object.create(Integer.prototype);
  88
  89    function isPrecise(n) {
  90        return -MAX_INT < n && n < MAX_INT;
  91    }
  92
  93    function smallToArray(n) { // For performance reasons doesn't reference BASE, need to change this function if BASE changes
  94        if (n < 1e7)
  95            return [n];
  96        if (n < 1e14)
  97            return [n % 1e7, Math.floor(n / 1e7)];
  98        return [n % 1e7, Math.floor(n / 1e7) % 1e7, Math.floor(n / 1e14)];
  99    }
 100
 101    function arrayToSmall(arr) { // If BASE changes this function may need to change
 102        trim(arr);
 103        var length = arr.length;
 104        if (length < 4 && compareAbs(arr, MAX_INT_ARR) < 0) {
 105            switch (length) {
 106                case 0: return 0;
 107                case 1: return arr[0];
 108                case 2: return arr[0] + arr[1] * BASE;
 109                default: return arr[0] + (arr[1] + arr[2] * BASE) * BASE;
 110            }
 111        }
 112        return arr;
 113    }
 114
 115    function trim(v) {
 116        var i = v.length;
 117        while (v[--i] === 0);
 118        v.length = i + 1;
 119    }
 120
 121    function createArray(length) { // function shamelessly stolen from Yaffle's library https://github.com/Yaffle/BigInteger
 122        var x = new Array(length);
 123        var i = -1;
 124        while (++i < length) {
 125            x[i] = 0;
 126        }
 127        return x;
 128    }
 129
 130    function truncate(n) {
 131        if (n > 0) return Math.floor(n);
 132        return Math.ceil(n);
 133    }
 134
 135    function add(a, b) { // assumes a and b are arrays with a.length >= b.length
 136        var l_a = a.length,
 137            l_b = b.length,
 138            r = new Array(l_a),
 139            carry = 0,
 140            base = BASE,
 141            sum, i;
 142        for (i = 0; i < l_b; i++) {
 143            sum = a[i] + b[i] + carry;
 144            carry = sum >= base ? 1 : 0;
 145            r[i] = sum - carry * base;
 146        }
 147        while (i < l_a) {
 148            sum = a[i] + carry;
 149            carry = sum === base ? 1 : 0;
 150            r[i++] = sum - carry * base;
 151        }
 152        if (carry > 0) r.push(carry);
 153        return r;
 154    }
 155
 156    function addAny(a, b) {
 157        if (a.length >= b.length) return add(a, b);
 158        return add(b, a);
 159    }
 160
 161    function addSmall(a, carry) { // assumes a is array, carry is number with 0 <= carry < MAX_INT
 162        var l = a.length,
 163            r = new Array(l),
 164            base = BASE,
 165            sum, i;
 166        for (i = 0; i < l; i++) {
 167            sum = a[i] - base + carry;
 168            carry = Math.floor(sum / base);
 169            r[i] = sum - carry * base;
 170            carry += 1;
 171        }
 172        while (carry > 0) {
 173            r[i++] = carry % base;
 174            carry = Math.floor(carry / base);
 175        }
 176        return r;
 177    }
 178
 179    BigInteger.prototype.add = function (v) {
 180        var n = parseValue(v);
 181        if (this.sign !== n.sign) {
 182            return this.subtract(n.negate());
 183        }
 184        var a = this.value, b = n.value;
 185        if (n.isSmall) {
 186            return new BigInteger(addSmall(a, Math.abs(b)), this.sign);
 187        }
 188        return new BigInteger(addAny(a, b), this.sign);
 189    };
 190    BigInteger.prototype.plus = BigInteger.prototype.add;
 191
 192    SmallInteger.prototype.add = function (v) {
 193        var n = parseValue(v);
 194        var a = this.value;
 195        if (a < 0 !== n.sign) {
 196            return this.subtract(n.negate());
 197        }
 198        var b = n.value;
 199        if (n.isSmall) {
 200            if (isPrecise(a + b)) return new SmallInteger(a + b);
 201            b = smallToArray(Math.abs(b));
 202        }
 203        return new BigInteger(addSmall(b, Math.abs(a)), a < 0);
 204    };
 205    SmallInteger.prototype.plus = SmallInteger.prototype.add;
 206
 207    NativeBigInt.prototype.add = function (v) {
 208        return new NativeBigInt(this.value + parseValue(v).value);
 209    }
 210    NativeBigInt.prototype.plus = NativeBigInt.prototype.add;
 211
 212    function subtract(a, b) { // assumes a and b are arrays with a >= b
 213        var a_l = a.length,
 214            b_l = b.length,
 215            r = new Array(a_l),
 216            borrow = 0,
 217            base = BASE,
 218            i, difference;
 219        for (i = 0; i < b_l; i++) {
 220            difference = a[i] - borrow - b[i];
 221            if (difference < 0) {
 222                difference += base;
 223                borrow = 1;
 224            } else borrow = 0;
 225            r[i] = difference;
 226        }
 227        for (i = b_l; i < a_l; i++) {
 228            difference = a[i] - borrow;
 229            if (difference < 0) difference += base;
 230            else {
 231                r[i++] = difference;
 232                break;
 233            }
 234            r[i] = difference;
 235        }
 236        for (; i < a_l; i++) {
 237            r[i] = a[i];
 238        }
 239        trim(r);
 240        return r;
 241    }
 242
 243    function subtractAny(a, b, sign) {
 244        var value;
 245        if (compareAbs(a, b) >= 0) {
 246            value = subtract(a, b);
 247        } else {
 248            value = subtract(b, a);
 249            sign = !sign;
 250        }
 251        value = arrayToSmall(value);
 252        if (typeof value === "number") {
 253            if (sign) value = -value;
 254            return new SmallInteger(value);
 255        }
 256        return new BigInteger(value, sign);
 257    }
 258
 259    function subtractSmall(a, b, sign) { // assumes a is array, b is number with 0 <= b < MAX_INT
 260        var l = a.length,
 261            r = new Array(l),
 262            carry = -b,
 263            base = BASE,
 264            i, difference;
 265        for (i = 0; i < l; i++) {
 266            difference = a[i] + carry;
 267            carry = Math.floor(difference / base);
 268            difference %= base;
 269            r[i] = difference < 0 ? difference + base : difference;
 270        }
 271        r = arrayToSmall(r);
 272        if (typeof r === "number") {
 273            if (sign) r = -r;
 274            return new SmallInteger(r);
 275        } return new BigInteger(r, sign);
 276    }
 277
 278    BigInteger.prototype.subtract = function (v) {
 279        var n = parseValue(v);
 280        if (this.sign !== n.sign) {
 281            return this.add(n.negate());
 282        }
 283        var a = this.value, b = n.value;
 284        if (n.isSmall)
 285            return subtractSmall(a, Math.abs(b), this.sign);
 286        return subtractAny(a, b, this.sign);
 287    };
 288    BigInteger.prototype.minus = BigInteger.prototype.subtract;
 289
 290    SmallInteger.prototype.subtract = function (v) {
 291        var n = parseValue(v);
 292        var a = this.value;
 293        if (a < 0 !== n.sign) {
 294            return this.add(n.negate());
 295        }
 296        var b = n.value;
 297        if (n.isSmall) {
 298            return new SmallInteger(a - b);
 299        }
 300        return subtractSmall(b, Math.abs(a), a >= 0);
 301    };
 302    SmallInteger.prototype.minus = SmallInteger.prototype.subtract;
 303
 304    NativeBigInt.prototype.subtract = function (v) {
 305        return new NativeBigInt(this.value - parseValue(v).value);
 306    }
 307    NativeBigInt.prototype.minus = NativeBigInt.prototype.subtract;
 308
 309    BigInteger.prototype.negate = function () {
 310        return new BigInteger(this.value, !this.sign);
 311    };
 312    SmallInteger.prototype.negate = function () {
 313        var sign = this.sign;
 314        var small = new SmallInteger(-this.value);
 315        small.sign = !sign;
 316        return small;
 317    };
 318    NativeBigInt.prototype.negate = function () {
 319        return new NativeBigInt(-this.value);
 320    }
 321
 322    BigInteger.prototype.abs = function () {
 323        return new BigInteger(this.value, false);
 324    };
 325    SmallInteger.prototype.abs = function () {
 326        return new SmallInteger(Math.abs(this.value));
 327    };
 328    NativeBigInt.prototype.abs = function () {
 329        return new NativeBigInt(this.value >= 0 ? this.value : -this.value);
 330    }
 331
 332
 333    function multiplyLong(a, b) {
 334        var a_l = a.length,
 335            b_l = b.length,
 336            l = a_l + b_l,
 337            r = createArray(l),
 338            base = BASE,
 339            product, carry, i, a_i, b_j;
 340        for (i = 0; i < a_l; ++i) {
 341            a_i = a[i];
 342            for (var j = 0; j < b_l; ++j) {
 343                b_j = b[j];
 344                product = a_i * b_j + r[i + j];
 345                carry = Math.floor(product / base);
 346                r[i + j] = product - carry * base;
 347                r[i + j + 1] += carry;
 348            }
 349        }
 350        trim(r);
 351        return r;
 352    }
 353
 354    function multiplySmall(a, b) { // assumes a is array, b is number with |b| < BASE
 355        var l = a.length,
 356            r = new Array(l),
 357            base = BASE,
 358            carry = 0,
 359            product, i;
 360        for (i = 0; i < l; i++) {
 361            product = a[i] * b + carry;
 362            carry = Math.floor(product / base);
 363            r[i] = product - carry * base;
 364        }
 365        while (carry > 0) {
 366            r[i++] = carry % base;
 367            carry = Math.floor(carry / base);
 368        }
 369        return r;
 370    }
 371
 372    function shiftLeft(x, n) {
 373        var r = [];
 374        while (n-- > 0) r.push(0);
 375        return r.concat(x);
 376    }
 377
 378    function multiplyKaratsuba(x, y) {
 379        var n = Math.max(x.length, y.length);
 380
 381        if (n <= 30) return multiplyLong(x, y);
 382        n = Math.ceil(n / 2);
 383
 384        var b = x.slice(n),
 385            a = x.slice(0, n),
 386            d = y.slice(n),
 387            c = y.slice(0, n);
 388
 389        var ac = multiplyKaratsuba(a, c),
 390            bd = multiplyKaratsuba(b, d),
 391            abcd = multiplyKaratsuba(addAny(a, b), addAny(c, d));
 392
 393        var product = addAny(addAny(ac, shiftLeft(subtract(subtract(abcd, ac), bd), n)), shiftLeft(bd, 2 * n));
 394        trim(product);
 395        return product;
 396    }
 397
 398    // The following function is derived from a surface fit of a graph plotting the performance difference
 399    // between long multiplication and karatsuba multiplication versus the lengths of the two arrays.
 400    function useKaratsuba(l1, l2) {
 401        return -0.012 * l1 - 0.012 * l2 + 0.000015 * l1 * l2 > 0;
 402    }
 403
 404    BigInteger.prototype.multiply = function (v) {
 405        var n = parseValue(v),
 406            a = this.value, b = n.value,
 407            sign = this.sign !== n.sign,
 408            abs;
 409        if (n.isSmall) {
 410            if (b === 0) return Integer[0];
 411            if (b === 1) return this;
 412            if (b === -1) return this.negate();
 413            abs = Math.abs(b);
 414            if (abs < BASE) {
 415                return new BigInteger(multiplySmall(a, abs), sign);
 416            }
 417            b = smallToArray(abs);
 418        }
 419        if (useKaratsuba(a.length, b.length)) // Karatsuba is only faster for certain array sizes
 420            return new BigInteger(multiplyKaratsuba(a, b), sign);
 421        return new BigInteger(multiplyLong(a, b), sign);
 422    };
 423
 424    BigInteger.prototype.times = BigInteger.prototype.multiply;
 425
 426    function multiplySmallAndArray(a, b, sign) { // a >= 0
 427        if (a < BASE) {
 428            return new BigInteger(multiplySmall(b, a), sign);
 429        }
 430        return new BigInteger(multiplyLong(b, smallToArray(a)), sign);
 431    }
 432    SmallInteger.prototype._multiplyBySmall = function (a) {
 433        if (isPrecise(a.value * this.value)) {
 434            return new SmallInteger(a.value * this.value);
 435        }
 436        return multiplySmallAndArray(Math.abs(a.value), smallToArray(Math.abs(this.value)), this.sign !== a.sign);
 437    };
 438    BigInteger.prototype._multiplyBySmall = function (a) {
 439        if (a.value === 0) return Integer[0];
 440        if (a.value === 1) return this;
 441        if (a.value === -1) return this.negate();
 442        return multiplySmallAndArray(Math.abs(a.value), this.value, this.sign !== a.sign);
 443    };
 444    SmallInteger.prototype.multiply = function (v) {
 445        return parseValue(v)._multiplyBySmall(this);
 446    };
 447    SmallInteger.prototype.times = SmallInteger.prototype.multiply;
 448
 449    NativeBigInt.prototype.multiply = function (v) {
 450        return new NativeBigInt(this.value * parseValue(v).value);
 451    }
 452    NativeBigInt.prototype.times = NativeBigInt.prototype.multiply;
 453
 454    function square(a) {
 455        //console.assert(2 * BASE * BASE < MAX_INT);
 456        var l = a.length,
 457            r = createArray(l + l),
 458            base = BASE,
 459            product, carry, i, a_i, a_j;
 460        for (i = 0; i < l; i++) {
 461            a_i = a[i];
 462            carry = 0 - a_i * a_i;
 463            for (var j = i; j < l; j++) {
 464                a_j = a[j];
 465                product = 2 * (a_i * a_j) + r[i + j] + carry;
 466                carry = Math.floor(product / base);
 467                r[i + j] = product - carry * base;
 468            }
 469            r[i + l] = carry;
 470        }
 471        trim(r);
 472        return r;
 473    }
 474
 475    BigInteger.prototype.square = function () {
 476        return new BigInteger(square(this.value), false);
 477    };
 478
 479    SmallInteger.prototype.square = function () {
 480        var value = this.value * this.value;
 481        if (isPrecise(value)) return new SmallInteger(value);
 482        return new BigInteger(square(smallToArray(Math.abs(this.value))), false);
 483    };
 484
 485    NativeBigInt.prototype.square = function (v) {
 486        return new NativeBigInt(this.value * this.value);
 487    }
 488
 489    function divMod1(a, b) { // Left over from previous version. Performs faster than divMod2 on smaller input sizes.
 490        var a_l = a.length,
 491            b_l = b.length,
 492            base = BASE,
 493            result = createArray(b.length),
 494            divisorMostSignificantDigit = b[b_l - 1],
 495            // normalization
 496            lambda = Math.ceil(base / (2 * divisorMostSignificantDigit)),
 497            remainder = multiplySmall(a, lambda),
 498            divisor = multiplySmall(b, lambda),
 499            quotientDigit, shift, carry, borrow, i, l, q;
 500        if (remainder.length <= a_l) remainder.push(0);
 501        divisor.push(0);
 502        divisorMostSignificantDigit = divisor[b_l - 1];
 503        for (shift = a_l - b_l; shift >= 0; shift--) {
 504            quotientDigit = base - 1;
 505            if (remainder[shift + b_l] !== divisorMostSignificantDigit) {
 506                quotientDigit = Math.floor((remainder[shift + b_l] * base + remainder[shift + b_l - 1]) / divisorMostSignificantDigit);
 507            }
 508            // quotientDigit <= base - 1
 509            carry = 0;
 510            borrow = 0;
 511            l = divisor.length;
 512            for (i = 0; i < l; i++) {
 513                carry += quotientDigit * divisor[i];
 514                q = Math.floor(carry / base);
 515                borrow += remainder[shift + i] - (carry - q * base);
 516                carry = q;
 517                if (borrow < 0) {
 518                    remainder[shift + i] = borrow + base;
 519                    borrow = -1;
 520                } else {
 521                    remainder[shift + i] = borrow;
 522                    borrow = 0;
 523                }
 524            }
 525            while (borrow !== 0) {
 526                quotientDigit -= 1;
 527                carry = 0;
 528                for (i = 0; i < l; i++) {
 529                    carry += remainder[shift + i] - base + divisor[i];
 530                    if (carry < 0) {
 531                        remainder[shift + i] = carry + base;
 532                        carry = 0;
 533                    } else {
 534                        remainder[shift + i] = carry;
 535                        carry = 1;
 536                    }
 537                }
 538                borrow += carry;
 539            }
 540            result[shift] = quotientDigit;
 541        }
 542        // denormalization
 543        remainder = divModSmall(remainder, lambda)[0];
 544        return [arrayToSmall(result), arrayToSmall(remainder)];
 545    }
 546
 547    function divMod2(a, b) { // Implementation idea shamelessly stolen from Silent Matt's library http://silentmatt.com/biginteger/
 548        // Performs faster than divMod1 on larger input sizes.
 549        var a_l = a.length,
 550            b_l = b.length,
 551            result = [],
 552            part = [],
 553            base = BASE,
 554            guess, xlen, highx, highy, check;
 555        while (a_l) {
 556            part.unshift(a[--a_l]);
 557            trim(part);
 558            if (compareAbs(part, b) < 0) {
 559                result.push(0);
 560                continue;
 561            }
 562            xlen = part.length;
 563            highx = part[xlen - 1] * base + part[xlen - 2];
 564            highy = b[b_l - 1] * base + b[b_l - 2];
 565            if (xlen > b_l) {
 566                highx = (highx + 1) * base;
 567            }
 568            guess = Math.ceil(highx / highy);
 569            do {
 570                check = multiplySmall(b, guess);
 571                if (compareAbs(check, part) <= 0) break;
 572                guess--;
 573            } while (guess);
 574            result.push(guess);
 575            part = subtract(part, check);
 576        }
 577        result.reverse();
 578        return [arrayToSmall(result), arrayToSmall(part)];
 579    }
 580
 581    function divModSmall(value, lambda) {
 582        var length = value.length,
 583            quotient = createArray(length),
 584            base = BASE,
 585            i, q, remainder, divisor;
 586        remainder = 0;
 587        for (i = length - 1; i >= 0; --i) {
 588            divisor = remainder * base + value[i];
 589            q = truncate(divisor / lambda);
 590            remainder = divisor - q * lambda;
 591            quotient[i] = q | 0;
 592        }
 593        return [quotient, remainder | 0];
 594    }
 595
 596    function divModAny(self, v) {
 597        var value, n = parseValue(v);
 598        if (supportsNativeBigInt) {
 599            return [new NativeBigInt(self.value / n.value), new NativeBigInt(self.value % n.value)];
 600        }
 601        var a = self.value, b = n.value;
 602        var quotient;
 603        if (b === 0) throw new Error("Cannot divide by zero");
 604        if (self.isSmall) {
 605            if (n.isSmall) {
 606                return [new SmallInteger(truncate(a / b)), new SmallInteger(a % b)];
 607            }
 608            return [Integer[0], self];
 609        }
 610        if (n.isSmall) {
 611            if (b === 1) return [self, Integer[0]];
 612            if (b == -1) return [self.negate(), Integer[0]];
 613            var abs = Math.abs(b);
 614            if (abs < BASE) {
 615                value = divModSmall(a, abs);
 616                quotient = arrayToSmall(value[0]);
 617                var remainder = value[1];
 618                if (self.sign) remainder = -remainder;
 619                if (typeof quotient === "number") {
 620                    if (self.sign !== n.sign) quotient = -quotient;
 621                    return [new SmallInteger(quotient), new SmallInteger(remainder)];
 622                }
 623                return [new BigInteger(quotient, self.sign !== n.sign), new SmallInteger(remainder)];
 624            }
 625            b = smallToArray(abs);
 626        }
 627        var comparison = compareAbs(a, b);
 628        if (comparison === -1) return [Integer[0], self];
 629        if (comparison === 0) return [Integer[self.sign === n.sign ? 1 : -1], Integer[0]];
 630
 631        // divMod1 is faster on smaller input sizes
 632        if (a.length + b.length <= 200)
 633            value = divMod1(a, b);
 634        else value = divMod2(a, b);
 635
 636        quotient = value[0];
 637        var qSign = self.sign !== n.sign,
 638            mod = value[1],
 639            mSign = self.sign;
 640        if (typeof quotient === "number") {
 641            if (qSign) quotient = -quotient;
 642            quotient = new SmallInteger(quotient);
 643        } else quotient = new BigInteger(quotient, qSign);
 644        if (typeof mod === "number") {
 645            if (mSign) mod = -mod;
 646            mod = new SmallInteger(mod);
 647        } else mod = new BigInteger(mod, mSign);
 648        return [quotient, mod];
 649    }
 650
 651    BigInteger.prototype.divmod = function (v) {
 652        var result = divModAny(this, v);
 653        return {
 654            quotient: result[0],
 655            remainder: result[1]
 656        };
 657    };
 658    NativeBigInt.prototype.divmod = SmallInteger.prototype.divmod = BigInteger.prototype.divmod;
 659
 660
 661    BigInteger.prototype.divide = function (v) {
 662        return divModAny(this, v)[0];
 663    };
 664    NativeBigInt.prototype.over = NativeBigInt.prototype.divide = function (v) {
 665        return new NativeBigInt(this.value / parseValue(v).value);
 666    };
 667    SmallInteger.prototype.over = SmallInteger.prototype.divide = BigInteger.prototype.over = BigInteger.prototype.divide;
 668
 669    BigInteger.prototype.mod = function (v) {
 670        return divModAny(this, v)[1];
 671    };
 672    NativeBigInt.prototype.mod = NativeBigInt.prototype.remainder = function (v) {
 673        return new NativeBigInt(this.value % parseValue(v).value);
 674    };
 675    SmallInteger.prototype.remainder = SmallInteger.prototype.mod = BigInteger.prototype.remainder = BigInteger.prototype.mod;
 676
 677    BigInteger.prototype.pow = function (v) {
 678        var n = parseValue(v),
 679            a = this.value,
 680            b = n.value,
 681            value, x, y;
 682        if (b === 0) return Integer[1];
 683        if (a === 0) return Integer[0];
 684        if (a === 1) return Integer[1];
 685        if (a === -1) return n.isEven() ? Integer[1] : Integer[-1];
 686        if (n.sign) {
 687            return Integer[0];
 688        }
 689        if (!n.isSmall) throw new Error("The exponent " + n.toString() + " is too large.");
 690        if (this.isSmall) {
 691            if (isPrecise(value = Math.pow(a, b)))
 692                return new SmallInteger(truncate(value));
 693        }
 694        x = this;
 695        y = Integer[1];
 696        while (true) {
 697            if (b & 1 === 1) {
 698                y = y.times(x);
 699                --b;
 700            }
 701            if (b === 0) break;
 702            b /= 2;
 703            x = x.square();
 704        }
 705        return y;
 706    };
 707    SmallInteger.prototype.pow = BigInteger.prototype.pow;
 708
 709    NativeBigInt.prototype.pow = function (v) {
 710        var n = parseValue(v);
 711        var a = this.value, b = n.value;
 712        var _0 = BigInt(0), _1 = BigInt(1), _2 = BigInt(2);
 713        if (b === _0) return Integer[1];
 714        if (a === _0) return Integer[0];
 715        if (a === _1) return Integer[1];
 716        if (a === BigInt(-1)) return n.isEven() ? Integer[1] : Integer[-1];
 717        if (n.isNegative()) return new NativeBigInt(_0);
 718        var x = this;
 719        var y = Integer[1];
 720        while (true) {
 721            if ((b & _1) === _1) {
 722                y = y.times(x);
 723                --b;
 724            }
 725            if (b === _0) break;
 726            b /= _2;
 727            x = x.square();
 728        }
 729        return y;
 730    }
 731
 732    BigInteger.prototype.modPow = function (exp, mod) {
 733        exp = parseValue(exp);
 734        mod = parseValue(mod);
 735        if (mod.isZero()) throw new Error("Cannot take modPow with modulus 0");
 736        var r = Integer[1],
 737            base = this.mod(mod);
 738        while (exp.isPositive()) {
 739            if (base.isZero()) return Integer[0];
 740            if (exp.isOdd()) r = r.multiply(base).mod(mod);
 741            exp = exp.divide(2);
 742            base = base.square().mod(mod);
 743        }
 744        return r;
 745    };
 746    NativeBigInt.prototype.modPow = SmallInteger.prototype.modPow = BigInteger.prototype.modPow;
 747
 748    function compareAbs(a, b) {
 749        if (a.length !== b.length) {
 750            return a.length > b.length ? 1 : -1;
 751        }
 752        for (var i = a.length - 1; i >= 0; i--) {
 753            if (a[i] !== b[i]) return a[i] > b[i] ? 1 : -1;
 754        }
 755        return 0;
 756    }
 757
 758    BigInteger.prototype.compareAbs = function (v) {
 759        var n = parseValue(v),
 760            a = this.value,
 761            b = n.value;
 762        if (n.isSmall) return 1;
 763        return compareAbs(a, b);
 764    };
 765    SmallInteger.prototype.compareAbs = function (v) {
 766        var n = parseValue(v),
 767            a = Math.abs(this.value),
 768            b = n.value;
 769        if (n.isSmall) {
 770            b = Math.abs(b);
 771            return a === b ? 0 : a > b ? 1 : -1;
 772        }
 773        return -1;
 774    };
 775    NativeBigInt.prototype.compareAbs = function (v) {
 776        var a = this.value;
 777        var b = parseValue(v).value;
 778        a = a >= 0 ? a : -a;
 779        b = b >= 0 ? b : -b;
 780        return a === b ? 0 : a > b ? 1 : -1;
 781    }
 782
 783    BigInteger.prototype.compare = function (v) {
 784        // See discussion about comparison with Infinity:
 785        // https://github.com/peterolson/BigInteger.js/issues/61
 786        if (v === Infinity) {
 787            return -1;
 788        }
 789        if (v === -Infinity) {
 790            return 1;
 791        }
 792
 793        var n = parseValue(v),
 794            a = this.value,
 795            b = n.value;
 796        if (this.sign !== n.sign) {
 797            return n.sign ? 1 : -1;
 798        }
 799        if (n.isSmall) {
 800            return this.sign ? -1 : 1;
 801        }
 802        return compareAbs(a, b) * (this.sign ? -1 : 1);
 803    };
 804    BigInteger.prototype.compareTo = BigInteger.prototype.compare;
 805
 806    SmallInteger.prototype.compare = function (v) {
 807        if (v === Infinity) {
 808            return -1;
 809        }
 810        if (v === -Infinity) {
 811            return 1;
 812        }
 813
 814        var n = parseValue(v),
 815            a = this.value,
 816            b = n.value;
 817        if (n.isSmall) {
 818            return a == b ? 0 : a > b ? 1 : -1;
 819        }
 820        if (a < 0 !== n.sign) {
 821            return a < 0 ? -1 : 1;
 822        }
 823        return a < 0 ? 1 : -1;
 824    };
 825    SmallInteger.prototype.compareTo = SmallInteger.prototype.compare;
 826
 827    NativeBigInt.prototype.compare = function (v) {
 828        if (v === Infinity) {
 829            return -1;
 830        }
 831        if (v === -Infinity) {
 832            return 1;
 833        }
 834        var a = this.value;
 835        var b = parseValue(v).value;
 836        return a === b ? 0 : a > b ? 1 : -1;
 837    }
 838    NativeBigInt.prototype.compareTo = NativeBigInt.prototype.compare;
 839
 840    BigInteger.prototype.equals = function (v) {
 841        return this.compare(v) === 0;
 842    };
 843    NativeBigInt.prototype.eq = NativeBigInt.prototype.equals = SmallInteger.prototype.eq = SmallInteger.prototype.equals = BigInteger.prototype.eq = BigInteger.prototype.equals;
 844
 845    BigInteger.prototype.notEquals = function (v) {
 846        return this.compare(v) !== 0;
 847    };
 848    NativeBigInt.prototype.neq = NativeBigInt.prototype.notEquals = SmallInteger.prototype.neq = SmallInteger.prototype.notEquals = BigInteger.prototype.neq = BigInteger.prototype.notEquals;
 849
 850    BigInteger.prototype.greater = function (v) {
 851        return this.compare(v) > 0;
 852    };
 853    NativeBigInt.prototype.gt = NativeBigInt.prototype.greater = SmallInteger.prototype.gt = SmallInteger.prototype.greater = BigInteger.prototype.gt = BigInteger.prototype.greater;
 854
 855    BigInteger.prototype.lesser = function (v) {
 856        return this.compare(v) < 0;
 857    };
 858    NativeBigInt.prototype.lt = NativeBigInt.prototype.lesser = SmallInteger.prototype.lt = SmallInteger.prototype.lesser = BigInteger.prototype.lt = BigInteger.prototype.lesser;
 859
 860    BigInteger.prototype.greaterOrEquals = function (v) {
 861        return this.compare(v) >= 0;
 862    };
 863    NativeBigInt.prototype.geq = NativeBigInt.prototype.greaterOrEquals = SmallInteger.prototype.geq = SmallInteger.prototype.greaterOrEquals = BigInteger.prototype.geq = BigInteger.prototype.greaterOrEquals;
 864
 865    BigInteger.prototype.lesserOrEquals = function (v) {
 866        return this.compare(v) <= 0;
 867    };
 868    NativeBigInt.prototype.leq = NativeBigInt.prototype.lesserOrEquals = SmallInteger.prototype.leq = SmallInteger.prototype.lesserOrEquals = BigInteger.prototype.leq = BigInteger.prototype.lesserOrEquals;
 869
 870    BigInteger.prototype.isEven = function () {
 871        return (this.value[0] & 1) === 0;
 872    };
 873    SmallInteger.prototype.isEven = function () {
 874        return (this.value & 1) === 0;
 875    };
 876    NativeBigInt.prototype.isEven = function () {
 877        return (this.value & BigInt(1)) === BigInt(0);
 878    }
 879
 880    BigInteger.prototype.isOdd = function () {
 881        return (this.value[0] & 1) === 1;
 882    };
 883    SmallInteger.prototype.isOdd = function () {
 884        return (this.value & 1) === 1;
 885    };
 886    NativeBigInt.prototype.isOdd = function () {
 887        return (this.value & BigInt(1)) === BigInt(1);
 888    }
 889
 890    BigInteger.prototype.isPositive = function () {
 891        return !this.sign;
 892    };
 893    SmallInteger.prototype.isPositive = function () {
 894        return this.value > 0;
 895    };
 896    NativeBigInt.prototype.isPositive = SmallInteger.prototype.isPositive;
 897
 898    BigInteger.prototype.isNegative = function () {
 899        return this.sign;
 900    };
 901    SmallInteger.prototype.isNegative = function () {
 902        return this.value < 0;
 903    };
 904    NativeBigInt.prototype.isNegative = SmallInteger.prototype.isNegative;
 905
 906    BigInteger.prototype.isUnit = function () {
 907        return false;
 908    };
 909    SmallInteger.prototype.isUnit = function () {
 910        return Math.abs(this.value) === 1;
 911    };
 912    NativeBigInt.prototype.isUnit = function () {
 913        return this.abs().value === BigInt(1);
 914    }
 915
 916    BigInteger.prototype.isZero = function () {
 917        return false;
 918    };
 919    SmallInteger.prototype.isZero = function () {
 920        return this.value === 0;
 921    };
 922    NativeBigInt.prototype.isZero = function () {
 923        return this.value === BigInt(0);
 924    }
 925
 926    BigInteger.prototype.isDivisibleBy = function (v) {
 927        var n = parseValue(v);
 928        if (n.isZero()) return false;
 929        if (n.isUnit()) return true;
 930        if (n.compareAbs(2) === 0) return this.isEven();
 931        return this.mod(n).isZero();
 932    };
 933    NativeBigInt.prototype.isDivisibleBy = SmallInteger.prototype.isDivisibleBy = BigInteger.prototype.isDivisibleBy;
 934
 935    function isBasicPrime(v) {
 936        var n = v.abs();
 937        if (n.isUnit()) return false;
 938        if (n.equals(2) || n.equals(3) || n.equals(5)) return true;
 939        if (n.isEven() || n.isDivisibleBy(3) || n.isDivisibleBy(5)) return false;
 940        if (n.lesser(49)) return true;
 941        // we don't know if it's prime: let the other functions figure it out
 942    }
 943
 944    function millerRabinTest(n, a) {
 945        var nPrev = n.prev(),
 946            b = nPrev,
 947            r = 0,
 948            d, t, i, x;
 949        while (b.isEven()) b = b.divide(2), r++;
 950        next: for (i = 0; i < a.length; i++) {
 951            if (n.lesser(a[i])) continue;
 952            x = bigInt(a[i]).modPow(b, n);
 953            if (x.isUnit() || x.equals(nPrev)) continue;
 954            for (d = r - 1; d != 0; d--) {
 955                x = x.square().mod(n);
 956                if (x.isUnit()) return false;
 957                if (x.equals(nPrev)) continue next;
 958            }
 959            return false;
 960        }
 961        return true;
 962    }
 963
 964    // Set "strict" to true to force GRH-supported lower bound of 2*log(N)^2
 965    BigInteger.prototype.isPrime = function (strict) {
 966        var isPrime = isBasicPrime(this);
 967        if (isPrime !== undefined) return isPrime;
 968        var n = this.abs();
 969        var bits = n.bitLength();
 970        if (bits <= 64)
 971            return millerRabinTest(n, [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]);
 972        var logN = Math.log(2) * bits.toJSNumber();
 973        var t = Math.ceil((strict === true) ? (2 * Math.pow(logN, 2)) : logN);
 974        for (var a = [], i = 0; i < t; i++) {
 975            a.push(bigInt(i + 2));
 976        }
 977        return millerRabinTest(n, a);
 978    };
 979    NativeBigInt.prototype.isPrime = SmallInteger.prototype.isPrime = BigInteger.prototype.isPrime;
 980
 981    BigInteger.prototype.isProbablePrime = function (iterations) {
 982        var isPrime = isBasicPrime(this);
 983        if (isPrime !== undefined) return isPrime;
 984        var n = this.abs();
 985        var t = iterations === undefined ? 5 : iterations;
 986        for (var a = [], i = 0; i < t; i++) {
 987            a.push(bigInt.randBetween(2, n.minus(2)));
 988        }
 989        return millerRabinTest(n, a);
 990    };
 991    NativeBigInt.prototype.isProbablePrime = SmallInteger.prototype.isProbablePrime = BigInteger.prototype.isProbablePrime;
 992
 993    BigInteger.prototype.modInv = function (n) {
 994        var t = bigInt.zero, newT = bigInt.one, r = parseValue(n), newR = this.abs(), q, lastT, lastR;
 995        while (!newR.isZero()) {
 996            q = r.divide(newR);
 997            lastT = t;
 998            lastR = r;
 999            t = newT;
1000            r = newR;
1001            newT = lastT.subtract(q.multiply(newT));
1002            newR = lastR.subtract(q.multiply(newR));
1003        }
1004        if (!r.isUnit()) throw new Error(this.toString() + " and " + n.toString() + " are not co-prime");
1005        if (t.compare(0) === -1) {
1006            t = t.add(n);
1007        }
1008        if (this.isNegative()) {
1009            return t.negate();
1010        }
1011        return t;
1012    };
1013
1014    NativeBigInt.prototype.modInv = SmallInteger.prototype.modInv = BigInteger.prototype.modInv;
1015
1016    BigInteger.prototype.next = function () {
1017        var value = this.value;
1018        if (this.sign) {
1019            return subtractSmall(value, 1, this.sign);
1020        }
1021        return new BigInteger(addSmall(value, 1), this.sign);
1022    };
1023    SmallInteger.prototype.next = function () {
1024        var value = this.value;
1025        if (value + 1 < MAX_INT) return new SmallInteger(value + 1);
1026        return new BigInteger(MAX_INT_ARR, false);
1027    };
1028    NativeBigInt.prototype.next = function () {
1029        return new NativeBigInt(this.value + BigInt(1));
1030    }
1031
1032    BigInteger.prototype.prev = function () {
1033        var value = this.value;
1034        if (this.sign) {
1035            return new BigInteger(addSmall(value, 1), true);
1036        }
1037        return subtractSmall(value, 1, this.sign);
1038    };
1039    SmallInteger.prototype.prev = function () {
1040        var value = this.value;
1041        if (value - 1 > -MAX_INT) return new SmallInteger(value - 1);
1042        return new BigInteger(MAX_INT_ARR, true);
1043    };
1044    NativeBigInt.prototype.prev = function () {
1045        return new NativeBigInt(this.value - BigInt(1));
1046    }
1047
1048    var powersOfTwo = [1];
1049    while (2 * powersOfTwo[powersOfTwo.length - 1] <= BASE) powersOfTwo.push(2 * powersOfTwo[powersOfTwo.length - 1]);
1050    var powers2Length = powersOfTwo.length, highestPower2 = powersOfTwo[powers2Length - 1];
1051
1052    function shift_isSmall(n) {
1053        return Math.abs(n) <= BASE;
1054    }
1055
1056    BigInteger.prototype.shiftLeft = function (v) {
1057        var n = parseValue(v).toJSNumber();
1058        if (!shift_isSmall(n)) {
1059            throw new Error(String(n) + " is too large for shifting.");
1060        }
1061        if (n < 0) return this.shiftRight(-n);
1062        var result = this;
1063        if (result.isZero()) return result;
1064        while (n >= powers2Length) {
1065            result = result.multiply(highestPower2);
1066            n -= powers2Length - 1;
1067        }
1068        return result.multiply(powersOfTwo[n]);
1069    };
1070    NativeBigInt.prototype.shiftLeft = SmallInteger.prototype.shiftLeft = BigInteger.prototype.shiftLeft;
1071
1072    BigInteger.prototype.shiftRight = function (v) {
1073        var remQuo;
1074        var n = parseValue(v).toJSNumber();
1075        if (!shift_isSmall(n)) {
1076            throw new Error(String(n) + " is too large for shifting.");
1077        }
1078        if (n < 0) return this.shiftLeft(-n);
1079        var result = this;
1080        while (n >= powers2Length) {
1081            if (result.isZero() || (result.isNegative() && result.isUnit())) return result;
1082            remQuo = divModAny(result, highestPower2);
1083            result = remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0];
1084            n -= powers2Length - 1;
1085        }
1086        remQuo = divModAny(result, powersOfTwo[n]);
1087        return remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0];
1088    };
1089    NativeBigInt.prototype.shiftRight = SmallInteger.prototype.shiftRight = BigInteger.prototype.shiftRight;
1090
1091    function bitwise(x, y, fn) {
1092        y = parseValue(y);
1093        var xSign = x.isNegative(), ySign = y.isNegative();
1094        var xRem = xSign ? x.not() : x,
1095            yRem = ySign ? y.not() : y;
1096        var xDigit = 0, yDigit = 0;
1097        var xDivMod = null, yDivMod = null;
1098        var result = [];
1099        while (!xRem.isZero() || !yRem.isZero()) {
1100            xDivMod = divModAny(xRem, highestPower2);
1101            xDigit = xDivMod[1].toJSNumber();
1102            if (xSign) {
1103                xDigit = highestPower2 - 1 - xDigit; // two's complement for negative numbers
1104            }
1105
1106            yDivMod = divModAny(yRem, highestPower2);
1107            yDigit = yDivMod[1].toJSNumber();
1108            if (ySign) {
1109                yDigit = highestPower2 - 1 - yDigit; // two's complement for negative numbers
1110            }
1111
1112            xRem = xDivMod[0];
1113            yRem = yDivMod[0];
1114            result.push(fn(xDigit, yDigit));
1115        }
1116        var sum = fn(xSign ? 1 : 0, ySign ? 1 : 0) !== 0 ? bigInt(-1) : bigInt(0);
1117        for (var i = result.length - 1; i >= 0; i -= 1) {
1118            sum = sum.multiply(highestPower2).add(bigInt(result[i]));
1119        }
1120        return sum;
1121    }
1122
1123    BigInteger.prototype.not = function () {
1124        return this.negate().prev();
1125    };
1126    NativeBigInt.prototype.not = SmallInteger.prototype.not = BigInteger.prototype.not;
1127
1128    BigInteger.prototype.and = function (n) {
1129        return bitwise(this, n, function (a, b) { return a & b; });
1130    };
1131    NativeBigInt.prototype.and = SmallInteger.prototype.and = BigInteger.prototype.and;
1132
1133    BigInteger.prototype.or = function (n) {
1134        return bitwise(this, n, function (a, b) { return a | b; });
1135    };
1136    NativeBigInt.prototype.or = SmallInteger.prototype.or = BigInteger.prototype.or;
1137
1138    BigInteger.prototype.xor = function (n) {
1139        return bitwise(this, n, function (a, b) { return a ^ b; });
1140    };
1141    NativeBigInt.prototype.xor = SmallInteger.prototype.xor = BigInteger.prototype.xor;
1142
1143    var LOBMASK_I = 1 << 30, LOBMASK_BI = (BASE & -BASE) * (BASE & -BASE) | LOBMASK_I;
1144    function roughLOB(n) { // get lowestOneBit (rough)
1145        // SmallInteger: return Min(lowestOneBit(n), 1 << 30)
1146        // BigInteger: return Min(lowestOneBit(n), 1 << 14) [BASE=1e7]
1147        var v = n.value,
1148            x = typeof v === "number" ? v | LOBMASK_I :
1149                typeof v === "bigint" ? v | BigInt(LOBMASK_I) :
1150                    v[0] + v[1] * BASE | LOBMASK_BI;
1151        return x & -x;
1152    }
1153
1154    function integerLogarithm(value, base) {
1155        if (base.compareTo(value) <= 0) {
1156            var tmp = integerLogarithm(value, base.square(base));
1157            var p = tmp.p;
1158            var e = tmp.e;
1159            var t = p.multiply(base);
1160            return t.compareTo(value) <= 0 ? { p: t, e: e * 2 + 1 } : { p: p, e: e * 2 };
1161        }
1162        return { p: bigInt(1), e: 0 };
1163    }
1164
1165    BigInteger.prototype.bitLength = function () {
1166        var n = this;
1167        if (n.compareTo(bigInt(0)) < 0) {
1168            n = n.negate().subtract(bigInt(1));
1169        }
1170        if (n.compareTo(bigInt(0)) === 0) {
1171            return bigInt(0);
1172        }
1173        return bigInt(integerLogarithm(n, bigInt(2)).e).add(bigInt(1));
1174    }
1175    NativeBigInt.prototype.bitLength = SmallInteger.prototype.bitLength = BigInteger.prototype.bitLength;
1176
1177    function max(a, b) {
1178        a = parseValue(a);
1179        b = parseValue(b);
1180        return a.greater(b) ? a : b;
1181    }
1182    function min(a, b) {
1183        a = parseValue(a);
1184        b = parseValue(b);
1185        return a.lesser(b) ? a : b;
1186    }
1187    function gcd(a, b) {
1188        a = parseValue(a).abs();
1189        b = parseValue(b).abs();
1190        if (a.equals(b)) return a;
1191        if (a.isZero()) return b;
1192        if (b.isZero()) return a;
1193        var c = Integer[1], d, t;
1194        while (a.isEven() && b.isEven()) {
1195            d = min(roughLOB(a), roughLOB(b));
1196            a = a.divide(d);
1197            b = b.divide(d);
1198            c = c.multiply(d);
1199        }
1200        while (a.isEven()) {
1201            a = a.divide(roughLOB(a));
1202        }
1203        do {
1204            while (b.isEven()) {
1205                b = b.divide(roughLOB(b));
1206            }
1207            if (a.greater(b)) {
1208                t = b; b = a; a = t;
1209            }
1210            b = b.subtract(a);
1211        } while (!b.isZero());
1212        return c.isUnit() ? a : a.multiply(c);
1213    }
1214    function lcm(a, b) {
1215        a = parseValue(a).abs();
1216        b = parseValue(b).abs();
1217        return a.divide(gcd(a, b)).multiply(b);
1218    }
1219    function randBetween(a, b) {
1220        a = parseValue(a);
1221        b = parseValue(b);
1222        var low = min(a, b), high = max(a, b);
1223        var range = high.subtract(low).add(1);
1224        if (range.isSmall) return low.add(Math.floor(Math.random() * range));
1225        var digits = toBase(range, BASE).value;
1226        var result = [], restricted = true;
1227        for (var i = 0; i < digits.length; i++) {
1228            var top = restricted ? digits[i] : BASE;
1229            var digit = truncate(Math.random() * top);
1230            result.push(digit);
1231            if (digit < top) restricted = false;
1232        }
1233        return low.add(Integer.fromArray(result, BASE, false));
1234    }
1235
1236    var parseBase = function (text, base, alphabet, caseSensitive) {
1237        alphabet = alphabet || DEFAULT_ALPHABET;
1238        text = String(text);
1239        if (!caseSensitive) {
1240            text = text.toLowerCase();
1241            alphabet = alphabet.toLowerCase();
1242        }
1243        var length = text.length;
1244        var i;
1245        var absBase = Math.abs(base);
1246        var alphabetValues = {};
1247        for (i = 0; i < alphabet.length; i++) {
1248            alphabetValues[alphabet[i]] = i;
1249        }
1250        for (i = 0; i < length; i++) {
1251            var c = text[i];
1252            if (c === "-") continue;
1253            if (c in alphabetValues) {
1254                if (alphabetValues[c] >= absBase) {
1255                    if (c === "1" && absBase === 1) continue;
1256                    throw new Error(c + " is not a valid digit in base " + base + ".");
1257                }
1258            }
1259        }
1260        base = parseValue(base);
1261        var digits = [];
1262        var isNegative = text[0] === "-";
1263        for (i = isNegative ? 1 : 0; i < text.length; i++) {
1264            var c = text[i];
1265            if (c in alphabetValues) digits.push(parseValue(alphabetValues[c]));
1266            else if (c === "<") {
1267                var start = i;
1268                do { i++; } while (text[i] !== ">" && i < text.length);
1269                digits.push(parseValue(text.slice(start + 1, i)));
1270            }
1271            else throw new Error(c + " is not a valid character");
1272        }
1273        return parseBaseFromArray(digits, base, isNegative);
1274    };
1275
1276    function parseBaseFromArray(digits, base, isNegative) {
1277        var val = Integer[0], pow = Integer[1], i;
1278        for (i = digits.length - 1; i >= 0; i--) {
1279            val = val.add(digits[i].times(pow));
1280            pow = pow.times(base);
1281        }
1282        return isNegative ? val.negate() : val;
1283    }
1284
1285    function stringify(digit, alphabet) {
1286        alphabet = alphabet || DEFAULT_ALPHABET;
1287        if (digit < alphabet.length) {
1288            return alphabet[digit];
1289        }
1290        return "<" + digit + ">";
1291    }
1292
1293    function toBase(n, base) {
1294        base = bigInt(base);
1295        if (base.isZero()) {
1296            if (n.isZero()) return { value: [0], isNegative: false };
1297            throw new Error("Cannot convert nonzero numbers to base 0.");
1298        }
1299        if (base.equals(-1)) {
1300            if (n.isZero()) return { value: [0], isNegative: false };
1301            if (n.isNegative())
1302                return {
1303                    value: [].concat.apply([], Array.apply(null, Array(-n.toJSNumber()))
1304                        .map(Array.prototype.valueOf, [1, 0])
1305                    ),
1306                    isNegative: false
1307                };
1308
1309            var arr = Array.apply(null, Array(n.toJSNumber() - 1))
1310                .map(Array.prototype.valueOf, [0, 1]);
1311            arr.unshift([1]);
1312            return {
1313                value: [].concat.apply([], arr),
1314                isNegative: false
1315            };
1316        }
1317
1318        var neg = false;
1319        if (n.isNegative() && base.isPositive()) {
1320            neg = true;
1321            n = n.abs();
1322        }
1323        if (base.isUnit()) {
1324            if (n.isZero()) return { value: [0], isNegative: false };
1325
1326            return {
1327                value: Array.apply(null, Array(n.toJSNumber()))
1328                    .map(Number.prototype.valueOf, 1),
1329                isNegative: neg
1330            };
1331        }
1332        var out = [];
1333        var left = n, divmod;
1334        while (left.isNegative() || left.compareAbs(base) >= 0) {
1335            divmod = left.divmod(base);
1336            left = divmod.quotient;
1337            var digit = divmod.remainder;
1338            if (digit.isNegative()) {
1339                digit = base.minus(digit).abs();
1340                left = left.next();
1341            }
1342            out.push(digit.toJSNumber());
1343        }
1344        out.push(left.toJSNumber());
1345        return { value: out.reverse(), isNegative: neg };
1346    }
1347
1348    function toBaseString(n, base, alphabet) {
1349        var arr = toBase(n, base);
1350        return (arr.isNegative ? "-" : "") + arr.value.map(function (x) {
1351            return stringify(x, alphabet);
1352        }).join('');
1353    }
1354
1355    BigInteger.prototype.toArray = function (radix) {
1356        return toBase(this, radix);
1357    };
1358
1359    SmallInteger.prototype.toArray = function (radix) {
1360        return toBase(this, radix);
1361    };
1362
1363    NativeBigInt.prototype.toArray = function (radix) {
1364        return toBase(this, radix);
1365    };
1366
1367    BigInteger.prototype.toString = function (radix, alphabet) {
1368        if (radix === undefined) radix = 10;
1369        if (radix !== 10) return toBaseString(this, radix, alphabet);
1370        var v = this.value, l = v.length, str = String(v[--l]), zeros = "0000000", digit;
1371        while (--l >= 0) {
1372            digit = String(v[l]);
1373            str += zeros.slice(digit.length) + digit;
1374        }
1375        var sign = this.sign ? "-" : "";
1376        return sign + str;
1377    };
1378
1379    SmallInteger.prototype.toString = function (radix, alphabet) {
1380        if (radix === undefined) radix = 10;
1381        if (radix != 10) return toBaseString(this, radix, alphabet);
1382        return String(this.value);
1383    };
1384
1385    NativeBigInt.prototype.toString = SmallInteger.prototype.toString;
1386
1387    NativeBigInt.prototype.toJSON = BigInteger.prototype.toJSON = SmallInteger.prototype.toJSON = function () { return this.toString(); }
1388
1389    BigInteger.prototype.valueOf = function () {
1390        return parseInt(this.toString(), 10);
1391    };
1392    BigInteger.prototype.toJSNumber = BigInteger.prototype.valueOf;
1393
1394    SmallInteger.prototype.valueOf = function () {
1395        return this.value;
1396    };
1397    SmallInteger.prototype.toJSNumber = SmallInteger.prototype.valueOf;
1398    NativeBigInt.prototype.valueOf = NativeBigInt.prototype.toJSNumber = function () {
1399        return parseInt(this.toString(), 10);
1400    }
1401
1402    function parseStringValue(v) {
1403        if (isPrecise(+v)) {
1404            var x = +v;
1405            if (x === truncate(x))
1406                return supportsNativeBigInt ? new NativeBigInt(BigInt(x)) : new SmallInteger(x);
1407            throw new Error("Invalid integer: " + v);
1408        }
1409        var sign = v[0] === "-";
1410        if (sign) v = v.slice(1);
1411        var split = v.split(/e/i);
1412        if (split.length > 2) throw new Error("Invalid integer: " + split.join("e"));
1413        if (split.length === 2) {
1414            var exp = split[1];
1415            if (exp[0] === "+") exp = exp.slice(1);
1416            exp = +exp;
1417            if (exp !== truncate(exp) || !isPrecise(exp)) throw new Error("Invalid integer: " + exp + " is not a valid exponent.");
1418            var text = split[0];
1419            var decimalPlace = text.indexOf(".");
1420            if (decimalPlace >= 0) {
1421                exp -= text.length - decimalPlace - 1;
1422                text = text.slice(0, decimalPlace) + text.slice(decimalPlace + 1);
1423            }
1424            if (exp < 0) throw new Error("Cannot include negative exponent part for integers");
1425            text += (new Array(exp + 1)).join("0");
1426            v = text;
1427        }
1428        var isValid = /^([0-9][0-9]*)$/.test(v);
1429        if (!isValid) throw new Error("Invalid integer: " + v);
1430        if (supportsNativeBigInt) {
1431            return new NativeBigInt(BigInt(sign ? "-" + v : v));
1432        }
1433        var r = [], max = v.length, l = LOG_BASE, min = max - l;
1434        while (max > 0) {
1435            r.push(+v.slice(min, max));
1436            min -= l;
1437            if (min < 0) min = 0;
1438            max -= l;
1439        }
1440        trim(r);
1441        return new BigInteger(r, sign);
1442    }
1443
1444    function parseNumberValue(v) {
1445        if (supportsNativeBigInt) {
1446            return new NativeBigInt(BigInt(v));
1447        }
1448        if (isPrecise(v)) {
1449            if (v !== truncate(v)) throw new Error(v + " is not an integer.");
1450            return new SmallInteger(v);
1451        }
1452        return parseStringValue(v.toString());
1453    }
1454
1455    function parseValue(v) {
1456        if (typeof v === "number") {
1457            return parseNumberValue(v);
1458        }
1459        if (typeof v === "string") {
1460            return parseStringValue(v);
1461        }
1462        if (typeof v === "bigint") {
1463            return new NativeBigInt(v);
1464        }
1465        return v;
1466    }
1467    // Pre-define numbers in range [-999,999]
1468    for (var i = 0; i < 1000; i++) {
1469        Integer[i] = parseValue(i);
1470        if (i > 0) Integer[-i] = parseValue(-i);
1471    }
1472    // Backwards compatibility
1473    Integer.one = Integer[1];
1474    Integer.zero = Integer[0];
1475    Integer.minusOne = Integer[-1];
1476    Integer.max = max;
1477    Integer.min = min;
1478    Integer.gcd = gcd;
1479    Integer.lcm = lcm;
1480    Integer.isInstance = function (x) { return x instanceof BigInteger || x instanceof SmallInteger || x instanceof NativeBigInt; };
1481    Integer.randBetween = randBetween;
1482
1483    Integer.fromArray = function (digits, base, isNegative) {
1484        return parseBaseFromArray(digits.map(parseValue), parseValue(base || 10), isNegative);
1485    };
1486
1487    return Integer;
1488})();
1489
1490// Node.js check
1491if (typeof module !== "undefined" && module.hasOwnProperty("exports")) {
1492    module.exports = bigInt;
1493}
1494
1495//amd check
1496if (typeof define === "function" && define.amd) {
1497    define("big-integer", [], function () {
1498        return bigInt;
1499    });
1500}
1501
1502},{}],4:[function(require,module,exports){
1503(function (process){
1504/*
1505    Copyright 2019 0KIMS association.
1506
1507    This file is part of websnark (Web Assembly zkSnark Prover).
1508
1509    websnark is a free software: you can redistribute it and/or modify it
1510    under the terms of the GNU General Public License as published by
1511    the Free Software Foundation, either version 3 of the License, or
1512    (at your option) any later version.
1513
1514    websnark is distributed in the hope that it will be useful, but WITHOUT
1515    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
1516    or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
1517    License for more details.
1518
1519    You should have received a copy of the GNU General Public License
1520    along with websnark. If not, see <https://www.gnu.org/licenses/>.
1521*/
1522
1523/* globals WebAssembly, Blob, Worker, navigator, Promise, window */
1524const bigInt = require("big-integer");
1525const groth16_wasm = require("../build/groth16_wasm.js");
1526const assert = require("assert");
1527
1528const inBrowser = (typeof window !== "undefined");
1529let NodeWorker;
1530let NodeCrypto;
1531if (!inBrowser) {
1532    NodeWorker = require("worker_threads").Worker;
1533    NodeCrypto = require("crypto");
1534}
1535
1536
1537class Deferred {
1538    constructor() {
1539        this.promise = new Promise((resolve, reject)=> {
1540            this.reject = reject;
1541            this.resolve = resolve;
1542        });
1543    }
1544}
1545
1546/*
1547function delay(ms) {
1548    return new Promise(resolve => setTimeout(resolve, ms));
1549}
1550*/
1551
1552function thread(self) {
1553    let instance;
1554    let memory;
1555    let i32;
1556
1557    async function init(data) {
1558        const code = new Uint8Array(data.code);
1559        const wasmModule = await WebAssembly.compile(code);
1560        memory = new WebAssembly.Memory({initial:data.init});
1561        i32 = new Uint32Array(memory.buffer);
1562
1563        instance = await WebAssembly.instantiate(wasmModule, {
1564            env: {
1565                "memory": memory
1566            }
1567        });
1568    }
1569
1570    function alloc(length) {
1571        while (i32[0] & 3) i32[0]++;  // Return always aligned pointers
1572        const res = i32[0];
1573        i32[0] += length;
1574        return res;
1575    }
1576
1577    function putBin(b) {
1578        const p = alloc(b.byteLength);
1579        const s32 = new Uint32Array(b);
1580        i32.set(s32, p/4);
1581        return p;
1582    }
1583
1584    function getBin(p, l) {
1585        return memory.buffer.slice(p, p+l);
1586    }
1587
1588    self.onmessage = function(e) {
1589        let data;
1590        if (e.data) {
1591            data = e.data;
1592        } else {
1593            data = e;
1594        }
1595
1596        if (data.command == "INIT") {
1597            init(data).then(function() {
1598                self.postMessage(data.result);
1599            });
1600        } else if (data.command == "G1_MULTIEXP") {
1601
1602            const oldAlloc = i32[0];
1603            const pScalars = putBin(data.scalars);
1604            const pPoints = putBin(data.points);
1605            const pRes = alloc(96);
1606            instance.exports.g1_zero(pRes);
1607            instance.exports.g1_multiexp(pScalars, pPoints, data.n, 5, pRes);
1608
1609            data.result = getBin(pRes, 96);
1610            i32[0] = oldAlloc;
1611            self.postMessage(data.result, [data.result]);
1612        } else if (data.command == "G2_MULTIEXP") {
1613
1614            const oldAlloc = i32[0];
1615            const pScalars = putBin(data.scalars);
1616            const pPoints = putBin(data.points);
1617            const pRes = alloc(192);
1618            instance.exports.g2_zero(pRes);
1619            instance.exports.g2_multiexp(pScalars, pPoints, data.n, 5, pRes);
1620
1621            data.result = getBin(pRes, 192);
1622            i32[0] = oldAlloc;
1623            self.postMessage(data.result, [data.result]);
1624        } else if (data.command == "CALC_H") {
1625            const oldAlloc = i32[0];
1626            const pSignals = putBin(data.signals);
1627            const pPolsA = putBin(data.polsA);
1628            const pPolsB = putBin(data.polsB);
1629            const nSignals = data.nSignals;
1630            const domainSize = data.domainSize;
1631            const pSignalsM = alloc(nSignals*32);
1632            const pPolA = alloc(domainSize*32);
1633            const pPolB = alloc(domainSize*32);
1634            const pPolA2 = alloc(domainSize*32*2);
1635            const pPolB2 = alloc(domainSize*32*2);
1636
1637            instance.exports.fft_toMontgomeryN(pSignals, pSignalsM, nSignals);
1638
1639            instance.exports.pol_zero(pPolA, domainSize);
1640            instance.exports.pol_zero(pPolB, domainSize);
1641
1642            instance.exports.pol_constructLC(pPolsA, pSignalsM, nSignals, pPolA);
1643            instance.exports.pol_constructLC(pPolsB, pSignalsM, nSignals, pPolB);
1644
1645            instance.exports.fft_copyNInterleaved(pPolA, pPolA2, domainSize);
1646            instance.exports.fft_copyNInterleaved(pPolB, pPolB2, domainSize);
1647
1648            instance.exports.fft_ifft(pPolA, domainSize, 0);
1649            instance.exports.fft_ifft(pPolB, domainSize, 0);
1650            instance.exports.fft_fft(pPolA, domainSize, 1);
1651            instance.exports.fft_fft(pPolB, domainSize, 1);
1652
1653            instance.exports.fft_copyNInterleaved(pPolA, pPolA2+32, domainSize);
1654            instance.exports.fft_copyNInterleaved(pPolB, pPolB2+32, domainSize);
1655
1656            instance.exports.fft_mulN(pPolA2, pPolB2, domainSize*2, pPolA2);
1657
1658            instance.exports.fft_ifft(pPolA2, domainSize*2, 0);
1659
1660            instance.exports.fft_fromMontgomeryN(pPolA2+domainSize*32, pPolA2+domainSize*32, nSignals);
1661
1662            data.result = getBin(pPolA2+domainSize*32, domainSize*32);
1663            i32[0] = oldAlloc;
1664            self.postMessage(data.result, [data.result]);
1665        } else if (data.command == "TERMINATE") {
1666            process.exit();
1667        }
1668    };
1669}
1670
1671async function build() {
1672
1673    const groth16 = new Groth16();
1674
1675    groth16.q = bigInt("21888242871839275222246405745257275088696311157297823662689037894645226208583");
1676    groth16.r = bigInt("21888242871839275222246405745257275088548364400416034343698204186575808495617");
1677    groth16.n64 = Math.floor((groth16.q.minus(1).bitLength() - 1)/64) +1;
1678    groth16.n32 = groth16.n64*2;
1679    groth16.n8 = groth16.n64*8;
1680
1681    groth16.memory = new WebAssembly.Memory({initial:1000});
1682    groth16.i32 = new Uint32Array(groth16.memory.buffer);
1683
1684    const wasmModule = await WebAssembly.compile(groth16_wasm.code);
1685
1686    groth16.instance = await WebAssembly.instantiate(wasmModule, {
1687        env: {
1688            "memory": groth16.memory
1689        }
1690    });
1691
1692    groth16.pq = groth16_wasm.pq;
1693    groth16.pr = groth16_wasm.pr;
1694
1695    groth16.pr0 = groth16.alloc(192);
1696    groth16.pr1 = groth16.alloc(192);
1697
1698    groth16.workers = [];
1699    groth16.pendingDeferreds = [];
1700    groth16.working = [];
1701
1702    let concurrency;
1703
1704    if ((typeof(navigator) === "object") && navigator.hardwareConcurrency) {
1705        concurrency = navigator.hardwareConcurrency;
1706    } else {
1707        concurrency = 8;
1708    }
1709
1710    function getOnMsg(i) {
1711        return function(e) {
1712            let data;
1713            if ((e)&&(e.data)) {
1714                data = e.data;
1715            } else {
1716                data = e;
1717            }
1718
1719            groth16.working[i]=false;
1720            groth16.pendingDeferreds[i].resolve(data);
1721            groth16.processWorks();
1722        };
1723    }
1724
1725    for (let i = 0; i<concurrency; i++) {
1726
1727        if (inBrowser) {
1728            const blob = new Blob(["(", thread.toString(), ")(self);"], { type: "text/javascript" });
1729            const url = URL.createObjectURL(blob);
1730
1731            groth16.workers[i] = new Worker(url);
1732
1733            groth16.workers[i].onmessage = getOnMsg(i);
1734
1735        } else {
1736            groth16.workers[i] = new NodeWorker("(" + thread.toString()+ ")(require('worker_threads').parentPort);", {eval: true});
1737
1738            groth16.workers[i].on("message", getOnMsg(i));
1739        }
1740
1741        groth16.working[i]=false;
1742    }
1743
1744    const initPromises = [];
1745    for (let i=0; i<groth16.workers.length;i++) {
1746        const copyCode = groth16_wasm.code.buffer.slice(0);
1747        initPromises.push(groth16.postAction(i, {
1748            command: "INIT",
1749            init: 1000,
1750            code: copyCode
1751
1752        }, [copyCode]));
1753    }
1754
1755    await Promise.all(initPromises);
1756
1757    return groth16;
1758}
1759
1760class Groth16 {
1761    constructor() {
1762        this.actionQueue = [];
1763    }
1764
1765    postAction(workerId, e, transfers, _deferred) {
1766        assert(this.working[workerId] == false);
1767        this.working[workerId] = true;
1768
1769        this.pendingDeferreds[workerId] = _deferred ? _deferred : new Deferred();
1770        this.workers[workerId].postMessage(e, transfers);
1771
1772        return this.pendingDeferreds[workerId].promise;
1773    }
1774
1775    processWorks() {
1776        for (let i=0; (i<this.workers.length)&&(this.actionQueue.length > 0); i++) {
1777            if (this.working[i] == false) {
1778                const work = this.actionQueue.shift();
1779                this.postAction(i, work.data, work.transfers, work.deferred);
1780            }
1781        }
1782    }
1783
1784    queueAction(actionData, transfers) {
1785        const d = new Deferred();
1786        this.actionQueue.push({
1787            data: actionData,
1788            transfers: transfers,
1789            deferred: d
1790        });
1791        this.processWorks();
1792        return d.promise;
1793    }
1794
1795    alloc(length) {
1796        while (this.i32[0] & 3) this.i32[0]++;  // Return always aligned pointers
1797        const res = this.i32[0];
1798        this.i32[0] += length;
1799        return res;
1800    }
1801
1802
1803    putBin(p, b) {
1804        const s32 = new Uint32Array(b);
1805        this.i32.set(s32, p/4);
1806    }
1807
1808    getBin(p, l) {
1809        return this.memory.buffer.slice(p, p+l);
1810    }
1811
1812    bin2int(b) {
1813        const i32 = new Uint32Array(b);
1814        let acc = bigInt(i32[7]);
1815        for (let i=6; i>=0; i--) {
1816            acc = acc.shiftLeft(32);
1817            acc = acc.add(i32[i]);
1818        }
1819        return acc.toString();
1820    }
1821
1822    bin2g1(b) {
1823        return [
1824            this.bin2int(b.slice(0,32)),
1825            this.bin2int(b.slice(32,64)),
1826            this.bin2int(b.slice(64,96)),
1827        ];
1828    }
1829    bin2g2(b) {
1830        return [
1831            [
1832                this.bin2int(b.slice(0,32)),
1833                this.bin2int(b.slice(32,64))
1834            ],
1835            [
1836                this.bin2int(b.slice(64,96)),
1837                this.bin2int(b.slice(96,128))
1838            ],
1839            [
1840                this.bin2int(b.slice(128,160)),
1841                this.bin2int(b.slice(160,192))
1842            ],
1843        ];
1844    }
1845
1846    async g1_multiexp(scalars, points) {
1847        const nPoints = scalars.byteLength /32;
1848        const nPointsPerThread = Math.floor(nPoints / this.workers.length);
1849        const opPromises = [];
1850        for (let i=0; i<this.workers.length; i++) {
1851            const th_nPoints =
1852                i < this.workers.length -1 ?
1853                    nPointsPerThread :
1854                    nPoints - (nPointsPerThread * (this.workers.length -1));
1855            const scalars_th = scalars.slice(i*nPointsPerThread*32, i*nPointsPerThread*32 + th_nPoints*32);
1856            const points_th = points.slice(i*nPointsPerThread*64, i*nPointsPerThread*64 + th_nPoints*64);
1857            opPromises.push(
1858                this.queueAction({
1859                    command: "G1_MULTIEXP",
1860                    scalars: scalars_th,
1861                    points: points_th,
1862                    n: th_nPoints
1863                }, [scalars_th, points_th])
1864            );
1865        }
1866
1867        const results = await Promise.all(opPromises);
1868
1869        this.instance.exports.g1_zero(this.pr0);
1870        for (let i=0; i<results.length; i++) {
1871            this.putBin(this.pr1, results[i]);
1872            this.instance.exports.g1_add(this.pr0, this.pr1, this.pr0);
1873        }
1874
1875        return this.getBin(this.pr0, 96);
1876    }
1877
1878    async g2_multiexp(scalars, points) {
1879        const nPoints = scalars.byteLength /32;
1880        const nPointsPerThread = Math.floor(nPoints / this.workers.length);
1881        const opPromises = [];
1882        for (let i=0; i<this.workers.length; i++) {
1883            const th_nPoints =
1884                i < this.workers.length -1 ?
1885                    nPointsPerThread :
1886                    nPoints - (nPointsPerThread * (this.workers.length -1));
1887            const scalars_th = scalars.slice(i*nPointsPerThread*32, i*nPointsPerThread*32 + th_nPoints*32);
1888            const points_th = points.slice(i*nPointsPerThread*128, i*nPointsPerThread*128 + th_nPoints*128);
1889            opPromises.push(
1890                this.queueAction({
1891                    command: "G2_MULTIEXP",
1892                    scalars: scalars_th,
1893                    points: points_th,
1894                    n: th_nPoints
1895                }, [scalars_th, points_th])
1896            );
1897        }
1898
1899        const results = await Promise.all(opPromises);
1900
1901        this.instance.exports.g2_zero(this.pr0);
1902        for (let i=0; i<results.length; i++) {
1903            this.putBin(this.pr1, results[i]);
1904            this.instance.exports.g2_add(this.pr0, this.pr1, this.pr0);
1905        }
1906
1907        return this.getBin(this.pr0, 192);
1908    }
1909
1910    g1_affine(p) {
1911        this.putBin(this.pr0, p);
1912        this.instance.exports.g1_affine(this.pr0, this.pr0);
1913        return this.getBin(this.pr0, 96);
1914    }
1915
1916    g2_affine(p) {
1917        this.putBin(this.pr0, p);
1918        this.instance.exports.g2_affine(this.pr0, this.pr0);
1919        return this.getBin(this.pr0, 192);
1920    }
1921
1922    g1_fromMontgomery(p) {
1923        this.putBin(this.pr0, p);
1924        this.instance.exports.g1_fromMontgomery(this.pr0, this.pr0);
1925        return this.getBin(this.pr0, 96);
1926    }
1927
1928    g2_fromMontgomery(p) {
1929        this.putBin(this.pr0, p);
1930        this.instance.exports.g2_fromMontgomery(this.pr0, this.pr0);
1931        return this.getBin(this.pr0, 192);
1932    }
1933
1934    loadPoint1(b) {
1935        const p = this.alloc(96);
1936        this.putBin(p, b);
1937        this.instance.exports.f1m_one(p+64);
1938        return p;
1939    }
1940
1941    loadPoint2(b) {
1942        const p = this.alloc(192);
1943        this.putBin(p, b);
1944        this.instance.exports.f2m_one(p+128);
1945        return p;
1946    }
1947
1948    terminate() {
1949        for (let i=0; i<this.workers.length; i++) {
1950            this.workers[i].postMessage({command: "TERMINATE"});
1951        }
1952    }
1953
1954
1955    async calcH(signals, polsA, polsB, nSignals, domainSize) {
1956        return this.queueAction({
1957            command: "CALC_H",
1958            signals: signals,
1959            polsA: polsA,
1960            polsB: polsB,
1961            nSignals: nSignals,
1962            domainSize: domainSize
1963        }, [signals, polsA, polsB]);
1964    }
1965
1966    async proof(signals, pkey) {
1967        const pkey32 = new Uint32Array(pkey);
1968        const nSignals = pkey32[0];
1969        const nPublic = pkey32[1];
1970        const domainSize = pkey32[2];
1971        const pPolsA = pkey32[3];
1972        const pPolsB = pkey32[4];
1973        const pPointsA = pkey32[5];
1974        const pPointsB1 = pkey32[6];
1975        const pPointsB2 = pkey32[7];
1976        const pPointsC = pkey32[8];
1977        const pHExps = pkey32[9];
1978        const polsA = pkey.slice(pPolsA, pPolsA + pPolsB);
1979        const polsB = pkey.slice(pPolsB, pPolsB + pPointsA);
1980        const pointsA = pkey.slice(pPointsA, pPointsA + nSignals*64);
1981        const pointsB1 = pkey.slice(pPointsB1, pPointsB1 + nSignals*64);
1982        const pointsB2 = pkey.slice(pPointsB2, pPointsB2 + nSignals*128);
1983        const pointsC = pkey.slice(pPointsC, pPointsC + (nSignals-nPublic-1)*64);
1984        const pointsHExps = pkey.slice(pHExps, pHExps + domainSize*64);
1985
1986        const alfa1 = pkey.slice(10*4, 10*4 + 64);
1987        const beta1 = pkey.slice(10*4 + 64, 10*4 + 128);
1988        const delta1 = pkey.slice(10*4 + 128, 10*4 + 192);
1989        const beta2 = pkey.slice(10*4 + 192, 10*4 + 320);
1990        const delta2 = pkey.slice(10*4 + 320, 10*4 + 448);
1991
1992
1993        const pH = this.calcH(signals.slice(0), polsA, polsB, nSignals, domainSize).then( (h) => {
1994            return this.g1_multiexp(h, pointsHExps);
1995        });
1996
1997        const pA = this.g1_multiexp(signals.slice(0), pointsA);
1998        const pB1 = this.g1_multiexp(signals.slice(0), pointsB1);
1999        const pB2 = this.g2_multiexp(signals.slice(0), pointsB2);
2000        const pC = this.g1_multiexp(signals.slice((nPublic+1)*32), pointsC);
2001
2002        const res = await Promise.all([pA, pB1, pB2, pC, pH]);
2003
2004        const pi_a = this.alloc(96);
2005        const pi_b = this.alloc(192);
2006        const pi_c = this.alloc(96);
2007        const pib1 = this.alloc(96);
2008
2009
2010        this.putBin(pi_a, res[0]);
2011        this.putBin(pib1, res[1]);
2012        this.putBin(pi_b, res[2]);
2013        this.putBin(pi_c, res[3]);
2014
2015        const pAlfa1 = this.loadPoint1(alfa1);
2016        const pBeta1 = this.loadPoint1(beta1);
2017        const pDelta1 = this.loadPoint1(delta1);
2018        const pBeta2 = this.loadPoint2(beta2);
2019        const pDelta2 = this.loadPoint2(delta2);
2020
2021
2022        let rnd = new Uint32Array(8);
2023
2024        const aux1 = this.alloc(96);
2025        const aux2 = this.alloc(192);
2026
2027        const pr = this.alloc(32);
2028        const ps = this.alloc(32);
2029
2030        if (inBrowser) {
2031            window.crypto.getRandomValues(rnd);
2032            this.putBin(pr, rnd);
2033
2034            window.crypto.getRandomValues(rnd);
2035            this.putBin(ps, rnd);
2036        } else {
2037            const br = NodeCrypto.randomBytes(32);
2038            this.putBin(pr, br);
2039            const bs = NodeCrypto.randomBytes(32);
2040            this.putBin(ps, bs);
2041        }
2042
2043        // pi_a = pi_a + Alfa1 + r*Delta1
2044        this.instance.exports.g1_add(pAlfa1, pi_a, pi_a);
2045        this.instance.exports.g1_timesScalar(pDelta1, pr, 32, aux1);
2046        this.instance.exports.g1_add(aux1, pi_a, pi_a);
2047
2048        // pi_b = pi_b + Beta2 + s*Delta2
2049        this.instance.exports.g2_add(pBeta2, pi_b, pi_b);
2050        this.instance.exports.g2_timesScalar(pDelta2, ps, 32, aux2);
2051        this.instance.exports.g2_add(aux2, pi_b, pi_b);
2052
2053        // pib1 = pib1 + Beta1 + s*Delta1
2054        this.instance.exports.g1_add(pBeta1, pib1, pib1);
2055        this.instance.exports.g1_timesScalar(pDelta1, ps, 32, aux1);
2056        this.instance.exports.g1_add(aux1, pib1, pib1);
2057
2058
2059        // pi_c = pi_c + pH
2060        this.putBin(aux1, res[4]);
2061        this.instance.exports.g1_add(aux1, pi_c, pi_c);
2062
2063        // pi_c = pi_c + s*pi_a
2064        this.instance.exports.g1_timesScalar(pi_a, ps, 32, aux1);
2065        this.instance.exports.g1_add(aux1, pi_c, pi_c);
2066
2067        // pi_c = pi_c + r*pib1
2068        this.instance.exports.g1_timesScalar(pib1, pr, 32, aux1);
2069        this.instance.exports.g1_add(aux1, pi_c, pi_c);
2070
2071        // pi_c = pi_c - r*s*delta1
2072        const prs = this.alloc(64);
2073        this.instance.exports.int_mul(pr, ps, prs);
2074        this.instance.exports.g1_timesScalar(pDelta1, prs, 64, aux1);
2075        this.instance.exports.g1_neg(aux1, aux1);
2076        this.instance.exports.g1_add(aux1, pi_c, pi_c);
2077
2078        this.instance.exports.g1_affine(pi_a, pi_a);
2079        this.instance.exports.g2_affine(pi_b, pi_b);
2080        this.instance.exports.g1_affine(pi_c, pi_c);
2081
2082        this.instance.exports.g1_fromMontgomery(pi_a, pi_a);
2083        this.instance.exports.g2_fromMontgomery(pi_b, pi_b);
2084        this.instance.exports.g1_fromMontgomery(pi_c, pi_c);
2085
2086        return {
2087            pi_a: this.bin2g1(this.getBin(pi_a, 96)),
2088            pi_b: this.bin2g2(this.getBin(pi_b, 192)),
2089            pi_c: this.bin2g1(this.getBin(pi_c, 96)),
2090        };
2091
2092    }
2093
2094}
2095
2096module.exports = build;
2097
2098}).call(this,require('_process'))
2099},{"../build/groth16_wasm.js":1,"_process":12,"assert":5,"big-integer":3,"crypto":undefined,"worker_threads":undefined}],5:[function(require,module,exports){
2100(function (global){
2101'use strict';
2102
2103// compare and isBuffer taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js
2104// original notice:
2105
2106/*!
2107 * The buffer module from node.js, for the browser.
2108 *
2109 * @author   Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
2110 * @license  MIT
2111 */
2112function compare(a, b) {
2113  if (a === b) {
2114    return 0;
2115  }
2116
2117  var x = a.length;
2118  var y = b.length;
2119
2120  for (var i = 0, len = Math.min(x, y); i < len; ++i) {
2121    if (a[i] !== b[i]) {
2122      x = a[i];
2123      y = b[i];
2124      break;
2125    }
2126  }
2127
2128  if (x < y) {
2129    return -1;
2130  }
2131  if (y < x) {
2132    return 1;
2133  }
2134  return 0;
2135}
2136function isBuffer(b) {
2137  if (global.Buffer && typeof global.Buffer.isBuffer === 'function') {
2138    return global.Buffer.isBuffer(b);
2139  }
2140  return !!(b != null && b._isBuffer);
2141}
2142
2143// based on node assert, original notice:
2144
2145// http://wiki.commonjs.org/wiki/Unit_Testing/1.0
2146//
2147// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8!
2148//
2149// Originally from narwhal.js (http://narwhaljs.org)
2150// Copyright (c) 2009 Thomas Robinson <280north.com>
2151//
2152// Permission is hereby granted, free of charge, to any person obtaining a copy
2153// of this software and associated documentation files (the 'Software'), to
2154// deal in the Software without restriction, including without limitation the
2155// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
2156// sell copies of the Software, and to permit persons to whom the Software is
2157// furnished to do so, subject to the following conditions:
2158//
2159// The above copyright notice and this permission notice shall be included in
2160// all copies or substantial portions of the Software.
2161//
2162// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2163// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2164// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2165// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
2166// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
2167// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2168
2169var util = require('util/');
2170var hasOwn = Object.prototype.hasOwnProperty;
2171var pSlice = Array.prototype.slice;
2172var functionsHaveNames = (function () {
2173  return function foo() {}.name === 'foo';
2174}());
2175function pToString (obj) {
2176  return Object.prototype.toString.call(obj);
2177}
2178function isView(arrbuf) {
2179  if (isBuffer(arrbuf)) {
2180    return false;
2181  }
2182  if (typeof global.ArrayBuffer !== 'function') {
2183    return false;
2184  }
2185  if (typeof ArrayBuffer.isView === 'function') {
2186    return ArrayBuffer.isView(arrbuf);
2187  }
2188  if (!arrbuf) {
2189    return false;
2190  }
2191  if (arrbuf instanceof DataView) {
2192    return true;
2193  }
2194  if (arrbuf.buffer && arrbuf.buffer instanceof ArrayBuffer) {
2195    return true;
2196  }
2197  return false;
2198}
2199// 1. The assert module provides functions that throw
2200// AssertionError's when particular conditions are not met. The
2201// assert module must conform to the following interface.
2202
2203var assert = module.exports = ok;
2204
2205// 2. The AssertionError is defined in assert.
2206// new assert.AssertionError({ message: message,
2207//                             actual: actual,
2208//                             expected: expected })
2209
2210var regex = /\s*function\s+([^\(\s]*)\s*/;
2211// based on https://github.com/ljharb/function.prototype.name/blob/adeeeec8bfcc6068b187d7d9fb3d5bb1d3a30899/implementation.js
2212function getName(func) {
2213  if (!util.isFunction(func)) {
2214    return;
2215  }
2216  if (functionsHaveNames) {
2217    return func.name;
2218  }
2219  var str = func.toString();
2220  var match = str.match(regex);
2221  return match && match[1];
2222}
2223assert.AssertionError = function AssertionError(options) {
2224  this.name = 'AssertionError';
2225  this.actual = options.actual;
2226  this.expected = options.expected;
2227  this.operator = options.operator;
2228  if (options.message) {
2229    this.message = options.message;
2230    this.generatedMessage = false;
2231  } else {
2232    this.message = getMessage(this);
2233    this.generatedMessage = true;
2234  }
2235  var stackStartFunction = options.stackStartFunction || fail;
2236  if (Error.captureStackTrace) {
2237    Error.captureStackTrace(this, stackStartFunction);
2238  } else {
2239    // non v8 browsers so we can have a stacktrace
2240    var err = new Error();
2241    if (err.stack) {
2242      var out = err.stack;
2243
2244      // try to strip useless frames
2245      var fn_name = getName(stackStartFunction);
2246      var idx = out.indexOf('\n' + fn_name);
2247      if (idx >= 0) {
2248        // once we have located the function frame
2249        // we need to strip out everything before it (and its line)
2250        var next_line = out.indexOf('\n', idx + 1);
2251        out = out.substring(next_line + 1);
2252      }
2253
2254      this.stack = out;
2255    }
2256  }
2257};
2258
2259// assert.AssertionError instanceof Error
2260util.inherits(assert.AssertionError, Error);
2261
2262function truncate(s, n) {
2263  if (typeof s === 'string') {
2264    return s.length < n ? s : s.slice(0, n);
2265  } else {
2266    return s;
2267  }
2268}
2269function inspect(something) {
2270  if (functionsHaveNames || !util.isFunction(something)) {
2271    return util.inspect(something);
2272  }
2273  var rawname = getName(something);
2274  var name = rawname ? ': ' + rawname : '';
2275  return '[Function' +  name + ']';
2276}
2277function getMessage(self) {
2278  return truncate(inspect(self.actual), 128) + ' ' +
2279         self.operator + ' ' +
2280         truncate(inspect(self.expected), 128);
2281}
2282
2283// At present only the three keys mentioned above are used and
2284// understood by the spec. Implementations or sub modules can pass
2285// other keys to the AssertionError's constructor - they will be
2286// ignored.
2287
2288// 3. All of the following functions must throw an AssertionError
2289// when a corresponding condition is not met, with a message that
2290// may be undefined if not provided.  All assertion methods provide
2291// both the actual and expected values to the assertion error for
2292// display purposes.
2293
2294function fail(actual, expected, message, operator, stackStartFunction) {
2295  throw new assert.AssertionError({
2296    message: message,
2297    actual: actual,
2298    expected: expected,
2299    operator: operator,
2300    stackStartFunction: stackStartFunction
2301  });
2302}
2303
2304// EXTENSION! allows for well behaved errors defined elsewhere.
2305assert.fail = fail;
2306
2307// 4. Pure assertion tests whether a value is truthy, as determined
2308// by !!guard.
2309// assert.ok(guard, message_opt);
2310// This statement is equivalent to assert.equal(true, !!guard,
2311// message_opt);. To test strictly for the value true, use
2312// assert.strictEqual(true, guard, message_opt);.
2313
2314function ok(value, message) {
2315  if (!value) fail(value, true, message, '==', assert.ok);
2316}
2317assert.ok = ok;
2318
2319// 5. The equality assertion tests shallow, coercive equality with
2320// ==.
2321// assert.equal(actual, expected, message_opt);
2322
2323assert.equal = function equal(actual, expected, message) {
2324  if (actual != expected) fail(actual, expected, message, '==', assert.equal);
2325};
2326
2327// 6. The non-equality assertion tests for whether two objects are not equal
2328// with != assert.notEqual(actual, expected, message_opt);
2329
2330assert.notEqual = function notEqual(actual, expected, message) {
2331  if (actual == expected) {
2332    fail(actual, expected, message, '!=', assert.notEqual);
2333  }
2334};
2335
2336// 7. The equivalence assertion tests a deep equality relation.
2337// assert.deepEqual(actual, expected, message_opt);
2338
2339assert.deepEqual = function deepEqual(actual, expected, message) {
2340  if (!_deepEqual(actual, expected, false)) {
2341    fail(actual, expected, message, 'deepEqual', assert.deepEqual);
2342  }
2343};
2344
2345assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) {
2346  if (!_deepEqual(actual, expected, true)) {
2347    fail(actual, expected, message, 'deepStrictEqual', assert.deepStrictEqual);
2348  }
2349};
2350
2351function _deepEqual(actual, expected, strict, memos) {
2352  // 7.1. All identical values are equivalent, as determined by ===.
2353  if (actual === expected) {
2354    return true;
2355  } else if (isBuffer(actual) && isBuffer(expected)) {
2356    return compare(actual, expected) === 0;
2357
2358  // 7.2. If the expected value is a Date object, the actual value is
2359  // equivalent if it is also a Date object that refers to the same time.
2360  } else if (util.isDate(actual) && util.isDate(expected)) {
2361    return actual.getTime() === expected.getTime();
2362
2363  // 7.3 If the expected value is a RegExp object, the actual value is
2364  // equivalent if it is also a RegExp object with the same source and
2365  // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`).
2366  } else if (util.isRegExp(actual) && util.isRegExp(expected)) {
2367    return actual.source === expected.source &&
2368           actual.global === expected.global &&
2369           actual.multiline === expected.multiline &&
2370           actual.lastIndex === expected.lastIndex &&
2371           actual.ignoreCase === expected.ignoreCase;
2372
2373  // 7.4. Other pairs that do not both pass typeof value == 'object',
2374  // equivalence is determined by ==.
2375  } else if ((actual === null || typeof actual !== 'object') &&
2376             (expected === null || typeof expected !== 'object')) {
2377    return strict ? actual === expected : actual == expected;
2378
2379  // If both values are instances of typed arrays, wrap their underlying
2380  // ArrayBuffers in a Buffer each to increase performance
2381  // This optimization requires the arrays to have the same type as checked by
2382  // Object.prototype.toString (aka pToString). Never perform binary
2383  // comparisons for Float*Arrays, though, since e.g. +0 === -0 but their
2384  // bit patterns are not identical.
2385  } else if (isView(actual) && isView(expected) &&
2386             pToString(actual) === pToString(expected) &&
2387             !(actual instanceof Float32Array ||
2388               actual instanceof Float64Array)) {
2389    return compare(new Uint8Array(actual.buffer),
2390                   new Uint8Array(expected.buffer)) === 0;
2391
2392  // 7.5 For all other Object pairs, including Array objects, equivalence is
2393  // determined by having the same number of owned properties (as verified
2394  // with Object.prototype.hasOwnProperty.call), the same set of keys
2395  // (although not necessarily the same order), equivalent values for every
2396  // corresponding key, and an identical 'prototype' property. Note: this
2397  // accounts for both named and indexed properties on Arrays.
2398  } else if (isBuffer(actual) !== isBuffer(expected)) {
2399    return false;
2400  } else {
2401    memos = memos || {actual: [], expected: []};
2402
2403    var actualIndex = memos.actual.indexOf(actual);
2404    if (actualIndex !== -1) {
2405      if (actualIndex === memos.expected.indexOf(expected)) {
2406        return true;
2407      }
2408    }
2409
2410    memos.actual.push(actual);
2411    memos.expected.push(expected);
2412
2413    return objEquiv(actual, expected, strict, memos);
2414  }
2415}
2416
2417function isArguments(object) {
2418  return Object.prototype.toString.call(object) == '[object Arguments]';
2419}
2420
2421function objEquiv(a, b, strict, actualVisitedObjects) {
2422  if (a === null || a === undefined || b === null || b === undefined)
2423    return false;
2424  // if one is a primitive, the other must be same
2425  if (util.isPrimitive(a) || util.isPrimitive(b))
2426    return a === b;
2427  if (strict && Object.getPrototypeOf(a) !== Object.getPrototypeOf(b))
2428    return false;
2429  var aIsArgs = isArguments(a);
2430  var bIsArgs = isArguments(b);
2431  if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs))
2432    return false;
2433  if (aIsArgs) {
2434    a = pSlice.call(a);
2435    b = pSlice.call(b);
2436    return _deepEqual(a, b, strict);
2437  }
2438  var ka = objectKeys(a);
2439  var kb = objectKeys(b);
2440  var key, i;
2441  // having the same number of owned properties (keys incorporates
2442  // hasOwnProperty)
2443  if (ka.length !== kb.length)
2444    return false;
2445  //the same set of keys (although not necessarily the same order),
2446  ka.sort();
2447  kb.sort();
2448  //~~~cheap key test
2449  for (i = ka.length - 1; i >= 0; i--) {
2450    if (ka[i] !== kb[i])
2451      return false;
2452  }
2453  //equivalent values for every corresponding key, and
2454  //~~~possibly expensive deep test
2455  for (i = ka.length - 1; i >= 0; i--) {
2456    key = ka[i];
2457    if (!_deepEqual(a[key], b[key], strict, actualVisitedObjects))
2458      return false;
2459  }
2460  return true;
2461}
2462
2463// 8. The non-equivalence assertion tests for any deep inequality.
2464// assert.notDeepEqual(actual, expected, message_opt);
2465
2466assert.notDeepEqual = function notDeepEqual(actual, expected, message) {
2467  if (_deepEqual(actual, expected, false)) {
2468    fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual);
2469  }
2470};
2471
2472assert.notDeepStrictEqual = notDeepStrictEqual;
2473function notDeepStrictEqual(actual, expected, message) {
2474  if (_deepEqual(actual, expected, true)) {
2475    fail(actual, expected, message, 'notDeepStrictEqual', notDeepStrictEqual);
2476  }
2477}
2478
2479
2480// 9. The strict equality assertion tests strict equality, as determined by ===.
2481// assert.strictEqual(actual, expected, message_opt);
2482
2483assert.strictEqual = function strictEqual(actual, expected, message) {
2484  if (actual !== expected) {
2485    fail(actual, expected, message, '===', assert.strictEqual);
2486  }
2487};
2488
2489// 10. The strict non-equality assertion tests for strict inequality, as
2490// determined by !==.  assert.notStrictEqual(actual, expected, message_opt);
2491
2492assert.notStrictEqual = function notStrictEqual(actual, expected, message) {
2493  if (actual === expected) {
2494    fail(actual, expected, message, '!==', assert.notStrictEqual);
2495  }
2496};
2497
2498function expectedException(actual, expected) {
2499  if (!actual || !expected) {
2500    return false;
2501  }
2502
2503  if (Object.prototype.toString.call(expected) == '[object RegExp]') {
2504    return expected.test(actual);
2505  }
2506
2507  try {
2508    if (actual instanceof expected) {
2509      return true;
2510    }
2511  } catch (e) {
2512    // Ignore.  The instanceof check doesn't work for arrow functions.
2513  }
2514
2515  if (Error.isPrototypeOf(expected)) {
2516    return false;
2517  }
2518
2519  return expected.call({}, actual) === true;
2520}
2521
2522function _tryBlock(block) {
2523  var error;
2524  try {
2525    block();
2526  } catch (e) {
2527    error = e;
2528  }
2529  return error;
2530}
2531
2532function _throws(shouldThrow, block, expected, message) {
2533  var actual;
2534
2535  if (typeof block !== 'function') {
2536    throw new TypeError('"block" argument must be a function');
2537  }
2538
2539  if (typeof expected === 'string') {
2540    message = expected;
2541    expected = null;
2542  }
2543
2544  actual = _tryBlock(block);
2545
2546  message = (expected && expected.name ? ' (' + expected.name + ').' : '.') +
2547            (message ? ' ' + message : '.');
2548
2549  if (shouldThrow && !actual) {
2550    fail(actual, expected, 'Missing expected exception' + message);
2551  }
2552
2553  var userProvidedMessage = typeof message === 'string';
2554  var isUnwantedException = !shouldThrow && util.isError(actual);
2555  var isUnexpectedException = !shouldThrow && actual && !expected;
2556
2557  if ((isUnwantedException &&
2558      userProvidedMessage &&
2559      expectedException(actual, expected)) ||
2560      isUnexpectedException) {
2561    fail(actual, expected, 'Got unwanted exception' + message);
2562  }
2563
2564  if ((shouldThrow && actual && expected &&
2565      !expectedException(actual, expected)) || (!shouldThrow && actual)) {
2566    throw actual;
2567  }
2568}
2569
2570// 11. Expected to throw an error:
2571// assert.throws(block, Error_opt, message_opt);
2572
2573assert.throws = function(block, /*optional*/error, /*optional*/message) {
2574  _throws(true, block, error, message);
2575};
2576
2577// EXTENSION! This is annoying to write outside this module.
2578assert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) {
2579  _throws(false, block, error, message);
2580};
2581
2582assert.ifError = function(err) { if (err) throw err; };
2583
2584var objectKeys = Object.keys || function (obj) {
2585  var keys = [];
2586  for (var key in obj) {
2587    if (hasOwn.call(obj, key)) keys.push(key);
2588  }
2589  return keys;
2590};
2591
2592}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
2593},{"util/":8}],6:[function(require,module,exports){
2594if (typeof Object.create === 'function') {
2595  // implementation from standard node.js 'util' module
2596  module.exports = function inherits(ctor, superCtor) {
2597    ctor.super_ = superCtor
2598    ctor.prototype = Object.create(superCtor.prototype, {
2599      constructor: {
2600        value: ctor,
2601        enumerable: false,
2602        writable: true,
2603        configurable: true
2604      }
2605    });
2606  };
2607} else {
2608  // old school shim for old browsers
2609  module.exports = function inherits(ctor, superCtor) {
2610    ctor.super_ = superCtor
2611    var TempCtor = function () {}
2612    TempCtor.prototype = superCtor.prototype
2613    ctor.prototype = new TempCtor()
2614    ctor.prototype.constructor = ctor
2615  }
2616}
2617
2618},{}],7:[function(require,module,exports){
2619module.exports = function isBuffer(arg) {
2620  return arg && typeof arg === 'object'
2621    && typeof arg.copy === 'function'
2622    && typeof arg.fill === 'function'
2623    && typeof arg.readUInt8 === 'function';
2624}
2625},{}],8:[function(require,module,exports){
2626(function (process,global){
2627// Copyright Joyent, Inc. and other Node contributors.
2628//
2629// Permission is hereby granted, free of charge, to any person obtaining a
2630// copy of this software and associated documentation files (the
2631// "Software"), to deal in the Software without restriction, including
2632// without limitation the rights to use, copy, modify, merge, publish,
2633// distribute, sublicense, and/or sell copies of the Software, and to permit
2634// persons to whom the Software is furnished to do so, subject to the
2635// following conditions:
2636//
2637// The above copyright notice and this permission notice shall be included
2638// in all copies or substantial portions of the Software.
2639//
2640// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
2641// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2642// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
2643// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
2644// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
2645// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
2646// USE OR OTHER DEALINGS IN THE SOFTWARE.
2647
2648var formatRegExp = /%[sdj%]/g;
2649exports.format = function(f) {
2650  if (!isString(f)) {
2651    var objects = [];
2652    for (var i = 0; i < arguments.length; i++) {
2653      objects.push(inspect(arguments[i]));
2654    }
2655    return objects.join(' ');
2656  }
2657
2658  var i = 1;
2659  var args = arguments;
2660  var len = args.length;
2661  var str = String(f).replace(formatRegExp, function(x) {
2662    if (x === '%%') return '%';
2663    if (i >= len) return x;
2664    switch (x) {
2665      case '%s': return String(args[i++]);
2666      case '%d': return Number(args[i++]);
2667      case '%j':
2668        try {
2669          return JSON.stringify(args[i++]);
2670        } catch (_) {
2671          return '[Circular]';
2672        }
2673      default:
2674        return x;
2675    }
2676  });
2677  for (var x = args[i]; i < len; x = args[++i]) {
2678    if (isNull(x) || !isObject(x)) {
2679      str += ' ' + x;
2680    } else {
2681      str += ' ' + inspect(x);
2682    }
2683  }
2684  return str;
2685};
2686
2687
2688// Mark that a method should not be used.
2689// Returns a modified function which warns once by default.
2690// If --no-deprecation is set, then it is a no-op.
2691exports.deprecate = function(fn, msg) {
2692  // Allow for deprecating things in the process of starting up.
2693  if (isUndefined(global.process)) {
2694    return function() {
2695      return exports.deprecate(fn, msg).apply(this, arguments);
2696    };
2697  }
2698
2699  if (process.noDeprecation === true) {
2700    return fn;
2701  }
2702
2703  var warned = false;
2704  function deprecated() {
2705    if (!warned) {
2706      if (process.throwDeprecation) {
2707        throw new Error(msg);
2708      } else if (process.traceDeprecation) {
2709        console.trace(msg);
2710      } else {
2711        console.error(msg);
2712      }
2713      warned = true;
2714    }
2715    return fn.apply(this, arguments);
2716  }
2717
2718  return deprecated;
2719};
2720
2721
2722var debugs = {};
2723var debugEnviron;
2724exports.debuglog = function(set) {
2725  if (isUndefined(debugEnviron))
2726    debugEnviron = process.env.NODE_DEBUG || '';
2727  set = set.toUpperCase();
2728  if (!debugs[set]) {
2729    if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
2730      var pid = process.pid;
2731      debugs[set] = function() {
2732        var msg = exports.format.apply(exports, arguments);
2733        console.error('%s %d: %s', set, pid, msg);
2734      };
2735    } else {
2736      debugs[set] = function() {};
2737    }
2738  }
2739  return debugs[set];
2740};
2741
2742
2743/**
2744 * Echos the value of a value. Trys to print the value out
2745 * in the best way possible given the different types.
2746 *
2747 * @param {Object} obj The object to print out.
2748 * @param {Object} opts Optional options object that alters the output.
2749 */
2750/* legacy: obj, showHidden, depth, colors*/
2751function inspect(obj, opts) {
2752  // default options
2753  var ctx = {
2754    seen: [],
2755    stylize: stylizeNoColor
2756  };
2757  // legacy...
2758  if (arguments.length >= 3) ctx.depth = arguments[2];
2759  if (arguments.length >= 4) ctx.colors = arguments[3];
2760  if (isBoolean(opts)) {
2761    // legacy...
2762    ctx.showHidden = opts;
2763  } else if (opts) {
2764    // got an "options" object
2765    exports._extend(ctx, opts);
2766  }
2767  // set default options
2768  if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
2769  if (isUndefined(ctx.depth)) ctx.depth = 2;
2770  if (isUndefined(ctx.colors)) ctx.colors = false;
2771  if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
2772  if (ctx.colors) ctx.stylize = stylizeWithColor;
2773  return formatValue(ctx, obj, ctx.depth);
2774}
2775exports.inspect = inspect;
2776
2777
2778// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
2779inspect.colors = {
2780  'bold' : [1, 22],
2781  'italic' : [3, 23],
2782  'underline' : [4, 24],
2783  'inverse' : [7, 27],
2784  'white' : [37, 39],
2785  'grey' : [90, 39],
2786  'black' : [30, 39],
2787  'blue' : [34, 39],
2788  'cyan' : [36, 39],
2789  'green' : [32, 39],
2790  'magenta' : [35, 39],
2791  'red' : [31, 39],
2792  'yellow' : [33, 39]
2793};
2794
2795// Don't use 'blue' not visible on cmd.exe
2796inspect.styles = {
2797  'special': 'cyan',
2798  'number': 'yellow',
2799  'boolean': 'yellow',
2800  'undefined': 'grey',
2801  'null': 'bold',
2802  'string': 'green',
2803  'date': 'magenta',
2804  // "name": intentionally not styling
2805  'regexp': 'red'
2806};
2807
2808
2809function stylizeWithColor(str, styleType) {
2810  var style = inspect.styles[styleType];
2811
2812  if (style) {
2813    return '\u001b[' + inspect.colors[style][0] + 'm' + str +
2814           '\u001b[' + inspect.colors[style][1] + 'm';
2815  } else {
2816    return str;
2817  }
2818}
2819
2820
2821function stylizeNoColor(str, styleType) {
2822  return str;
2823}
2824
2825
2826function arrayToHash(array) {
2827  var hash = {};
2828
2829  array.forEach(function(val, idx) {
2830    hash[val] = true;
2831  });
2832
2833  return hash;
2834}
2835
2836
2837function formatValue(ctx, value, recurseTimes) {
2838  // Provide a hook for user-specified inspect functions.
2839  // Check that value is an object with an inspect function on it
2840  if (ctx.customInspect &&
2841      value &&
2842      isFunction(value.inspect) &&
2843      // Filter out the util module, it's inspect function is special
2844      value.inspect !== exports.inspect &&
2845      // Also filter out any prototype objects using the circular check.
2846      !(value.constructor && value.constructor.prototype === value)) {
2847    var ret = value.inspect(recurseTimes, ctx);
2848    if (!isString(ret)) {
2849      ret = formatValue(ctx, ret, recurseTimes);
2850    }
2851    return ret;
2852  }
2853
2854  // Primitive types cannot have properties
2855  var primitive = formatPrimitive(ctx, value);
2856  if (primitive) {
2857    return primitive;
2858  }
2859
2860  // Look up the keys of the object.
2861  var keys = Object.keys(value);
2862  var visibleKeys = arrayToHash(keys);
2863
2864  if (ctx.showHidden) {
2865    keys = Object.getOwnPropertyNames(value);
2866  }
2867
2868  // IE doesn't make error fields non-enumerable
2869  // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
2870  if (isError(value)
2871      && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
2872    return formatError(value);
2873  }
2874
2875  // Some type of object without properties can be shortcutted.
2876  if (keys.length === 0) {
2877    if (isFunction(value)) {
2878      var name = value.name ? ': ' + value.name : '';
2879      return ctx.stylize('[Function' + name + ']', 'special');
2880    }
2881    if (isRegExp(value)) {
2882      return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
2883    }
2884    if (isDate(value)) {
2885      return ctx.stylize(Date.prototype.toString.call(value), 'date');
2886    }
2887    if (isError(value)) {
2888      return formatError(value);
2889    }
2890  }
2891
2892  var base = '', array = false, braces = ['{', '}'];
2893
2894  // Make Array say that they are Array
2895  if (isArray(value)) {
2896    array = true;
2897    braces = ['[', ']'];
2898  }
2899
2900  // Make functions say that they are functions
2901  if (isFunction(value)) {
2902    var n = value.name ? ': ' + value.name : '';
2903    base = ' [Function' + n + ']';
2904  }
2905
2906  // Make RegExps say that they are RegExps
2907  if (isRegExp(value)) {
2908    base = ' ' + RegExp.prototype.toString.call(value);
2909  }
2910
2911  // Make dates with properties first say the date
2912  if (isDate(value)) {
2913    base = ' ' + Date.prototype.toUTCString.call(value);
2914  }
2915
2916  // Make error with message first say the error
2917  if (isError(value)) {
2918    base = ' ' + formatError(value);
2919  }
2920
2921  if (keys.length === 0 && (!array || value.length == 0)) {
2922    return braces[0] + base + braces[1];
2923  }
2924
2925  if (recurseTimes < 0) {
2926    if (isRegExp(value)) {
2927      return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
2928    } else {
2929      return ctx.stylize('[Object]', 'special');
2930    }
2931  }
2932
2933  ctx.seen.push(value);
2934
2935  var output;
2936  if (array) {
2937    output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
2938  } else {
2939    output = keys.map(function(key) {
2940      return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
2941    });
2942  }
2943
2944  ctx.seen.pop();
2945
2946  return reduceToSingleString(output, base, braces);
2947}
2948
2949
2950function formatPrimitive(ctx, value) {
2951  if (isUndefined(value))
2952    return ctx.stylize('undefined', 'undefined');
2953  if (isString(value)) {
2954    var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
2955                                             .replace(/'/g, "\\'")
2956                                             .replace(/\\"/g, '"') + '\'';
2957    return ctx.stylize(simple, 'string');
2958  }
2959  if (isNumber(value))
2960    return ctx.stylize('' + value, 'number');
2961  if (isBoolean(value))
2962    return ctx.stylize('' + value, 'boolean');
2963  // For some reason typeof null is "object", so special case here.
2964  if (isNull(value))
2965    return ctx.stylize('null', 'null');
2966}
2967
2968
2969function formatError(value) {
2970  return '[' + Error.prototype.toString.call(value) + ']';
2971}
2972
2973
2974function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
2975  var output = [];
2976  for (var i = 0, l = value.length; i < l; ++i) {
2977    if (hasOwnProperty(value, String(i))) {
2978      output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
2979          String(i), true));
2980    } else {
2981      output.push('');
2982    }
2983  }
2984  keys.forEach(function(key) {
2985    if (!key.match(/^\d+$/)) {
2986      output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
2987          key, true));
2988    }
2989  });
2990  return output;
2991}
2992
2993
2994function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
2995  var name, str, desc;
2996  desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
2997  if (desc.get) {
2998    if (desc.set) {
2999      str = ctx.stylize('[Getter/Setter]', 'special');
3000    } else {
3001      str = ctx.stylize('[Getter]', 'special');
3002    }
3003  } else {
3004    if (desc.set) {
3005      str = ctx.stylize('[Setter]', 'special');
3006    }
3007  }
3008  if (!hasOwnProperty(visibleKeys, key)) {
3009    name = '[' + key + ']';
3010  }
3011  if (!str) {
3012    if (ctx.seen.indexOf(desc.value) < 0) {
3013      if (isNull(recurseTimes)) {
3014        str = formatValue(ctx, desc.value, null);
3015      } else {
3016        str = formatValue(ctx, desc.value, recurseTimes - 1);
3017      }
3018      if (str.indexOf('\n') > -1) {
3019        if (array) {
3020          str = str.split('\n').map(function(line) {
3021            return '  ' + line;
3022          }).join('\n').substr(2);
3023        } else {
3024          str = '\n' + str.split('\n').map(function(line) {
3025            return '   ' + line;
3026          }).join('\n');
3027        }
3028      }
3029    } else {
3030      str = ctx.stylize('[Circular]', 'special');
3031    }
3032  }
3033  if (isUndefined(name)) {
3034    if (array && key.match(/^\d+$/)) {
3035      return str;
3036    }
3037    name = JSON.stringify('' + key);
3038    if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
3039      name = name.substr(1, name.length - 2);
3040      name = ctx.stylize(name, 'name');
3041    } else {
3042      name = name.replace(/'/g, "\\'")
3043                 .replace(/\\"/g, '"')
3044                 .replace(/(^"|"$)/g, "'");
3045      name = ctx.stylize(name, 'string');
3046    }
3047  }
3048
3049  return name + ': ' + str;
3050}
3051
3052
3053function reduceToSingleString(output, base, braces) {
3054  var numLinesEst = 0;
3055  var length = output.reduce(function(prev, cur) {
3056    numLinesEst++;
3057    if (cur.indexOf('\n') >= 0) numLinesEst++;
3058    return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
3059  }, 0);
3060
3061  if (length > 60) {
3062    return braces[0] +
3063           (base === '' ? '' : base + '\n ') +
3064           ' ' +
3065           output.join(',\n  ') +
3066           ' ' +
3067           braces[1];
3068  }
3069
3070  return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
3071}
3072
3073
3074// NOTE: These type checking functions intentionally don't use `instanceof`
3075// because it is fragile and can be easily faked with `Object.create()`.
3076function isArray(ar) {
3077  return Array.isArray(ar);
3078}
3079exports.isArray = isArray;
3080
3081function isBoolean(arg) {
3082  return typeof arg === 'boolean';
3083}
3084exports.isBoolean = isBoolean;
3085
3086function isNull(arg) {
3087  return arg === null;
3088}
3089exports.isNull = isNull;
3090
3091function isNullOrUndefined(arg) {
3092  return arg == null;
3093}
3094exports.isNullOrUndefined = isNullOrUndefined;
3095
3096function isNumber(arg) {
3097  return typeof arg === 'number';
3098}
3099exports.isNumber = isNumber;
3100
3101function isString(arg) {
3102  return typeof arg === 'string';
3103}
3104exports.isString = isString;
3105
3106function isSymbol(arg) {
3107  return typeof arg === 'symbol';
3108}
3109exports.isSymbol = isSymbol;
3110
3111function isUndefined(arg) {
3112  return arg === void 0;
3113}
3114exports.isUndefined = isUndefined;
3115
3116function isRegExp(re) {
3117  return isObject(re) && objectToString(re) === '[object RegExp]';
3118}
3119exports.isRegExp = isRegExp;
3120
3121function isObject(arg) {
3122  return typeof arg === 'object' && arg !== null;
3123}
3124exports.isObject = isObject;
3125
3126function isDate(d) {
3127  return isObject(d) && objectToString(d) === '[object Date]';
3128}
3129exports.isDate = isDate;
3130
3131function isError(e) {
3132  return isObject(e) &&
3133      (objectToString(e) === '[object Error]' || e instanceof Error);
3134}
3135exports.isError = isError;
3136
3137function isFunction(arg) {
3138  return typeof arg === 'function';
3139}
3140exports.isFunction = isFunction;
3141
3142function isPrimitive(arg) {
3143  return arg === null ||
3144         typeof arg === 'boolean' ||
3145         typeof arg === 'number' ||
3146         typeof arg === 'string' ||
3147         typeof arg === 'symbol' ||  // ES6 symbol
3148         typeof arg === 'undefined';
3149}
3150exports.isPrimitive = isPrimitive;
3151
3152exports.isBuffer = require('./support/isBuffer');
3153
3154function objectToString(o) {
3155  return Object.prototype.toString.call(o);
3156}
3157
3158
3159function pad(n) {
3160  return n < 10 ? '0' + n.toString(10) : n.toString(10);
3161}
3162
3163
3164var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
3165              'Oct', 'Nov', 'Dec'];
3166
3167// 26 Feb 16:19:34
3168function timestamp() {
3169  var d = new Date();
3170  var time = [pad(d.getHours()),
3171              pad(d.getMinutes()),
3172              pad(d.getSeconds())].join(':');
3173  return [d.getDate(), months[d.getMonth()], time].join(' ');
3174}
3175
3176
3177// log is just a thin wrapper to console.log that prepends a timestamp
3178exports.log = function() {
3179  console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
3180};
3181
3182
3183/**
3184 * Inherit the prototype methods from one constructor into another.
3185 *
3186 * The Function.prototype.inherits from lang.js rewritten as a standalone
3187 * function (not on Function.prototype). NOTE: If this file is to be loaded
3188 * during bootstrapping this function needs to be rewritten using some native
3189 * functions as prototype setup using normal JavaScript does not work as
3190 * expected during bootstrapping (see mirror.js in r114903).
3191 *
3192 * @param {function} ctor Constructor function which needs to inherit the
3193 *     prototype.
3194 * @param {function} superCtor Constructor function to inherit prototype from.
3195 */
3196exports.inherits = require('inherits');
3197
3198exports._extend = function(origin, add) {
3199  // Don't do anything if add isn't an object
3200  if (!add || !isObject(add)) return origin;
3201
3202  var keys = Object.keys(add);
3203  var i = keys.length;
3204  while (i--) {
3205    origin[keys[i]] = add[keys[i]];
3206  }
3207  return origin;
3208};
3209
3210function hasOwnProperty(obj, prop) {
3211  return Object.prototype.hasOwnProperty.call(obj, prop);
3212}
3213
3214}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
3215},{"./support/isBuffer":7,"_process":12,"inherits":6}],9:[function(require,module,exports){
3216'use strict'
3217
3218exports.byteLength = byteLength
3219exports.toByteArray = toByteArray
3220exports.fromByteArray = fromByteArray
3221
3222var lookup = []
3223var revLookup = []
3224var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
3225
3226var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
3227for (var i = 0, len = code.length; i < len; ++i) {
3228  lookup[i] = code[i]
3229  revLookup[code.charCodeAt(i)] = i
3230}
3231
3232// Support decoding URL-safe base64 strings, as Node.js does.
3233// See: https://en.wikipedia.org/wiki/Base64#URL_applications
3234revLookup['-'.charCodeAt(0)] = 62
3235revLookup['_'.charCodeAt(0)] = 63
3236
3237function getLens (b64) {
3238  var len = b64.length
3239
3240  if (len % 4 > 0) {
3241    throw new Error('Invalid string. Length must be a multiple of 4')
3242  }
3243
3244  // Trim off extra bytes after placeholder bytes are found
3245  // See: https://github.com/beatgammit/base64-js/issues/42
3246  var validLen = b64.indexOf('=')
3247  if (validLen === -1) validLen = len
3248
3249  var placeHoldersLen = validLen === len
3250    ? 0
3251    : 4 - (validLen % 4)
3252
3253  return [validLen, placeHoldersLen]
3254}
3255
3256// base64 is 4/3 + up to two characters of the original data
3257function byteLength (b64) {
3258  var lens = getLens(b64)
3259  var validLen = lens[0]
3260  var placeHoldersLen = lens[1]
3261  return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
3262}
3263
3264function _byteLength (b64, validLen, placeHoldersLen) {
3265  return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
3266}
3267
3268function toByteArray (b64) {
3269  var tmp
3270  var lens = getLens(b64)
3271  var validLen = lens[0]
3272  var placeHoldersLen = lens[1]
3273
3274  var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
3275
3276  var curByte = 0
3277
3278  // if there are placeholders, only get up to the last complete 4 chars
3279  var len = placeHoldersLen > 0
3280    ? validLen - 4
3281    : validLen
3282
3283  for (var i = 0; i < len; i += 4) {
3284    tmp =
3285      (revLookup[b64.charCodeAt(i)] << 18) |
3286      (revLookup[b64.charCodeAt(i + 1)] << 12) |
3287      (revLookup[b64.charCodeAt(i + 2)] << 6) |
3288      revLookup[b64.charCodeAt(i + 3)]
3289    arr[curByte++] = (tmp >> 16) & 0xFF
3290    arr[curByte++] = (tmp >> 8) & 0xFF
3291    arr[curByte++] = tmp & 0xFF
3292  }
3293
3294  if (placeHoldersLen === 2) {
3295    tmp =
3296      (revLookup[b64.charCodeAt(i)] << 2) |
3297      (revLookup[b64.charCodeAt(i + 1)] >> 4)
3298    arr[curByte++] = tmp & 0xFF
3299  }
3300
3301  if (placeHoldersLen === 1) {
3302    tmp =
3303      (revLookup[b64.charCodeAt(i)] << 10) |
3304      (revLookup[b64.charCodeAt(i + 1)] << 4) |
3305      (revLookup[b64.charCodeAt(i + 2)] >> 2)
3306    arr[curByte++] = (tmp >> 8) & 0xFF
3307    arr[curByte++] = tmp & 0xFF
3308  }
3309
3310  return arr
3311}
3312
3313function tripletToBase64 (num) {
3314  return lookup[num >> 18 & 0x3F] +
3315    lookup[num >> 12 & 0x3F] +
3316    lookup[num >> 6 & 0x3F] +
3317    lookup[num & 0x3F]
3318}
3319
3320function encodeChunk (uint8, start, end) {
3321  var tmp
3322  var output = []
3323  for (var i = start; i < end; i += 3) {
3324    tmp =
3325      ((uint8[i] << 16) & 0xFF0000) +
3326      ((uint8[i + 1] << 8) & 0xFF00) +
3327      (uint8[i + 2] & 0xFF)
3328    output.push(tripletToBase64(tmp))
3329  }
3330  return output.join('')
3331}
3332
3333function fromByteArray (uint8) {
3334  var tmp
3335  var len = uint8.length
3336  var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
3337  var parts = []
3338  var maxChunkLength = 16383 // must be multiple of 3
3339
3340  // go through the array every three bytes, we'll deal with trailing stuff later
3341  for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
3342    parts.push(encodeChunk(
3343      uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
3344    ))
3345  }
3346
3347  // pad the end with zeros, but make sure to not forget the extra bytes
3348  if (extraBytes === 1) {
3349    tmp = uint8[len - 1]
3350    parts.push(
3351      lookup[tmp >> 2] +
3352      lookup[(tmp << 4) & 0x3F] +
3353      '=='
3354    )
3355  } else if (extraBytes === 2) {
3356    tmp = (uint8[len - 2] << 8) + uint8[len - 1]
3357    parts.push(
3358      lookup[tmp >> 10] +
3359      lookup[(tmp >> 4) & 0x3F] +
3360      lookup[(tmp << 2) & 0x3F] +
3361      '='
3362    )
3363  }
3364
3365  return parts.join('')
3366}
3367
3368},{}],10:[function(require,module,exports){
3369(function (Buffer){
3370/*!
3371 * The buffer module from node.js, for the browser.
3372 *
3373 * @author   Feross Aboukhadijeh <https://feross.org>
3374 * @license  MIT
3375 */
3376/* eslint-disable no-proto */
3377
3378'use strict'
3379
3380var base64 = require('base64-js')
3381var ieee754 = require('ieee754')
3382
3383exports.Buffer = Buffer
3384exports.SlowBuffer = SlowBuffer
3385exports.INSPECT_MAX_BYTES = 50
3386
3387var K_MAX_LENGTH = 0x7fffffff
3388exports.kMaxLength = K_MAX_LENGTH
3389
3390/**
3391 * If `Buffer.TYPED_ARRAY_SUPPORT`:
3392 *   === true    Use Uint8Array implementation (fastest)
3393 *   === false   Print warning and recommend using `buffer` v4.x which has an Object
3394 *               implementation (most compatible, even IE6)
3395 *
3396 * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
3397 * Opera 11.6+, iOS 4.2+.
3398 *
3399 * We report that the browser does not support typed arrays if the are not subclassable
3400 * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`
3401 * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support
3402 * for __proto__ and has a buggy typed array implementation.
3403 */
3404Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport()
3405
3406if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&
3407    typeof console.error === 'function') {
3408  console.error(
3409    'This browser lacks typed array (Uint8Array) support which is required by ' +
3410    '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'
3411  )
3412}
3413
3414function typedArraySupport () {
3415  // Can typed array instances can be augmented?
3416  try {
3417    var arr = new Uint8Array(1)
3418    arr.__proto__ = { __proto__: Uint8Array.prototype, foo: function () { return 42 } }
3419    return arr.foo() === 42
3420  } catch (e) {
3421    return false
3422  }
3423}
3424
3425Object.defineProperty(Buffer.prototype, 'parent', {
3426  enumerable: true,
3427  get: function () {
3428    if (!Buffer.isBuffer(this)) return undefined
3429    return this.buffer
3430  }
3431})
3432
3433Object.defineProperty(Buffer.prototype, 'offset', {
3434  enumerable: true,
3435  get: function () {
3436    if (!Buffer.isBuffer(this)) return undefined
3437    return this.byteOffset
3438  }
3439})
3440
3441function createBuffer (length) {
3442  if (length > K_MAX_LENGTH) {
3443    throw new RangeError('The value "' + length + '" is invalid for option "size"')
3444  }
3445  // Return an augmented `Uint8Array` instance
3446  var buf = new Uint8Array(length)
3447  buf.__proto__ = Buffer.prototype
3448  return buf
3449}
3450
3451/**
3452 * The Buffer constructor returns instances of `Uint8Array` that have their
3453 * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
3454 * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
3455 * and the `Uint8Array` methods. Square bracket notation works as expected -- it
3456 * returns a single octet.
3457 *
3458 * The `Uint8Array` prototype remains unmodified.
3459 */
3460
3461function Buffer (arg, encodingOrOffset, length) {
3462  // Common case.
3463  if (typeof arg === 'number') {
3464    if (typeof encodingOrOffset === 'string') {
3465      throw new TypeError(
3466        'The "string" argument must be of type string. Received type number'
3467      )
3468    }
3469    return allocUnsafe(arg)
3470  }
3471  return from(arg, encodingOrOffset, length)
3472}
3473
3474// Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
3475if (typeof Symbol !== 'undefined' && Symbol.species != null &&
3476    Buffer[Symbol.species] === Buffer) {
3477  Object.defineProperty(Buffer, Symbol.species, {
3478    value: null,
3479    configurable: true,
3480    enumerable: false,
3481    writable: false
3482  })
3483}
3484
3485Buffer.poolSize = 8192 // not used by this implementation
3486
3487function from (value, encodingOrOffset, length) {
3488  if (typeof value === 'string') {
3489    return fromString(value, encodingOrOffset)
3490  }
3491
3492  if (ArrayBuffer.isView(value)) {
3493    return fromArrayLike(value)
3494  }
3495
3496  if (value == null) {
3497    throw TypeError(
3498      'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
3499      'or Array-like Object. Received type ' + (typeof value)
3500    )
3501  }
3502
3503  if (isInstance(value, ArrayBuffer) ||
3504      (value && isInstance(value.buffer, ArrayBuffer))) {
3505    return fromArrayBuffer(value, encodingOrOffset, length)
3506  }
3507
3508  if (typeof value === 'number') {
3509    throw new TypeError(
3510      'The "value" argument must not be of type number. Received type number'
3511    )
3512  }
3513
3514  var valueOf = value.valueOf && value.valueOf()
3515  if (valueOf != null && valueOf !== value) {
3516    return Buffer.from(valueOf, encodingOrOffset, length)
3517  }
3518
3519  var b = fromObject(value)
3520  if (b) return b
3521
3522  if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&
3523      typeof value[Symbol.toPrimitive] === 'function') {
3524    return Buffer.from(
3525      value[Symbol.toPrimitive]('string'), encodingOrOffset, length
3526    )
3527  }
3528
3529  throw new TypeError(
3530    'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
3531    'or Array-like Object. Received type ' + (typeof value)
3532  )
3533}
3534
3535/**
3536 * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
3537 * if value is a number.
3538 * Buffer.from(str[, encoding])
3539 * Buffer.from(array)
3540 * Buffer.from(buffer)
3541 * Buffer.from(arrayBuffer[, byteOffset[, length]])
3542 **/
3543Buffer.from = function (value, encodingOrOffset, length) {
3544  return from(value, encodingOrOffset, length)
3545}
3546
3547// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:
3548// https://github.com/feross/buffer/pull/148
3549Buffer.prototype.__proto__ = Uint8Array.prototype
3550Buffer.__proto__ = Uint8Array
3551
3552function assertSize (size) {
3553  if (typeof size !== 'number') {
3554    throw new TypeError('"size" argument must be of type number')
3555  } else if (size < 0) {
3556    throw new RangeError('The value "' + size + '" is invalid for option "size"')
3557  }
3558}
3559
3560function alloc (size, fill, encoding) {
3561  assertSize(size)
3562  if (size <= 0) {
3563    return createBuffer(size)
3564  }
3565  if (fill !== undefined) {
3566    // Only pay attention to encoding if it's a string. This
3567    // prevents accidentally sending in a number that would
3568    // be interpretted as a start offset.
3569    return typeof encoding === 'string'
3570      ? createBuffer(size).fill(fill, encoding)
3571      : createBuffer(size).fill(fill)
3572  }
3573  return createBuffer(size)
3574}
3575
3576/**
3577 * Creates a new filled Buffer instance.
3578 * alloc(size[, fill[, encoding]])
3579 **/
3580Buffer.alloc = function (size, fill, encoding) {
3581  return alloc(size, fill, encoding)
3582}
3583
3584function allocUnsafe (size) {
3585  assertSize(size)
3586  return createBuffer(size < 0 ? 0 : checked(size) | 0)
3587}
3588
3589/**
3590 * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
3591 * */
3592Buffer.allocUnsafe = function (size) {
3593  return allocUnsafe(size)
3594}
3595/**
3596 * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
3597 */
3598Buffer.allocUnsafeSlow = function (size) {
3599  return allocUnsafe(size)
3600}
3601
3602function fromString (string, encoding) {
3603  if (typeof encoding !== 'string' || encoding === '') {
3604    encoding = 'utf8'
3605  }
3606
3607  if (!Buffer.isEncoding(encoding)) {
3608    throw new TypeError('Unknown encoding: ' + encoding)
3609  }
3610
3611  var length = byteLength(string, encoding) | 0
3612  var buf = createBuffer(length)
3613
3614  var actual = buf.write(string, encoding)
3615
3616  if (actual !== length) {
3617    // Writing a hex string, for example, that contains invalid characters will
3618    // cause everything after the first invalid character to be ignored. (e.g.
3619    // 'abxxcd' will be treated as 'ab')
3620    buf = buf.slice(0, actual)
3621  }
3622
3623  return buf
3624}
3625
3626function fromArrayLike (array) {
3627  var length = array.length < 0 ? 0 : checked(array.length) | 0
3628  var buf = createBuffer(length)
3629  for (var i = 0; i < length; i += 1) {
3630    buf[i] = array[i] & 255
3631  }
3632  return buf
3633}
3634
3635function fromArrayBuffer (array, byteOffset, length) {
3636  if (byteOffset < 0 || array.byteLength < byteOffset) {
3637    throw new RangeError('"offset" is outside of buffer bounds')
3638  }
3639
3640  if (array.byteLength < byteOffset + (length || 0)) {
3641    throw new RangeError('"length" is outside of buffer bounds')
3642  }
3643
3644  var buf
3645  if (byteOffset === undefined && length === undefined) {
3646    buf = new Uint8Array(array)
3647  } else if (length === undefined) {
3648    buf = new Uint8Array(array, byteOffset)
3649  } else {
3650    buf = new Uint8Array(array, byteOffset, length)
3651  }
3652
3653  // Return an augmented `Uint8Array` instance
3654  buf.__proto__ = Buffer.prototype
3655  return buf
3656}
3657
3658function fromObject (obj) {
3659  if (Buffer.isBuffer(obj)) {
3660    var len = checked(obj.length) | 0
3661    var buf = createBuffer(len)
3662
3663    if (buf.length === 0) {
3664      return buf
3665    }
3666
3667    obj.copy(buf, 0, 0, len)
3668    return buf
3669  }
3670
3671  if (obj.length !== undefined) {
3672    if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {
3673      return createBuffer(0)
3674    }
3675    return fromArrayLike(obj)
3676  }
3677
3678  if (obj.type === 'Buffer' && Array.isArray(obj.data)) {
3679    return fromArrayLike(obj.data)
3680  }
3681}
3682
3683function checked (length) {
3684  // Note: cannot use `length < K_MAX_LENGTH` here because that fails when
3685  // length is NaN (which is otherwise coerced to zero.)
3686  if (length >= K_MAX_LENGTH) {
3687    throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
3688                         'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')
3689  }
3690  return length | 0
3691}
3692
3693function SlowBuffer (length) {
3694  if (+length != length) { // eslint-disable-line eqeqeq
3695    length = 0
3696  }
3697  return Buffer.alloc(+length)
3698}
3699
3700Buffer.isBuffer = function isBuffer (b) {
3701  return b != null && b._isBuffer === true &&
3702    b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false
3703}
3704
3705Buffer.compare = function compare (a, b) {
3706  if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength)
3707  if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength)
3708  if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
3709    throw new TypeError(
3710      'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
3711    )
3712  }
3713
3714  if (a === b) return 0
3715
3716  var x = a.length
3717  var y = b.length
3718
3719  for (var i = 0, len = Math.min(x, y); i < len; ++i) {
3720    if (a[i] !== b[i]) {
3721      x = a[i]
3722      y = b[i]
3723      break
3724    }
3725  }
3726
3727  if (x < y) return -1
3728  if (y < x) return 1
3729  return 0
3730}
3731
3732Buffer.isEncoding = function isEncoding (encoding) {
3733  switch (String(encoding).toLowerCase()) {
3734    case 'hex':
3735    case 'utf8':
3736    case 'utf-8':
3737    case 'ascii':
3738    case 'latin1':
3739    case 'binary':
3740    case 'base64':
3741    case 'ucs2':
3742    case 'ucs-2':
3743    case 'utf16le':
3744    case 'utf-16le':
3745      return true
3746    default:
3747      return false
3748  }
3749}
3750
3751Buffer.concat = function concat (list, length) {
3752  if (!Array.isArray(list)) {
3753    throw new TypeError('"list" argument must be an Array of Buffers')
3754  }
3755
3756  if (list.length === 0) {
3757    return Buffer.alloc(0)
3758  }
3759
3760  var i
3761  if (length === undefined) {
3762    length = 0
3763    for (i = 0; i < list.length; ++i) {
3764      length += list[i].length
3765    }
3766  }
3767
3768  var buffer = Buffer.allocUnsafe(length)
3769  var pos = 0
3770  for (i = 0; i < list.length; ++i) {
3771    var buf = list[i]
3772    if (isInstance(buf, Uint8Array)) {
3773      buf = Buffer.from(buf)
3774    }
3775    if (!Buffer.isBuffer(buf)) {
3776      throw new TypeError('"list" argument must be an Array of Buffers')
3777    }
3778    buf.copy(buffer, pos)
3779    pos += buf.length
3780  }
3781  return buffer
3782}
3783
3784function byteLength (string, encoding) {
3785  if (Buffer.isBuffer(string)) {
3786    return string.length
3787  }
3788  if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {
3789    return string.byteLength
3790  }
3791  if (typeof string !== 'string') {
3792    throw new TypeError(
3793      'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' +
3794      'Received type ' + typeof string
3795    )
3796  }
3797
3798  var len = string.length
3799  var mustMatch = (arguments.length > 2 && arguments[2] === true)
3800  if (!mustMatch && len === 0) return 0
3801
3802  // Use a for loop to avoid recursion
3803  var loweredCase = false
3804  for (;;) {
3805    switch (encoding) {
3806      case 'ascii':
3807      case 'latin1':
3808      case 'binary':
3809        return len
3810      case 'utf8':
3811      case 'utf-8':
3812        return utf8ToBytes(string).length
3813      case 'ucs2':
3814      case 'ucs-2':
3815      case 'utf16le':
3816      case 'utf-16le':
3817        return len * 2
3818      case 'hex':
3819        return len >>> 1
3820      case 'base64':
3821        return base64ToBytes(string).length
3822      default:
3823        if (loweredCase) {
3824          return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8
3825        }
3826        encoding = ('' + encoding).toLowerCase()
3827        loweredCase = true
3828    }
3829  }
3830}
3831Buffer.byteLength = byteLength
3832
3833function slowToString (encoding, start, end) {
3834  var loweredCase = false
3835
3836  // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
3837  // property of a typed array.
3838
3839  // This behaves neither like String nor Uint8Array in that we set start/end
3840  // to their upper/lower bounds if the value passed is out of range.
3841  // undefined is handled specially as per ECMA-262 6th Edition,
3842  // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
3843  if (start === undefined || start < 0) {
3844    start = 0
3845  }
3846  // Return early if start > this.length. Done here to prevent potential uint32
3847  // coercion fail below.
3848  if (start > this.length) {
3849    return ''
3850  }
3851
3852  if (end === undefined || end > this.length) {
3853    end = this.length
3854  }
3855
3856  if (end <= 0) {
3857    return ''
3858  }
3859
3860  // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
3861  end >>>= 0
3862  start >>>= 0
3863
3864  if (end <= start) {
3865    return ''
3866  }
3867
3868  if (!encoding) encoding = 'utf8'
3869
3870  while (true) {
3871    switch (encoding) {
3872      case 'hex':
3873        return hexSlice(this, start, end)
3874
3875      case 'utf8':
3876      case 'utf-8':
3877        return utf8Slice(this, start, end)
3878
3879      case 'ascii':
3880        return asciiSlice(this, start, end)
3881
3882      case 'latin1':
3883      case 'binary':
3884        return latin1Slice(this, start, end)
3885
3886      case 'base64':
3887        return base64Slice(this, start, end)
3888
3889      case 'ucs2':
3890      case 'ucs-2':
3891      case 'utf16le':
3892      case 'utf-16le':
3893        return utf16leSlice(this, start, end)
3894
3895      default:
3896        if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
3897        encoding = (encoding + '').toLowerCase()
3898        loweredCase = true
3899    }
3900  }
3901}
3902
3903// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)
3904// to detect a Buffer instance. It's not possible to use `instanceof Buffer`
3905// reliably in a browserify context because there could be multiple different
3906// copies of the 'buffer' package in use. This method works even for Buffer
3907// instances that were created from another copy of the `buffer` package.
3908// See: https://github.com/feross/buffer/issues/154
3909Buffer.prototype._isBuffer = true
3910
3911function swap (b, n, m) {
3912  var i = b[n]
3913  b[n] = b[m]
3914  b[m] = i
3915}
3916
3917Buffer.prototype.swap16 = function swap16 () {
3918  var len = this.length
3919  if (len % 2 !== 0) {
3920    throw new RangeError('Buffer size must be a multiple of 16-bits')
3921  }
3922  for (var i = 0; i < len; i += 2) {
3923    swap(this, i, i + 1)
3924  }
3925  return this
3926}
3927
3928Buffer.prototype.swap32 = function swap32 () {
3929  var len = this.length
3930  if (len % 4 !== 0) {
3931    throw new RangeError('Buffer size must be a multiple of 32-bits')
3932  }
3933  for (var i = 0; i < len; i += 4) {
3934    swap(this, i, i + 3)
3935    swap(this, i + 1, i + 2)
3936  }
3937  return this
3938}
3939
3940Buffer.prototype.swap64 = function swap64 () {
3941  var len = this.length
3942  if (len % 8 !== 0) {
3943    throw new RangeError('Buffer size must be a multiple of 64-bits')
3944  }
3945  for (var i = 0; i < len; i += 8) {
3946    swap(this, i, i + 7)
3947    swap(this, i + 1, i + 6)
3948    swap(this, i + 2, i + 5)
3949    swap(this, i + 3, i + 4)
3950  }
3951  return this
3952}
3953
3954Buffer.prototype.toString = function toString () {
3955  var length = this.length
3956  if (length === 0) return ''
3957  if (arguments.length === 0) return utf8Slice(this, 0, length)
3958  return slowToString.apply(this, arguments)
3959}
3960
3961Buffer.prototype.toLocaleString = Buffer.prototype.toString
3962
3963Buffer.prototype.equals = function equals (b) {
3964  if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
3965  if (this === b) return true
3966  return Buffer.compare(this, b) === 0
3967}
3968
3969Buffer.prototype.inspect = function inspect () {
3970  var str = ''
3971  var max = exports.INSPECT_MAX_BYTES
3972  str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()
3973  if (this.length > max) str += ' ... '
3974  return '<Buffer ' + str + '>'
3975}
3976
3977Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
3978  if (isInstance(target, Uint8Array)) {
3979    target = Buffer.from(target, target.offset, target.byteLength)
3980  }
3981  if (!Buffer.isBuffer(target)) {
3982    throw new TypeError(
3983      'The "target" argument must be one of type Buffer or Uint8Array. ' +
3984      'Received type ' + (typeof target)
3985    )
3986  }
3987
3988  if (start === undefined) {
3989    start = 0
3990  }
3991  if (end === undefined) {
3992    end = target ? target.length : 0
3993  }
3994  if (thisStart === undefined) {
3995    thisStart = 0
3996  }
3997  if (thisEnd === undefined) {
3998    thisEnd = this.length
3999  }
4000
4001  if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
4002    throw new RangeError('out of range index')
4003  }
4004
4005  if (thisStart >= thisEnd && start >= end) {
4006    return 0
4007  }
4008  if (thisStart >= thisEnd) {
4009    return -1
4010  }
4011  if (start >= end) {
4012    return 1
4013  }
4014
4015  start >>>= 0
4016  end >>>= 0
4017  thisStart >>>= 0
4018  thisEnd >>>= 0
4019
4020  if (this === target) return 0
4021
4022  var x = thisEnd - thisStart
4023  var y = end - start
4024  var len = Math.min(x, y)
4025
4026  var thisCopy = this.slice(thisStart, thisEnd)
4027  var targetCopy = target.slice(start, end)
4028
4029  for (var i = 0; i < len; ++i) {
4030    if (thisCopy[i] !== targetCopy[i]) {
4031      x = thisCopy[i]
4032      y = targetCopy[i]
4033      break
4034    }
4035  }
4036
4037  if (x < y) return -1
4038  if (y < x) return 1
4039  return 0
4040}
4041
4042// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
4043// OR the last index of `val` in `buffer` at offset <= `byteOffset`.
4044//
4045// Arguments:
4046// - buffer - a Buffer to search
4047// - val - a string, Buffer, or number
4048// - byteOffset - an index into `buffer`; will be clamped to an int32
4049// - encoding - an optional encoding, relevant is val is a string
4050// - dir - true for indexOf, false for lastIndexOf
4051function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
4052  // Empty buffer means no match
4053  if (buffer.length === 0) return -1
4054
4055  // Normalize byteOffset
4056  if (typeof byteOffset === 'string') {
4057    encoding = byteOffset
4058    byteOffset = 0
4059  } else if (byteOffset > 0x7fffffff) {
4060    byteOffset = 0x7fffffff
4061  } else if (byteOffset < -0x80000000) {
4062    byteOffset = -0x80000000
4063  }
4064  byteOffset = +byteOffset // Coerce to Number.
4065  if (numberIsNaN(byteOffset)) {
4066    // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
4067    byteOffset = dir ? 0 : (buffer.length - 1)
4068  }
4069
4070  // Normalize byteOffset: negative offsets start from the end of the buffer
4071  if (byteOffset < 0) byteOffset = buffer.length + byteOffset
4072  if (byteOffset >= buffer.length) {
4073    if (dir) return -1
4074    else byteOffset = buffer.length - 1
4075  } else if (byteOffset < 0) {
4076    if (dir) byteOffset = 0
4077    else return -1
4078  }
4079
4080  // Normalize val
4081  if (typeof val === 'string') {
4082    val = Buffer.from(val, encoding)
4083  }
4084
4085  // Finally, search either indexOf (if dir is true) or lastIndexOf
4086  if (Buffer.isBuffer(val)) {
4087    // Special case: looking for empty string/buffer always fails
4088    if (val.length === 0) {
4089      return -1
4090    }
4091    return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
4092  } else if (typeof val === 'number') {
4093    val = val & 0xFF // Search for a byte value [0-255]
4094    if (typeof Uint8Array.prototype.indexOf === 'function') {
4095      if (dir) {
4096        return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
4097      } else {
4098        return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
4099      }
4100    }
4101    return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
4102  }
4103
4104  throw new TypeError('val must be string, number or Buffer')
4105}
4106
4107function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
4108  var indexSize = 1
4109  var arrLength = arr.length
4110  var valLength = val.length
4111
4112  if (encoding !== undefined) {
4113    encoding = String(encoding).toLowerCase()
4114    if (encoding === 'ucs2' || encoding === 'ucs-2' ||
4115        encoding === 'utf16le' || encoding === 'utf-16le') {
4116      if (arr.length < 2 || val.length < 2) {
4117        return -1
4118      }
4119      indexSize = 2
4120      arrLength /= 2
4121      valLength /= 2
4122      byteOffset /= 2
4123    }
4124  }
4125
4126  function read (buf, i) {
4127    if (indexSize === 1) {
4128      return buf[i]
4129    } else {
4130      return buf.readUInt16BE(i * indexSize)
4131    }
4132  }
4133
4134  var i
4135  if (dir) {
4136    var foundIndex = -1
4137    for (i = byteOffset; i < arrLength; i++) {
4138      if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
4139        if (foundIndex === -1) foundIndex = i
4140        if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
4141      } else {
4142        if (foundIndex !== -1) i -= i - foundIndex
4143        foundIndex = -1
4144      }
4145    }
4146  } else {
4147    if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
4148    for (i = byteOffset; i >= 0; i--) {
4149      var found = true
4150      for (var j = 0; j < valLength; j++) {
4151        if (read(arr, i + j) !== read(val, j)) {
4152          found = false
4153          break
4154        }
4155      }
4156      if (found) return i
4157    }
4158  }
4159
4160  return -1
4161}
4162
4163Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
4164  return this.indexOf(val, byteOffset, encoding) !== -1
4165}
4166
4167Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
4168  return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
4169}
4170
4171Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
4172  return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
4173}
4174
4175function hexWrite (buf, string, offset, length) {
4176  offset = Number(offset) || 0
4177  var remaining = buf.length - offset
4178  if (!length) {
4179    length = remaining
4180  } else {
4181    length = Number(length)
4182    if (length > remaining) {
4183      length = remaining
4184    }
4185  }
4186
4187  var strLen = string.length
4188
4189  if (length > strLen / 2) {
4190    length = strLen / 2
4191  }
4192  for (var i = 0; i < length; ++i) {
4193    var parsed = parseInt(string.substr(i * 2, 2), 16)
4194    if (numberIsNaN(parsed)) return i
4195    buf[offset + i] = parsed
4196  }
4197  return i
4198}
4199
4200function utf8Write (buf, string, offset, length) {
4201  return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
4202}
4203
4204function asciiWrite (buf, string, offset, length) {
4205  return blitBuffer(asciiToBytes(string), buf, offset, length)
4206}
4207
4208function latin1Write (buf, string, offset, length) {
4209  return asciiWrite(buf, string, offset, length)
4210}
4211
4212function base64Write (buf, string, offset, length) {
4213  return blitBuffer(base64ToBytes(string), buf, offset, length)
4214}
4215
4216function ucs2Write (buf, string, offset, length) {
4217  return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
4218}
4219
4220Buffer.prototype.write = function write (string, offset, length, encoding) {
4221  // Buffer#write(string)
4222  if (offset === undefined) {
4223    encoding = 'utf8'
4224    length = this.length
4225    offset = 0
4226  // Buffer#write(string, encoding)
4227  } else if (length === undefined && typeof offset === 'string') {
4228    encoding = offset
4229    length = this.length
4230    offset = 0
4231  // Buffer#write(string, offset[, length][, encoding])
4232  } else if (isFinite(offset)) {
4233    offset = offset >>> 0
4234    if (isFinite(length)) {
4235      length = length >>> 0
4236      if (encoding === undefined) encoding = 'utf8'
4237    } else {
4238      encoding = length
4239      length = undefined
4240    }
4241  } else {
4242    throw new Error(
4243      'Buffer.write(string, encoding, offset[, length]) is no longer supported'
4244    )
4245  }
4246
4247  var remaining = this.length - offset
4248  if (length === undefined || length > remaining) length = remaining
4249
4250  if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
4251    throw new RangeError('Attempt to write outside buffer bounds')
4252  }
4253
4254  if (!encoding) encoding = 'utf8'
4255
4256  var loweredCase = false
4257  for (;;) {
4258    switch (encoding) {
4259      case 'hex':
4260        return hexWrite(this, string, offset, length)
4261
4262      case 'utf8':
4263      case 'utf-8':
4264        return utf8Write(this, string, offset, length)
4265
4266      case 'ascii':
4267        return asciiWrite(this, string, offset, length)
4268
4269      case 'latin1':
4270      case 'binary':
4271        return latin1Write(this, string, offset, length)
4272
4273      case 'base64':
4274        // Warning: maxLength not taken into account in base64Write
4275        return base64Write(this, string, offset, length)
4276
4277      case 'ucs2':
4278      case 'ucs-2':
4279      case 'utf16le':
4280      case 'utf-16le':
4281        return ucs2Write(this, string, offset, length)
4282
4283      default:
4284        if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
4285        encoding = ('' + encoding).toLowerCase()
4286        loweredCase = true
4287    }
4288  }
4289}
4290
4291Buffer.prototype.toJSON = function toJSON () {
4292  return {
4293    type: 'Buffer',
4294    data: Array.prototype.slice.call(this._arr || this, 0)
4295  }
4296}
4297
4298function base64Slice (buf, start, end) {
4299  if (start === 0 && end === buf.length) {
4300    return base64.fromByteArray(buf)
4301  } else {
4302    return base64.fromByteArray(buf.slice(start, end))
4303  }
4304}
4305
4306function utf8Slice (buf, start, end) {
4307  end = Math.min(buf.length, end)
4308  var res = []
4309
4310  var i = start
4311  while (i < end) {
4312    var firstByte = buf[i]
4313    var codePoint = null
4314    var bytesPerSequence = (firstByte > 0xEF) ? 4
4315      : (firstByte > 0xDF) ? 3
4316        : (firstByte > 0xBF) ? 2
4317          : 1
4318
4319    if (i + bytesPerSequence <= end) {
4320      var secondByte, thirdByte, fourthByte, tempCodePoint
4321
4322      switch (bytesPerSequence) {
4323        case 1:
4324          if (firstByte < 0x80) {
4325            codePoint = firstByte
4326          }
4327          break
4328        case 2:
4329          secondByte = buf[i + 1]
4330          if ((secondByte & 0xC0) === 0x80) {
4331            tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
4332            if (tempCodePoint > 0x7F) {
4333              codePoint = tempCodePoint
4334            }
4335          }
4336          break
4337        case 3:
4338          secondByte = buf[i + 1]
4339          thirdByte = buf[i + 2]
4340          if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
4341            tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
4342            if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
4343              codePoint = tempCodePoint
4344            }
4345          }
4346          break
4347        case 4:
4348          secondByte = buf[i + 1]
4349          thirdByte = buf[i + 2]
4350          fourthByte = buf[i + 3]
4351          if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
4352            tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
4353            if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
4354              codePoint = tempCodePoint
4355            }
4356          }
4357      }
4358    }
4359
4360    if (codePoint === null) {
4361      // we did not generate a valid codePoint so insert a
4362      // replacement char (U+FFFD) and advance only 1 byte
4363      codePoint = 0xFFFD
4364      bytesPerSequence = 1
4365    } else if (codePoint > 0xFFFF) {
4366      // encode to utf16 (surrogate pair dance)
4367      codePoint -= 0x10000
4368      res.push(codePoint >>> 10 & 0x3FF | 0xD800)
4369      codePoint = 0xDC00 | codePoint & 0x3FF
4370    }
4371
4372    res.push(codePoint)
4373    i += bytesPerSequence
4374  }
4375
4376  return decodeCodePointsArray(res)
4377}
4378
4379// Based on http://stackoverflow.com/a/22747272/680742, the browser with
4380// the lowest limit is Chrome, with 0x10000 args.
4381// We go 1 magnitude less, for safety
4382var MAX_ARGUMENTS_LENGTH = 0x1000
4383
4384function decodeCodePointsArray (codePoints) {
4385  var len = codePoints.length
4386  if (len <= MAX_ARGUMENTS_LENGTH) {
4387    return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
4388  }
4389
4390  // Decode in chunks to avoid "call stack size exceeded".
4391  var res = ''
4392  var i = 0
4393  while (i < len) {
4394    res += String.fromCharCode.apply(
4395      String,
4396      codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
4397    )
4398  }
4399  return res
4400}
4401
4402function asciiSlice (buf, start, end) {
4403  var ret = ''
4404  end = Math.min(buf.length, end)
4405
4406  for (var i = start; i < end; ++i) {
4407    ret += String.fromCharCode(buf[i] & 0x7F)
4408  }
4409  return ret
4410}
4411
4412function latin1Slice (buf, start, end) {
4413  var ret = ''
4414  end = Math.min(buf.length, end)
4415
4416  for (var i = start; i < end; ++i) {
4417    ret += String.fromCharCode(buf[i])
4418  }
4419  return ret
4420}
4421
4422function hexSlice (buf, start, end) {
4423  var len = buf.length
4424
4425  if (!start || start < 0) start = 0
4426  if (!end || end < 0 || end > len) end = len
4427
4428  var out = ''
4429  for (var i = start; i < end; ++i) {
4430    out += toHex(buf[i])
4431  }
4432  return out
4433}
4434
4435function utf16leSlice (buf, start, end) {
4436  var bytes = buf.slice(start, end)
4437  var res = ''
4438  for (var i = 0; i < bytes.length; i += 2) {
4439    res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))
4440  }
4441  return res
4442}
4443
4444Buffer.prototype.slice = function slice (start, end) {
4445  var len = this.length
4446  start = ~~start
4447  end = end === undefined ? len : ~~end
4448
4449  if (start < 0) {
4450    start += len
4451    if (start < 0) start = 0
4452  } else if (start > len) {
4453    start = len
4454  }
4455
4456  if (end < 0) {
4457    end += len
4458    if (end < 0) end = 0
4459  } else if (end > len) {
4460    end = len
4461  }
4462
4463  if (end < start) end = start
4464
4465  var newBuf = this.subarray(start, end)
4466  // Return an augmented `Uint8Array` instance
4467  newBuf.__proto__ = Buffer.prototype
4468  return newBuf
4469}
4470
4471/*
4472 * Need to make sure that buffer isn't trying to write out of bounds.
4473 */
4474function checkOffset (offset, ext, length) {
4475  if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
4476  if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
4477}
4478
4479Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
4480  offset = offset >>> 0
4481  byteLength = byteLength >>> 0
4482  if (!noAssert) checkOffset(offset, byteLength, this.length)
4483
4484  var val = this[offset]
4485  var mul = 1
4486  var i = 0
4487  while (++i < byteLength && (mul *= 0x100)) {
4488    val += this[offset + i] * mul
4489  }
4490
4491  return val
4492}
4493
4494Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
4495  offset = offset >>> 0
4496  byteLength = byteLength >>> 0
4497  if (!noAssert) {
4498    checkOffset(offset, byteLength, this.length)
4499  }
4500
4501  var val = this[offset + --byteLength]
4502  var mul = 1
4503  while (byteLength > 0 && (mul *= 0x100)) {
4504    val += this[offset + --byteLength] * mul
4505  }
4506
4507  return val
4508}
4509
4510Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
4511  offset = offset >>> 0
4512  if (!noAssert) checkOffset(offset, 1, this.length)
4513  return this[offset]
4514}
4515
4516Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
4517  offset = offset >>> 0
4518  if (!noAssert) checkOffset(offset, 2, this.length)
4519  return this[offset] | (this[offset + 1] << 8)
4520}
4521
4522Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
4523  offset = offset >>> 0
4524  if (!noAssert) checkOffset(offset, 2, this.length)
4525  return (this[offset] << 8) | this[offset + 1]
4526}
4527
4528Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
4529  offset = offset >>> 0
4530  if (!noAssert) checkOffset(offset, 4, this.length)
4531
4532  return ((this[offset]) |
4533      (this[offset + 1] << 8) |
4534      (this[offset + 2] << 16)) +
4535      (this[offset + 3] * 0x1000000)
4536}
4537
4538Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
4539  offset = offset >>> 0
4540  if (!noAssert) checkOffset(offset, 4, this.length)
4541
4542  return (this[offset] * 0x1000000) +
4543    ((this[offset + 1] << 16) |
4544    (this[offset + 2] << 8) |
4545    this[offset + 3])
4546}
4547
4548Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
4549  offset = offset >>> 0
4550  byteLength = byteLength >>> 0
4551  if (!noAssert) checkOffset(offset, byteLength, this.length)
4552
4553  var val = this[offset]
4554  var mul = 1
4555  var i = 0
4556  while (++i < byteLength && (mul *= 0x100)) {
4557    val += this[offset + i] * mul
4558  }
4559  mul *= 0x80
4560
4561  if (val >= mul) val -= Math.pow(2, 8 * byteLength)
4562
4563  return val
4564}
4565
4566Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
4567  offset = offset >>> 0
4568  byteLength = byteLength >>> 0
4569  if (!noAssert) checkOffset(offset, byteLength, this.length)
4570
4571  var i = byteLength
4572  var mul = 1
4573  var val = this[offset + --i]
4574  while (i > 0 && (mul *= 0x100)) {
4575    val += this[offset + --i] * mul
4576  }
4577  mul *= 0x80
4578
4579  if (val >= mul) val -= Math.pow(2, 8 * byteLength)
4580
4581  return val
4582}
4583
4584Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
4585  offset = offset >>> 0
4586  if (!noAssert) checkOffset(offset, 1, this.length)
4587  if (!(this[offset] & 0x80)) return (this[offset])
4588  return ((0xff - this[offset] + 1) * -1)
4589}
4590
4591Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
4592  offset = offset >>> 0
4593  if (!noAssert) checkOffset(offset, 2, this.length)
4594  var val = this[offset] | (this[offset + 1] << 8)
4595  return (val & 0x8000) ? val | 0xFFFF0000 : val
4596}
4597
4598Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
4599  offset = offset >>> 0
4600  if (!noAssert) checkOffset(offset, 2, this.length)
4601  var val = this[offset + 1] | (this[offset] << 8)
4602  return (val & 0x8000) ? val | 0xFFFF0000 : val
4603}
4604
4605Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
4606  offset = offset >>> 0
4607  if (!noAssert) checkOffset(offset, 4, this.length)
4608
4609  return (this[offset]) |
4610    (this[offset + 1] << 8) |
4611    (this[offset + 2] << 16) |
4612    (this[offset + 3] << 24)
4613}
4614
4615Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
4616  offset = offset >>> 0
4617  if (!noAssert) checkOffset(offset, 4, this.length)
4618
4619  return (this[offset] << 24) |
4620    (this[offset + 1] << 16) |
4621    (this[offset + 2] << 8) |
4622    (this[offset + 3])
4623}
4624
4625Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
4626  offset = offset >>> 0
4627  if (!noAssert) checkOffset(offset, 4, this.length)
4628  return ieee754.read(this, offset, true, 23, 4)
4629}
4630
4631Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
4632  offset = offset >>> 0
4633  if (!noAssert) checkOffset(offset, 4, this.length)
4634  return ieee754.read(this, offset, false, 23, 4)
4635}
4636
4637Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
4638  offset = offset >>> 0
4639  if (!noAssert) checkOffset(offset, 8, this.length)
4640  return ieee754.read(this, offset, true, 52, 8)
4641}
4642
4643Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
4644  offset = offset >>> 0
4645  if (!noAssert) checkOffset(offset, 8, this.length)
4646  return ieee754.read(this, offset, false, 52, 8)
4647}
4648
4649function checkInt (buf, value, offset, ext, max, min) {
4650  if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
4651  if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
4652  if (offset + ext > buf.length) throw new RangeError('Index out of range')
4653}
4654
4655Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
4656  value = +value
4657  offset = offset >>> 0
4658  byteLength = byteLength >>> 0
4659  if (!noAssert) {
4660    var maxBytes = Math.pow(2, 8 * byteLength) - 1
4661    checkInt(this, value, offset, byteLength, maxBytes, 0)
4662  }
4663
4664  var mul = 1
4665  var i = 0
4666  this[offset] = value & 0xFF
4667  while (++i < byteLength && (mul *= 0x100)) {
4668    this[offset + i] = (value / mul) & 0xFF
4669  }
4670
4671  return offset + byteLength
4672}
4673
4674Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
4675  value = +value
4676  offset = offset >>> 0
4677  byteLength = byteLength >>> 0
4678  if (!noAssert) {
4679    var maxBytes = Math.pow(2, 8 * byteLength) - 1
4680    checkInt(this, value, offset, byteLength, maxBytes, 0)
4681  }
4682
4683  var i = byteLength - 1
4684  var mul = 1
4685  this[offset + i] = value & 0xFF
4686  while (--i >= 0 && (mul *= 0x100)) {
4687    this[offset + i] = (value / mul) & 0xFF
4688  }
4689
4690  return offset + byteLength
4691}
4692
4693Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
4694  value = +value
4695  offset = offset >>> 0
4696  if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
4697  this[offset] = (value & 0xff)
4698  return offset + 1
4699}
4700
4701Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
4702  value = +value
4703  offset = offset >>> 0
4704  if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
4705  this[offset] = (value & 0xff)
4706  this[offset + 1] = (value >>> 8)
4707  return offset + 2
4708}
4709
4710Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
4711  value = +value
4712  offset = offset >>> 0
4713  if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
4714  this[offset] = (value >>> 8)
4715  this[offset + 1] = (value & 0xff)
4716  return offset + 2
4717}
4718
4719Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
4720  value = +value
4721  offset = offset >>> 0
4722  if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
4723  this[offset + 3] = (value >>> 24)
4724  this[offset + 2] = (value >>> 16)
4725  this[offset + 1] = (value >>> 8)
4726  this[offset] = (value & 0xff)
4727  return offset + 4
4728}
4729
4730Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
4731  value = +value
4732  offset = offset >>> 0
4733  if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
4734  this[offset] = (value >>> 24)
4735  this[offset + 1] = (value >>> 16)
4736  this[offset + 2] = (value >>> 8)
4737  this[offset + 3] = (value & 0xff)
4738  return offset + 4
4739}
4740
4741Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
4742  value = +value
4743  offset = offset >>> 0
4744  if (!noAssert) {
4745    var limit = Math.pow(2, (8 * byteLength) - 1)
4746
4747    checkInt(this, value, offset, byteLength, limit - 1, -limit)
4748  }
4749
4750  var i = 0
4751  var mul = 1
4752  var sub = 0
4753  this[offset] = value & 0xFF
4754  while (++i < byteLength && (mul *= 0x100)) {
4755    if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
4756      sub = 1
4757    }
4758    this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
4759  }
4760
4761  return offset + byteLength
4762}
4763
4764Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
4765  value = +value
4766  offset = offset >>> 0
4767  if (!noAssert) {
4768    var limit = Math.pow(2, (8 * byteLength) - 1)
4769
4770    checkInt(this, value, offset, byteLength, limit - 1, -limit)
4771  }
4772
4773  var i = byteLength - 1
4774  var mul = 1
4775  var sub = 0
4776  this[offset + i] = value & 0xFF
4777  while (--i >= 0 && (mul *= 0x100)) {
4778    if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
4779      sub = 1
4780    }
4781    this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
4782  }
4783
4784  return offset + byteLength
4785}
4786
4787Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
4788  value = +value
4789  offset = offset >>> 0
4790  if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
4791  if (value < 0) value = 0xff + value + 1
4792  this[offset] = (value & 0xff)
4793  return offset + 1
4794}
4795
4796Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
4797  value = +value
4798  offset = offset >>> 0
4799  if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
4800  this[offset] = (value & 0xff)
4801  this[offset + 1] = (value >>> 8)
4802  return offset + 2
4803}
4804
4805Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
4806  value = +value
4807  offset = offset >>> 0
4808  if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
4809  this[offset] = (value >>> 8)
4810  this[offset + 1] = (value & 0xff)
4811  return offset + 2
4812}
4813
4814Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
4815  value = +value
4816  offset = offset >>> 0
4817  if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
4818  this[offset] = (value & 0xff)
4819  this[offset + 1] = (value >>> 8)
4820  this[offset + 2] = (value >>> 16)
4821  this[offset + 3] = (value >>> 24)
4822  return offset + 4
4823}
4824
4825Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
4826  value = +value
4827  offset = offset >>> 0
4828  if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
4829  if (value < 0) value = 0xffffffff + value + 1
4830  this[offset] = (value >>> 24)
4831  this[offset + 1] = (value >>> 16)
4832  this[offset + 2] = (value >>> 8)
4833  this[offset + 3] = (value & 0xff)
4834  return offset + 4
4835}
4836
4837function checkIEEE754 (buf, value, offset, ext, max, min) {
4838  if (offset + ext > buf.length) throw new RangeError('Index out of range')
4839  if (offset < 0) throw new RangeError('Index out of range')
4840}
4841
4842function writeFloat (buf, value, offset, littleEndian, noAssert) {
4843  value = +value
4844  offset = offset >>> 0
4845  if (!noAssert) {
4846    checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
4847  }
4848  ieee754.write(buf, value, offset, littleEndian, 23, 4)
4849  return offset + 4
4850}
4851
4852Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
4853  return writeFloat(this, value, offset, true, noAssert)
4854}
4855
4856Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
4857  return writeFloat(this, value, offset, false, noAssert)
4858}
4859
4860function writeDouble (buf, value, offset, littleEndian, noAssert) {
4861  value = +value
4862  offset = offset >>> 0
4863  if (!noAssert) {
4864    checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
4865  }
4866  ieee754.write(buf, value, offset, littleEndian, 52, 8)
4867  return offset + 8
4868}
4869
4870Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
4871  return writeDouble(this, value, offset, true, noAssert)
4872}
4873
4874Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
4875  return writeDouble(this, value, offset, false, noAssert)
4876}
4877
4878// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
4879Buffer.prototype.copy = function copy (target, targetStart, start, end) {
4880  if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')
4881  if (!start) start = 0
4882  if (!end && end !== 0) end = this.length
4883  if (targetStart >= target.length) targetStart = target.length
4884  if (!targetStart) targetStart = 0
4885  if (end > 0 && end < start) end = start
4886
4887  // Copy 0 bytes; we're done
4888  if (end === start) return 0
4889  if (target.length === 0 || this.length === 0) return 0
4890
4891  // Fatal error conditions
4892  if (targetStart < 0) {
4893    throw new RangeError('targetStart out of bounds')
4894  }
4895  if (start < 0 || start >= this.length) throw new RangeError('Index out of range')
4896  if (end < 0) throw new RangeError('sourceEnd out of bounds')
4897
4898  // Are we oob?
4899  if (end > this.length) end = this.length
4900  if (target.length - targetStart < end - start) {
4901    end = target.length - targetStart + start
4902  }
4903
4904  var len = end - start
4905
4906  if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {
4907    // Use built-in when available, missing from IE11
4908    this.copyWithin(targetStart, start, end)
4909  } else if (this === target && start < targetStart && targetStart < end) {
4910    // descending copy from end
4911    for (var i = len - 1; i >= 0; --i) {
4912      target[i + targetStart] = this[i + start]
4913    }
4914  } else {
4915    Uint8Array.prototype.set.call(
4916      target,
4917      this.subarray(start, end),
4918      targetStart
4919    )
4920  }
4921
4922  return len
4923}
4924
4925// Usage:
4926//    buffer.fill(number[, offset[, end]])
4927//    buffer.fill(buffer[, offset[, end]])
4928//    buffer.fill(string[, offset[, end]][, encoding])
4929Buffer.prototype.fill = function fill (val, start, end, encoding) {
4930  // Handle string cases:
4931  if (typeof val === 'string') {
4932    if (typeof start === 'string') {
4933      encoding = start
4934      start = 0
4935      end = this.length
4936    } else if (typeof end === 'string') {
4937      encoding = end
4938      end = this.length
4939    }
4940    if (encoding !== undefined && typeof encoding !== 'string') {
4941      throw new TypeError('encoding must be a string')
4942    }
4943    if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
4944      throw new TypeError('Unknown encoding: ' + encoding)
4945    }
4946    if (val.length === 1) {
4947      var code = val.charCodeAt(0)
4948      if ((encoding === 'utf8' && code < 128) ||
4949          encoding === 'latin1') {
4950        // Fast path: If `val` fits into a single byte, use that numeric value.
4951        val = code
4952      }
4953    }
4954  } else if (typeof val === 'number') {
4955    val = val & 255
4956  }
4957
4958  // Invalid ranges are not set to a default, so can range check early.
4959  if (start < 0 || this.length < start || this.length < end) {
4960    throw new RangeError('Out of range index')
4961  }
4962
4963  if (end <= start) {
4964    return this
4965  }
4966
4967  start = start >>> 0
4968  end = end === undefined ? this.length : end >>> 0
4969
4970  if (!val) val = 0
4971
4972  var i
4973  if (typeof val === 'number') {
4974    for (i = start; i < end; ++i) {
4975      this[i] = val
4976    }
4977  } else {
4978    var bytes = Buffer.isBuffer(val)
4979      ? val
4980      : Buffer.from(val, encoding)
4981    var len = bytes.length
4982    if (len === 0) {
4983      throw new TypeError('The value "' + val +
4984        '" is invalid for argument "value"')
4985    }
4986    for (i = 0; i < end - start; ++i) {
4987      this[i + start] = bytes[i % len]
4988    }
4989  }
4990
4991  return this
4992}
4993
4994// HELPER FUNCTIONS
4995// ================
4996
4997var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g
4998
4999function base64clean (str) {
5000  // Node takes equal signs as end of the Base64 encoding
5001  str = str.split('=')[0]
5002  // Node strips out invalid characters like \n and \t from the string, base64-js does not
5003  str = str.trim().replace(INVALID_BASE64_RE, '')
5004  // Node converts strings with length < 2 to ''
5005  if (str.length < 2) return ''
5006  // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
5007  while (str.length % 4 !== 0) {
5008    str = str + '='
5009  }
5010  return str
5011}
5012
5013function toHex (n) {
5014  if (n < 16) return '0' + n.toString(16)
5015  return n.toString(16)
5016}
5017
5018function utf8ToBytes (string, units) {
5019  units = units || Infinity
5020  var codePoint
5021  var length = string.length
5022  var leadSurrogate = null
5023  var bytes = []
5024
5025  for (var i = 0; i < length; ++i) {
5026    codePoint = string.charCodeAt(i)
5027
5028    // is surrogate component
5029    if (codePoint > 0xD7FF && codePoint < 0xE000) {
5030      // last char was a lead
5031      if (!leadSurrogate) {
5032        // no lead yet
5033        if (codePoint > 0xDBFF) {
5034          // unexpected trail
5035          if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
5036          continue
5037        } else if (i + 1 === length) {
5038          // unpaired lead
5039          if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
5040          continue
5041        }
5042
5043        // valid lead
5044        leadSurrogate = codePoint
5045
5046        continue
5047      }
5048
5049      // 2 leads in a row
5050      if (codePoint < 0xDC00) {
5051        if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
5052        leadSurrogate = codePoint
5053        continue
5054      }
5055
5056      // valid surrogate pair
5057      codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
5058    } else if (leadSurrogate) {
5059      // valid bmp char, but last char was a lead
5060      if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
5061    }
5062
5063    leadSurrogate = null
5064
5065    // encode utf8
5066    if (codePoint < 0x80) {
5067      if ((units -= 1) < 0) break
5068      bytes.push(codePoint)
5069    } else if (codePoint < 0x800) {
5070      if ((units -= 2) < 0) break
5071      bytes.push(
5072        codePoint >> 0x6 | 0xC0,
5073        codePoint & 0x3F | 0x80
5074      )
5075    } else if (codePoint < 0x10000) {
5076      if ((units -= 3) < 0) break
5077      bytes.push(
5078        codePoint >> 0xC | 0xE0,
5079        codePoint >> 0x6 & 0x3F | 0x80,
5080        codePoint & 0x3F | 0x80
5081      )
5082    } else if (codePoint < 0x110000) {
5083      if ((units -= 4) < 0) break
5084      bytes.push(
5085        codePoint >> 0x12 | 0xF0,
5086        codePoint >> 0xC & 0x3F | 0x80,
5087        codePoint >> 0x6 & 0x3F | 0x80,
5088        codePoint & 0x3F | 0x80
5089      )
5090    } else {
5091      throw new Error('Invalid code point')
5092    }
5093  }
5094
5095  return bytes
5096}
5097
5098function asciiToBytes (str) {
5099  var byteArray = []
5100  for (var i = 0; i < str.length; ++i) {
5101    // Node's code seems to be doing this and not & 0x7F..
5102    byteArray.push(str.charCodeAt(i) & 0xFF)
5103  }
5104  return byteArray
5105}
5106
5107function utf16leToBytes (str, units) {
5108  var c, hi, lo
5109  var byteArray = []
5110  for (var i = 0; i < str.length; ++i) {
5111    if ((units -= 2) < 0) break
5112
5113    c = str.charCodeAt(i)
5114    hi = c >> 8
5115    lo = c % 256
5116    byteArray.push(lo)
5117    byteArray.push(hi)
5118  }
5119
5120  return byteArray
5121}
5122
5123function base64ToBytes (str) {
5124  return base64.toByteArray(base64clean(str))
5125}
5126
5127function blitBuffer (src, dst, offset, length) {
5128  for (var i = 0; i < length; ++i) {
5129    if ((i + offset >= dst.length) || (i >= src.length)) break
5130    dst[i + offset] = src[i]
5131  }
5132  return i
5133}
5134
5135// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass
5136// the `instanceof` check but they should be treated as of that type.
5137// See: https://github.com/feross/buffer/issues/166
5138function isInstance (obj, type) {
5139  return obj instanceof type ||
5140    (obj != null && obj.constructor != null && obj.constructor.name != null &&
5141      obj.constructor.name === type.name)
5142}
5143function numberIsNaN (obj) {
5144  // For IE11 support
5145  return obj !== obj // eslint-disable-line no-self-compare
5146}
5147
5148}).call(this,require("buffer").Buffer)
5149},{"base64-js":9,"buffer":10,"ieee754":11}],11:[function(require,module,exports){
5150exports.read = function (buffer, offset, isLE, mLen, nBytes) {
5151  var e, m
5152  var eLen = (nBytes * 8) - mLen - 1
5153  var eMax = (1 << eLen) - 1
5154  var eBias = eMax >> 1
5155  var nBits = -7
5156  var i = isLE ? (nBytes - 1) : 0
5157  var d = isLE ? -1 : 1
5158  var s = buffer[offset + i]
5159
5160  i += d
5161
5162  e = s & ((1 << (-nBits)) - 1)
5163  s >>= (-nBits)
5164  nBits += eLen
5165  for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
5166
5167  m = e & ((1 << (-nBits)) - 1)
5168  e >>= (-nBits)
5169  nBits += mLen
5170  for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
5171
5172  if (e === 0) {
5173    e = 1 - eBias
5174  } else if (e === eMax) {
5175    return m ? NaN : ((s ? -1 : 1) * Infinity)
5176  } else {
5177    m = m + Math.pow(2, mLen)
5178    e = e - eBias
5179  }
5180  return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
5181}
5182
5183exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
5184  var e, m, c
5185  var eLen = (nBytes * 8) - mLen - 1
5186  var eMax = (1 << eLen) - 1
5187  var eBias = eMax >> 1
5188  var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
5189  var i = isLE ? 0 : (nBytes - 1)
5190  var d = isLE ? 1 : -1
5191  var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
5192
5193  value = Math.abs(value)
5194
5195  if (isNaN(value) || value === Infinity) {
5196    m = isNaN(value) ? 1 : 0
5197    e = eMax
5198  } else {
5199    e = Math.floor(Math.log(value) / Math.LN2)
5200    if (value * (c = Math.pow(2, -e)) < 1) {
5201      e--
5202      c *= 2
5203    }
5204    if (e + eBias >= 1) {
5205      value += rt / c
5206    } else {
5207      value += rt * Math.pow(2, 1 - eBias)
5208    }
5209    if (value * c >= 2) {
5210      e++
5211      c /= 2
5212    }
5213
5214    if (e + eBias >= eMax) {
5215      m = 0
5216      e = eMax
5217    } else if (e + eBias >= 1) {
5218      m = ((value * c) - 1) * Math.pow(2, mLen)
5219      e = e + eBias
5220    } else {
5221      m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
5222      e = 0
5223    }
5224  }
5225
5226  for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
5227
5228  e = (e << mLen) | m
5229  eLen += mLen
5230  for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
5231
5232  buffer[offset + i - d] |= s * 128
5233}
5234
5235},{}],12:[function(require,module,exports){
5236// shim for using process in browser
5237var process = module.exports = {};
5238
5239// cached from whatever global is present so that test runners that stub it
5240// don't break things.  But we need to wrap it in a try catch in case it is
5241// wrapped in strict mode code which doesn't define any globals.  It's inside a
5242// function because try/catches deoptimize in certain engines.
5243
5244var cachedSetTimeout;
5245var cachedClearTimeout;
5246
5247function defaultSetTimout() {
5248    throw new Error('setTimeout has not been defined');
5249}
5250function defaultClearTimeout () {
5251    throw new Error('clearTimeout has not been defined');
5252}
5253(function () {
5254    try {
5255        if (typeof setTimeout === 'function') {
5256            cachedSetTimeout = setTimeout;
5257        } else {
5258            cachedSetTimeout = defaultSetTimout;
5259        }
5260    } catch (e) {
5261        cachedSetTimeout = defaultSetTimout;
5262    }
5263    try {
5264        if (typeof clearTimeout === 'function') {
5265            cachedClearTimeout = clearTimeout;
5266        } else {
5267            cachedClearTimeout = defaultClearTimeout;
5268        }
5269    } catch (e) {
5270        cachedClearTimeout = defaultClearTimeout;
5271    }
5272} ())
5273function runTimeout(fun) {
5274    if (cachedSetTimeout === setTimeout) {
5275        //normal enviroments in sane situations
5276        return setTimeout(fun, 0);
5277    }
5278    // if setTimeout wasn't available but was latter defined
5279    if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
5280        cachedSetTimeout = setTimeout;
5281        return setTimeout(fun, 0);
5282    }
5283    try {
5284        // when when somebody has screwed with setTimeout but no I.E. maddness
5285        return cachedSetTimeout(fun, 0);
5286    } catch(e){
5287        try {
5288            // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
5289            return cachedSetTimeout.call(null, fun, 0);
5290        } catch(e){
5291            // 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
5292            return cachedSetTimeout.call(this, fun, 0);
5293        }
5294    }
5295
5296
5297}
5298function runClearTimeout(marker) {
5299    if (cachedClearTimeout === clearTimeout) {
5300        //normal enviroments in sane situations
5301        return clearTimeout(marker);
5302    }
5303    // if clearTimeout wasn't available but was latter defined
5304    if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
5305        cachedClearTimeout = clearTimeout;
5306        return clearTimeout(marker);
5307    }
5308    try {
5309        // when when somebody has screwed with setTimeout but no I.E. maddness
5310        return cachedClearTimeout(marker);
5311    } catch (e){
5312        try {
5313            // When we are in I.E. but the script has been evaled so I.E. doesn't  trust the global object when called normally
5314            return cachedClearTimeout.call(null, marker);
5315        } catch (e){
5316            // 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.
5317            // Some versions of I.E. have different rules for clearTimeout vs setTimeout
5318            return cachedClearTimeout.call(this, marker);
5319        }
5320    }
5321
5322
5323
5324}
5325var queue = [];
5326var draining = false;
5327var currentQueue;
5328var queueIndex = -1;
5329
5330function cleanUpNextTick() {
5331    if (!draining || !currentQueue) {
5332        return;
5333    }
5334    draining = false;
5335    if (currentQueue.length) {
5336        queue = currentQueue.concat(queue);
5337    } else {
5338        queueIndex = -1;
5339    }
5340    if (queue.length) {
5341        drainQueue();
5342    }
5343}
5344
5345function drainQueue() {
5346    if (draining) {
5347        return;
5348    }
5349    var timeout = runTimeout(cleanUpNextTick);
5350    draining = true;
5351
5352    var len = queue.length;
5353    while(len) {
5354        currentQueue = queue;
5355        queue = [];
5356        while (++queueIndex < len) {
5357            if (currentQueue) {
5358                currentQueue[queueIndex].run();
5359            }
5360        }
5361        queueIndex = -1;
5362        len = queue.length;
5363    }
5364    currentQueue = null;
5365    draining = false;
5366    runClearTimeout(timeout);
5367}
5368
5369process.nextTick = function (fun) {
5370    var args = new Array(arguments.length - 1);
5371    if (arguments.length > 1) {
5372        for (var i = 1; i < arguments.length; i++) {
5373            args[i - 1] = arguments[i];
5374        }
5375    }
5376    queue.push(new Item(fun, args));
5377    if (queue.length === 1 && !draining) {
5378        runTimeout(drainQueue);
5379    }
5380};
5381
5382// v8 likes predictible objects
5383function Item(fun, array) {
5384    this.fun = fun;
5385    this.array = array;
5386}
5387Item.prototype.run = function () {
5388    this.fun.apply(null, this.array);
5389};
5390process.title = 'browser';
5391process.browser = true;
5392process.env = {};
5393process.argv = [];
5394process.version = ''; // empty string to avoid regexp issues
5395process.versions = {};
5396
5397function noop() {}
5398
5399process.on = noop;
5400process.addListener = noop;
5401process.once = noop;
5402process.off = noop;
5403process.removeListener = noop;
5404process.removeAllListeners = noop;
5405process.emit = noop;
5406process.prependListener = noop;
5407process.prependOnceListener = noop;
5408
5409process.listeners = function (name) { return [] }
5410
5411process.binding = function (name) {
5412    throw new Error('process.binding is not supported');
5413};
5414
5415process.cwd = function () { return '/' };
5416process.chdir = function (dir) {
5417    throw new Error('process.chdir is not supported');
5418};
5419process.umask = function() { return 0; };
5420
5421},{}]},{},[2]);